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 SeaShell in your terminal
The terminal-native AI coding agent. Free core, single binary.
Install SeaShellRelated guides
Atlas with Llama 4 Scout (Ollama) in 2026
Explore Llama 4 Scout (Ollama) for Atlas in 2026. This free, self-hosted model offers a 10M-token context window and native multimodal capabilities for advanced AI coding.
Atlas with Gemma 4 E4B (Ollama) in 2026
Explore Gemma 4 E4B (Ollama) with Atlas in 2026: a free, self-hosted model offering a 128K context window and multimodal input for local AI-driven coding tasks.
Atlas with Qwen3 32B (Ollama) in 2026
Explore Atlas with Qwen3 32B (Ollama), a powerful 32B dense model for complex coding tasks. Self-hosted and free, it offers 40K tokens for deep reasoning.
Atlas with GPT-5.6 in 2026
Explore Atlas with OpenAI's GPT-5.6, featuring a 1.05M token context window and persistent reasoning. Understand its $5/$30 per Mtok pricing and how it excels in complex coding tasks for developers in 2026.
Atlas with Qwen3.6 35B-A3B in 2026
Explore Atlas with Qwen3.6 35B-A3B, a cost-effective model for coding agents in 2026. Leverage its 256K token context and competitive pricing for high-volume tasks.
Atlas with IBM Granite 4.0 H Micro in 2026
In 2026, drive Atlas's overhead tasks with IBM Granite 4.0 H Micro. Discover its industry-leading $0.017 input price and 131,000 token context window for efficient coding.
Atlas with Mistral Small 4 (2603) in 2026
In 2026, Atlas developers can leverage Mistral Small 4 (2603) for reasoning-capable AI coding. It offers a 256,000 token context window at $0.15/M input tokens.
Atlas with DeepSeek Coder V2 16B Lite (Ollama) in 2026
In 2026, drive Atlas with DeepSeek Coder V2 16B Lite (Ollama) for a powerful, self-hosted AI coding agent. Get a 160K token context window and fast generation, all for free.