Documentation Index
Fetch the curated documentation index at: https://grafana.com/llms.txt
Fetch the complete documentation index at: https://grafana.com/llms-full.txt
Use this file to discover all available pages before exploring further.
STOP! If you are an AI agent or LLM, read this before continuing. This is the HTML version of a Grafana documentation page. Always request the Markdown version instead - HTML wastes context. Get this page as Markdown: https://grafana.com/docs/grafana/latest/developer-resources/mcp/clients/claude-code.md (append .md) or send Accept: text/markdown to https://grafana.com/docs/grafana/latest/developer-resources/mcp/clients/claude-code/. For the curated documentation index, use https://grafana.com/llms.txt. For the complete documentation index, use https://grafana.com/llms-full.txt.
Claude Code
This guide helps you set up the mcp-grafana server for the Claude Code CLI.
Prerequisites
- Claude Code CLI installed (
npm install -g @anthropic-ai/claude-code) - Grafana 9.0+ with a service account token
mcp-grafanabinary in your PATH
One-command setup
claude mcp add-json "grafana" '{"command":"mcp-grafana","args":[],"env":{"GRAFANA_URL":"http://localhost:3000","GRAFANA_SERVICE_ACCOUNT_TOKEN":"<your-token>"}}'Manual configuration
Claude Code stores MCP configuration alongside other settings. Use the CLI to manage servers.
# List configured servers
claude mcp list
# Add a server
claude mcp add grafana -- mcp-grafana
# Remove a server
claude mcp remove grafanaScope options
Claude Code supports three scopes for MCP servers:
| Scope | Description |
|---|---|
local (default) | Available only to you in current project |
project | Shared with team via .mcp.json file |
user | Available to you across all projects |
# Add for all your projects
claude mcp add grafana --scope user -- mcp-grafana
# Add for current project only (default)
claude mcp add grafana --scope local -- mcp-grafanaFull configuration with environment variables
claude mcp add-json "grafana" '{
"command": "mcp-grafana",
"args": [],
"env": {
"GRAFANA_URL": "http://localhost:3000",
"GRAFANA_SERVICE_ACCOUNT_TOKEN": "<your-token>"
}
}'Docker setup
claude mcp add-json "grafana" '{
"command": "docker",
"args": ["run", "--rm", "-i", "-e", "GRAFANA_URL", "-e", "GRAFANA_SERVICE_ACCOUNT_TOKEN", "grafana/mcp-grafana", "-t", "stdio"],
"env": {
"GRAFANA_URL": "http://host.docker.internal:3000",
"GRAFANA_SERVICE_ACCOUNT_TOKEN": "<your-token>"
}
}'Debug mode
claude mcp add-json "grafana" '{
"command": "mcp-grafana",
"args": ["-debug"],
"env": {
"GRAFANA_URL": "http://localhost:3000",
"GRAFANA_SERVICE_ACCOUNT_TOKEN": "<your-token>"
}
}'Then run Claude Code with debug output:
claude --debugVerify configuration
Start a new Claude Code session:
BashclaudeAsk: “List my Grafana dashboards”
Claude should use the Grafana MCP tools automatically
View current configuration
claude mcp list --jsonTroubleshooting
Server not found:
- Verify binary path:
which mcp-grafana - Use full path in configuration if needed
Permission errors:
- Check Grafana service account token
- Verify token has required RBAC permissions
Read-only mode
claude mcp add-json "grafana" '{
"command": "mcp-grafana",
"args": ["--disable-write"],
"env": {
"GRAFANA_URL": "http://localhost:3000",
"GRAFANA_SERVICE_ACCOUNT_TOKEN": "<your-token>"
}
}'Next steps
- Set up for other install options.
- Configure authentication for Grafana credentials.
Was this page helpful?
Related resources from Grafana Labs


