# MCP Grafana

> MCP Grafana is an open-source MCP server for developer tools. Safe-by-default MCP server for searching, querying and editing Grafana dashboards. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI
- **Repository:** https://github.com/dockndevai/mcp-grafana
- **MCP Registry name:** io.github.dockndevai/mcp-grafana
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools), [analytics and data](https://ai-powered.com/categories/analytics-and-data)
- **Listing updated:** 2026-11-23

## About

The server starts in read-only mode and only registers the tools a chosen mode allows, so an agent that is pointed at Grafana with a Viewer token cannot edit anything. Setting GRAFANA_MODE to read-write adds dashboard, folder and annotation writes, and admin mode adds deletes, which also need GRAFANA_ALLOW_DELETE.

On the read side the agent can search by name or tag, pull a dashboard's full JSON model, list datasources with secrets redacted, and run PromQL, LogQL or SQL through Grafana's unified query API. Alert rules and annotations are readable too.

Guards go beyond the token's own role: folder allowlists and protected folders (a protected folder also shields its sub-folders), a datasource allowlist, dry-run, a JSON audit line on stderr, and human approval through MCP elicitation before deletes. The repository also bundles a skill with conventions for dashboard JSON and query patterns. It authenticates with a Grafana service-account token and runs over stdio via npx.

## Features

- **Read-only start:** Higher-capability tools are not even registered until the mode is raised.
- **Datasource queries:** Run PromQL, LogQL or SQL through the unified query API.
- **Dashboard JSON access:** Fetch the full dashboard model and metadata by UID.
- **Folder protection:** Allowlist writable folders and mark others as read-only, including sub-folders.
- **Confirmed deletes:** Deletes need admin mode, an allow flag and a human approval prompt.
- **Audit and dry-run:** Log guarded operations as JSON and preview writes without executing them.

## Good for

- Ask which dashboards cover a service and open their definitions
- Run a Prometheus or Loki query from chat while debugging an incident
- Mark a deploy or incident as an annotation on graphs
- Generate or update a dashboard in a staging folder
- Review alert rules without opening the Grafana UI

## Install

### Claude Code: Add with the CLI (Terminal)

```sh
claude mcp add mcp-grafana --env GRAFANA_TOKEN='<GRAFANA_TOKEN>' -- npx -y @dockndevai/mcp-grafana
```

Add --scope user to use it in every project, or --scope project to share it in .mcp.json.

### Claude Code: Or share it with your project (.mcp.json)

```json
{
  "mcpServers": {
    "mcp-grafana": {
      "command": "npx",
      "args": [
        "-y",
        "@dockndevai/mcp-grafana"
      ],
      "env": {
        "GRAFANA_TOKEN": "<GRAFANA_TOKEN>"
      }
    }
  }
}
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "mcp-grafana": {
      "command": "npx",
      "args": [
        "-y",
        "@dockndevai/mcp-grafana"
      ],
      "env": {
        "GRAFANA_TOKEN": "<GRAFANA_TOKEN>"
      }
    }
  }
}
```

Settings → Developer → Edit Config, then quit and reopen Claude Desktop.

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "mcp-grafana": {
      "command": "npx",
      "args": [
        "-y",
        "@dockndevai/mcp-grafana"
      ],
      "env": {
        "GRAFANA_TOKEN": "<GRAFANA_TOKEN>"
      }
    }
  }
}
```

Use .cursor/mcp.json in a project to share it with the project.

### VS Code (~/.copilot/mcp-config.json)

```json
{
  "mcpServers": {
    "mcp-grafana": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@dockndevai/mcp-grafana"
      ],
      "env": {
        "GRAFANA_TOKEN": "<GRAFANA_TOKEN>"
      }
    }
  }
}
```

Or put the same entry in .mcp.json at your workspace root to share it.

### Codex: Add with the CLI (Terminal)

```sh
codex mcp add mcp-grafana --env GRAFANA_TOKEN='<GRAFANA_TOKEN>' -- npx -y @dockndevai/mcp-grafana
```

### Codex: Or add to config.toml (~/.codex/config.toml)

```toml
[mcp_servers.mcp-grafana]
command = "npx"
args = ["-y", "@dockndevai/mcp-grafana"]
env = { GRAFANA_TOKEN = "<GRAFANA_TOKEN>" }
```

### Gemini CLI and Antigravity: Gemini CLI (~/.gemini/settings.json)

```json
{
  "mcpServers": {
    "mcp-grafana": {
      "command": "npx",
      "args": [
        "-y",
        "@dockndevai/mcp-grafana"
      ],
      "env": {
        "GRAFANA_TOKEN": "<GRAFANA_TOKEN>"
      }
    }
  }
}
```

Or run: gemini mcp add -s user -e GRAFANA_TOKEN='<GRAFANA_TOKEN>' mcp-grafana npx -- -y @dockndevai/mcp-grafana

### Gemini CLI and Antigravity: Antigravity (~/.gemini/config/mcp_config.json)

```json
{
  "mcpServers": {
    "mcp-grafana": {
      "command": "npx",
      "args": [
        "-y",
        "@dockndevai/mcp-grafana"
      ],
      "env": {
        "GRAFANA_TOKEN": "<GRAFANA_TOKEN>"
      }
    }
  }
}
```

Use .agents/mcp_config.json to add it to one workspace only.

### Devin Desktop (~/.config/devin/mcp_config.json)

```json
{
  "mcpServers": {
    "mcp-grafana": {
      "command": "npx",
      "args": [
        "-y",
        "@dockndevai/mcp-grafana"
      ],
      "env": {
        "GRAFANA_TOKEN": "<GRAFANA_TOKEN>"
      }
    }
  }
}
```

On Windows the file is %APPDATA%\\devin\\mcp_config.json. Use .devin/mcp_config.json to share it with a project.

### Cline (cline_mcp_settings.json)

```json
{
  "mcpServers": {
    "mcp-grafana": {
      "command": "npx",
      "args": [
        "-y",
        "@dockndevai/mcp-grafana"
      ],
      "env": {
        "GRAFANA_TOKEN": "<GRAFANA_TOKEN>"
      }
    }
  }
}
```

Open it from the MCP Servers icon → Configure → Configure MCP Servers.

### Zed (Zed settings.json)

```json
{
  "context_servers": {
    "mcp-grafana": {
      "command": "npx",
      "args": [
        "-y",
        "@dockndevai/mcp-grafana"
      ],
      "env": {
        "GRAFANA_TOKEN": "<GRAFANA_TOKEN>"
      }
    }
  }
}
```

Open it with zed: open settings file. Merge context_servers into the settings you already have.

### JetBrains AI Assistant and Junie: AI Assistant (Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add)

```json
{
  "mcpServers": {
    "mcp-grafana": {
      "command": "npx",
      "args": [
        "-y",
        "@dockndevai/mcp-grafana"
      ],
      "env": {
        "GRAFANA_TOKEN": "<GRAFANA_TOKEN>"
      }
    }
  }
}
```

The AI Assistant docs only show command and args. If the env block is ignored, use Junie for this server.

### JetBrains AI Assistant and Junie: Junie (~/.junie/mcp/mcp.json)

```json
{
  "mcpServers": {
    "mcp-grafana": {
      "command": "npx",
      "args": [
        "-y",
        "@dockndevai/mcp-grafana"
      ],
      "env": {
        "GRAFANA_TOKEN": "<GRAFANA_TOKEN>"
      }
    }
  }
}
```

Use .junie/mcp/mcp.json to share it with a project.

### Kiro (~/.kiro/settings/mcp.json)

```json
{
  "mcpServers": {
    "mcp-grafana": {
      "command": "npx",
      "args": [
        "-y",
        "@dockndevai/mcp-grafana"
      ],
      "env": {
        "GRAFANA_TOKEN": "<GRAFANA_TOKEN>"
      }
    }
  }
}
```

Use .kiro/settings/mcp.json to add it to one workspace only.

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "mcp-grafana": {
      "command": "npx",
      "args": [
        "-y",
        "@dockndevai/mcp-grafana"
      ],
      "env": {
        "GRAFANA_TOKEN": "<GRAFANA_TOKEN>"
      }
    }
  }
}
```

## Tools

From the tool list in its README, going by the names, 3 of 16 tools delete data and 3 change data. From the server's own tool labels and tool names; not verified by us.

- `get_health` (name suggests: reads): Check the instance is up and report its version
- `search` (name suggests: reads): Find dashboards and folders by name or tag
- `list_dashboards` (name suggests: reads): List dashboards
- `list_folders` (name suggests: reads): List folders
- `get_dashboard` (name suggests: reads): Return the full dashboard JSON model and metadata
- `list_datasources` (name suggests: reads): List datasources with secrets redacted
- `get_datasource` (name suggests: reads): Get one datasource
- `query_datasource` (name suggests: reads): Run PromQL, LogQL or SQL through the unified query API
- `list_alert_rules` (name suggests: reads): List Grafana-managed alert rules
- `list_annotations` (name suggests: reads): List annotations overlaid on graphs
- `create_or_update_dashboard` (name suggests: changes): Upsert a dashboard (read-write mode)
- `create_folder` (name suggests: changes): Create a folder (read-write mode)
- `create_annotation` (name suggests: changes): Add an annotation, for example a deploy or incident marker (read-write mode)
- `delete_dashboard` (name suggests: deletes): Delete a dashboard (admin mode)
- `delete_folder` (name suggests: deletes): Delete a folder (admin mode)
- `delete_annotation` (name suggests: deletes): Delete an annotation (admin mode)

## FAQ

### What does MCP Grafana need to connect?

A Grafana base URL and a service-account token; a Viewer role is enough for read-only use.

### Can the agent delete dashboards?

Only in admin mode with GRAFANA_ALLOW_DELETE set, and with a human approval prompt where the client supports it.

### Are datasource secrets exposed?

No. Secrets, passwords and tokens are stripped from responses.

### How is MCP Grafana installed?

Run npx -y @dockndevai/mcp-grafana from an MCP client such as Claude Code, Cursor, Codex, VS Code or Windsurf.

### Is MCP Grafana free?

Yes. MCP Grafana is open source, so you can use and self-host it for free.

### How do I add MCP Grafana to Claude Code?

Run this command in your terminal: claude mcp add mcp-grafana --env GRAFANA_TOKEN='<GRAFANA_TOKEN>' -- npx -y @dockndevai/mcp-grafana

### What are the best alternatives to MCP Grafana?

The closest alternatives to MCP Grafana are REA, Context7, Chrome DevTools MCP, Codebase Memory and GitHub.

## Where this comes from

- Description: written from the project's README.
- Install steps: from the official MCP Registry entry.

## Alternatives

- [REA](https://ai-powered.com/mcp/rea): REA is an open-source MCP server for developer tools.
- [Context7](https://ai-powered.com/mcp/context7): Context7 is a freemium MCP server for developer tools.
- [Chrome DevTools MCP](https://ai-powered.com/mcp/chrome-devtools-mcp-2): Chrome DevTools MCP is an open-source MCP server for browser automation.
- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Codebase Memory is an open-source MCP server for knowledge and memory.
- [GitHub](https://ai-powered.com/mcp/github): GitHub is an open-source MCP server for developer tools.
- [Serena MCP: the IDE for your agent](https://ai-powered.com/mcp/serena-mcp-the-ide-for-your-agent): Serena MCP: the IDE for your agent is an open-source MCP server for developer tools.
- [awesome-mcp-servers](https://ai-powered.com/mcp/awesome-mcp-servers-2): awesome-mcp-servers is an open-source MCP server for developer tools.
- [XERJ](https://ai-powered.com/mcp/xerj): XERJ is an open-source MCP server for knowledge and memory.

---
Source: https://ai-powered.com/mcp/mcp-grafana
