Skip to main content
ClaudeWave

MCP server for Grafana — search & edit dashboards, query datasources (Prometheus/Loki/SQL), inspect alerts, with safe-by-default access modes.

MCP ServersRegistry oficial0 estrellas0 forksTypeScriptMITActualizado today
ClaudeWave Trust Score
87/100
Trusted
Passed
  • Open-source license (MIT)
  • Actively maintained (<30d)
  • Clear description
  • Documented (README)
Last scanned: 9/13/2026
Install in Claude Code / Claude Desktop
Method: NPX · @dockndevai/mcp-grafana
Claude Code CLI
claude mcp add mcp-grafana -- npx -y @dockndevai/mcp-grafana
claude_desktop_config.json (Claude Desktop)
{
  "mcpServers": {
    "mcp-grafana": {
      "command": "npx",
      "args": ["-y", "@dockndevai/mcp-grafana"],
      "env": {
        "GRAFANA_URL": "<grafana_url>",
        "GRAFANA_TOKEN": "<grafana_token>"
      }
    }
  }
}
1. Run the command above in your terminal (Claude Code), or paste the JSON config into claude_desktop_config.json (Claude Desktop).
2. Replace any <placeholder> values with your API keys or paths.
3. Restart Claude. The MCP server and its tools appear automatically.
Detected environment variables
GRAFANA_URLGRAFANA_TOKEN
Casos de uso

Resumen de MCP Servers

# mcp-grafana

[![npm](https://img.shields.io/npm/v/@dockndevai/mcp-grafana)](https://www.npmjs.com/package/@dockndevai/mcp-grafana)
[![CI](https://github.com/dockndevai/mcp-grafana/actions/workflows/ci.yml/badge.svg)](https://github.com/dockndevai/mcp-grafana/actions/workflows/ci.yml)
[![licence](https://img.shields.io/badge/licence-MIT-blue)](LICENSE)

A **safe-by-default** [Model Context Protocol](https://modelcontextprotocol.io) 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](https://dockndevai.github.io/) — 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](docs/demo.gif)

## What it gives an agent

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

| Tool | For | Needs mode |
|---|---|---|
| `get_health` | check the instance is up, version | read-only |
| `search` | find dashboards & folders by name/tag (get UIDs) | read-only |
| `list_dashboards` / `list_folders` | enumerate dashboards / folders | read-only |
| `get_dashboard` | the full dashboard JSON model + meta | read-only |
| `list_datasources` / `get_datasource` | datasources (secrets redacted) | read-only |
| `query_datasource` | run PromQL / LogQL / SQL via the unified query API | read-only |
| `list_alert_rules` | Grafana-managed alert rules | read-only |
| `list_annotations` | events overlaid on graphs | read-only |
| `create_or_update_dashboard` | upsert a dashboard (versioned, reversible) | read-write |
| `create_folder` | create a folder | read-write |
| `create_annotation` | mark a deploy/incident on graphs | read-write |
| `delete_dashboard` / `delete_folder` / `delete_annotation` | delete (irreversible) | admin + `GRAFANA_ALLOW_DELETE` |

## Install

```bash
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

```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](docs/CLIENTS.md) for Claude Code / Cursor / Codex / VS Code / Windsurf snippets, and [.env.example](.env.example) for every supported variable.

## Safe by default

The access model is enforced by [`src/security.ts`](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.](docs/confirm-demo.gif)

See [SECURITY.md](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`](.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

```bash
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

Lo que la gente pregunta sobre mcp-grafana

¿Qué es dockndevai/mcp-grafana?

+

dockndevai/mcp-grafana es mcp servers para el ecosistema de Claude AI. MCP server for Grafana — search & edit dashboards, query datasources (Prometheus/Loki/SQL), inspect alerts, with safe-by-default access modes. Tiene 0 estrellas en GitHub y su última actualización registrada es del 2026-09-12.

¿Cómo se instala mcp-grafana?

+

Puedes instalar mcp-grafana clonando el repositorio (https://github.com/dockndevai/mcp-grafana) o siguiendo las instrucciones del README en GitHub. ClaudeWave también te ofrece bloques de instalación rápida en esta misma página.

¿Es seguro usar dockndevai/mcp-grafana?

+

Nuestro agente de seguridad ha analizado dockndevai/mcp-grafana y le ha asignado un Trust Score de 87/100 (tier: Trusted). Revisa el desglose completo de comprobaciones superadas y flags en esta página.

¿Quién mantiene dockndevai/mcp-grafana?

+

dockndevai/mcp-grafana es mantenido por dockndevai. La última actividad registrada en GitHub es del 2026-09-12, con 0 issues abiertos.

¿Hay alternativas a mcp-grafana?

+

Sí. En ClaudeWave puedes explorar mcp servers similares en /categories/mcp, ordenados por popularidad o actividad reciente.

Despliega mcp-grafana en tu cloud

Lleva este repo a producción en minutos. Cada plataforma genera su propio entorno con variables de entorno editables.

¿Mantienes este repo? Añade un badge a tu README

Pega el badge en tu README de GitHub para mostrar que está auditado por ClaudeWave. Cada badge enlaza de vuelta a esta página y muestra el Trust Score actual.

Featured on ClaudeWave: dockndevai/mcp-grafana
[![Featured on ClaudeWave](https://claudewave.com/api/badge/dockndevai-mcp-grafana)](https://claudewave.com/repo/dockndevai-mcp-grafana)
<a href="https://claudewave.com/repo/dockndevai-mcp-grafana"><img src="https://claudewave.com/api/badge/dockndevai-mcp-grafana" alt="Featured on ClaudeWave: dockndevai/mcp-grafana" width="320" height="64" /></a>

Más MCP Servers

Alternativas a mcp-grafana