目录
1. 简介
Prometheus Alertmanager MCP 是 Prometheus Alertmanager 的模型上下文协议(MCP) 服务器。它使 AI 助手和工具能够以编程方式安全地查询和管理 Alertmanager 资源。
2. 特点
- [x] 查询 Alertmanager 状态、警报、静默、接收器和警报组
- [x] 创建、更新和删除静默
- [x] 创建新警报
- [x] 身份验证支持(通过环境变量进行基本身份验证)
- [x] Docker 容器化支持
3. 快速入门
3.1. 先决条件
- Python 3.12+
- uv (用于快速依赖管理)。
- Docker(可选,用于容器化部署)。
- 确保您的 Prometheus Alertmanager 服务器可从运行此 MCP 服务器的环境访问。
3.2. 通过 Smithery 安装
要通过Smithery自动为 Claude Desktop 安装 Prometheus Alertmanager MCP 服务器:
3.3. 本地运行
- 克隆存储库:
- 通过 .env 文件或系统环境变量配置 Prometheus 服务器的环境变量:
- 将服务器配置添加到客户端配置文件中。例如,对于 Claude Desktop:
- 或者使用 make 命令安装:
- 重新启动 Claude Desktop 以加载新配置。
- 您现在可以要求 Claude 使用自然语言与 Alertmanager 进行交互:
- “显示当前警报”
- “过滤与 CPU 问题相关的警报”
- “获取此警报的详细信息”
- “在接下来的 2 小时内将此警报设置为静默”
3.4. Docker 运行
- 使用预先构建的图像运行它(或者您可以自己构建它):
- 在 Claude Desktop 中使用 Docker 运行:
此配置通过使用仅带有变量名的-e
标志,并在env
对象中提供实际值,将环境变量从 Claude Desktop 传递到 Docker 容器。
4.工具
MCP 服务器公开了用于查询和管理 Alertmanager 的工具,遵循其 API v2 :
- 获取状态:
get_status()
- 列出警报:
get_alerts()
- 列出沉默:
get_silences()
- 创建静默:
post_silence(silence_dict)
- 删除静默:
delete_silence(silence_id)
- 列出接收器:
get_receivers()
- 列出警报组:
get_alert_groups()
有关完整的 API 详细信息,请参阅src/alertmanager_mcp_server/server.py 。
5.开发
欢迎贡献代码!如果您有任何建议或改进,请提交 issue 或 pull request。
本项目使用uv来管理依赖项。请按照您平台的说明安装 uv。
6. 许可证
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Tools
alertmanager-mcp-服务器
Related MCP Servers
- AsecurityAlicenseAqualityA simple MCP server that can send notifications on mac devices.Last updated -598TypeScriptMIT License
- Python
- PythonMIT License
- PythonMIT License