Grafana MCP server
Grafana Labs' official server for dashboards, Prometheus and Loki queries, alerting, incidents and OnCall in Grafana or Grafana Cloud. Runs locally through uvx with a Grafana service account token.
Local (stdio)Credential
Set up Grafana
Configuration examples, not tested connections. Replace placeholders and review the upstream documentation before use.
Claude Code
Run in your terminal.
claude mcp add grafana --env GRAFANA_URL="http://localhost:3000" --env GRAFANA_SERVICE_ACCOUNT_TOKEN="$GRAFANA_SERVICE_ACCOUNT_TOKEN" -- uvx mcp-grafana
Cursor
Merge into ~/.cursor/mcp.json
{
"mcpServers": {
"grafana": {
"command": "uvx",
"args": [
"mcp-grafana"
],
"env": {
"GRAFANA_URL": "http://localhost:3000",
"GRAFANA_SERVICE_ACCOUNT_TOKEN": "REPLACE_WITH_GRAFANA_SERVICE_ACCOUNT_TOKEN"
}
}
}
}
Codex
Run in your terminal.
codex mcp add grafana --env GRAFANA_URL="http://localhost:3000" --env GRAFANA_SERVICE_ACCOUNT_TOKEN="$GRAFANA_SERVICE_ACCOUNT_TOKEN" -- uvx mcp-grafana
Gemini CLI
Merge into ~/.gemini/settings.json
{
"mcpServers": {
"grafana": {
"command": "uvx",
"args": [
"mcp-grafana"
],
"env": {
"GRAFANA_URL": "http://localhost:3000",
"GRAFANA_SERVICE_ACCOUNT_TOKEN": "REPLACE_WITH_GRAFANA_SERVICE_ACCOUNT_TOKEN"
}
}
}
}
OpenCode
Merge into ~/.config/opencode/opencode.jsonc
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"grafana": {
"type": "local",
"command": [
"uvx",
"mcp-grafana"
],
"enabled": true,
"environment": {
"GRAFANA_URL": "http://localhost:3000",
"GRAFANA_SERVICE_ACCOUNT_TOKEN": "REPLACE_WITH_GRAFANA_SERVICE_ACCOUNT_TOKEN"
}
}
}
}
VS Code
Merge into .vscode/mcp.json
{
"servers": {
"grafana": {
"type": "stdio",
"command": "uvx",
"args": [
"mcp-grafana"
],
"env": {
"GRAFANA_URL": "http://localhost:3000",
"GRAFANA_SERVICE_ACCOUNT_TOKEN": "${input:GRAFANA_SERVICE_ACCOUNT_TOKEN}"
}
}
},
"inputs": [
{
"id": "GRAFANA_SERVICE_ACCOUNT_TOKEN",
"type": "promptString",
"description": "GRAFANA_SERVICE_ACCOUNT_TOKEN",
"password": true
}
]
}
Using more than one server?Add to a config with other servers
Step-by-step setup guides: Claude Code and Codex CLI, Cursor and VS Code. In Claude Desktop, the Cursor JSON goes in claude_desktop_config.json. This is a local server that runs on your machine; see remote vs local servers and authentication and security basics.
Overview
Grafana Labs maintains mcp-grafana, an MCP server for Grafana and Grafana Cloud. Version 2.0.2 was released on 7 October 2026, both on GitHub and on PyPI. It lets an agent use your observability stack during an investigation, not just read static notes about it.
The tool set is broad. search_dashboards and get_dashboard_by_uid find and read dashboards, and list_datasources shows what data is available. query_prometheus and query_loki_logs run metric and log queries. Further tools manage alert rules and silences, read and create incidents, list OnCall schedules and on-call users, and fetch Tempo traces. When we started version 2.0.2 locally on 11 October 2026, it listed more than fifty tools.
The example runs uvx mcp-grafana, so you need uv installed. Set GRAFANA_URL to your instance, for example http://localhost:3000 or your Grafana Cloud URL, and GRAFANA_SERVICE_ACCOUNT_TOKEN to a token from a Grafana service account. That account's role decides what the agent can see and change, so start with Viewer permissions and add more only when you need write tools such as annotations or incidents. Upstream also documents Docker images and an HTTP mode for shared deployments.
Example tools
search_dashboardsget_dashboard_by_uidquery_prometheusquery_loki_logslist_datasourceslist_incidents
Tool names are upstream examples. The server's live tool list can differ.
Related Developer Tools servers
Sources
This page was written from the upstream documentation below and last reviewed on 11 October 2026. Listing is not a security or compatibility endorsement. Report a correction through the contact page.