Grafana MCP Server
Grafana MCP server
Grafana's official MCP server: dashboards, Prometheus and Loki queries, alerts and incidents straight from the agent
Install
{
"mcpServers": {
"grafana": {
"command": "uvx",
"args": ["mcp-grafana"],
"env": {
"GRAFANA_URL": "http://localhost:3000",
"GRAFANA_SERVICE_ACCOUNT_TOKEN": "<your service account token>"
}
}
}
}Requires uv. For Grafana Cloud use your instance URL
This is third-party code. Review the repository files before installing.
What it does
The server connects the agent to your Grafana or Grafana Cloud using a service account token. The agent searches and reads dashboards, gets compact summaries without the full JSON, and edits panels with targeted patches. It runs PromQL and LogQL queries, reaches ClickHouse, CloudWatch, Elasticsearch and other datasources, and works with alerting, OnCall, incidents and annotations. The --disable-write flag makes the server read-only, and there are guardrails on Loki query cost.
Who it is for. For SREs, DevOps engineers and developers who investigate metrics and logs in Grafana.
Good fit when
- You need to find the cause of an error spike across metrics and logs
- You need to create or edit a dashboard without hand-editing JSON
- You want alerts, on-call and incidents in one conversation
Not a fit when
- Your monitoring is not built on Grafana
- You cannot issue a service account token
Example request
Why did the 5xx rate for the checkout service rise in the last hour? Check metrics and Loki logsLimitations
Requires Grafana 9.0 or later and a service account token with suitable permissions. Full dashboards consume a lot of context, so prefer summaries and JSONPath. Some tools are off by default, and Grafana Assistant tools need a separate plugin. In network modes without --server-auth-token callers are not authenticated.
How to disable. Remove the grafana block from the MCP client config.
MCP
- Transport
- stdio, sse, http
- Authentication
- API key
| Environment variables | |
|---|---|
| GRAFANA_URL required | Grafana or Grafana Cloud URL |
| GRAFANA_SERVICE_ACCOUNT_TOKEN required, secret | Grafana service account token |
| GRAFANA_ORG_ID | Organization ID for multi-org setups |
| MCP_GRAFANA_SERVER_TOKEN secret | Bearer token callers must send in network modes |
Security check
- Can change dashboards, alerts and incidents in production Grafana
- Holds a token with access to metrics and logs
README in short
The README opens with a uvx config and lists tools by area: dashboards, datasources, queries to many backends, alerting, OnCall, incidents, Sift, annotations, snapshots and rendering. It documents CLI flags, read-only and query-free modes and Loki guardrails in detail. Docker, binary and Helm installs, TLS, multi-org, custom headers and observability are covered. Apache-2.0 licensed.
FAQ
How do I stop the agent from changing dashboards?
Start the server with --disable-write so write tools are not registered.
Is there an option without Python?
Yes, the grafana/mcp-grafana Docker image, a go install binary and a Helm chart.
Related
An MCP server built into the Netdata agent: metrics, logs, alerts and live process, service and container data for an AI assistant
GitHub's official MCP server: code, issues, pull requests, Actions and security alerts straight from the agent
AWS's official MCP server suite: docs, IaC, containers, serverless, databases, cost and monitoring
A GitHub Action that runs Claude Code in pull requests and issues: answers mentions, reviews and makes changes