Grafana MCP ServerGrafana MCP Server
Grafana 官方 MCP server(Apache-2.0,Go 实现):把 agent 接进你的 Grafana 实例—— 仪表盘、数据源、统一 SQL、告警与 IRM。三条硬口径:服务账号 token + RBAC scopes 是前置门; 部分工具组默认禁用;整份仪表盘 JSON 是上下文窗口黑洞,官方备了 summary/JSONPath/patch 三件套。
Grafana's official MCP server (Apache-2.0, Go): plugs agents into your Grafana instance — dashboards, datasources, unified SQL, alerts and IRM. Three hard facts: a service-account token + RBAC scopes are the front gate; some tool groups are disabled by default; full dashboard JSON is a context-window black hole, and the official README ships summary/JSONPath/patch as the escape hatches.
适合与不适合When to use it, when not to
适合:agent 在自托管或 Grafana Cloud 上查仪表盘/指标/告警、改仪表盘、跨数据源统一 SQL。 不适合:零配置无 token 场景;Grafana 9.0 以下(部分功能因缺 API 端点不可用)。
Fits: agents querying dashboards/metrics/alerts on self-hosted or Grafana Cloud instances, editing dashboards, unified SQL across datasources. Not a fit: zero-config no-token scenarios (a service-account token is required); Grafana below 9.0 (some features lack API endpoints).
中文生态China availability 国产 / 国内可直接用 / 备案状态 · 快照domestic / direct access / CAC filing · snapshot 2026-10-23
- 出品属地Origin
- 国外出品foreign-made Grafana Labs(美国)。Grafana Labs (US).
- 国内使用Direct access
- 直连不可达direct blocked grafana.com 直连实测 000(网络受限,非死链);GitHub 仓与 raw README 经代理 200(2026-10-23)。grafana.com measured 000 direct (network restricted, not dead); the GitHub repo and raw README returned 200 via proxy (2026-10-23).
- 备案状态CAC filing
- 未见于备案名单not in filing list:未见于网信办公示名单(2026-10-23 检索);该产品未面向大陆公众提供服务,备案不适用。not in the CAC public registry (searched 2026-10-23); the product does not serve the mainland public, so filing does not apply.
备案信息以网信办《生成式人工智能服务已备案信息》公示名单为准(按批次滚动更新,本站只抄编号不解读);「大陆可直连」是本站从大陆网络直连实测的结果,不是厂商承诺。GitHub 类站点当日实测有波动,口径写在依据里。Filing status is quoted from the CAC public registry (updated batch by batch; this site copies the number and does not interpret it). "Direct access" is this site's own reachability measurement from a mainland network, not a vendor promise. GitHub-hosted sites fluctuated on the measurement day — the note says so.
固定坐标系Fixed coordinate system
11 个维度dimensions, 与同分区其他对象逐项可比each comparable item by item against others in the same section.
- 模型与开放条件Model & openness
它自己不调模型——被 MCP 客户端调用的接口实现。它把 Grafana 实例 (仪表盘、数据源、告警、OnCall/IRM 等)包装成工具给 agent 用。
It calls no model itself — an interface implementation called by MCP clients. It wraps your Grafana instance (dashboards, data sources, alerts, OnCall/IRM etc.) as tools for agents.
- 运行位置Where it runs
本地进程(uvx mcp-grafana stdio;官方另给 Docker、二进制、Helm 部署线); GitHub 3,593★,最近推送 2026-10-23,最新 release v2.1.1(2026-10-20,API 核验)。 完整功能要求 Grafana 9.0 或更新(官方 README:更早版本缺 API 端点,数据源类操作可能不可用)。
A local process (uvx mcp-grafana stdio; the official line also offers Docker, binary, Helm deployment paths); GitHub 3,593★, last push 2026-10-23, latest release v2.1.1 (2026-10-20, API verified). Full functionality requires Grafana 9.0 or newer (official README: older versions lack API endpoints, data-source operations may be unavailable).
- 本地文件Local files
不读写本机文件——作用域是 Grafana 实例与其连接的数据源; 统一 SQL 的凭据由数据源配置处理,官方 README 明写服务端看不到凭据。
Reads and writes no local files — the scope is the Grafana instance and its connected data sources; unified-SQL credentials are handled by data source configuration, the official README states the server never sees the credentials.
- 关机后的任务Tasks after shutdown
stdio 随客户端生死;无后台任务语义。
stdio lives and dies with the client; no background-task semantics.
- 工具与扩展Tools & extensions
仪表盘族(搜索/读取/摘要/JSONPath 属性提取/更新/创建/patch)、数据源族、 统一 SQL(ClickHouse/Snowflake/Athena/MySQL/PostgreSQL/MSSQL)、 Prometheus/Loki/CloudWatch/Elasticsearch 等查询族、Cloud Logging、RBAC 与用户管理族; 部分工具组(跑面板查询、查询示例、Graphite)默认禁用,要 --enabled-tools 开启。 完整清单以仓 README 为准。
Dashboard family (search/read/summary/JSONPath property extraction/update/create/patch), data source family, unified SQL (ClickHouse/Snowflake/Athena/MySQL/PostgreSQL/MSSQL), the Prometheus/Loki/CloudWatch/Elasticsearch query families, Cloud Logging, the RBAC and user-management families; some tool groups (running panel queries, query examples, Graphite) are disabled by default, enable with --enabled-tools. The complete inventory follows the repo README.
- 上下文与记忆Context & memory
无 server 侧跨会话记忆——状态在 Grafana 实例本身。 官方 README 专门警告:整份仪表盘 JSON 很吃上下文窗口, 优先用 summary/JSONPath/patch 这类省窗口的工具。
No server-side cross-session memory — state lives in the Grafana instance itself. The official README warns specifically: full dashboard JSON eats the context window, prefer the window-saving tools summary/JSONPath/patch.
- 权限与限制Permissions & limits
权限面是这条目的核心:Grafana 服务账号 token + RBAC 细粒度 scopes (官方 README 逐工具列最小动作);README 同时给了省事提示——内置 Editor 角色 比手工 scopes 粗,只在「方便比最小权限重要」时用。 SSE/streamable-http 线可另设调用方鉴权(--server-auth-token),stdio 不受影响。
The permission surface is the core of this entry: Grafana service account token + fine-grained RBAC scopes (the official README lists the minimum action per tool); the README also gives a convenience note — the built-in Editor role is coarser than hand-made scopes, use it only when "convenience matters more than least privilege". The SSE/streamable-http line can set separate caller authentication (--server-auth-token); stdio is unaffected.
- 适合什么任务Best for
适合:agent 在自托管或 Grafana Cloud 上查仪表盘/指标/告警、改仪表盘、 跨数据源统一 SQL 查询。 不适合:零配置无 token 场景(要服务账号 token);Grafana 9.0 以下(部分功能缺)。
Fits: agents querying dashboards/metrics/alerts, modifying dashboards, and running cross-data-source unified SQL on self-hosted or Grafana Cloud instances. Not a fit: zero-config tokenless scenarios (a service account token is required); Grafana below 9.0 (some features missing).
- 传输方式Transport
stdio(uvx mcp-grafana)为主;官方另提供 SSE/streamable-http 服务模式 (可加调用方鉴权)。核验:仓 README(2026-10-23 直抓)。
stdio (uvx mcp-grafana) is primary; the official line also provides an SSE/streamable-http server mode (with optional caller auth). Verified: repo README (fetched directly 2026-10-23).
- 认证机制Authentication
服务端用 GRAFANA_SERVICE_ACCOUNT_TOKEN 连 Grafana;客户端侧可选 --server-auth-token Bearer(仅 SSE/streamable-http 生效)。 官方 README:启用调用方鉴权时,验证过的 Authorization 头会在到达 Grafana 前被剥掉。
Server side connects to Grafana with GRAFANA_SERVICE_ACCOUNT_TOKEN; client side optional --server-auth-token Bearer (only effective for SSE/streamable-http). Official README: when caller auth is enabled, validated Authorization headers are stripped before reaching Grafana.
- 权限范围Permission scope
读写都有:仪表盘读 + 更新/创建/patch,告警与 IRM 线有写动作; 每工具最小 RBAC 动作 README 有列表。SQL 凭据走数据源配置,server 不经手。
Both read and write: dashboard reads + update/create/patch, alert and IRM lines have write actions; the minimum RBAC action per tool is listed in the README. SQL credentials go through data source configuration, the server never handles them.
头号误解Top misconception
- 把「开源」当「零配置」——要 GRAFANA_URL 加服务账号 token,RBAC scopes 决定哪些工具真能用Treating "open source" as "zero config" — it needs GRAFANA_URL plus a service-account token, and RBAC scopes decide which tools actually work
- 默认拉整份仪表盘 JSON——官方 README 明说吃上下文窗口,summary/JSONPath/patch 才是预期用法Pulling full dashboard JSON by default — the official README warns it eats the context window; summary/JSONPath/patch are the intended tools
- 以为所有工具都在——跑面板查询、查询示例、Graphite 等默认禁用,要 --enabled-toolsAssuming every tool is on — run-panel-query, query examples and Graphite are disabled by default and need --enabled-tools
- 图省事直接给 Editor 角色——官方提示它比手工 scopes 粗,严格最小权限场景别用它Grabbing the built-in Editor role for convenience — the README notes it is coarser than hand-applied scopes; avoid it under strict least-privilege
未知项清单Known unknowns
- 工具全清单与逐工具 RBAC 动作映射(README 有列表,未逐条清点)
- SSE/streamable-http 服务模式的当前使用面(README 有模式说明;官方未提供托管端点)
- Docker/Helm 部署线的功能边界(未逐条核验)
- The full tool inventory and the per-tool RBAC action mapping (the README has lists, not enumerated item by item)
- The current usage surface of the SSE/streamable-http server mode (the README explains the mode; the official side provides no hosted endpoint)
- The functional boundaries of the Docker/Helm deployment lines (not verified item by item)
证据来源Evidence sources
判断可回到以下一手源复核。本站核验日Every judgement can be rechecked against the primary sources below. Verified on 2026-10-23,内容更新日content updated on 2026-10-23。
| 类型Type | 名称Name | 链接Link |
|---|---|---|
| repo | grafana/mcp-grafana · 仓库(Apache-2.0;3,593★,最近推送 2026-10-23,GitHub API 核验)grafana/mcp-grafana · repository (Apache-2.0; 3,593★, last push 2026-10-23, GitHub API verified) | https://github.com/grafana/mcp-grafana |
| changelog | grafana/mcp-grafana · Releases(v2.1.1 @ 2026-10-20)grafana/mcp-grafana · Releases (v2.1.1 @ 2026-10-20) | https://github.com/grafana/mcp-grafana/releases |
| docs | Grafana Cloud · MCP 文档页(官方文档线;直抓 000 网络受限,未逐页核验)Grafana Cloud · MCP docs page (official docs line; direct fetch 000 network-restricted, not page-verified) | https://grafana.com/docs/grafana-cloud/machine-learning/mcp/ |
实测记录Measured runs
本档未在真实客户端逐项跑通;工具清单与权限来自官方 README。
This site has not completed measured runs. The test protocol is at protocols/mcp/_protocol.md.
相关条目Related entries
- Sentry MCPSentry MCP / Toolkit同为可观测面:Sentry 聚焦错误 issue 分诊,Grafana 是仪表盘与数据源查询面。Both observability surfaces: Sentry focuses on error-issue triage, Grafana is the dashboard and data-source query surface.
- Datadog MCPDatadog MCP Server同大类对照:Grafana 开源可自托管,Datadog 闭源官方托管加凭据透传。Same-category contrast: Grafana is open source and self-hostable, Datadog is closed source with official hosting plus credential pass-through.
- CursorCursor另一层 · AI 编程Other layer · AI coding
- Claude Code IDE 扩展Claude Code (IDE extension)另一层 · AI 编程Other layer · AI coding
本页由This page is generated from the ai-handbook 数据层生成(CC BY 4.0)。data layer (CC BY 4.0).
方法论与坐标系定义见仓库内For the methodology and coordinate definitions, see METHODOLOGY.md.