Skip to main content
MCP server CX Codex

mcp-grafana — Claude Code MCP server: dashboards and metrics

Gives your agent access to Grafana: search dashboards, read panels, run PromQL and LogQL. Useful when you are chasing an incident or editing a graph from the chat.

Install into Claude Code · Platform CLI: remote server All methods and platforms ↓
claude mcp add --transport http mcp-grafana https://mcp.grafana.com/mcp
Open on GitHub

What mcp-grafana does

The server connects to your Grafana instance and hands the agent tools for dashboards: search by title, folder, tag or starred status, fetch panels and their queries, list saved versions. get_dashboard_summary and get_dashboard_property with JSONPath pull only the piece you need, because the full JSON of a large dashboard eats context. Edits work too: update, create, and a targeted patch that skips loading the whole file.

Then come the data queries. Prometheus answers PromQL, instant and range, plus metric metadata and histogram percentiles via histogram_quantile. Loki takes LogQL, along with metadata and detected log patterns. Datasource listing covers Prometheus, Loki, ClickHouse, CloudWatch, Elasticsearch, OpenSearch, Snowflake and Athena. Some tools ship disabled: runpanelquery, examples, influxdb and sql need the --enabled-tools flag. SQL tools go through Grafana's datasource plugins, so the MCP server never sees your database credentials.

Grafana 9.0 or later is required — on older versions datasource operations break because the API endpoints are missing. The uvx route needs uv installed; the Docker route needs Docker. Config takes GRAFANA_URL and GRAFANA_SERVICE_ACCOUNT_TOKEN; on Grafana Cloud you point GRAFANA_URL at your instance address.

What it helps with

  • find a dashboard by tag or folder without opening a browser
  • pull every panel and its query out of a dashboard
  • run a PromQL query and read the metric values
  • inspect Loki log patterns over a time range
  • patch one dashboard setting without loading the full JSON

Example prompts for the agent

  • Find dashboards tagged payments and show a summary of each
  • Run a PromQL range query for http_requests_total over the last hour
  • Show Loki log patterns for the checkout service

How to install mcp-grafana

1Platform CLI: remote server

claude mcp add --transport http mcp-grafana https://mcp.grafana.com/mcp

2Platform CLI

claude mcp add --env GRAFANA_URL=<GRAFANA_URL> --env GRAFANA_SERVICE_ACCOUNT_TOKEN=<GRAFANA_SERVICE_ACCOUNT_TOKEN> --env GRAFANA_USERNAME=<GRAFANA_USERNAME> --env GRAFANA_PASSWORD=<GRAFANA_PASSWORD> --env GRAFANA_ORG_ID=<GRAFANA_ORG_ID> --transport stdio mcp-grafana -- docker run -i --rm -e GRAFANA_URL -e GRAFANA_SERVICE_ACCOUNT_TOKEN -e GRAFANA_USERNAME -e GRAFANA_PASSWORD -e GRAFANA_ORG_ID docker.io/grafana/mcp-grafana:2.1.1

Replace <…> with your own values. 2 more environment variables are in the server README

Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more

Questions about mcp-grafana

How do I install mcp-grafana in Claude Code?

Remote, one command: claude mcp add --transport http mcp-grafana https://mcp.grafana.com/mcp. Or locally via Docker: `claude mcp add --env GRAFANA_URL=<GRAFANA_URL> --env GRAFANA_SERVICE_ACCOUNT_TOKEN=<GRAFANA_SERVICE_ACCOUNT_TOKEN> --env GRAFANA_USERNAME=<GRAFANA_USERNAME> --env GRAFANA_PASSWORD=<GRAFANA_PASSWORD> --env GRAFANA_ORG_ID=<GRAFANA_ORG_ID> --transport stdio mcp-grafana -- docker run -i --rm -e GRAFANA_URL -e GRAFANA_SERVICE_ACCOUNT_TOKEN -e GRAFANA_USERNAME -e GRAFANA_PASSWORD -e GRAFANA_ORG_ID docker.io/grafana/mcp-grafana:2.1.1`.

What does mcp-grafana do?

It gives the agent access to your Grafana instance: searching and reading dashboards, querying Prometheus and Loki, working with datasources and SQL sources. Some tools are enabled separately with the --enabled-tools flag.

Which Grafana version is required?

Grafana 9.0 or later. On older versions datasource operations may fail because the API endpoints are missing.

Similar MCP servers

All MCP servers for DevOps and infrastructure →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor