Grafana MCP for Claude Code: Query Dashboards, Metrics, and Alerts Directly
Description and use
Configuring Grafana MCP lets Claude Code agents directly query Grafana dashboards, Prometheus, Loki, alerts, and incidents, eliminating manual copy‑paste.
Problem
Manual copy‑paste between Grafana dashboards and Claude Code slows incident response.
Outcome
Setup takes ~5 minutes; after configuration Claude Code can query Grafana data directly, eliminating manual copy‑paste.
Workflow
- Create Grafana service account token with Viewer role
- Run
claude mcp add --scope user --transport stdio grafana --env GRAFANA_URL=<url> --env GRAFANA_SERVICE_ACCOUNT_TOKEN=<token> -- uvx mcp-grafana --disable-write - Verify connection with
claude mcp list - Use Grafana tools (dashboards, Prometheus, Loki, alerting, incidents) in Claude Code
Evidence
When something breaks in production, the usual Claude Code loop is: open Grafana, find the right dashboard, squint at a spike, copy a PromQL query or a chunk of Loki logs, paste it into the terminal, and repeat when Claude asks for a wider time range.
Grafana MCP is Grafana Labs’ official MCP server. It lets Claude Code search your dashboards, run PromQL against Prometheus and LogQL against Loki, read alert rules and their firing state, and look up incidents on its own.
Create a Grafana service account token with the Viewer role (Administration → Users and access → Service accounts), then run: claude mcp add … --env GRAFANA_SERVICE_ACCOUNT_TOKEN=<your-token> -- uvx mcp-grafana --disable-write
If a grafana entry already exists, stop and show me its config instead of adding a second one.
- Record date: 2026-10-13T21:55:56.715Z