# Grafana

> Query dashboards, Prometheus/Loki datasources, alerts, and incidents from an AI agent — official.

[Canonical HTML page](https://top-mcps.com/mcp/grafana) · [server.json](https://top-mcps.com/mcp/grafana.json) · [methodology](https://top-mcps.com/about/methodology)

## Install

### Claude Desktop — `claude_desktop_config.json`

Paste under mcpServers. Fully quit and reopen Claude after editing.

```json
{
  "mcpServers": {
    "grafana": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "-e",
        "GRAFANA_URL",
        "-e",
        "GRAFANA_SERVICE_ACCOUNT_TOKEN",
        "grafana/mcp-grafana",
        "-t",
        "stdio"
      ],
      "env": {
        "GRAFANA_URL": "${GRAFANA_URL}",
        "GRAFANA_SERVICE_ACCOUNT_TOKEN": "${GRAFANA_SERVICE_ACCOUNT_TOKEN}"
      }
    }
  }
}
```

### Claude Code — `CLI or .mcp.json`

Run from your repo. Commit .mcp.json to share with your team.

```shell
# export GRAFANA_URL=https://myinstance.grafana.net
# export GRAFANA_SERVICE_ACCOUNT_TOKEN=glsa_your_token
claude mcp add grafana -- docker run --rm -i -e GRAFANA_URL -e GRAFANA_SERVICE_ACCOUNT_TOKEN grafana/mcp-grafana -t stdio
```

### Cursor — `.cursor/mcp.json`

Global path: ~/.cursor/mcp.json. Reload window after editing.

```json
{
  "mcpServers": {
    "grafana": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "-e",
        "GRAFANA_URL",
        "-e",
        "GRAFANA_SERVICE_ACCOUNT_TOKEN",
        "grafana/mcp-grafana",
        "-t",
        "stdio"
      ],
      "env": {
        "GRAFANA_URL": "${GRAFANA_URL}",
        "GRAFANA_SERVICE_ACCOUNT_TOKEN": "${GRAFANA_SERVICE_ACCOUNT_TOKEN}"
      }
    }
  }
}
```

### VS Code — `.vscode/mcp.json`

VS Code uses the "servers" key (not "mcpServers").

```jsonc
{
  "servers": {
    "grafana": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "-e",
        "GRAFANA_URL",
        "-e",
        "GRAFANA_SERVICE_ACCOUNT_TOKEN",
        "grafana/mcp-grafana",
        "-t",
        "stdio"
      ],
      "env": {
        "GRAFANA_URL": "${GRAFANA_URL}",
        "GRAFANA_SERVICE_ACCOUNT_TOKEN": "${GRAFANA_SERVICE_ACCOUNT_TOKEN}"
      }
    }
  }
}
```

### Windsurf — `~/.codeium/windsurf/mcp_config.json`

Open via Cascade → hammer icon → Configure.

```json
{
  "mcpServers": {
    "grafana": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "-e",
        "GRAFANA_URL",
        "-e",
        "GRAFANA_SERVICE_ACCOUNT_TOKEN",
        "grafana/mcp-grafana",
        "-t",
        "stdio"
      ],
      "env": {
        "GRAFANA_URL": "${GRAFANA_URL}",
        "GRAFANA_SERVICE_ACCOUNT_TOKEN": "${GRAFANA_SERVICE_ACCOUNT_TOKEN}"
      }
    }
  }
}
```

### Cline — `cline_mcp_settings.json`

Open via the Cline sidebar → MCP Servers → Edit.

```json
{
  "mcpServers": {
    "grafana": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "-e",
        "GRAFANA_URL",
        "-e",
        "GRAFANA_SERVICE_ACCOUNT_TOKEN",
        "grafana/mcp-grafana",
        "-t",
        "stdio"
      ],
      "env": {
        "GRAFANA_URL": "${GRAFANA_URL}",
        "GRAFANA_SERVICE_ACCOUNT_TOKEN": "${GRAFANA_SERVICE_ACCOUNT_TOKEN}"
      }
    }
  }
}
```

### Continue — `~/.continue/config.json`

Continue uses modelContextProtocolServers with a transport block.

```json
{
  "experimental": {
    "modelContextProtocolServers": [
      {
        "transport": {
          "type": "stdio",
          "command": "docker",
          "args": [
            "run",
            "--rm",
            "-i",
            "-e",
            "GRAFANA_URL",
            "-e",
            "GRAFANA_SERVICE_ACCOUNT_TOKEN",
            "grafana/mcp-grafana",
            "-t",
            "stdio"
          ],
          "env": {
            "GRAFANA_URL": "${GRAFANA_URL}",
            "GRAFANA_SERVICE_ACCOUNT_TOKEN": "${GRAFANA_SERVICE_ACCOUNT_TOKEN}"
          }
        }
      }
    ]
  }
}
```

### Codex CLI — `~/.codex/config.toml`

Codex uses TOML. Each server is a [mcp_servers.<name>] subtable.

```shell
# ~/.codex/config.toml
[mcp_servers.grafana]
command = "docker"
args = [
  "run",
  "--rm",
  "-i",
  "-e",
  "GRAFANA_URL",
  "-e",
  "GRAFANA_SERVICE_ACCOUNT_TOKEN",
  "grafana/mcp-grafana",
  "-t",
  "stdio",
]
env = { GRAFANA_URL = "${GRAFANA_URL}", GRAFANA_SERVICE_ACCOUNT_TOKEN = "${GRAFANA_SERVICE_ACCOUNT_TOKEN}" }
```

### Zed — `~/.config/zed/settings.json`

Zed calls them "context_servers". Settings live-reload on save.

```jsonc
{
  "context_servers": {
    "grafana": {
      "command": {
        "path": "docker",
        "args": [
          "run",
          "--rm",
          "-i",
          "-e",
          "GRAFANA_URL",
          "-e",
          "GRAFANA_SERVICE_ACCOUNT_TOKEN",
          "grafana/mcp-grafana",
          "-t",
          "stdio"
        ]
      },
      "env": {
        "GRAFANA_URL": "${GRAFANA_URL}",
        "GRAFANA_SERVICE_ACCOUNT_TOKEN": "${GRAFANA_SERVICE_ACCOUNT_TOKEN}"
      }
    }
  }
}
```

### ChatGPT — `ChatGPT → Apps directory`

Grafana doesn't ship a hosted HTTPS endpoint today. ChatGPT supports remote MCP servers only — to use this server in ChatGPT you'll need to deploy it to a public HTTPS URL first (e.g. via Cloudflare Workers or Vercel) or wait for an official remote build.

```none

```

## At a glance

- **Maintainer:** Grafana Labs
- **Transport:** stdio, SSE, Streamable HTTP
- **Auth model:** API key
- **Required secrets:** GRAFANA_URL, GRAFANA_SERVICE_ACCOUNT_TOKEN
- **Supported clients:** Claude, Cursor, VS Code, Any MCP-compatible client, Grafana 9.0+
- **License:** Apache-2.0
- **Language:** Go
- **Latest version:** latest
- **Last verified:** 2026-07-16
- **GitHub stars:** 3,246 (fetched 2026-07-17T12:42:37.493Z)
- **Score:** 92/100 (rubric 2026-04 — see https://top-mcps.com/about/methodology)
- **Source:** https://github.com/grafana/mcp-grafana

## Quick answer

**What it does.** Exposes Grafana operations as MCP tools: dashboard search/edit, datasource queries (Prometheus, Loki, and 10+ others), alert-rule inspection, and Incident/OnCall/Sift workflows.

**Best for:**
- Incident investigation across metrics + logs
- Querying Prometheus and Loki via one MCP
- Dashboard search and editing
- Alert-rule inspection
- Grafana Incident / OnCall / Sift workflows

**Not for:**
- Grafana versions before 9.0
- Direct datasource access without Grafana
- Instances where a service-account token cannot be issued

## Description

Grafana's official MCP (Apache-2.0, ~3.2k stars) gives an agent read/write access to a Grafana instance: search and edit dashboards, query Prometheus and Loki datasources, inspect alert rules, and drive Incident, OnCall, and Sift. It turns "what fired at 2am" into a single grounded question.

## Why it matters

Observability data is only useful if you can ask it questions. A Grafana MCP lets an agent pull the metric, correlate the log, and read the alert without a human pivoting across tabs — the core of AI-assisted incident response.

## Key features

- Dashboards + 12 datasource types (Prometheus, Loki, ClickHouse, CloudWatch…)
- Alerting, Incident, OnCall, Sift tools
- stdio, SSE, and streamable-http transports
- Service-account token auth
- Official Grafana Labs, Apache-2.0, Go

## FAQ

### What auth does it need?

A Grafana service-account token (`GRAFANA_SERVICE_ACCOUNT_TOKEN`) plus your instance `GRAFANA_URL`. The deprecated `GRAFANA_API_KEY` still works.

### Which datasources can it query?

Prometheus and Loki are first-class, plus ClickHouse, CloudWatch, Elasticsearch/OpenSearch, InfluxDB, Snowflake, Athena, and more.

### Minimum Grafana version?

Grafana 9.0 or later for full tool coverage.

## Changelog

- **2026-07-16** — Refreshed install snippets and fact sheet; verified for 2026.
- **2025-04-01** — Initial directory listing.
