Install
$ agentstack add mcp-tay3223-mcp-server-prometheus ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
About
Prometheus MCP 服务器 🚀
大家好!这是一个超级简单易用的工具,它可以帮助你把 Prometheus(一个监控系统)的数据展示在 Cursor(一个超智能的代码编辑器)中。通过这个工具,你可以直接在 Cursor 中查看各种监控数据,就像跟 AI 助手聊天一样简单!
🌟 这个工具能做什么?
- 📊 查看实时数据:随时查看监控指标
- 📈 查看历史趋势:了解一段时间内的数据变化
- 🏷️ 查看标签信息:浏览所有监控标签
- 📝 查看详细信息:获取监控指标的详细说明
- 🎯 查看监控目标:了解正在监控哪些服务
- ⚠️ 查看告警信息:及时发现系统问题
- 📋 查看监控规则:了解监控的具体设置
- 🔐 安全可靠:支持API密钥保护
🚀 三步搞定部署
第一步:下载和安装
- 确保你的电脑已经安装了 Go语言(版本 1.21 或更高)
- 打开终端,输入以下命令:
```bash # 下载代码 git clone https://github.com/tay3223/mcp-server-prometheus.git
# 进入项目目录 cd mcp-server-prometheus
# 编译程序(Windows用户使用 mcp-server-prometheus.exe) go build -o mcp-server-prometheus cmd/server/main.go ```
第二步:启动服务
- 找到你的 Prometheus 服务地址(比如:http://localhost:9090)
- 启动服务器(选择下面任意一种方式):
方式一:直接运行(会自动生成API密钥) ``bash ./mcp-server-prometheus --prometheus=http://localhost:9090 ``
方式二:使用自定义API密钥 ``bash ./mcp-server-prometheus --prometheus=http://localhost:9090 --api-key=你的密钥 ``
方式三:使用环境变量 ``bash export PROMETHEUS_HOST=http://localhost:9090 export MCP_API_KEY=你的密钥 ./mcp-server-prometheus ``
- 看到类似下面的输出就说明启动成功了:
`` 生成的API Key: xxxxxxxx(记住这个密钥!) 连接到Prometheus服务器: http://localhost:9090 启动Prometheus MCP服务器... ``
第三步:配置 Cursor
- 打开 Cursor 编辑器
- 按下
Command + Shift + P(Windows用户按Ctrl + Shift + P)
- 输入
Open Settings (JSON),回车
- 在设置文件中添加下面的配置(记得替换其中的值):
``json { "mcpServers": { "prometheus": { "url": "http://localhost:8080", // 改成你的MCP服务器地址 "defaultArguments": { "X-API-Key": "你的密钥" // 改成你的API密钥 } } } } ``
- 保存设置文件
🎮 如何使用
- 打开 Cursor,创建或打开任意文件
- 确保 Cursor 的 AI 助手设置为 "Auto" 模式:
- 点击右下角的 AI 图标
- 选择 "Auto" 模式
- 在编辑器中输入类似下面的问题:
`` 查询一下现在系统的运行状态 ``
- AI 助手会自动调用 Prometheus 查询,并给你友好的回答!
📝 常用查询示例
# 查看某个服务是否在线
"查询 nginx 服务的在线状态"
# 查看 CPU 使用率
"最近一小时的 CPU 使用率是多少?"
# 查看内存使用情况
"当前系统内存使用情况如何?"
# 查看磁盘空间
"哪些磁盘的使用率超过了 80%?"
# 查看网络流量
"过去 30 分钟的网络流入流量是多少?"
🔧 常见问题
- 问:启动时报错 "connection refused"?
答:检查你的 Prometheus 地址是否正确,并确保可以访问
- 问:Cursor 中无法连接到服务器?
答:检查服务器地址和 API 密钥是否配置正确
- 问:查询时提示 "unauthorized"?
答:检查 API 密钥是否正确
🤝 需要帮助?
- 遇到问题?欢迎提交 Issue
- 有改进建议?欢迎提交 PR
- 想学习更多?查看Prometheus 官方文档
📜 开源协议
本项目采用 [MIT 协议](LICENSE) 开源,欢迎自由使用!
Source & license
This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: tay3223
- Source: tay3223/mcp-server-prometheus
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.