Home / MCP / Grafana MCP Server

Grafana MCP Server

Provides an MCP server to access Grafana data sources, dashboards, incidents, alerting, and more via a programmable API.

go
Installation
Add the following to your MCP client configuration file.

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.

How to use

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.

How to install

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"
      }
    }
  }
}

Additional sections

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.

Notes and tips

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.

Available tools

list_teams

List all teams in Grafana

list_users_by_org

List all users in an organization

search_dashboards

Search for dashboards by title or metadata

get_dashboard_by_uid

Get a dashboard by its UID

update_dashboard

Update or create a dashboard

get_dashboard_panel_queries

Get panel titles, queries, datasource UIDs and types

get_dashboard_property

Extract specific parts of a dashboard using JSONPath

get_dashboard_summary

Get a compact dashboard overview

list_datasources

List datasources

get_datasource_by_uid

Get a datasource by UID

get_datasource_by_name

Get a datasource by name

query_prometheus

Execute a Prometheus query

list_prometheus_metric_metadata

List metric metadata

list_prometheus_metric_names

List metric names

list_prometheus_label_names

List label names

list_prometheus_label_values

List label values for a label

list_incidents

List incidents in Grafana Incident

create_incident

Create an incident in Grafana Incident

add_activity_to_incident

Add activity to an incident

get_incident

Get a single incident by ID

query_loki_logs

Query Loki logs using LogQL

list_loki_label_names

List Loki label names

list_loki_label_values

List Loki label values

query_loki_stats

Get statistics about log streams

list_alert_rules

List alert rules

get_alert_rule_by_uid

Get an alert rule by UID

list_contact_points

List notification contact points

list_oncall_schedules

List OnCall schedules

get_oncall_shift

Get details for a specific OnCall shift

get_current_oncall_users

Get current on-call users for a schedule

list_oncall_teams

List OnCall teams

list_oncall_users

List OnCall users

list_alert_groups

List alert groups for OnCall

get_alert_group

Get alert group details

get_sift_investigation

Retrieve a Sift investigation by UUID

get_sift_analysis

Retrieve a Sift analysis

list_sift_investigations

List Sift investigations with optional limit

find_error_pattern_logs

Find elevated error patterns in Loki logs

find_slow_requests

Find slow requests from Tempo-related sources

list_pyroscope_label_names

List Pyroscope label names

list_pyroscope_label_values

List Pyroscope label values

list_pyroscope_profile_types

List available Pyroscope profile types

fetch_pyroscope_profile

Fetch a Pyroscope profile in DOT format

get_assertions

Get assertion summary for an entity

generate_deeplink

Generate direct deeplink URLs for Grafana resources

get_annotations

Fetch annotations with filters

create_annotation

Create a new annotation on a dashboard or panel

create_graphite_annotation

Create a Graphite-formatted annotation

update_annotation

Replace all fields of an annotation

patch_annotation

Update specific fields of an annotation

get_annotation_tags

List annotation tags