Atlas queries Grafana dashboards, Prometheus and Loki datasources, and alert rules through Grafana's official MCP server, so it can go from a spiking panel to the handler that emits the metric. Run it in stdio mode with grafana/mcp-grafana and a Grafana service account token, or use the hosted server at https://mcp.grafana.com/mcp on Grafana Cloud.
What Atlas reads from Grafana
Atlas queries Grafana dashboards, Prometheus and Loki datasources, and alert rules through Grafana's official MCP server, so it can go from a spiking panel to the handler that emits the metric. In 2026 that whole path runs from the terminal.
A Grafana panel is a question with the answer hidden two layers down: the PromQL that produces the series, and the line of code that increments the counter the series counts. Grafana's official MCP server gives Atlas both of the first two layers, the dashboards and the Prometheus and Loki datasources behind them, plus the alert rules that decide when a panel matters. Atlas supplies the third layer itself, because it already has your repository open.
Running grafana/mcp-grafana in stdio mode
Run Grafana's official server in stdio mode with atlas mcp add grafana --env GRAFANA_URL=$GRAFANA_URL --env GRAFANA_SERVICE_ACCOUNT_TOKEN=$GRAFANA_SERVICE_ACCOUNT_TOKEN -- docker run -i --rm -e GRAFANA_URL -e GRAFANA_SERVICE_ACCOUNT_TOKEN grafana/mcp-grafana -t stdio. Exactly 2 environment variables carry everything Grafana needs.
GRAFANA_URL points at your Grafana instance and GRAFANA_SERVICE_ACCOUNT_TOKEN authenticates against it. Both are passed to Atlas with --env and forwarded into the container with -e, which is why they appear twice in the command. The container runs with -i so stdio stays open and --rm so it does not accumulate stopped containers across sessions. Once registered, the grafana entry lives in atlas.json and starts on demand.
The -t stdio flag is not optional
Pass -t stdio explicitly, because the grafana/mcp-grafana image defaults to SSE and Atlas expects stdio for local servers. Omitting that 1 flag is the likeliest reason a Grafana MCP registration looks completely correct and still never connects.
Transport defaults are a quiet source of pain. The grafana/mcp-grafana image was built to serve SSE out of the box, and Atlas expects stdio from a local server it launches itself. The two do not meet in the middle. Adding -t stdio to the end of the docker run command is the entire fix. If your Grafana entry starts, stays silent, and never reports connected, check for the missing -t stdio before you check the service account token.
Use a Grafana service account token, not GRAFANA_API_KEY
Create a Grafana service account token rather than a legacy GRAFANA_API_KEY, which is deprecated but still honored. The service account token is the supported credential for grafana/mcp-grafana in 2026, and it is exactly what GRAFANA_SERVICE_ACCOUNT_TOKEN expects to receive.
GRAFANA_API_KEY still works, which is what makes it a trap: an old key found in a password manager will authenticate fine and quietly leave you on a deprecated path. Create a service account in Grafana, mint a token from it, and export it as GRAFANA_SERVICE_ACCOUNT_TOKEN. The service account is also the cleaner audit story, since the Grafana access Atlas uses belongs to a named service account rather than to whoever happened to set the integration up.
The Grafana Cloud hosted server
Grafana Cloud users can skip Docker entirely and use the hosted server: run atlas mcp add grafana --url https://mcp.grafana.com/mcp, then atlas mcp auth grafana. That 2 command path replaces the service account token with an OAuth flow and needs no local container at all.
The hosted path is shorter because there is nothing to run. No docker run, no -t stdio, no GRAFANA_URL, no GRAFANA_SERVICE_ACCOUNT_TOKEN. atlas mcp add grafana --url https://mcp.grafana.com/mcp registers the endpoint and atlas mcp auth grafana completes the browser flow. Choose it if you are on Grafana Cloud. Stay with the grafana/mcp-grafana container if your Grafana is self-hosted, since the hosted endpoint cannot reach an instance behind your network boundary.
The daily loop: PromQL to source code
Ask Atlas to run the PromQL behind a failing panel, read the result, and locate the code that increments that counter. Those 3 steps are the daily loop in 2026, and Grafana's MCP server exposes the dashboard's Prometheus and Loki datasources so Atlas queries them directly.
The instruction is deliberately three steps, because each one grounds the next. Running the PromQL behind the panel means Atlas is reasoning about real numbers, not a screenshot. Reading the result tells it which label or dimension is actually anomalous. Locating the code that increments that counter is the step only a coding agent can do, and it is the one that turns an alert into a change. Loki logs fill in the gaps when a metric alone is ambiguous.
Dashboard changes as reviewable diffs
Have Atlas draft the new panel JSON as a diff you review before you import it into the Grafana dashboard. 1 review step separates a proposed panel from a live one, and treating a dashboard change like a code change means panel JSON gets the same scrutiny as the handler emitting the metric.
Dashboards drift because editing them is too easy and reviewing them is impossible. Having Atlas produce panel JSON as a diff restores the review. You read the change, you understand which query and which thresholds moved, and only then do you import it into Grafana. The same discipline applies to alert rules: a proposal you can read beats a change somebody made in the UI at midnight and never explained.
Setup
- 01Run Grafana's official server in stdio mode: atlas mcp add grafana --env GRAFANA_URL=$GRAFANA_URL --env GRAFANA_SERVICE_ACCOUNT_TOKEN=$GRAFANA_SERVICE_ACCOUNT_TOKEN -- docker run -i --rm -e GRAFANA_URL -e GRAFANA_SERVICE_ACCOUNT_TOKEN grafana/mcp-grafana -t stdio
- 02Pass -t stdio explicitly, because the grafana/mcp-grafana image defaults to SSE and Atlas expects stdio for local servers.
- 03Create a Grafana service account token rather than a legacy GRAFANA_API_KEY, which is deprecated but still honored.
- 04On Grafana Cloud, use the hosted server instead: atlas mcp add grafana --url https://mcp.grafana.com/mcp then atlas mcp auth grafana.
- 05Ask Atlas to run the PromQL behind a failing panel, read the result, and locate the code that increments that counter.
- 06Have Atlas draft the new panel JSON as a diff you review before you import it into the dashboard.
Frequently asked questions
- how to connect Atlas to Grafana
- Register grafana/mcp-grafana in stdio mode with atlas mcp add grafana, passing GRAFANA_URL and GRAFANA_SERVICE_ACCOUNT_TOKEN, and ending the docker run command with -t stdio. On Grafana Cloud, use https://mcp.grafana.com/mcp instead.
- why does the Grafana MCP server not connect in stdio
- The grafana/mcp-grafana image defaults to SSE, and Atlas expects stdio for local servers. Pass -t stdio explicitly at the end of the docker run command.
- GRAFANA_API_KEY or service account token for MCP
- Create a Grafana service account token. The legacy GRAFANA_API_KEY is deprecated but still honored, which is why an old key can quietly leave you on the unsupported path.
- can Atlas run PromQL against a Grafana dashboard
- Yes. Grafana's MCP server exposes the dashboard's Prometheus and Loki datasources, so Atlas can run the PromQL behind a failing panel and read the result.
- Grafana Cloud MCP server setup for AI agents
- Run atlas mcp add grafana --url https://mcp.grafana.com/mcp then atlas mcp auth grafana. No Docker container and no service account token are needed on that path.
- can an AI agent edit a Grafana dashboard panel
- Atlas can draft the new panel JSON as a diff you review before you import it into the dashboard, which keeps a human approval between a proposed panel and a live one.
- does the Grafana MCP server expose alert rules
- Yes. Atlas queries Grafana dashboards, Prometheus and Loki datasources, and alert rules through Grafana's official MCP server.
Try Atlas in your terminal
The terminal-native AI coding agent. Free core, single binary.
Install AtlasRelated guides
Atlas with Llama 4 Scout (Ollama): A 10M-Token Window on Local Hardware in 2026
Run Atlas on Llama 4 Scout (Ollama): a 67GB 16-expert MoE with a 10M-token context and image input, free self-hosted. The memory math before you pull 67GB.
Atlas with Gemma 4 E4B (Ollama): the Default Gemma 4 Tag in 2026
Gemma 4 E4B (Ollama) is the :latest tag of Google's newest Gemma line: 9.6GB, 128K tokens (131,072), Free (self-hosted), with qat, mlx, mxfp8 and nvfp4 quants.
Atlas with Qwen3 32B (Ollama): dense reasoning over raw speed in 2026
Qwen3 32B (Ollama) in Atlas: dense 20GB weights on a 24GB card, 40K tokens (40,960) of context, Free (self-hosted). Slower than the MoE, steadier on hard problems.
Atlas with GPT-5.6: OpenAI's 2026 Flagship in the Terminal
GPT-5.6 gives Atlas a 1,050,000 token context at $5 / $30 per Mtok. Atlas routes OpenAI through the Responses API so reasoning persists across tool calls in 2026.
Atlas with Qwen3.6 35B-A3B: The $0.248 per Mtok Workhorse of 2026
Qwen3.6 35B-A3B is the cheapest reasoning model in the Qwen3.6 line at $0.248 per Mtok input and $1.485 per Mtok output, with a full 256K tokens (262,144) context for Atlas.
Atlas with IBM Granite 4.0 H Micro in 2026
IBM Granite 4.0 H Micro in Atlas, 2026: a hybrid Mamba-Transformer model at $0.017/$0.112 per Mtok on Cloudflare Workers AI, the cheapest input in the registry.
Atlas with Mistral Small 4 (2603): Cheap Reasoning in 2026
Mistral Small 4 (2603) brings reasoning to the Small tier: 256,000 tokens at $0.15 / 1M input tokens and $0.60 / 1M output tokens. Atlas setup, costs, tradeoffs.
Atlas with DeepSeek Coder V2 16B Lite (Ollama): The 160K Local Agent Model in 2026
DeepSeek Coder V2 16B Lite (Ollama) gives Atlas a 160K token context from an 8.9GB download, Free (self-hosted). Setup, MoE speed, and the KV cache catch, for 2026.