Grafana MCP for Claude Code: Query Dashboards, Metrics, and Alerts Directly
Описание и применение
Настройка Grafana MCP позволяет агенту Claude Code напрямую получать данные из Grafana, устраняя ручной копипаст.
Задача
Manual copy‑paste between Grafana dashboards and Claude Code slows incident response.
Результат
Setup takes ~5 minutes; after configuration Claude Code can query Grafana data directly, eliminating manual copy‑paste.
Рабочий процесс
- 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
Доказательства
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.
- Дата записи: 2026-10-13T21:55:56.715Z