The grafana/otel-lgtm image integrates with Model Context Protocol (MCP)
so AI coding tools (Claude, Cursor, etc.) can query your telemetry data directly.
Tempo exposes an HTTP MCP endpoint from inside the container. Grafana data is accessed
via a client-side uvx mcp-grafana process that runs on your machine and connects to
the Grafana instance in the container.
- Dashboards: list, read, and search dashboards via client-side
uvx mcp-grafana - Logs: query via LogQL via client-side
uvx mcp-grafana - Metrics: query via PromQL via client-side
uvx mcp-grafana - Traces: query via TraceQL via client-side
uvx mcp-grafanaor through Tempo's built-in HTTP MCP endpoint (in-container)
-
Enable the Tempo MCP server:
echo 'TEMPO_EXTRA_ARGS=--query-frontend.mcp-server.enabled=true' >> .env
-
Start the container:
./run-lgtm.sh
-
Get the MCP configuration:
docker exec lgtm cat /etc/lgtm/mcp.json # or: podman exec ...
-
Paste the JSON into your AI tool's MCP configuration.
For Claude Code, you can add the servers individually:
# Get the service account token TOKEN=$(docker exec lgtm cat /tmp/grafana-sa-token) # or: podman exec ... # Add the Grafana MCP server (requires uvx) claude mcp add grafana \ -e GRAFANA_URL=http://localhost:3000 \ -e GRAFANA_SERVICE_ACCOUNT_TOKEN="$TOKEN" \ -- uvx mcp-grafana
The Grafana MCP server proxies the Tempo MCP server, but you can add it separately if you wish:
# Add the Tempo MCP server claude mcp add --transport http tempo http://localhost:3200/api/mcp
| Component | MCP Server | Transport | What you can query |
|---|---|---|---|
| Grafana | grafana |
stdio | Dashboards, PromQL, LogQL |
| Tempo | tempo |
HTTP | Traces via TraceQL |
The OpenTelemetry Collector includes a debug exporter that logs all received telemetry to stdout. This is useful for verifying that data is flowing correctly.
Enable it by setting the environment variable before starting the container:
OTEL_COLLECTOR_DEBUG_EXPORTER=true ./run-lgtm.shThis adds the debug exporter to the logs, metrics, and traces pipelines.
The output appears in the collector's logs (enable with ENABLE_LOGS_OTELCOL=true
or ENABLE_LOGS_ALL=true).
When OBI is enabled, it generates traces and RED metrics automatically. These are queryable via PromQL through the Grafana MCP server:
# Number of instrumented processes
obi_instrumented_processes
# HTTP request duration (RED metrics)
http_server_request_duration_seconds_count{http_route="/rolldice"}
See the OBI section in the README for setup instructions.