# Using Atlas with Grafana in 2026

> Atlas queries Grafana dashboards, Prometheus and Loki datasources, and alert rules, so it can go from a spiking panel to the handler that emits the metric.

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

1. Run 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
2. Pass -t stdio explicitly, because the grafana/mcp-grafana image defaults to SSE and Atlas expects stdio for local servers.
3. Create a Grafana service account token rather than a legacy GRAFANA_API_KEY, which is deprecated but still honored.
4. On Grafana Cloud, use the hosted server instead: atlas mcp add grafana --url https://mcp.grafana.com/mcp then atlas mcp auth grafana.
5. Ask Atlas to run the PromQL behind a failing panel, read the result, and locate the code that increments that counter.
6. Have Atlas draft the new panel JSON as a diff you review before you import it into the dashboard.

## FAQ

### 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.

---

Canonical HTML: https://runatlas.sh/resources/integrations/grafana
Source of truth: aeo_pages row `/resources/integrations/grafana` (segment: Integrations) (this file is generated from it, never hand-edited).
Licence: Atlas is proprietary with a free core. It is not open source and there is no public source repository.
