Grafana MCP Server
The official Grafana MCP server by Grafana Labs gives AI agents access to your Grafana stack: search and edit dashboards, list datasources, run Prometheus PromQL and Loki LogQL queries, explore metrics and labels, manage incidents and on-call schedules, and work with alert rules and annotations.
Install Grafana
- Published by
- Official (vendor)
- Transport
- Local process (stdio)
- Authentication
- API key
- Package
- mcp-grafana
Claude Desktop, Claude Code and Cursor
Add this to the mcpServers object in your client's
config file, then restart the client.
{
"mcpServers": {
"grafana": {
"command": "uvx",
"args": [
"mcp-grafana"
],
"env": {
"GRAFANA_URL": "http://localhost:3000",
"GRAFANA_SERVICE_ACCOUNT_TOKEN": "${GRAFANA_SERVICE_ACCOUNT_TOKEN}"
}
}
}
}
VS Code uses a different key — show that config
Identical entry, filed under servers rather than
mcpServers. Put it in
.vscode/mcp.json for one workspace.
{
"servers": {
"grafana": {
"command": "uvx",
"args": [
"mcp-grafana"
],
"env": {
"GRAFANA_URL": "http://localhost:3000",
"GRAFANA_SERVICE_ACCOUNT_TOKEN": "${GRAFANA_SERVICE_ACCOUNT_TOKEN}"
}
}
}
}
Before it will answer
Runs locally and points at your own Grafana, so GRAFANA_URL is yours to set — localhost or a Grafana Cloud instance. Authenticate with a service account token rather than the legacy username and password path; GRAFANA_SERVICE_ACCOUNT_TOKEN_FILE keeps the token out of your config file entirely. Needs Grafana 9.0 or later, and GRAFANA_ORG_ID if you run multiple organisations.
Tools
alerting_manage_rules
List, create, update, or delete Grafana alert rules.
create_incident
Create a brand-new incident record in Grafana Incident.
get_annotations
Query Grafana annotations using time and tag filters.
get_dashboard_by_uid
Retrieve a dashboard's full details by its unique UID.
get_dashboard_panel_queries
Get the query and datasource for each dashboard panel.
get_dashboard_summary
Get a compact overview of a dashboard without full JSON.
get_datasource
Retrieve details about a specific Grafana datasource.
list_datasources
List all of the datasources configured in Grafana.
list_incidents
Display the incidents tracked in Grafana Incident.
list_loki_label_names
List all of the available label names in Loki logs.
list_prometheus_label_names
Find the Prometheus label names matching a given selector.
list_prometheus_metric_names
Discover the available metric names in Prometheus.
query_loki_logs
Run log or metric queries against Loki using LogQL.
query_loki_patterns
Retrieve log patterns detected by Loki for a stream.
query_prometheus
Execute a PromQL instant or range query in Prometheus.
query_prometheus_histogram
Calculate histogram percentile values from Prometheus.
search_dashboards
Find Grafana dashboards by title or other metadata.
update_dashboard
Modify an existing Grafana dashboard or create a new one.