This guide walks you through getting the codebase running, tested and linted on your workstation. It should take ≤ 10 minutes on macOS, Linux or WSL.
The project targets Python 3.12. Earlier versions are not supported.
| Tool | Version | Purpose |
|---|---|---|
| Python | 3.12 (CPython) | Run the FastAPI server + tests |
| Poetry | ≥ 1.8 | Dependency & virtual-env manager |
| Docker Desktop / Engine | ≥ 20.10 | Boot the observability stack locally |
| Docker Compose v2 | comes with Docker Desktop | Spins up the 7-container stack |
| Git | any | Source control |
| (optional) VS Code + Python extension | latest | Recommended IDE |
Install examples (macOS/Homebrew):
brew install python@3.12
pipx install poetry # pipx keeps Poetry isolated from site-packagesgit clone https://github.com/your-org/mcp-observability.git
cd mcp-observability
# Create the venv & install prod + dev deps
poetry install --with devPoetry will create .venv/ inside the project. Activate it when running ad-hoc commands:
poetry shell # optional; or prefix commands with `poetry run`The fastest way to run all dependencies (Prometheus, Loki, Tempo, etc.) is Docker Compose:
docker compose -f mcp-obs.yml up -dServices will be reachable on the default ports – see the Docker guide for full details.
With the stack up you can start the FastAPI server and have it hot-reload on code changes:
poetry run python -m app.main # http://localhost:8000Pass --reload env ENV=dev if you wire Uvicorn directly.
Tip: you normally don't need to run the API manually when using Compose – the
mcp-servercontainer auto-reloads your code via bind-mount.
Run the unit test-suite:
poetry run pytest -qStatic checks:
poetry run black --check .
poetry run isort --check-only .
poetry run mypy appCombine in one go:
./scripts/ci/check_drift.py # example helperpre-commit – we don't use it yet; feel free to open a PR if you'd like automatic formatting.
| Variable | Default | Description |
|---|---|---|
MCP_TOKEN |
none | Bearer token required for most endpoints. Set the same value inside Compose (mcp-obs.yml) and your curl/HTTP calls. |
OTEL_EXPORTER_OTLP_ENDPOINT |
http://otel-collector:4318 |
Where the API sends its own telemetry. |
GF_ADMIN_PASSWORD |
admin |
Grafana admin password for local dashboards |
You can export these in your terminal or create a
.envfile. Docker Compose picks them up automatically.
| Symptom | Resolution |
|---|---|
ImportError: cannot import name ... |
Make sure you're inside the Poetry venv (poetry shell). |
Address already in use :8000 |
Another process is binding the port – change it in app/main.py or stop the other app. |
| Tests failing with TLS errors | Delete certs/ and restart Compose to regenerate the self-signed CA. |
If you get stuck open an issue or ask in the project chat – we're happy to help!