Grafana MCP Server
Connect AI agents to Grafana dashboards, metrics, logs, and alerts over MCP.
Updated
What is Grafana MCP?
The Grafana MCP server is a Model Context Protocol server that gives AI assistants and agents access to your Grafana observability data — dashboards, metrics, logs, traces, alerts, and incidents.
There are two flavors. Grafana ships an open-source server (grafana/mcp-grafana, Apache-2.0) that you run yourself and point at any Grafana instance using a service account token. Grafana Cloud also offers a fully hosted remote server at https://mcp.grafana.com/mcp (Streamable HTTP transport), which uses an OAuth 2.1 authorization flow so you don't manage tokens by hand — you authorize through a browser consent page on first connection.
Both expose the same broad tool surface: searching and managing dashboards and folders, listing datasources, running PromQL and Loki queries, exploring traces and profiles, managing alert rules and notification policies, and working with Grafana Incident, Sift, and OnCall. The hosted server optionally takes an X-Grafana-URL header pointing at your Grafana Cloud instance.
Tools the Grafana MCP server exposes
| Tool | What it does |
|---|---|
| search_dashboards | Find dashboards by title or query across your Grafana instance. |
| get_dashboard_summary | Retrieve a dashboard's panels, queries, and structure. |
| update_dashboard | Create or update a dashboard, including patching individual panels. |
| list_datasources | List configured datasources (Prometheus, Loki, ClickHouse, CloudWatch, and more). |
| query_prometheus | Run PromQL range or instant queries and fetch metric metadata. |
| query_loki_logs | Query Loki logs and metrics, explore labels, and inspect patterns. |
| list_alert_rules | List and inspect Grafana alert rules and their state. |
| list_contact_points | View alerting notification policies and contact points. |
| create_incident | Create and manage incidents via Grafana Incident. |
| generate_deeplink | Generate deeplinks to dashboards, panels, and Explore views. |
Connect the Grafana MCP server
Claude Code (hosted Grafana Cloud MCP)
- 1
Add the remote server
Run: claude mcp add --transport http grafana https://mcp.grafana.com/mcp
- 2
Authorize via OAuth
On first use, Claude Code opens a browser consent page; sign in to Grafana Cloud and approve access. Tokens are handled by the OAuth 2.1 flow.
- 3
Point at your instance (optional)
If needed, set the X-Grafana-URL header to your Grafana Cloud instance URL so queries target the right stack.
- 4
Verify
Run /mcp in Claude Code and confirm the grafana server is connected, then ask it to search your dashboards.
Cursor (hosted Grafana Cloud MCP)
- 1
Open MCP settings
In Cursor, go to Settings - MCP and add a new server.
- 2
Configure the remote endpoint
Add a server entry with URL https://mcp.grafana.com/mcp using the Streamable HTTP transport, optionally with an X-Grafana-URL header for your Grafana Cloud instance.
- 3
Complete OAuth
Save the config; Cursor triggers the OAuth 2.1 browser flow. Approve access to your Grafana Cloud data.
- 4
Use it
Confirm the server shows as connected, then ask Cursor to query metrics or pull a dashboard.
Sample use cases
Security & permissions
The hosted Grafana Cloud server at mcp.grafana.com uses an OAuth 2.1 authorization flow with dynamic client registration — you authorize through a browser consent page and Grafana issues scoped, revocable access rather than a long-lived static token. Access is governed by your Grafana Cloud role and the Assistant Cloud MCP permission, so the agent inherits the data and actions your authorized identity is allowed to see (dashboards, metrics, logs, alerts, incidents).
The self-hosted open-source server authenticates with a Grafana service account token (GRAFANA_SERVICE_ACCOUNT_TOKEN); scope it to the minimum RBAC permissions the agent needs, and note that administrative tools (team/user/role management) are disabled by default. In all cases, grant the narrowest access required and treat the connection as having read/write reach into your observability data.
Using Grafana MCP with Gamut
In Gamut, you connect Grafana once and then let an agent use it as a tool inside event- or schedule-triggered workflows — Gamut manages the underlying MCP connection and OAuth authorization. For example, a scheduled agent can query Prometheus and Loki each morning to summarize error rates and latency, post a digest to chat, and link back to the relevant dashboards via deeplinks; or an incident-triggered agent can pull recent alert rules and dashboard context to enrich a ticket. The agent only performs the Grafana actions its authorized scope permits.
Frequently asked questions
Can the Grafana MCP agent modify dashboards or is it read-only?
It supports both. The update_dashboard tool can create new dashboards and patch existing panels. search_dashboards, get_dashboard_summary, and query tools are read-only. You control write access through Grafana's own API key permissions.
Which data sources does the Grafana MCP server support?
The server can query any datasource configured in your Grafana instance. It has dedicated tools for Prometheus (PromQL) and Loki (LogQL), plus list_datasources to discover all connected sources including ClickHouse, CloudWatch, and others.
Does querying through the MCP server affect Grafana performance?
MCP queries hit the same Grafana HTTP API that the UI uses. A heavy PromQL range query will consume the same Prometheus resources regardless of whether it comes from the UI or the MCP server. Use appropriate step intervals and time ranges.