Grafana MCP server

Search and edit Grafana dashboards, query metrics and logs, and handle alerts

Official · Grafana Labs Go Remote (hosted) · Streamable HTTPLocal · stdio DevOps and monitoringData and analytics

103 popularity score ★ 3.6k ↓ 740k/mo

Connect your client

Remote (hosted)

Add in one click

Opens the app, which asks before it adds the server. Then replace each <NAME> in its settings with your value.

Or add it by command or config

Cursor.cursor/mcp.json
{
  "mcpServers": {
    "grafana": {
      "url": "https://mcp.grafana.com/mcp",
      "headers": {
        "X-Grafana-URL": "https://<YOUR_STACK>.grafana.net"
      }
    }
  }
}
Claude Desktopclaude_desktop_config.json
{
  "mcpServers": {
    "grafana": {
      "type": "http",
      "url": "https://mcp.grafana.com/mcp",
      "headers": {
        "X-Grafana-URL": "https://<YOUR_STACK>.grafana.net"
      }
    }
  }
}
Claude Codeterminal
claude mcp add grafana https://mcp.grafana.com/mcp \
  --transport http \
  --header "X-Grafana-URL: https://<YOUR_STACK>.grafana.net"
windsurf~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "grafana": {
      "url": "https://mcp.grafana.com/mcp",
      "headers": {
        "X-Grafana-URL": "https://<YOUR_STACK>.grafana.net"
      }
    }
  }
}
VS Code.vscode/mcp.json
{
  "servers": {
    "grafana": {
      "type": "http",
      "url": "https://mcp.grafana.com/mcp",
      "headers": {
        "X-Grafana-URL": "https://<YOUR_STACK>.grafana.net"
      }
    }
  }
}
Local (PyPI)

Add in one click

Opens the app, which asks before it adds the server. Then replace each <NAME> in its settings with your value.

Or add it by command or config

It needs GRAFANA_URL, GRAFANA_SERVICE_ACCOUNT_TOKEN. Replace each <NAME> with your value.

Claude CodeTerminal
claude mcp add grafana -e GRAFANA_URL=<GRAFANA_URL> -e GRAFANA_SERVICE_ACCOUNT_TOKEN=<GRAFANA_SERVICE_ACCOUNT_TOKEN> -- uvx mcp-grafana
Claude Desktopclaude_desktop_config.json
{
  "mcpServers": {
    "grafana": {
      "command": "uvx",
      "args": [
        "mcp-grafana"
      ],
      "env": {
        "GRAFANA_URL": "<GRAFANA_URL>",
        "GRAFANA_SERVICE_ACCOUNT_TOKEN": "<GRAFANA_SERVICE_ACCOUNT_TOKEN>"
      }
    }
  }
}
Cursor~/.cursor/mcp.json
{
  "mcpServers": {
    "grafana": {
      "command": "uvx",
      "args": [
        "mcp-grafana"
      ],
      "env": {
        "GRAFANA_URL": "<GRAFANA_URL>",
        "GRAFANA_SERVICE_ACCOUNT_TOKEN": "<GRAFANA_SERVICE_ACCOUNT_TOKEN>"
      }
    }
  }
}
VS Code.vscode/mcp.json
{
  "servers": {
    "grafana": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "mcp-grafana"
      ],
      "env": {
        "GRAFANA_URL": "<GRAFANA_URL>",
        "GRAFANA_SERVICE_ACCOUNT_TOKEN": "<GRAFANA_SERVICE_ACCOUNT_TOKEN>"
      }
    }
  }
}
Codex~/.codex/config.toml
[mcp_servers.grafana]
command = "uvx"
args = ["mcp-grafana"]

[mcp_servers.grafana.env]
GRAFANA_URL = "<GRAFANA_URL>"
GRAFANA_SERVICE_ACCOUNT_TOKEN = "<GRAFANA_SERVICE_ACCOUNT_TOKEN>"
Gemini CLITerminal
gemini mcp add --scope user -e GRAFANA_URL=<GRAFANA_URL> -e GRAFANA_SERVICE_ACCOUNT_TOKEN=<GRAFANA_SERVICE_ACCOUNT_TOKEN> grafana uvx -- mcp-grafana
Local (Docker)

Add in one click

Opens the app, which asks before it adds the server. Then replace each <NAME> in its settings with your value.

Or add it by command or config

It needs GRAFANA_URL, GRAFANA_SERVICE_ACCOUNT_TOKEN. Replace each <NAME> with your value.

Claude CodeTerminal
claude mcp add grafana -e GRAFANA_URL=<GRAFANA_URL> -e GRAFANA_SERVICE_ACCOUNT_TOKEN=<GRAFANA_SERVICE_ACCOUNT_TOKEN> -- docker run --rm -i -e GRAFANA_URL -e GRAFANA_SERVICE_ACCOUNT_TOKEN grafana/mcp-grafana -t stdio
Claude Desktopclaude_desktop_config.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>"
      }
    }
  }
}
Cursor~/.cursor/mcp.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>"
      }
    }
  }
}
VS Code.vscode/mcp.json
{
  "servers": {
    "grafana": {
      "type": "stdio",
      "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>"
      }
    }
  }
}
Codex~/.codex/config.toml
[mcp_servers.grafana]
command = "docker"
args = ["run", "--rm", "-i", "-e", "GRAFANA_URL", "-e", "GRAFANA_SERVICE_ACCOUNT_TOKEN", "grafana/mcp-grafana", "-t", "stdio"]

[mcp_servers.grafana.env]
GRAFANA_URL = "<GRAFANA_URL>"
GRAFANA_SERVICE_ACCOUNT_TOKEN = "<GRAFANA_SERVICE_ACCOUNT_TOKEN>"
Gemini CLITerminal
gemini mcp add --scope user -e GRAFANA_URL=<GRAFANA_URL> -e GRAFANA_SERVICE_ACCOUNT_TOKEN=<GRAFANA_SERVICE_ACCOUNT_TOKEN> grafana docker -- run --rm -i -e GRAFANA_URL -e GRAFANA_SERVICE_ACCOUNT_TOKEN grafana/mcp-grafana -t stdio

Settings 12

GRAFANA_URL Required: Address of your Grafana instance or Grafana Cloud stack. Default http://localhost:3000.
GRAFANA_SERVICE_ACCOUNT_TOKEN secret Required: Service account token. GRAFANA_SERVICE_ACCOUNT_TOKEN_FILE or GRAFANA_USERNAME with GRAFANA_PASSWORD can be used instead.
GRAFANA_SERVICE_ACCOUNT_TOKEN_FILE Optional: Path to a file holding the token, read again on each request so it can be rotated.
GRAFANA_ORG_ID Optional: Numeric organization ID on multi-org instances.
GRAFANA_EXTRA_HEADERS Optional: Extra HTTP headers sent with every request to Grafana, as JSON.
GRAFANA_USAGE_STATS Optional: Set to disabled to stop usage reports, or log to print them instead. DO_NOT_TRACK=1 also turns them off. Default enabled.
MCP_GRAFANA_SERVER_TOKEN secret Optional: Bearer token clients must send when the server runs over HTTP. For SSE and streamable HTTP transports.
Set together: prometheus guardrail
GRAFANA_PROMETHEUS_GUARDRAIL_MODE Optional: off, shadow (log what would be blocked) or enforce (reject queries over the caps below). Default off. For query_prometheus, query_prometheus_histogram, run_panel_query.
GRAFANA_PROMETHEUS_GUARDRAIL_MAX_RANGE Optional: Longest time range one PromQL query may read, counting range vectors and subqueries. 0 turns the check off. Default 192h.
GRAFANA_PROMETHEUS_GUARDRAIL_MAX_POINTS Optional: Most points per series a range query may ask for. 0 turns the check off. Default 11000.
Set together: loki guardrail
GRAFANA_LOKI_GUARDRAIL_MODE Optional: off, shadow or enforce. GRAFANA_LOKI_GUARDRAIL_MAX_RANGE (24h by default) and GRAFANA_LOKI_GUARDRAIL_MAX_BYTES set its caps. Default off. For query_loki_logs, query_loki_patterns.
GRAFANA_LOKI_GUARDRAIL_ON_ESTIMATE_FAILURE Optional: Set to block to reject, in enforce mode, queries the Loki guardrail cannot size up. Default allow.

In a container, a setting goes in with -e NAME=value after docker run.

What it does

Grafana Labs publishes this open-source server so an assistant can work inside a Grafana instance. It finds and edits dashboards, and it queries Prometheus, Loki, Tempo or Pyroscope through the datasources you already have. Alert rules and silences are in there too. So are Grafana Incident and OnCall, which matters if your on-call rota and incident timeline already live in Grafana and you want the assistant to update them while it digs through the data.

You run it yourself with uvx or the Docker image and point it at Grafana with GRAFANA_URL and a service account token. In the code GRAFANA_URL falls back to http://localhost:3000 when unset. What the tools can touch comes down to that token's RBAC permissions, and --disable-write turns writes off.

A good share of the tools stay off until you ask for them. The default --enabled-tools list leaves out seven datasource groups, SQL and CloudWatch among them. Admin tools and run_panel_query are opt-in as well. Since 2.2.0 the SQL tools also take BigQuery datasources, and CloudWatch has three Logs Insights tools next to the metrics ones. Listing log groups stops at 50, so on a big AWS account you pass a name prefix. A Logs Insights query gets 30 seconds to finish.

PromQL and LogQL queries can be held back by guardrails, which are off unless you set a mode. Put the Prometheus one in enforce mode and it turns away a query spanning more than 192 hours or asking for more than 11000 points per series, unless you change those caps. The Loki one has a 24 hour range cap by default. Shadow mode only logs what would have been blocked.

If your stack is on Grafana Cloud you can skip the install. Grafana runs a hosted copy at mcp.grafana.com that you sign in to with OAuth in the browser.

What it needs

To run it yourselfPythonDocker
Runs onmacOS, Windows, Linux
GrafanaYour own instanceSelf-managed Grafana 9.0 or later, or a Grafana Cloud stack, with a service account token
Also
  • uv on PATH for the uvx command

Create a service account in Grafana and give it the roles the tools need. The README lists them per tool, and the Editor role is the simpler but wider choice. Then make a token for it. The hosted endpoint needs a Grafana Cloud stack where the Grafana Assistant terms have been accepted. Your user also needs the Cloud MCP access permission, which Editors and above have by default.

Limits

  • Limit SQL, InfluxDB, CloudWatch, Cloud Logging, Elasticsearch, Quickwit, Graphite, admin and run_panel_query tools are off until named in --enabled-tools
  • Limit Under --disable-write, query_sql and query_influxdb are dropped too unless --enable-query is set, since they pass queries through unfiltered
  • Limit The Prometheus and Loki query guardrails are off by default and only reject queries once their mode is set to enforce
  • Size cap list_cloudwatch_log_groups returns at most 50 log groups, and query_cloudwatch_logs waits up to 30 seconds for a result
  • Size cap update_dashboard takes the whole dashboard JSON, which can fill a lot of the model's context on large dashboards
  • Limit Panel images need the Grafana Image Renderer installed on the Grafana side
  • Limit Cloud Logging tools need the Google Cloud Logging plugin 1.8.0 or later on Grafana 11.2 or later
  • Not covered The hosted endpoint works with Grafana Cloud stacks only and speaks streamable HTTP, with no SSE
  • Limit GRAFANA_API_KEY still works but is deprecated in favour of GRAFANA_SERVICE_ACCOUNT_TOKEN

Who it suits

Teams already on Grafana who want an assistant to read dashboards and traces during an incident. Run it locally for a self-managed instance, where the token and --disable-write keep its reach small. On Grafana Cloud the hosted endpoint saves the install and acts as the signed-in user. If you only need raw Prometheus or Loki access without Grafana in between, a server for that backend may be simpler.

Tools 60 of 123

47 only read, 11 change things, 2 can delete or overwrite.

search_dashboards
Find dashboards by title, folder, tag or starred state
get_dashboard_by_uid
Fetch a dashboard's JSON by UID, or one of its saved versions
list_dashboard_versions
List a dashboard's saved versions with author, time and message
get_dashboard_summary
Return a short outline of a dashboard instead of its full JSON
get_dashboard_property
Pull parts of a dashboard out with a JSONPath expression
get_dashboard_panel_queries
Show each panel's title, queries and datasource
update_dashboard changes
Create a dashboard or overwrite an existing one with new JSON
run_panel_query
Run the queries behind one or more dashboard panels (off by default)
create_folder changes
Create a dashboard folder
list_datasources
List the configured datasources
get_datasource
Fetch one datasource by UID or name
check_datasources_health
Run Grafana's health check on one or more datasources
create_datasource changes
Add a new datasource
update_datasource changes
Change an existing datasource's settings
query_prometheus
Run a PromQL instant or range query
list_prometheus_metric_names
List metric names in a Prometheus datasource
list_prometheus_label_names
List label names that match a selector
list_prometheus_label_values
List the values one label takes
query_prometheus_histogram
Work out histogram percentiles from Prometheus buckets
query_loki_logs
Run a LogQL log or metric query
list_loki_label_names
List the label names in a Loki datasource
list_loki_label_values
List the values of one Loki label
query_loki_stats
Report stream, chunk and byte counts for a log selector
query_loki_patterns
Return the log patterns Loki has detected
analyze_loki_labels
Review a Loki label setup and point out costly labels
query_influxdb changes
Run an InfluxQL or Flux query (off by default, can change data)
list_sql_databases
List databases, schemas, catalogs or BigQuery datasets in a SQL datasource (off by default)
list_sql_tables
List tables in a SQL datasource (off by default)
describe_sql_table
Show a table's columns and types (off by default)
query_sql changes
Run raw SQL through a Grafana SQL datasource, BigQuery included (off by default, can change data)
list_cloudwatch_namespaces
List AWS CloudWatch namespaces (off by default)
list_cloudwatch_metrics
List the metrics in a CloudWatch namespace (off by default)
list_cloudwatch_dimensions
List the dimensions of a CloudWatch metric (off by default)
query_cloudwatch
Run a CloudWatch metrics query over a time range (off by default)
list_cloudwatch_log_groups
List up to 50 CloudWatch log groups in a region, filtered by name prefix (off by default)
list_cloudwatch_log_group_fields
List the fields found in a CloudWatch log group (off by default)
query_cloudwatch_logs
Run a Logs Insights query over one or more log groups (off by default)
query_cloud_logging
Search Google Cloud Logging entries (off by default)
query_elasticsearch
Search Elasticsearch or OpenSearch with Lucene or Query DSL (off by default)
query_graphite
Fetch Graphite series for a target expression (off by default)
query_pyroscope
Fetch profiles or profile metrics from Pyroscope
search_tempo_traces
Find traces with a TraceQL query
get_tempo_trace
Fetch one trace by its ID
query_tempo_metrics
Compute TraceQL metrics over traces
list_incidents
List Grafana Incident incidents
get_incident
Fetch one incident with its custom fields
create_incident changes
Open a new incident in Grafana Incident
update_incident changes
Change an incident's status, severity, title or custom fields
alerting_rules_read
List alert rules, read one, or see its version history
alerting_rules_write deletes
Create, edit or delete alert rules
alerting_silences_read
List silences or read one
alerting_silences_write changes
Create, edit or expire silences
list_oncall_schedules
List Grafana OnCall schedules
get_current_oncall_users
Show who is on call now for a schedule
list_alert_groups
List OnCall alert groups with filters
update_alert_group changes
Acknowledge or resolve an OnCall alert group, or undo either
install_plugin changes
Install a Grafana plugin (write mode only)
render_grafana_app
Run an enabled query tool and show its result as an interactive Grafana view in hosts that support it
user_info
Show who the token belongs to, what it may do and which orgs it reaches
grafana_api_request deletes
Call any Grafana HTTP API path, GET only under --disable-write

Similar servers