Grafana MCP Server
Official Grafana MCP server exposing 40+ tools across dashboards, Prometheus, Loki, alerting, incidents, OnCall, Sift, and 16 categories.
mcp-grafana is the official Model Context Protocol server from Grafana Labs that exposes a Grafana instance (self-hosted or Grafana Cloud) to MCP-compatible clients like Claude Desktop, Cursor, and VS Code Copilot. It gives AI assistants programmatic access to query metrics and logs, search and manage dashboards, manage alert rules, work with Incident and Sift, and generate deeplinks back into the Grafana UI.
The server ships 40+ tools organized into roughly 16 categories: Dashboards, Datasources, Prometheus, Loki, Alerting, Incidents, OnCall, Sift, Navigation, Annotations, Rendering, Admin/RBAC, plus disabled-by-default integrations for InfluxDB, ClickHouse, CloudWatch, Elasticsearch, Snowflake, Athena, and Graphite. It supports stdio, SSE, and streamable-http transports, runs via uvx, Docker, a Go binary, or a Helm chart, and authenticates with a Grafana service account token.
Because it is maintained by Grafana Labs directly, it tracks the Grafana HTTP API closely, supports both Grafana OSS (9.0+) and Grafana Cloud with the same configuration, and includes operational niceties like --disable-write for read-only mode, OTLP tracing, Prometheus metrics, and granular per-category tool toggles.
Tools
| Tool | Description |
|---|---|
search_dashboards |
Search dashboards by query string |
get_dashboard_by_uid |
Fetch the full dashboard JSON for a given UID |
get_dashboard_summary |
Get a concise summary of a dashboard |
get_dashboard_property |
Retrieve a specific property/path from a dashboard |
update_dashboard |
Create or update a dashboard |
get_dashboard_panel_queries |
List the queries used in a panel |
run_panel_query |
Execute a saved panel query (disabled by default) |
list_datasources |
List all configured datasources |
get_datasource |
Get details for a datasource by uid or name |
query_prometheus |
Run a PromQL query (instant or range) |
list_prometheus_metric_metadata |
List Prometheus metric metadata |
list_prometheus_metric_names |
List Prometheus metric names |
list_prometheus_label_names |
List Prometheus label names |
list_prometheus_label_values |
List values for a Prometheus label |
query_prometheus_histogram |
Query Prometheus histogram percentiles |
query_loki_logs |
Run a LogQL query for log lines |
list_loki_label_names |
List Loki label names |
list_loki_label_values |
List values for a Loki label |
query_loki_stats |
Get stream/byte stats for a LogQL selector |
query_loki_patterns |
Extract log patterns from a LogQL query |
alerting_manage_rules |
List, create, update alert rules |
alerting_manage_routing |
Manage notification policies and contact points |
list_incidents |
List Grafana Incidents |
create_incident |
Create a new incident |
get_incident |
Fetch incident details |
add_activity_to_incident |
Append an activity/note to an incident |
list_oncall_schedules |
List OnCall schedules |
get_oncall_shift |
Get details for an OnCall shift |
get_current_oncall_users |
Get users currently on call |
list_oncall_teams |
List OnCall teams |
list_oncall_users |
List OnCall users |
list_alert_groups |
List OnCall alert groups |
get_alert_group |
Get an OnCall alert group |
get_sift_investigation |
Get a Sift investigation |
list_sift_investigations |
List Sift investigations |
get_sift_analysis |
Fetch a Sift analysis result |
find_error_pattern_logs |
Run Sift error pattern analysis on logs |
find_slow_requests |
Run Sift slow request analysis on traces |
list_teams |
List Grafana teams |
list_users_by_org |
List users in the organization |
list_all_roles |
List RBAC roles |
get_role_details |
Get details for an RBAC role |
get_role_assignments |
Get assignments for a role |
list_user_roles |
List roles assigned to a user |
list_team_roles |
List roles assigned to a team |
get_resource_permissions |
Get permissions on a resource |
generate_deeplink |
Generate a Grafana URL for a dashboard, panel, or explore view |
get_annotations |
Fetch annotations |
create_annotation |
Create a new annotation |
update_annotation |
Update an annotation |
get_annotation_tags |
List annotation tags |
get_panel_image |
Render a panel as a PNG image |
Prerequisites
- Grafana 9.0+ (self-hosted or Grafana Cloud)
- A Grafana service account token with appropriate RBAC permissions. The built-in Editor role works for most read/write operations.
- One of:
uvx, Docker, the Go binary, or the Helm chart.
Install
The recommended path is uvx:
uvx mcp-grafana
Or pull the Docker image:
docker run --rm -i \
-e GRAFANA_URL=http://localhost:3000 \
-e GRAFANA_SERVICE_ACCOUNT_TOKEN=<token> \
grafana/mcp-grafana -t stdio
Claude Desktop / Cursor config
Using uvx:
{
"mcpServers": {
"grafana": {
"command": "uvx",
"args": ["mcp-grafana"],
"env": {
"GRAFANA_URL": "http://localhost:3000",
"GRAFANA_SERVICE_ACCOUNT_TOKEN": "<token>"
}
}
}
}
Using Docker:
{
"mcpServers": {
"grafana": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"-e", "GRAFANA_URL",
"-e", "GRAFANA_SERVICE_ACCOUNT_TOKEN",
"grafana/mcp-grafana", "-t", "stdio"
],
"env": {
"GRAFANA_URL": "http://localhost:3000",
"GRAFANA_SERVICE_ACCOUNT_TOKEN": "<token>"
}
}
}
}
Environment variables
GRAFANA_URL: Grafana instance URL (e.g.http://localhost:3000orhttps://myinstance.grafana.net)GRAFANA_SERVICE_ACCOUNT_TOKEN: Service account token (recommended)GRAFANA_USERNAME/GRAFANA_PASSWORD: Basic auth alternativeGRAFANA_ORG_ID: Optional org id for multi-org setupsGRAFANA_EXTRA_HEADERS: Additional headers as JSON
Useful flags
-t stdio|sse|streamable-http: Transport mode (defaultstdio)--enabled-tools datasource,prometheus,loki,...: Enable extra categories likeinfluxdb,clickhouse,cloudwatch,elasticsearch,snowflake,athena,graphite,admin,runpanelquery--disable-write: Run in read-only mode (disablesupdate_dashboard,create_incident,create_annotation, alert rule mutations, Sift investigations)--metricsand--metrics-address :9090: Expose Prometheus metrics--debug/--log-level debug: Verbose logging
- Ask an agent to query PromQL or LogQL and summarize anomalies during an incident, then create a Grafana Incident with an activity log of what it found.
- Triage on-call alerts by listing current OnCall users, fetching the active alert group, and running Sift
find_error_pattern_logsagainst the relevant Loki datasource. - Have an LLM search dashboards, fetch panel queries, and propose an updated dashboard JSON, then apply it via
update_dashboard. - Generate deeplinks to specific dashboards or Explore views and drop them into Slack or a postmortem doc with the right time range pre-filled.
- Annotate dashboards programmatically from a deploy pipeline or chat workflow using
create_annotation.
- "Query Prometheus for the p99 latency of the checkout service over the last 1h and chart the top 5 routes."
- "Search Loki for error patterns in the
paymentsnamespace in the last 30 minutes and summarize the top three." - "Who is currently on call for the SRE team, and is there an open alert group right now?"
- "Find the
Production Overviewdashboard, list its panel queries, and generate a deeplink scoped to the last 6 hours." - "Create a Grafana Incident titled 'Elevated 5xx on api-gateway' with a summary of the recent Sift analysis."
- Maintained by Grafana Labs as the official MCP server, with regular releases and tight coverage of the Grafana HTTP API.
- Broad surface area: 40+ tools across dashboards, Prometheus, Loki, alerting, incidents, OnCall, Sift, annotations, RBAC, and rendering.
- Flexible deployment: uvx, Docker, Go binary, or Helm chart, with stdio, SSE, and streamable-http transports.
- Operational controls like
--disable-write, per-category tool toggles, OTLP tracing, and a Prometheus/metricsendpoint.
- Several integrations (InfluxDB, ClickHouse, CloudWatch, Elasticsearch, Snowflake, Athena, Graphite, admin,
run_panel_query) are disabled by default and must be enabled with--enabled-tools. - Requires a Grafana service account token with carefully scoped RBAC; misconfigured permissions silently break tools.
- Some advanced features (Incidents, OnCall, Sift) depend on Grafana Cloud or specific plugins and will not work on a bare OSS Grafana install.
- grafana/loki-mcp: Focused MCP server for Grafana Loki only.
- grafana/tempo-mcp-server: MCP server for Grafana Tempo traces.
- prometheus-community Prometheus MCP servers: Community MCP servers that talk directly to Prometheus without going through Grafana.