The official Grafana MCP server connects an AI client to your Grafana — search dashboards, query datasources (Prometheus, Loki), inspect alerts and incidents — so you can investigate issues in natural language. Here's the setup.
Step 1 — create a service account token
In Grafana: Administration → Service accounts → Add service account, give it a least-privilege role (Viewer is enough for read-only), then Add token and copy it. Note your Grafana URL.
Step 2 — configure the client
The server is a Go binary (mcp-grafana); a Docker image is also published. Example:
{
"mcpServers": {
"grafana": {
"command": "mcp-grafana",
"env": {
"GRAFANA_URL": "https://your-grafana.example.com",
"GRAFANA_SERVICE_ACCOUNT_TOKEN": "glsa_your_token"
}
}
}
}
Install the binary per the repo (or use the Docker mcp/grafana image with the same env). Restart the client; see MCP config file location.
What it gives your AI
Search dashboards and panels, run Prometheus/Loki queries, list and inspect alert rules and incidents, and read datasource config — useful for on-call debugging with a coding agent.
Verify
Ask: "Which Grafana alerts are firing right now, and show the related dashboard." Real alert data back confirms it works.
Common problems
401— wrong token or URL; regenerate the service-account token.- Empty results — the service account's role lacks access to those folders/datasources.
- Binary not found — install
mcp-grafanaor use the Docker image (see Docker MCP example).
Going further
Grafana pairs with Sentry and GitHub for a full incident loop. Use a read-only service account by default — see MCP security best practices. Browse the devops category or curated loadouts.