mcp-grafana
Read-only by default, this server lets you inspect and query Grafana; higher access modes unlock guarded write and delete operations.
Check Grafana health, version, and database status.
Search and list dashboards and folders, and fetch dashboard JSON or folder details.
List and inspect datasources with secrets redacted.
Run read-only PromQL, LogQL, or SQL queries through Grafana's unified query API.
List Grafana-managed alert rules and annotations.
In read-write/admin modes, create or update dashboards, create folders and annotations, and perform gated deletes with allowlists, protected folders, audit logging, dry-run, and optional human approval.
Provides tools for interacting with Grafana instances, enabling agents to search dashboards and folders, read dashboard JSON models, list datasources, query datasources, inspect alert rules and annotations, and (with elevated modes) create/update dashboards and folders, write annotations, and delete with safeguards.
Enables querying Prometheus datasources through Grafana's unified query API using PromQL.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-grafana search dashboards for 'checkout' and query prometheus for error rates"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-grafana
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.

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.
Tool | For | Needs mode |
| check the instance is up, version | read-only |
| find dashboards & folders by name/tag (get UIDs) | read-only |
| enumerate dashboards / folders | read-only |
| the full dashboard JSON model + meta | read-only |
| datasources (secrets redacted) | read-only |
| run PromQL / LogQL / SQL via the unified query API | read-only |
| Grafana-managed alert rules | read-only |
| events overlaid on graphs | read-only |
| upsert a dashboard (versioned, reversible) | read-write |
| create a folder | read-write |
| mark a deploy/incident on graphs | read-write |
| delete (irreversible) | admin + |
Related MCP server: Grafana FastMCP Server
Install
npx -y @dockndevai/mcp-grafanaYou 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
{
"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 needread-write; deletes needadmin.GRAFANA_ALLOW_DELETE— deletes are irreversible, so on top ofadminmode 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. Matched by folder UID or title. Writes check the target folder and, when overwriting, the folder the dashboard currently sits in;create_annotationchecks the folder of the dashboard it attaches to; deletes resolve the target's folder first. The General (root) folder is scoped like any other (name itGeneralin the allowlist or protected list). A protected folder also protects its sub-folders, anddelete_folderrefuses if a protected folder is nested inside. Anything that cannot be resolved is refused.GRAFANA_DATASOURCE_ALLOWLIST— restrict which datasourcesquery_datasourcemay 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. The prompt shows the tool, the exact arguments and a fingerprint; the target's version is pinned across the prompt and the action is refused if it changed; a prompt nobody answers is a refusal. Clients that can't elicit fall back to the
GRAFANA_ALLOW_DELETEgate.GRAFANA_REQUIRE_HUMAN_APPROVAL— defaultfalse. Whentrue, deletes are refused if the client cannot elicit (instead of falling back to theGRAFANA_ALLOW_DELETEgate alone).Secrets are never returned — datasource
secureJsonData, passwords and tokens are stripped from every response.

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
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.jsLicence
MIT
Available Tools
11 toolsget_dashboardGet dashboardARead-onlyIdempotent
Return the full dashboard JSON model (panels, targets, templating, time) plus meta (folder, version, url) for a dashboard UID. This is the model you edit and pass back to create_or_update_dashboard.
Inputs: uid (required).
get_datasourceGet datasourceARead-onlyIdempotent
Return a single datasource by UID (secrets redacted).
Inputs: uid (required).
get_folderGet folderCRead-onlyIdempotent
Return a folder's details by UID.
Inputs: uid (required).
get_healthGrafana healthARead-onlyIdempotent
Check the Grafana instance is reachable and return its version and database status.
Inputs: no named parameters.
list_alert_rulesList alert rulesARead-onlyIdempotent
List Grafana-managed alert rules (via the provisioning API): title, condition, folder, state.
Inputs: no named parameters.
list_annotationsList annotationsBRead-onlyIdempotent
List annotations (events overlaid on graphs), optionally within a time range or by tag.
Inputs: to, from, tags, limit.
list_dashboardsList dashboardsBRead-onlyIdempotent
List dashboards (optionally filtered by tag). Shorthand for search with type=dash-db.
Inputs: tag, limit.
list_datasourcesList datasourcesARead-onlyIdempotent
List configured datasources (uid, name, type, url). Secrets (secureJsonData, passwords, tokens) are never returned. Use the uid with query_datasource.
Inputs: no named parameters.
list_foldersList foldersARead-onlyIdempotent
List dashboard folders with their UIDs and titles.
Inputs: no named parameters.
query_datasourceQuery a datasourceARead-onlyIdempotent
Run a query against a datasource through Grafana's unified query API and return the result frames. For Prometheus/Loki set expr (PromQL / LogQL); for SQL datasources set rawSql. Reading data only — this never mutates anything. Use a bounded time range and a small maxDataPoints to keep results manageable.
Inputs: datasourceUid (required), to, expr, from, +2 more.
searchSearch dashboards & foldersARead-onlyIdempotent
Search dashboards and folders by name/tag. Use this first to find a dashboard's UID before get_dashboard. Returns title, uid, type (dash-db | dash-folder), folder and tags.
Inputs: tag, type, limit, query.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 11 tools
Most tools have distinct resource+action purposes (get_health, get_dashboard, get_folder, get_datasource, query_datasource, list_alert_rules, list_annotations). The only real overlap is list_dashboards vs search, but the description explicitly frames list_dashboards as shorthand for search with type=dash-db, which mitigates the ambiguity.
Names follow a clear verb_noun convention (list_*, get_*, query_*), making the pattern predictable. 'search' is the lone deviation without an explicit noun, and 'get_health' is slightly idiosyncratic, but overall consistency is strong.
11 tools is well within the ideal 3-15 range for a Grafana integration. Each tool maps to a concrete resource or operation, and none feel redundant or filler.
Read coverage is broad (dashboards, folders, datasources, alert rules, annotations, health), but the surface is almost entirely read-only. Notably, get_dashboard references passing the model back to 'create_or_update_dashboard,' a tool that does not exist, and there is no create/update/delete for dashboards, folders, annotations, or alert rules — a meaningful lifecycle gap.
Maintenance
Related MCP Connectors
Provide real-time data querying and visualization by integrating Tako with your agents. Generate o…
Governed access to sensitive data, secrets and APIs for AI agents. A signed proof for each decision.
1Context and control for any AI. Agent identity, scoped access, and proof across tools.
Amazon Ads, Seller Central, Vendor Central and AMC data for AI agents. Read-only by default.
Related MCP Servers
- AlicenseBqualityCmaintenanceEnables AI assistants to interact with Grafana dashboards, datasources, alerts, incidents, and monitoring data through 43 comprehensive tools. Supports querying Prometheus metrics, Loki logs, managing incidents, and dashboard operations with full authentication support.43694 npm3MIT
- AlicenseNot gradedqualityDmaintenanceEnables MCP-compatible agents to interact with Grafana instances for searching, creating, and updating dashboards, exploring logs via Loki, querying datasources, managing alerts, incidents, and on-call shifts, and accessing observability data.8Apache 2.0
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to query Grafana dashboards, alerts, and datasources for observability insights and incident investigation.MIT
- AlicenseAqualityCmaintenanceEnables AI assistants to query Grafana datasources (Prometheus/Loki metrics and SQL databases like ClickHouse/Postgres/MySQL) and search or inspect dashboards through natural language, using read-only access to Grafana's API.6MIT