modelscope·@grafana/mcp-grafana
一种用于 Grafana 的模型上下文协议(MCP)服务器。 这为您提供了对 Grafana 实例及其周边生态系统的访问。
一个用于 Grafana 的 Model Context Protocol (MCP) 服务器。
它提供了对您的 Grafana 实例及其周围生态系统的访问。
工具列表是可配置的,因此您可以选择要向 MCP 客户端提供的工具。
如果您不使用某些功能,或者不想占用太多上下文窗口空间,这将非常有用。
要禁用某一类工具,在启动服务器时使用 --disable-<category> 标志。例如,要禁用
OnCall 工具,请使用 --disable-oncall。
| Tool | Category | Description |
|---|---|---|
search_dashboards | Search | Search for dashboards |
get_dashboard_by_uid | Dashboard | Get a dashboard by uid |
list_datasources | Datasources | List datasources |
get_datasource_by_uid | Datasources | Get a datasource by uid |
get_datasource_by_name | Datasources | Get a datasource by name |
query_prometheus | Prometheus | Execute a query against a Prometheus datasource |
list_prometheus_metric_metadata | Prometheus | List metric metadata |
list_prometheus_metric_names | Prometheus | List available metric names |
list_prometheus_label_names | Prometheus | List label names matching a selector |
list_prometheus_label_values | Prometheus | List values for a specific label |
list_incidents | Incident | List incidents in Grafana Incident |
create_incident | Incident | Create an incident in Grafana Incident |
add_activity_to_incident | Incident | Add an activity item to an incident in Grafana Incident |
resolve_incident | Incident | Resolve an incident in Grafana Incident |
query_loki_logs | Loki | Query and retrieve logs using LogQL (either log or metric queries) |
list_loki_label_names | Loki | List all available label names in logs |
list_loki_label_values | Loki | List values for a specific log label |
query_loki_stats | Loki | Get statistics about log streams |
list_alert_rules | Alerting | List alert rules |
get_alert_rule_by_uid | Alerting | Get alert rule by UID |
list_oncall_schedules | OnCall | List schedules from Grafana OnCall |
get_oncall_shift | OnCall | Get details for a specific OnCall shift |
get_current_oncall_users | OnCall | Get users currently on-call for a specific schedule |
list_oncall_teams | OnCall | List teams from Grafana OnCall |
list_oncall_users | OnCall | List users from Grafana OnCall |
在 Grafana 中创建一个具有足够权限的服务账号,以便使用你想要使用的工具,生成服务账号令牌,并将其复制到剪贴板以供配置文件使用。详细步骤请参阅 [Grafana 文档][service-account]。
从 发布页面 下载最新版本的 mcp-grafana 并将其放置在你的 $PATH 中。
如果你已安装了 Go 工具链,也可以通过源码构建并安装它,使用 GOBIN 环境变量指定二进制文件应安装的目录。该目录也应包含在你的 PATH 中。
GOBIN="$HOME/go/bin" go install github.com/grafana/mcp-grafana/cmd/mcp-grafana@latest
将服务器配置添加到客户端配置文件中。例如,对于 Claude Desktop:
{
"mcpServers": {
"grafana": {
"command": "mcp-grafana",
"args": [],
"env": {
"GRAFANA_URL": "http://localhost:3000",
"GRAFANA_API_KEY": "<your service account token>"
}
}
}
}
注意:如果在 Claude Desktop 中看到
Error: spawn mcp-grafana ENOENT错误,你需要指定mcp-grafana的完整路径。
你可以通过向命令中添加 -debug 标志来启用 Grafana 传输的调试模式。这将提供 MCP 服务器与 Grafana API 之间 HTTP 请求和响应的详细日志记录,有助于故障排除。
要在 Claude Desktop 配置中使用调试模式,请按如下方式更新你的配置:
{
"mcpServers": {
"grafana": {
"command": "mcp-grafana",
"args": ["-debug"],
"env": {
"GRAFANA_URL": "http://localhost:3000",
"GRAFANA_API_KEY": "<your service account token>"
}
}
}
}
欢迎贡献!如果你有任何建议或改进,请打开一个问题或提交一个拉取请求。
此项目是用 Go 编写的。请按照适用于你平台的说明安装 Go。
要运行服务器,请使用:
make run
你也可以使用 Docker 内的 SSE 传输运行服务器。要构建镜像,请使用
make build-image
要运行镜像,请使用:
docker run -it --rm -p 8000:8000 mcp-grafana:latest
有三种类型的测试可用:
make test-unit
你也可以运行单元测试:
make test
make test-integration
make test-cloud
注意:云测试在 CI 中自动配置。对于本地开发,你需要设置自己的 Grafana Cloud 实例和凭据。
更全面的集成测试需要在本地端口 3000 上运行一个 Grafana 实例;你可以使用 Docker Compose 启动一个:
docker-compose up -d
集成测试可以这样运行:
`…
通过可配置的MCP服务器,启用管理Jenkins操作的功能,例如列出作业、触发构建和检查构建状态。
模型上下文协议(MCP)Jenkins集成是一种开源实现,它根据Anthropic的MCP规范将Jenkins与人工智能语言模型桥接起来。该项目在保持数据隐私和安全的同时,实现了与Jenkins工具的安全、基于上下文的人工智能交互。
通过标准化的Model Context Protocol接口提供对Prometheus指标和查询的访问,允许AI助手执行PromQL查询并分析指标数据。
通过 Model Context Protocol 服务器为 Vue 应用提供应用洞察,公开组件树、状态、路由和 Pinia 数据。
# 翻译 一个通过模型上下文协议提供访问Google Search Console数据的服务器,允许用户检索和分析具有自定义维度和报告周期的搜索分析数据。
一种通过模型上下文协议服务器访问 Prometheus 指标数据的工具,允许使用自然语言与监控数据进行交互。