GM

grafana/mcp-grafana

分析与监控官方

本页由 AI 翻译,技术细节请以原文为准。 查看原文

3631 stars 483 forks 质量 90 趋势 54Apache-2.0

Grafana 的 MCP 服务器

概览

Grafana 的模型上下文协议(MCP)服务器。 这为你提供了对 Grafana 实例及周边生态系统的访问。 需要 UV。在你的 MCP 客户端配置中添加以下内容(例如 Claude Desktop,光标): 对于 Grafana Cloud,请将GRAFANA_URL替换为你的实例 URL(例如 [[T0])。更多安装选项包括 Docker、二进制和 Helm 在内,请参见使用情况。 - 是完整功能所必需的。某些功能,尤其是与数据源相关的操作,由于缺少API端点,可能无法在早期版本中正常工作。 以下功能目前可在MCP服务器中提供。本列表仅供参考,不构成未来功能的路线图或承诺。 - 按标题或其他元数据查找仪表盘- 使用唯一标识符检索完整仪表盘细节。警告:大型仪表盘可能会占用大量上下文窗口空间。

概述(AI 翻译)

一个为Grafana设计的[模型上下文协议][MCP](MCP)服务器。

这为你提供了对 Grafana 实例及周边生态系统的访问。

快速启动

需要 UV。在你的 MCP 客户端配置中添加以下内容(例如 Claude Desktop,光标):

对于 Grafana Cloud,将 GRAFANA_URL 替换为你的实例 URL(例如 https://myinstance.grafana.net)。更多安装选项包括 Docker、二进制和 Helm 的使用情况。

要求

  • Grafana 9.0 或更高版本 才能实现完整功能。某些功能,尤其是与数据源相关的操作,由于缺少 API 端点,可能无法在早期版本中正常工作。

特色

以下_The功能目前可在MCP服务器中提供。本列表仅供参考,不构成未来路线图或未来承诺features._

仪表板

  • 搜索仪表盘: 按标题、文件夹 UID、标签或星号状态查找仪表盘
  • 通过UID获取仪表盘: 使用其唯一标识符获取完整仪表盘细节。通过可选的version来加载已保存的快照,而非当前仪表盘。Warning:大型仪表盘可能占用大量上下文窗口space.

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Grafana MCP server

A [Model Context Protocol][mcp] (MCP) server for Grafana.

This provides access to your Grafana instance and the surrounding ecosystem.

Quick Start

Requires uv. Add the following to your MCP client configuration (e.g. Claude Desktop, Cursor):

{
  "mcpServers": {
    "grafana": {
      "command": "uvx",
      "args": ["mcp-grafana"],
      "env": {
        "GRAFANA_URL": "http://localhost:3000",
        "GRAFANA_SERVICE_ACCOUNT_TOKEN": ""
      }
    }
  }
}

For Grafana Cloud, replace GRAFANA_URL with your instance URL (e.g. https://myinstance.grafana.net). See Usage for more installation options including Docker, binary, and Helm.

Requirements

  • Grafana version 9.0 or later is required for full functionality. Some features, particularly datasource-related operations, may not work correctly with earlier versions due to missing API endpoints.

Features

The following features are currently available in MCP server. This list is for informational purposes only and does not represent a roadmap or commitment to future features.

Dashboards

  • Search for dashboards: Find dashboards by title, folder UID, tag, or starred status
  • Get dashboard by UID: Retrieve full dashboard details using its unique identifier. Pass optional version to load a saved snapshot instead of the current dashboard. Warning: Large dashboards can consume significant context window space.
  • List dashboard versions: List saved versions of a dashboard as compact metadata (version number, author, timestamp, save message)
  • Get dashboard summary: Get a compact overview of a dashboard including title, panel count, panel types, variables, and metadata without the full JSON to minimize context window usage
  • Get dashboard property: Extract specific parts of a dashboard using JSONPath expressions (e.g., $.title, $.panels[*].title) to fetch only needed data and reduce context window consumption
在 GitHub 查看完整 README

安装

uvx mcp-grafana
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "grafana": { "command": "uvx", "args": ["mcp-grafana"], "env": { "GRAFANA_URL": "http://localhost:3000", "GRAFANA_SERVICE_ACCOUNT_TOKEN": "<your service account token>" } } } }