Documentation for automated readers
A curated documentation index is available at: https://grafana.com/llms.txt
A complete documentation index is available at: https://grafana.com/llms-full.txt
These indexes can help with page discovery before fetching individual documents.
This page is also available in Markdown, which may be easier for automated readers and AI tools to parse than HTML. The Markdown version is available at https://grafana.com/docs/grafana/v13.0/developer-resources/mcp/clients/claude-code.md, or by sending Accept: text/markdown to https://grafana.com/docs/grafana/v13.0/developer-resources/mcp/clients/claude-code/. For broader documentation discovery, the curated index is available at https://grafana.com/llms.txt and the complete index is available at 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


