From grafana-mcp
Guides setup, configuration, and usage of Grafana MCP server exposing 50+ API tools for Grafana 9.0+. Covers Docker/binary installs, env vars, CLI flags, RBAC, tool categories like dashboards.
npx claudepluginhub grafana/ai-marketplace --plugin grafana-mcpThis skill uses the workspace's default tool permissions.
MCP server exposing 50+ Grafana API tools. Supports Grafana 9.0+ (local and Grafana Cloud).
Query and manage Grafana dashboards, alert rules, and data sources via HTTP API. Useful for viewing dashboards, troubleshooting alerts, checking metrics, or on mentions of Grafana, monitoring, observability.
Creates and manages production Grafana dashboards for visualizing Prometheus metrics, APIs, SLOs, infrastructure, and KPIs using RED/USE methods. Use for monitoring and observability.
Share bugs, ideas, or general feedback.
MCP server exposing 50+ Grafana API tools. Supports Grafana 9.0+ (local and Grafana Cloud).
The MCP server must already be installed. Do not attempt to install it automatically. If it is not available, stop and tell the user to install it first.
Installation instructions, pre-built binaries, Docker images, and Helm charts: github.com/grafana/mcp-grafana
| Variable | Description |
|---|---|
GRAFANA_URL | Grafana instance URL (default: http://localhost:3000) |
GRAFANA_SERVICE_ACCOUNT_TOKEN | Service account token (recommended) |
GRAFANA_API_KEY | API key (deprecated, use service account token) |
GRAFANA_USERNAME + GRAFANA_PASSWORD | Basic auth |
GRAFANA_ORG_ID | Organization ID for multi-org setups |
GRAFANA_EXTRA_HEADERS | JSON object with custom HTTP headers |
Create a service account in Grafana with at least Viewer role (or Editor for write operations). Generate a token.
Set environment variables:
export GRAFANA_URL="https://mystack.grafana.net"
export GRAFANA_SERVICE_ACCOUNT_TOKEN="glsa_..."
The MCP server starts automatically when Cursor loads the plugin.
When connecting to localhost from Docker, use host.docker.internal:
{
"env": {
"GRAFANA_URL": "http://host.docker.internal:3000"
}
}
If you prefer the binary over Docker, update mcp.json:
{
"mcpServers": {
"grafana": {
"command": "mcp-grafana",
"args": [],
"env": {
"GRAFANA_URL": "${GRAFANA_URL}",
"GRAFANA_SERVICE_ACCOUNT_TOKEN": "${GRAFANA_SERVICE_ACCOUNT_TOKEN}"
}
}
}
}
| Flag | Description |
|---|---|
-t, --transport | Transport type: stdio (default), sse, streamable-http |
--address | Host:port for SSE/HTTP (default: localhost:8000) |
--debug | Enable debug logging |
--log-level | debug, info, warn, error |
--disable-write | Read-only mode (no create/update/delete tools) |
--enabled-tools | Comma-separated list of enabled tool categories |
--metrics | Enable Prometheus metrics at /metrics |
search_dashboards — search by title/metadataget_dashboard_summary — compact overview (preferred over full JSON)get_dashboard_property — extract specific parts via JSONPathget_dashboard_panel_queries — get panel queries and datasource infoget_dashboard_by_uid — full dashboard JSON (large, avoid unless needed)update_dashboard — create or update a dashboardpatch_dashboard — targeted modifications without full JSONlist_datasources — list all datasourcesget_datasource_by_uid / get_datasource_by_name — get datasource detailsquery_prometheus — execute PromQL querieslist_prometheus_metric_metadata — get metric metadatalist_prometheus_metric_names — list available metricslist_prometheus_label_names / list_prometheus_label_values — label discoveryquery_prometheus_histogram — calculate histogram percentilesquery_loki_logs — query logs/metrics using LogQLlist_loki_label_names / list_loki_label_values — label discoveryquery_loki_stats — stream statisticsquery_loki_patterns — detected log patternslist_alert_rules / get_alert_rule_by_uid — read alert rulescreate_alert_rule / update_alert_rule / delete_alert_rule — manage ruleslist_contact_points — notification endpointslist_incidents / get_incident — read incidentscreate_incident / add_activity_to_incident — manage incidentslist_oncall_schedules / get_oncall_shift / get_current_oncall_users — scheduleslist_oncall_teams / list_oncall_users — team/user discoverylist_alert_groups / get_alert_group — alert groupslist_sift_investigations / get_sift_investigation / get_sift_analysisfind_error_pattern_logs / find_slow_requestslist_pyroscope_label_names / list_pyroscope_label_valueslist_pyroscope_profile_types / fetch_pyroscope_profileget_annotations / create_annotation / update_annotation / patch_annotationcreate_graphite_annotation / get_annotation_tagsgenerate_deeplink — generate URLs for dashboards, panels, Exploreget_panel_image — render panel/dashboard as PNG (requires Image Renderer)These categories must be explicitly enabled with --enabled-tools:
list_clickhouse_tables, describe_clickhouse_table, query_clickhouselist_cloudwatch_namespaces, list_cloudwatch_metrics, list_cloudwatch_dimensions, query_cloudwatchquery_elasticsearchlist_teams, list_users_by_org, list_all_roles, get_role_details, get_role_assignmentssearch_logs (high-level across ClickHouse and Loki)get_query_examplesget_dashboard_summary instead of get_dashboard_by_uid to avoid consuming context with full dashboard JSON.get_dashboard_property with JSONPath to extract only the specific parts you need.patch_dashboard for targeted modifications over update_dashboard with full payload.search_dashboards to discover dashboards before retrieving by UID.generate_deeplink to provide clickable URLs rather than describing navigation steps.list_datasources, list_prometheus_metric_names) before writing queries.update_dashboard, create_incident, create_alert_rule) unless explicitly asked by the user.--disable-write flag for read-only mode when write access isn't needed.--enabled-tools to reduce attack surface and context usage.