alertmanager-mcp-server

Apache 2.0
  • Linux
  • Apple

Integrations

  • Supports containerized deployment of the MCP server through Docker, with configuration via environment variables for connecting to Alertmanager instances.

  • Enables querying and managing Prometheus Alertmanager resources including status, alerts, silences, receivers, and alert groups. Supports creating new alerts, managing silences (create, update, delete), and retrieving alert information through the Alertmanager API v2.

目录

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. 本地运行

  • 克隆存储库:
# Clone the repository $ git clone https://github.com/ntk148v/alertmanager-mcp-server.git
  • 通过 .env 文件或系统环境变量配置 Prometheus 服务器的环境变量:
# Set environment variables (see .env.sample) ALERTMANAGER_URL=http://your-alertmanager:9093 ALERTMANAGER_USERNAME=your_username # optional ALERTMANAGER_PASSWORD=your_password # optional
  • 将服务器配置添加到客户端配置文件中。例如,对于 Claude Desktop:
{ "mcpServers": { "alertmanager": { "command": "uv", "args": [ "--directory", "<full path to alertmanager-mcp-server directory>", "run", "src/alertmanager_mcp_server/server.py" ], "env": { "ALERTMANAGER_URL": "http://your-alertmanager:9093s", "ALERTMANAGER_USERNAME": "your_username", "ALERTMANAGER_PASSWORD": "your_password" } } } }

3.3. Docker 运行

  • 使用预先构建的图像运行它(或者您可以自己构建它):
$ docker run -e ALERTMANAGER_URL=http://your-alertmanager:9093 \ -e ALERTMANAGER_USERNAME=your_username \ -e ALERTMANAGER_PASSWORD=your_password \ -p 8000:8000 ghcr.io/ntk148v/alertmanager-mcp-server
  • 在 Claude Desktop 中使用 Docker 运行:
{ "mcpServers": { "alertmanager": { "command": "docker", "args": [ "run", "--rm", "-i", "-e", "ALERTMANAGER_URL", "-e", "ALERTMANAGER_USERNAME", "-e", "ALERTMANAGER_PASSWORD", "ghcr.io/ntk148v/alertmanager-mcp-server:latest" ], "env": { "ALERTMANAGER_URL": "http://your-alertmanager:9093s", "ALERTMANAGER_USERNAME": "your_username", "ALERTMANAGER_PASSWORD": "your_password" } } } }

此配置通过使用仅带有变量名的-e标志并将环境变量从 Claude Desktop 传递到 Docker 容器,并在env对象中提供实际值。

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。

# Clone the repository $ git clone https://github.com/ntk148v/alertmanager-mcp-server.git $ uv venv $ source .venv/bin/activate # On Unix/macOS $ .venv\Scripts\activate # On Windows $ uv pip install -e . # run test $ pytest

6. 许可证

Apache 2.0


You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

alertmanager-mcp-服务器

  1. 简介
    1. 特点
      1. 快速入门
        1. 3.1. 先决条件
        2. 3.2. 本地运行
        3. 3.3. Docker 运行
      2. 4.工具
        1. 5.开发
          1. 许可证

            Related MCP Servers

            • A
              security
              A
              license
              A
              quality
              A simple MCP server that can send notifications on mac devices.
              Last updated -
              5
              9
              8
              TypeScript
              MIT License
              • Apple
            • -
              security
              A
              license
              -
              quality
              The MCP server that keeps you informed by sending the notification on phone using ntfy.sh
              Last updated -
              18
              6
              JavaScript
              Apache 2.0
              • Linux
              • Apple

            View all related MCP servers

            ID: oblhy82ylg