Grafana Labs has released an official Model Context Protocol (MCP) server that allows Claude Code to interact directly with Grafana instances. This integration enables the AI agent to search dashboards, execute PromQL and LogQL queries, and inspect alert states without human intervention. The move addresses a critical friction point in agentic workflows: the 'copy-paste bridge' where developers manually transfer context from observability tools to the terminal.

Technical Implementation and Requirements

The server, identified as grafana/mcp-grafana, operates under an Apache 2.0 license and requires Grafana version 9.0 or later, supporting both self-hosted and Grafana Cloud environments. Authentication is handled via service account tokens, with the Viewer role recommended for initial read-only access. Setup involves configuring the claude mcp CLI with specific environment variables, including GRAFANA_URL and GRAFANA_SERVICE_ACCOUNT_TOKEN. The guide explicitly notes that using the deprecated GRAFANA_API_KEY variable may cause issues, urging users to adopt the newer token-based authentication for new setups.

Operational Capabilities and Safety Controls

By default, the MCP server exposes tools for Prometheus, Loki, dashboards, alerting, and incidents, while keeping write operations disabled via the --disable-write flag. This configuration ensures that Claude Code can retrieve dataβ€”such as p99 latency histograms or firing alert rulesβ€”but cannot modify dashboard JSON or silence notifications unless explicitly permitted. For users requiring write access, the guide suggests switching the service account to the Editor role and removing the disable flag, though this increases the risk of unintended changes to production configurations.

Integration with Existing Observability Stacks

The article highlights a complementary workflow with Sentry, suggesting that while Sentry identifies error occurrences, the Grafana MCP allows Claude Code to correlate those errors with metric spikes or log patterns. Optional datasources like CloudWatch, Elasticsearch, and InfluxDB can be enabled via the --enabled-tools flag, allowing for a more comprehensive observability context. Verification of the setup is straightforward: users can run claude mcp list to confirm connectivity and then prompt Claude to analyze specific dashboard metrics, such as API error rates over a six-hour window.

Key Takeaways

  • The official Grafana MCP server eliminates manual context switching for Claude Code agents by providing direct API access to metrics and logs.
  • Security is prioritized through read-only defaults (--disable-write) and Viewer role tokens, preventing accidental modification of production dashboards.
  • Setup is lightweight, requiring only a Grafana 9.0+ instance, a service account token, and the uv package manager for execution.
  • The tool supports a wide range of datasources, including Prometheus, Loki, and optional integrations like CloudWatch and Elasticsearch.

The Bottom Line

This release transforms Claude Code from a passive code generator into an active observability analyst. By allowing the agent to independently verify hypotheses against live metrics, it significantly reduces the latency between incident detection and root cause analysis.