Skip to content

Grafana MCP server with Atomic Agent

Grafana Labs maintains mcp-grafana, the official MCP server for Grafana. It searches and edits dashboards, lists datasources, and runs PromQL and LogQL queries against Prometheus and Loki, with more datasources behind flags. It runs locally as a stdio process and talks to your Grafana instance over its HTTP API.

Config

{
"name": "grafana",
"description": "Grafana dashboards, Prometheus and Loki",
"transport": {
"kind": "stdio",
"command": "uvx",
"args": ["mcp-grafana"]
},
"env": {
"GRAFANA_URL": "http://localhost:3000",
"GRAFANA_SERVICE_ACCOUNT_TOKEN": "glsa_YOUR_TOKEN"
}
}

You need uv installed for uvx, and Grafana 9.0 or later. For Grafana Cloud, set GRAFANA_URL to your instance, for example https://myinstance.grafana.net. Create the token under Administration › Users and access › Service accounts with the smallest role that covers what you want the agent to do (Viewer for read-only work).

Keep the token out of config.json (recommended). Because this is a stdio server, it inherits the agent’s environment. Put both values in ~/.atomic-agent/.env instead and drop the env block:

Terminal window
GRAFANA_URL=https://myinstance.grafana.net
GRAFANA_SERVICE_ACCOUNT_TOKEN=glsa_YOUR_TOKEN

Where to add it:

  • Desktop app: Settings › Connections › MCP servers › Add server, paste the object, press ⌘Enter (Ctrl+Enter on Windows and Linux), then Restart on the new row.
  • Terminal UI: /mcp add, paste the object. It connects right away.
  • By hand: add the object to mcp.servers in ~/.atomic-agent/config.json and restart the agent.

Some tool groups are off by default (SQL datasources, CloudWatch, InfluxDB, Elasticsearch and others) and are switched on with the server’s --enabled-tools flag. See the mcp-grafana README for the list.

What to ask the agent

Tools arrive as mcp.grafana.<tool>. Some prompts that work well:

  • “Find the dashboard for the checkout service and give me a summary: panels, variables and datasources. Don’t load the full JSON.”
  • “Query Prometheus for the p95 latency of http_request_duration_seconds on the api job over the last 6 hours and tell me when it peaked.”
  • “Search Loki for error logs from the payments app in the last hour and group them by message pattern.”
  • “The 5xx rate jumped at 14:10. Pull the Loki errors from 14:05 to 14:20, then check git log in this repo for anything merged just before.”

Grafana’s README recommends the dashboard summary and property tools over fetching full dashboard JSON, which is large. That advice matters more with Atomic Agent, where each tool result reaches the model capped at about 8,000 characters.

Tokens and approvals

  • Where the token lives. Either in the env block of config.json (plain text, written with owner-only permissions 0600 on macOS and Linux) or, better, in ~/.atomic-agent/.env.
  • What asks for approval. Tools the server does not mark read-only ask before they run, so dashboard updates wait for you. Use a Viewer service account if the agent should never change anything, whatever you approve. At approval level 5 (full trust) nothing asks.
  • pure_read is not safe here with an Editor or Admin token, because the server includes dashboard write tools.
  • Stdio servers see your whole environment. mcp-grafana can read every variable the agent holds, including unrelated keys in .env.

Troubleshooting

spawn uvx ENOENT or uvx: command not found. uv is not installed or not on the agent’s PATH. The desktop app on macOS (launched from Finder or the Dock) does not inherit the PATH your shell sets up, so use the full path from which uvx as command.

connect timeout after 15000ms on first start. The first uvx mcp-grafana run downloads the package. Run uvx mcp-grafana once in a terminal, stop it with Ctrl+C once it is waiting for input, then press Restart.

401 or 403 from Grafana. Wrong or expired service account token, or a role that is too small for the tool. Check the row’s error and the token’s role.

A datasource tool is missing. It may be off by default. Add the group to --enabled-tools in args, as the README describes.

Answers look cut off. Ask for summaries, shorter time ranges or fewer series.

FAQ

Is this the official Grafana MCP server?

Yes. mcp-grafana is developed by Grafana Labs in the grafana/mcp-grafana repository.

Does it work with Grafana Cloud?

Yes. Set GRAFANA_URL to your Grafana Cloud instance URL and use a service account token from that instance.

Can I run it with Docker instead of uvx?

The README also documents Docker, a standalone binary and Helm. Any of them works as long as it runs the server over stdio; put the command and its arguments in transport.command and transport.args.


Checked on 22 Oct 2026 against Atomic Agent v0.6.10 and Desktop v0.0.4, and the mcp-grafana README.

Get updates by email

One email when a new version comes out.