MCP Grafana logo

MCP Grafana

Search & edit Grafana dashboards, query datasources (PromQL/LogQL/SQL), inspect alerts.

Install MCP Grafana

Pick your client, then add it in one click or paste the config.

STDIONode.js
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "mcp-grafana": {
      "command": "npx",
      "args": [
        "-y",
        "@dockndevai/mcp-grafana"
      ]
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

We couldn’t confirm it starts correctly

The install command installed and started the server, which then stopped for configuration (such as an API key) that our sandbox does not have — expected for servers that connect to your account.

npx -y @dockndevai/mcp-grafana

No response to initialize.

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked 4d ago.

Overview

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked 2d ago

Recent health check succeeded.

5/5 checks healthy over the last 42d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 5h ago via OSV.dev · @dockndevai/mcp-grafana (npm)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

npm downloads489Package downloads in the last 30 days.
Last commit5d agoMost recent push to the default branch.
Install checkRunsOur sandbox started it; it then asked for an API key or config.
Directory activity2 viewsConfig copies, upvotes, and views on AllMCPs.

From the project README

mcp-grafana

npm CI licence

A safe-by-default Model Context Protocol server for Grafana. It lets an agent explore and operate Grafana — search dashboards, read the dashboard JSON model, list and query datasources (Prometheus / Loki / SQL), inspect alert rules and annotations, and (in higher modes) create/update dashboards and folders, write annotations, and delete.

Part of the dockndevai MCP server suite — one governance model across all of them.

mcp-grafana — safe by default: read-only exposes 11 tools; raising the access mode unlocks writes and (gated) deletes

What it gives an agent

The server starts read-only (see Safe by default); higher-capability tools are only registered when you raise the mode.

ToolForNeeds mode
get_healthcheck the instance is up, versionread-only
searchfind dashboards & folders by name/tag (get UIDs)read-only
list_dashboards / list_foldersenumerate dashboards / foldersread-only
get_dashboardthe full dashboard JSON model + metaread-only
list_datasources / get_datasourcedatasources (secrets redacted)read-only
query_datasourcerun PromQL / LogQL / SQL via the unified query APIread-only
list_alert_rulesGrafana-managed alert rulesread-only
list_annotationsevents overlaid on graphsread-only
create_or_update_dashboardupsert a dashboard (versioned, reversible)read-write
create_foldercreate a folderread-write
create_annotationmark a deploy/incident on graphsread-write
delete_dashboard / delete_folder / delete_annotationdelete (irreversible)admin + GRAFANA_ALLOW_DELETE

Install

Terminal
npx -y @dockndevai/mcp-grafana

You need a Grafana service account token (Administration → Service accounts → Add service account → Add token). Give it the least role that works — Viewer for read-only use, Editor to create/update, Admin only if you must delete.

Configure

config.json
{
  "mcpServers": {
    "grafana": {
      "command": "npx",
      "args": ["-y", "@dockndevai/mcp-grafana"],
      "env": {
        "GRAFANA_URL": "http://localhost:3000",
        "GRAFANA_TOKEN": "glsa_...",
        "GRAFANA_MODE": "read-only"
      }
    }
  }
}

See docs/CLIENTS.md for Claude Code / Cursor / Codex / VS Code / Windsurf snippets, and .env.example for every supported variable.

Safe by default

The access model is enforced by src/security.ts — defence in depth on top of the service-account token's own role:

  • GRAFANA_MODE — read-only (default) → read-write → admin. A tool is registered only if the mode allows its capability. Read-only exposes the 11 read tools; edits need read-write; deletes need admin.
  • GRAFANA_ALLOW_DELETE — deletes are irreversible, so on top of admin mode they also require this flag.
  • GRAFANA_FOLDER_ALLOWLIST / GRAFANA_PROTECTED_FOLDERS — confine which folders can be written to; mark folders (e.g. production) that may be read but never modified or deleted.
  • GRAFANA_DATASOURCE_ALLOWLIST — restrict which datasources query_datasource may hit.
  • GRAFANA_DRY_RUN — validate and log writes without executing them.
  • GRAFANA_AUDIT_LOG — a JSON audit line per guarded operation, on stderr (default on).
  • Interactive confirmation — when the client supports MCP elicitation, deleting a dashboard/folder/annotation prompts the human to approve before it runs; clients that can't elicit fall back to the GRAFANA_ALLOW_DELETE gate.
  • Secrets are never returned — datasource secureJsonData, passwords and tokens are stripped from every response.

Interactive confirmation — the agent asks to delete a dashboard; the server pauses and asks the human via MCP elicitation. Declining leaves the dashboard untouched; approving proceeds.

See SECURITY.md.

Working with dashboards & queries

Conventions for the dashboard JSON model, panel/target shapes, PromQL/LogQL/SQL query patterns, folder organisation and safe editing live in the bundled skill: .claude/skills/grafana-dashboards-and-queries/SKILL.md. Agents that load it can build and edit dashboards to a consistent standard without being re-taught each time.

Developing

Terminal
npm install
npm run build
GRAFANA_URL=http://localhost:3000 GRAFANA_TOKEN=glsa_… node dist/index.js
# introspect without a live Grafana:
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | GRAFANA_TOKEN=x node dist/index.js

Licence

MIT

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about MCP Grafana

mcp-grafana is an MCP server that lets agents explore and operate Grafana safely. It can search dashboards and folders, read dashboard JSON, list and query Prometheus, Loki, and SQL datasources, inspect alert rules and annotations, and, in higher modes, create or update dashboards and folders, write annotations, or delete resources.

Install mcp-grafana with npx using `npx -y @dockndevai/mcp-grafana`. Configure `GRAFANA_URL`, a Grafana service account token in `GRAFANA_TOKEN`, and optionally `GRAFANA_MODE`, which defaults to `read-only`. The README recommends a Viewer role for read-only use, Editor for updates, and Admin only when deletion is required.

Yes, mcp-grafana starts in `read-only` mode, registering tools for health checks, dashboard and folder searches, dashboard inspection, datasource listing and queries, alert rules, and annotations. Set `GRAFANA_MODE` to `read-write` to enable edits; deletes require `admin` mode plus `GRAFANA_ALLOW_DELETE`.

Yes, mcp-grafana can query Prometheus with PromQL, Loki with LogQL, and SQL datasources through Grafana's unified query API. You can use `GRAFANA_DATASOURCE_ALLOWLIST` to restrict which datasources the `query_datasource` tool may access.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewMCP Grafana AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/mcp-grafana?style=directory)](https://allmcps.com/mcp/mcp-grafana)
HTML Embed
<a href="https://allmcps.com/mcp/mcp-grafana"><img src="https://allmcps.com/api/badge/mcp-grafana?style=directory" alt="MCP Grafana on AllMCPs" /></a>