跳过安装。2 分钟内即可运行。
在 cloud.anythingmcp.com 开始免费试用,一键添加 Grafana,然后将你的 AI 客户端(Claude、ChatGPT、Copilot 或 Cursor)指向生成的 MCP 端点。无需 Docker,无需 git clone,无需任何工程经验。
摘要
让你的 AI 读取你的 Grafana:搜索仪表板并查看其面板和查询,查询 Prometheus、Loki 和 SQL 数据源,查看哪些告警正在触发以及规则是如何定义的,读取和添加注释,并列出联系点、用户和团队。支持 Grafana Cloud 和自托管的 Grafana。
试试这样问
Grafana 的示例提示
点击任意提示即可复制,然后粘贴到 Claude、ChatGPT、Cursor、Gemini、Copilot 或 OpenClaw 中,在该连接器上运行。
Claude 是 AI,可能会出错。请核对回答。
💡 无需安装? 直接使用 cloud.anythingmcp.com。 登录、点击 Connectors → Grafana、粘贴凭证、生成 MCP API key,即可完成。无 Docker、无
git clone、无本地服务器。
Grafana + Meta Muse
让你的 AI 读取你的 Grafana:搜索仪表板并查看其面板和查询,查询 Prometheus、Loki 和 SQL 数据源,查看哪些告警正在触发以及规则是如何定义的,读取和添加注释,并列出联系点、用户和团队。支持 Grafana Cloud 和自托管的 Grafana。
前提条件
完整的设置说明已内置在连接器中 (在 store 中选择连接器时可见)。所需环境变量:
GRAFANA_URL, GRAFANA_SERVICE_ACCOUNT_TOKEN
步骤 1 — 获取凭证
- 把
GRAFANA_URL设为你打开 Grafana 时使用的地址,末尾不要带斜杠:Grafana Cloud 上是https://your-stack.grafana.net,自有地址则如https://grafana.example.com(如果 Grafana 运行在某个路径下,则为https://example.com/grafana)。在 AnythingMCP Cloud 上,该实例必须能从互联网访问。 - 在 Grafana 中打开 Administration → Users and access → Service accounts,点击 Add service account,为它命名(例如 AnythingMCP),并赋予 Viewer 角色。
- 打开该服务账户,点击 Add service account token,选择有效期并复制令牌。它以
glsa_开头,Grafana 只显示一次。 - 把它粘贴到
GRAFANA_SERVICE_ACCOUNT_TOKEN,不要加 Bearer 一词,然后安装连接器。令牌只能访问该服务账户所属的组织。 - 用
grafana_get_current_org检查设置:它会显示令牌对应的组织。grafana_get_health即使没有令牌也会响应,因此它会显示 Grafana 版本,但不能证明令牌可用。
选择哪个角色:Viewer 涵盖仪表板、文件夹、数据源、查询、告警规则、正在触发的告警、注释和联系点。列出用户和团队需要 Admin,添加注释需要 Editor。在 Grafana Cloud 和 Grafana Enterprise 上,服务账户还需要对每个要读取的数据源拥有查询权限。
它能做什么:搜索仪表板和文件夹,读取仪表板的面板及其 PromQL、LogQL 或 SQL 查询;通过 Grafana 对 Prometheus(或 Mimir)、Loki 和 SQL 数据源运行查询;查看当前有哪些告警正在触发、它们的规则如何定义,以及哪些联系点会收到通知;读取在图表上标记部署和事故的注释;列出组织的用户和团队。
只有一项修改,而且 AI 会先问你:连接器唯一能做的修改是用 grafana_create_annotation 添加注释,所有人都会在仪表板上看到它。添加之前,AI 会给你看文本、时间和标签,并等你同意。这里没有任何操作会修改仪表板、数据源或告警规则,也不会删除任何内容。
机密信息留在 Grafana 中:数据源的密码和密钥永远不会返回;联系点也不附带其设置,因为设置中包含 Webhook URL 和密钥。
限制:查询结果在约 60 KB 处截断,因此 AI 会在查询中进行聚合(sum、topk、rate),并让时间范围保持较短。以较新的 v2 schema 保存的仪表板(带标签页或自动网格布局的 Grafana 12 仪表板)可能无法通过此 API 读取;这时 Grafana 会返回一个指明新 API 的错误。
常见错误:401 Invalid API key:令牌错误、已过期或已删除,或者 GRAFANA_URL 指向了另一个 stack。403:服务账户的角色太低(用户和团队需要 Admin,注释需要 Editor),或者它对该数据源没有查询权限。404:此组织中没有该 uid 的仪表板、数据源或规则,或者 GRAFANA_URL 中的路径有误。查询返回 400:表达式对该数据源无效,错误信息会说明原因。
该连接器不会创建或修改仪表板、数据源、告警规则、联系点、静默规则或用户,不会删除任何内容,也不涉及 Grafana OnCall、Grafana Incident 或 Grafana Cloud stack API。
步骤 2 — 安装 adapter
curl -fsSL https://raw.githubusercontent.com/HelpCode-ai/anythingmcp/main/docker-compose.quickstart.yml -o docker-compose.yml
printf 'JWT_SECRET=%s\nENCRYPTION_KEY=%s\n' "$(openssl rand -hex 32)" "$(openssl rand -hex 32)" > .env
docker compose up -d
步骤 3 — 在 Muse 中添加连接器
你的服务器 URL: 在 AnythingMCP 中打开 MCP Servers → 此连接器所在的服务器,复制它的 URL(
https://cloud.anythingmcp.com/mcp/…)。本指南中出现YOUR_SERVER_ID的地方都用它替换。
Muse 以自定义连接器的形式添加远程 MCP 服务器,并通过 OAuth 登录。
- 在 Muse 中打开 Settings → Connectors,选择 Add custom connector。
- 粘贴 MCP 服务器 URL
https://cloud.anythingmcp.com/mcp/YOUR_SERVER_ID。 - Muse 会打开 AnythingMCP 的登录页面:登录并批准访问。
- 在聊天中,向 Muse 提出需要用到
Grafana的工具的请求。
你也可以在聊天中完成设置,适用于网页版、iOS 和 Android 应用以及 WhatsApp。给 Muse 发送这条消息:
Create a Custom Connector for a new remote MCP server, then connect to it:
Name: AnythingMCP
Transport: remote streamable HTTP
URL: https://cloud.anythingmcp.com/mcp/YOUR_SERVER_ID
Auth: OAuth
自托管?请用你实例的公网 HTTPS 地址替换 https://cloud.anythingmcp.com。Muse 从 Meta 的云端连接,因此 localhost 无法使用。
可用工具
| Tool | What it does |
|---|---|
grafana_get_health | Check that the Grafana instance is up: database state, Grafana version and commit |
grafana_get_current_org | Read the Grafana organization the service account token belongs to: id and name |
grafana_search | Search dashboards and folders by title, tag or folder: uid, title, type (dash-db for dashboards, dash-folder for folders), tags, folder and… |
grafana_list_folders | List folders: uid and title, top level by default or the subfolders of a parent |
grafana_get_dashboard | Read a dashboard by uid in a compact form: title, tags, folder, time range, variables (name, type, current value) and panels with id… |
grafana_list_datasources | List the data sources: uid, name, type (prometheus, loki, postgres...), URL, access mode and which one is the default |
grafana_get_datasource | Read one data source by uid: name, type, URL, access mode, default flag and its non-secret settings (jsonData) |
grafana_query_datasource | Run a query against a data source through Grafana and return the result frames: a PromQL query for Prometheus or Mimir, a LogQL query for… |
grafana_list_alert_rules | List the Grafana-managed alert rules: uid, title, folder, rule group, paused or not, pending period (for), labels, summary, what happens on… |
grafana_get_alert_rule | Read one alert rule by uid: title, folder, group, condition, the queries and expressions it evaluates (data source uid, expression, time… |
grafana_list_firing_alerts | List the alert instances in Grafana's Alertmanager, by default the active ones (firing): alert name and labels, summary and description… |
grafana_list_annotations | List annotations (event markers on graphs such as deployments or incidents, and alert state changes): id, time and end time (epoch… |
grafana_create_annotation | Add an annotation (an event marker such as a deployment, incident or maintenance window) that shows on graphs for everyone who opens the… |
grafana_list_org_users | List the users of the organization: user id, login, email, name, role (Viewer, Editor, Admin), last seen and disabled flag |
grafana_search_teams | Search the teams of the organization: id, uid, name, email and member count |
grafana_list_contact_points | List the alerting contact points (where notifications go): uid, name, integration type (email, slack, pagerduty, webhook...) and whether… |
示例提示
- “Grafana 里现在有哪些告警正在触发?对每个告警,给我看它背后的规则以及接收通知的联系点。”
- “找到我们的 API 延迟仪表板,解释每个面板显示什么、运行的是哪个查询。”
- “在 Prometheus 中查询过去一小时每个服务的 5xx 响应速率,告诉我哪个服务最差。”
- “给我看 Loki 在过去 30 分钟内为 checkout 应用记录的错误日志行,并按消息分组。”
- “在今天 14:05 添加一条注释‘Deployed v2.4.1’,标签为 deploy。添加前先给我看文本、时间和标签。”
FAQ
Muse 在哪些地区可用? Meta 目前在美国和加拿大提供 Muse,可在网页版、iOS 和 Android 应用以及 WhatsApp 中使用。
Meta 会审核这个连接器吗? 不会。Meta 不审核自定义连接器。Muse 只能看到你在 AnythingMCP 中为此 MCP 服务器启用的工具,你也可以随时在 Settings → Connectors 中断开它。
下一步
这份指南对你有帮助吗?