Grafana MCP server
Grafana Labs' official MCP server: query dashboards, Prometheus, Loki, incidents, alerts, and OnCall from your agent.
The Grafana MCP server (mcp-grafana) is Grafana Labs' official integration that connects a coding or operations agent to a Grafana instance and the observability stack behind it. It can search and read dashboards, list and inspect datasources, run PromQL queries against Prometheus and LogQL queries against Loki, pull Pyroscope profiles, and render panels as PNG images. On the incident-response side it manages Grafana Incident, Grafana OnCall schedules and shifts, alert rules and routing, Sift investigations for automated root-cause analysis, Asserts assertions, and annotations.
The canonical install is the official Docker image grafana/mcp-grafana run with the -t stdio flag (the image defaults to SSE, so the flag is required for stdio clients). It authenticates with a Grafana service account token passed via GRAFANA_SERVICE_ACCOUNT_TOKEN, alongside GRAFANA_URL pointing at your instance, and works with both self-managed Grafana 9.0+ and Grafana Cloud. The server has a large tool surface organized into categories, with several advanced or write-capable toolsets (admin, query execution, ClickHouse, CloudWatch, and others) disabled by default so you opt in only to what an agent needs.
Quick install
Copy-paste configs are provided for all 8 supported clients. Pick your client below.
Add to ~/.claude.json
{
"mcpServers": {
"grafana": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"-e",
"GRAFANA_URL",
"-e",
"GRAFANA_SERVICE_ACCOUNT_TOKEN",
"grafana/mcp-grafana",
"-t",
"stdio"
],
"env": {
"GRAFANA_URL": "<GRAFANA_URL>",
"GRAFANA_SERVICE_ACCOUNT_TOKEN": "<GRAFANA_SERVICE_ACCOUNT_TOKEN>"
}
}
}
}claude mcp add grafana -- docker run --rm -i -e GRAFANA_URL -e GRAFANA_SERVICE_ACCOUNT_TOKEN grafana/mcp-grafana -t stdioAvailable tools
| Tool | Description |
|---|---|
| search_dashboards | Finds dashboards by title or metadata. |
| get_dashboard_by_uid | Retrieves the full details of a dashboard by UID. |
| get_dashboard_summary | Gets a compact overview of a dashboard. |
| get_dashboard_property | Extracts parts of a dashboard via a JSONPath expression. |
| get_dashboard_panel_queries | Gets the queries and datasource info for a dashboard's panels. |
| update_dashboard | Modifies or creates a dashboard. |
| patch_dashboard | Applies targeted changes to a dashboard without sending full JSON. |
| run_panel_query | Executes a dashboard panel's query over a custom time range (disabled by default). |
| list_datasources | Lists all configured datasources. |
| get_datasource | Gets a datasource by UID or name. |
| get_query_examples | Retrieves example queries for a datasource type (disabled by default). |
| query_prometheus | Executes a PromQL query against a Prometheus datasource. |
| query_prometheus_histogram | Calculates histogram percentile values from Prometheus data. |
| list_prometheus_metric_metadata | Retrieves metadata for Prometheus metrics. |
| list_prometheus_metric_names | Lists available Prometheus metric names. |
| list_prometheus_label_names | Lists Prometheus label names matching a selector. |
| list_prometheus_label_values | Lists the values for a specific Prometheus label. |
| query_loki_logs | Runs a log or metric query using LogQL. |
| query_loki_stats | Gets statistics about Loki log streams. |
| query_loki_patterns | Queries detected log patterns in Loki. |
| list_loki_label_names | Lists available Loki label names. |
| list_loki_label_values | Lists the values for a Loki log label. |
| analyze_loki_labels | Audits Loki label strategy and query performance. |
| suggest_loki_alloy_label_config | Generates an Alloy config snippet for Loki labels. |
| query_influxdb | Queries InfluxDB using InfluxQL or Flux (disabled by default). |
| list_clickhouse_tables | Lists tables in a ClickHouse database (disabled by default). |
| describe_clickhouse_table | Gets a ClickHouse table schema with column types (disabled by default). |
| query_clickhouse | Executes a ClickHouse SQL query with macro substitution (disabled by default). |
| list_cloudwatch_namespaces | Discovers available AWS CloudWatch namespaces (disabled by default). |
| list_cloudwatch_metrics | Lists CloudWatch metrics in a namespace (disabled by default). |
| list_cloudwatch_dimensions | Gets dimensions for CloudWatch metric queries (disabled by default). |
| query_cloudwatch | Executes a CloudWatch metric query (disabled by default). |
| query_graphite | Executes a Graphite render API query (disabled by default). |
| list_graphite_metrics | Browses and discovers Graphite metric paths (disabled by default). |
| list_graphite_tags | Lists Graphite tags and tag values (disabled by default). |
| query_graphite_density | Queries Graphite metric density for a pattern (disabled by default). |
| list_athena_catalogs | Discovers Amazon Athena data catalogs (disabled by default). |
| list_athena_databases | Lists databases in an Athena catalog (disabled by default). |
| list_athena_tables | Lists tables in an Athena database (disabled by default). |
| describe_athena_table | Gets the column names for an Athena table (disabled by default). |
| query_athena | Executes an Athena SQL query with macro substitution (disabled by default). |
| list_snowflake_tables | Discovers Snowflake tables with metadata (disabled by default). |
| describe_snowflake_table | Gets a Snowflake table schema with column details (disabled by default). |
| query_snowflake | Executes a Snowflake SQL query with macro/variable substitution (disabled by default). |
| query_elasticsearch | Executes an Elasticsearch/OpenSearch query using Lucene or Query DSL (disabled by default). |
| list_incidents | Lists incidents in Grafana Incident. |
| get_incident | Gets a single incident by ID. |
| create_incident | Creates an incident in Grafana Incident. |
| add_activity_to_incident | Adds an activity entry to an incident. |
| list_sift_investigations | Retrieves the list of Sift investigations. |
| get_sift_investigation | Retrieves details of a specific Sift investigation. |
| get_sift_analysis | Retrieves a specific analysis from a Sift investigation. |
| find_error_pattern_logs | Detects elevated error patterns in Loki via Sift. |
| find_slow_requests | Detects slow requests via Tempo using Sift. |
| list_pyroscope_profile_types | Lists the available Pyroscope profile types. |
| list_pyroscope_label_names | Lists Pyroscope label names matching a selector. |
| list_pyroscope_label_values | Lists Pyroscope label values for a label name. |
| fetch_pyroscope_profile | Fetches a Pyroscope profile in DOT format. |
| alerting_manage_rules | Lists, creates, updates, and deletes alert rules. |
| alerting_manage_routing | Manages notification policies, contact points, and mute timings. |
| list_oncall_schedules | Lists Grafana OnCall schedules. |
| get_oncall_shift | Gets details for a specific OnCall shift. |
| get_current_oncall_users | Gets the users currently on call. |
| list_oncall_teams | Lists Grafana OnCall teams. |
| list_oncall_users | Lists Grafana OnCall users. |
| list_alert_groups | Lists OnCall alert groups with filtering. |
| get_alert_group | Gets a specific OnCall alert group by ID. |
| get_assertions | Gets the assertion summary for an entity via Grafana Asserts. |
| get_annotations | Queries annotations with filters. |
| create_annotation | Creates a standard or Graphite annotation. |
| update_annotation | Replaces all fields of an annotation. |
| patch_annotation | Updates specific fields of an annotation. |
| get_annotation_tags | Lists annotation tags. |
| generate_deeplink | Creates a deeplink URL for a Grafana dashboard, panel, or Explore query. |
| get_panel_image | Renders a dashboard panel or full dashboard as a PNG image. |
| list_teams | Lists all configured teams (admin; disabled by default). |
| list_users_by_org | Lists all users in an organization (admin; disabled by default). |
| list_all_roles | Lists all Grafana roles (admin; disabled by default). |
| get_role_details | Gets details for a specific role (admin; disabled by default). |
| get_role_assignments | Lists assignments for a role (admin; disabled by default). |
| list_user_roles | Lists roles assigned to a user (admin; disabled by default). |
| list_team_roles | Lists roles assigned to a team (admin; disabled by default). |
| get_resource_permissions | Lists permissions for a resource (admin; disabled by default). |
| get_resource_description | Describes a Grafana resource type (admin; disabled by default). |
Required configuration
- GRAFANA_URLRequired
URL of your Grafana instance, e.g. https://myinstance.grafana.net or http://localhost:3000.
- GRAFANA_SERVICE_ACCOUNT_TOKENRequired
Grafana service account token used to authenticate (Grafana 9.0+).
- GRAFANA_API_KEYOptional
Legacy API key auth. Deprecated and slated for removal; prefer a service account token.
What you can do with it
Investigate an alert from chat
The agent reads the firing alert, runs PromQL and LogQL queries against the relevant datasources, fetches a Pyroscope profile, and renders the dashboard panel as an image to confirm the regression.
Drive incident response
Create or update a Grafana Incident, check who is currently on call, kick off a Sift investigation to surface error patterns and slow requests, and annotate the timeline as the team works the issue.
FAQ
- Is it free?
- Yes. mcp-grafana is free and open source under the Apache 2.0 license. You provide your own Grafana instance (self-managed or Grafana Cloud), and usage is governed by your Grafana plan.
- Does it support remote/OAuth?
- The canonical install is a local Docker stdio server authenticated with a Grafana service account token rather than OAuth; the image can also run in SSE/HTTP mode. It is not distributed as a hosted OAuth endpoint.