MCP/Grafana MCP Server
Grafana MCP Server logo

Grafana MCP Server

Verified Golden (1000+ GitHub stars)

Official Grafana MCP server connecting AI assistants with dashboards, Prometheus metrics, Loki logs, SQL datasources, and alerts.

rag-data•Data, Analytics & BI
GitHub3.6k
License:Apache-2.0
OFFICIAL

About this Server

Official Grafana MCP Server (`grafana` / `mcp-grafana`) connects AI agents directly to Grafana Cloud and on-premises instances. It equips assistants with tools to search, inspect, and patch dashboards, execute PromQL, LogQL, and TraceQL queries, query SQL datasources (ClickHouse, Snowflake, Athena, Postgres), inspect alerts and on-call rotations, and render panel images for reports.

Real-time Interaction

Direct low-latency RPC protocol communication with structured JSON schemas.

Scoped Sandboxing

Restricted capability bounds to prevent accidental modifications or leakage.

Security & Best Practices

Granular RBAC Service Accounts: Connect via a Grafana service account token with explicit read-only scopes (e.g. datasources:read, dashboards:read).
Read-Only Flag Guardrail: Run with --disable-write to block dashboard updates, folder creation, and raw SQL mutations.
Loki Query Cost Controls: Built-in guardrails cap maximum query scan bytes and enforce selective label matchers.

When to Use (and When Not To)

Best For
  • •Analyzing production metrics, query performance, and error logs directly from AI development assistants
  • •Inspecting and modifying Grafana dashboards with token-efficient JSONPath property tools
  • •Querying diverse SQL data warehouses (ClickHouse, Snowflake, Athena) through existing Grafana connections
Not For / Limitations
  • •App Store and Google Play customer review sentiment analytics (use App Store Review Intelligence MCP instead)
  • •SEO rank tracking and Google Search Console performance data (use AltoRank MCP instead)
  • •Raw terminal AWS CLI shell pipelines (use AWS Cloud MCP Server instead)

Install & Setup

terminal command
$claude mcp add grafana -- uvx mcp-grafana

Exposed Tools & Endpoints

8 tools

Functions your AI agent can invoke via this Model Context Protocol server

search_dashboards

Finds dashboards by title keyword, folder UID, tag, or starred status.

get_dashboard_summary

Retrieves a compact summary of a dashboard (panel count, types, variables, metadata) to minimize context window usage.

query_prometheus

Executes PromQL queries (instant vectors or range series) and histogram percentiles against Prometheus datasources.

query_loki_logs

Queries logs and stream statistics using LogQL with stream selectors and pattern detection.

query_sql

Executes SQL queries with macro substitution ($__timeFilter) across ClickHouse, Snowflake, Athena, Postgres, and MySQL.

list_datasources

Lists all configured datasources (Prometheus, Loki, ClickHouse, CloudWatch, OpenSearch) and tests connectivity health.

alerting_rules_read

Lists and inspects Grafana-managed and datasource-managed alert rules, evaluate states, and execution histories.

get_panel_image

Renders a stored dashboard panel or ad-hoc Explore view into a PNG image for inclusion in automated reports.