Home / MCP / Grafana MCP Server
Provides an MCP server to access Grafana data sources, dashboards, incidents, alerting, and more via a programmable API.
Configuration
View docs{
"mcpServers": {
"grafana": {
"command": "mcp-grafana",
"args": [],
"env": {
"GRAFANA_URL": "<your Grafana URL>",
"GRAFANA_SERVICE_ACCOUNT_TOKEN": "<your service account token>",
"GRAFANA_USERNAME": "<your username>",
"GRAFANA_PASSWORD": "<your password>",
"GRAFANA_ORG_ID": "1"
}
}
}
}You run an MCP server that acts as a bridge between Grafana and clients or AI assistants. It exposes Grafana data, dashboards, incidents, alerts, and related resources through a programmable API, letting you search, query, and manage Grafana data from tools and automation.
Connect your MCP client to Grafana through the two documented ways: a local stdio server you run on your machine, or a Docker-based approach that spawns a container to provide the MCP interface. The server handles data access, querying, and management operations across dashboards, datasources, incidents, alerting, and more.
Prerequisites: you need Go installed for building from source, or you can use the prebuilt binaries or Docker images. If you plan to run locally in STDIO mode, you will use a binary named mcp-grafana or run it via Docker with an explicit stdio transport.
Install and run using the documented STDIO approach with a locally installed binary or via Docker. Below are concrete steps that mirror the supported options.
{
"mcpServers": {
"grafana": {
"command": "mcp-grafana",
"args": [],
"env": {
"GRAFANA_URL": "http://localhost:3000",
"GRAFANA_SERVICE_ACCOUNT_TOKEN": "<your service account token>",
// Optional: specify organization ID if needed
"GRAFANA_ORG_ID": "1"
}
}
}
}If you prefer running the MCP server via Docker in STDIO mode, use the following configuration as a guide. It keeps stdin open and passes through the necessary Grafana connection details.
{
"mcpServers": {
"grafana": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"-e",
"GRAFANA_URL",
"-e",
"GRAFANA_SERVICE_ACCOUNT_TOKEN",
"mcp/grafana",
"-t",
"stdio"
],
"env": {
"GRAFANA_URL": "http://localhost:3000",
"GRAFANA_SERVICE_ACCOUNT_TOKEN": "<your service account token>",
"GRAFANA_USERNAME": "<your username>",
"GRAFANA_PASSWORD": "<your password>",
"GRAFANA_ORG_ID": "1"
}
}
}
}Configuration notes show how to enable or disable tool categories, how to manage RBAC permissions, and how to run in various transports. The server supports several transports, including stdio, SSE, and streamable HTTP, and you can disable entire categories of tools to reduce the context window you send to the client.
Security and TLS are configurable. Client TLS settings control how the MCP server authenticates to Grafana, while server TLS settings apply when using the streamable HTTP transport.
Debug mode can be enabled to get detailed HTTP request/response logs between the MCP server and Grafana, which helps with troubleshooting.
Health checks are available when using SSE or streamable HTTP transports. The endpoint reports readiness for integration with load balancers and monitoring systems.
If you see a spawn error like Error: spawn mcp-grafana ENOENT in client apps, provide the full path to the mcp-grafana binary to ensure the client can locate the executable.
Use the provided tooling configuration to tailor which capabilities you expose. You can disable categories such as OnCall, navigation, or Sift tools if you do not need them.
List all teams in Grafana
List all users in an organization
Search for dashboards by title or metadata
Get a dashboard by its UID
Update or create a dashboard
Get panel titles, queries, datasource UIDs and types
Extract specific parts of a dashboard using JSONPath
Get a compact dashboard overview
List datasources
Get a datasource by UID
Get a datasource by name
Execute a Prometheus query
List metric metadata
List metric names
List label names
List label values for a label
List incidents in Grafana Incident
Create an incident in Grafana Incident
Add activity to an incident
Get a single incident by ID
Query Loki logs using LogQL
List Loki label names
List Loki label values
Get statistics about log streams
List alert rules
Get an alert rule by UID
List notification contact points
List OnCall schedules
Get details for a specific OnCall shift
Get current on-call users for a schedule
List OnCall teams
List OnCall users
List alert groups for OnCall
Get alert group details
Retrieve a Sift investigation by UUID
Retrieve a Sift analysis
List Sift investigations with optional limit
Find elevated error patterns in Loki logs
Find slow requests from Tempo-related sources
List Pyroscope label names
List Pyroscope label values
List available Pyroscope profile types
Fetch a Pyroscope profile in DOT format
Get assertion summary for an entity
Generate direct deeplink URLs for Grafana resources
Fetch annotations with filters
Create a new annotation on a dashboard or panel
Create a Graphite-formatted annotation
Replace all fields of an annotation
Update specific fields of an annotation
List annotation tags