Connect AI coding agents (Claude Code, Cursor, VS Code, OpenAI Codex) to Grafana Cloud via the Model Context Protocol (MCP) server. Use when the user asks to connect Claude Code to Grafana, set up MCP for Grafana, use Grafana tools in Cursor, query Grafana from an AI agent, configure the Grafana MCP server, or make AI agents interact with Grafana Cloud APIs. Triggers on phrases like "MCP server", "connect Claude Code to Grafana", "Grafana MCP", "AI agent Grafana", "Claude Grafana tools", "Cursor Grafana", or "agent observability".
65
77%
Does it follow best practices?
Impact
—
No eval scenarios have been run
Risky
Do not use without reviewing
Optimize this skill with Tessl
npx tessl skill review --optimize ./skills/grafana-cloud/assistant-mcp/SKILL.mdThe Grafana MCP server exposes Grafana Cloud capabilities as tools that AI agents can call via the Model Context Protocol. Once connected, agents can query metrics, search dashboards, manage alerts, investigate incidents, and interact with Fleet Management - all without leaving their coding environment.
Available transports:
stdio - agent spawns the server as a subprocess (simplest, works everywhere)SSE - server runs independently, agent connects via HTTPYou need a Service Account token with appropriate scopes.
Viewer role (add Editor if you need write operations)https://myorg.grafana.net) and the tokenFor Grafana Cloud Prometheus/Loki/Tempo access you may also need:
# Via Go (recommended - always gets latest)
go install github.com/grafana/mcp-grafana/cmd/mcp-grafana@latest
# Verify
mcp-grafana --versionAlternatively, download a pre-built binary from the releases page.
Add the server to Claude Code's MCP configuration. The config file is at:
~/.claude/settings.json or the project's .claude/settings.json{
"mcpServers": {
"grafana": {
"command": "mcp-grafana",
"args": [],
"env": {
"GRAFANA_URL": "https://myorg.grafana.net",
"GRAFANA_API_KEY": "glsa_xxxx"
}
}
}
}Read-only mode (safer for exploration - disables all write tools):
{
"mcpServers": {
"grafana": {
"command": "mcp-grafana",
"args": ["--disable-write"],
"env": {
"GRAFANA_URL": "https://myorg.grafana.net",
"GRAFANA_API_KEY": "glsa_xxxx"
}
}
}
}Restart Claude Code after editing settings. Run /mcp in Claude Code to verify the server appears and its tools are listed.
In Cursor: Settings > Features > MCP Servers (or edit ~/.cursor/mcp.json):
{
"mcpServers": {
"grafana": {
"command": "mcp-grafana",
"args": [],
"env": {
"GRAFANA_URL": "https://myorg.grafana.net",
"GRAFANA_API_KEY": "glsa_xxxx"
}
}
}
}Run the server as a long-lived SSE process instead of per-session stdio:
GRAFANA_URL=https://myorg.grafana.net \
GRAFANA_API_KEY=glsa_xxxx \
mcp-grafana --transport sse --port 3001Then point agents at http://localhost:3001/sse.
VS Code MCP extension config (settings.json):
{
"mcp.servers": {
"grafana": {
"type": "sse",
"url": "http://localhost:3001/sse"
}
}
}Once connected, the agent can call:
Query tools:
query_prometheus - run PromQL queries against Grafana Cloud Metricsquery_loki - run LogQL queries against Grafana Cloud Logsquery_tempo - run TraceQL queries against Grafana Cloud Traceslist_datasources - enumerate configured data sourcesDashboard tools:
search_dashboards - find dashboards by name, tag, or folderget_dashboard - retrieve full dashboard JSONcreate_dashboard - create or update a dashboard (requires Editor role)Alerting and incident tools:
list_alert_rules - list firing and pending alertsget_alert_rule - get details of a specific alert rulelist_incidents - list active incidents (requires IRM)Fleet Management tools (if collector-app is installed):
list_collectors - list Alloy collectors and their health statuslist_pipelines - list remote configuration pipelinesget_pipeline - get pipeline YAML contentAnnotation tools:
list_annotations - search dashboard annotations by time rangecreate_annotation - add an annotation to a dashboardIn Claude Code, ask the agent to use a Grafana tool:
What data sources are configured in my Grafana instance?Or:
Show me dashboards tagged with "kubernetes" in my Grafana.If the tool call fails:
GRAFANA_URL has no trailing slashmcp-grafana --debug to see raw request/response logsIf you have the grafana-core skills installed, the agent already knows:
grafana-core/promql)grafana-core/dashboarding)grafana-cloud/fleet-management)Combined with the MCP tools, the agent can answer questions like:
The Grafana Assistant supports the A2A protocol for agent-to-agent communication. External agents can discover available Grafana agents at:
GET https://<GRAFANA_ASSISTANT_HOST>/.well-known/agent.jsonThis returns an Agent Card describing the supervisor agent's capabilities. Use this for programmatic integration when building agents that need to delegate observability reasoning to the Grafana Assistant.
--disable-write) for shared or CI environmentsa031314
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.