Prometheus Alertmanager MCP
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
Table of Contents
- Table of Contents
- 1. Introduction
- 2. Features
- 3. Quickstart
- 3.1. Prerequisites
- 3.2. Installing via Smithery
- 3.3. Local Run
- 3.4. Docker Run
- 4. Tools
- 5. Development
- 6. License
1. Introduction
Prometheus Alertmanager MCP is a Model Context Protocol (MCP) server for Prometheus Alertmanager. It enables AI assistants and tools to query and manage Alertmanager resources programmatically and securely.
2. Features
- [x] Query Alertmanager status, alerts, silences, receivers, and alert groups
- [x] **Smart pagination support** to prevent LLM context window overflow when handling large numbers of alerts
- [x] Create, update, and delete silences
- [x] Create new alerts
- [x] Authentication support (Basic auth via environment variables)
- [x] Multi-tenant support (via ALERTMANAGER_TENANT for Mimir/Cortex)
- [x] Docker containerization support
3. Quickstart
3.1. Prerequisites
- Python 3.12+
- uv (for fast dependency management).
- Docker (optional, for containerized deployment).
- Ensure your Prometheus Alertmanager server is accessible from the environment where you'll run this MCP server.
3.2. Installing via Smithery
To install Prometheus Alertmanager MCP Server for Claude Desktop automatically via Smithery:
3.3. Local Run
- Clone the repository:
- Configure the environment variables for your Prometheus server, either through a .env file or system environment variables:
Multi-tenant Support
For multi-tenant Alertmanager deployments (e.g., Grafana Mimir, Cortex), set the tenant ID via the ALERTMANAGER_TENANT environment variable. The tenant is fixed at startup and is **never taken from a request header** — caller-supplied X-Scope-OrgId values are ignored to prevent a client from selecting an arbitrary tenant.
Transport configuration
You can control how the MCP server communicates with clients using the transport options and host/port settings. These can be set either with command-line flags (which take precedence) or with environment variables.
- MCP_TRANSPORT: Transport mode. One of stdio, http, or sse. Default: stdio.
- MCP_HOST: Host/interface to bind when running http or sse transports (used by the embedded uvicorn server). Default: 127.0.0.1.
- MCP_PORT: Port to listen on when running http or sse transports. Default: 8000.
- MCP_API_KEY: **Optional** bearer/API key. When set, every http/sse request must send Authorization: Bearer or it is rejected with 401. When unset, the server logs a startup warning that the web transports are unauthenticated. Strongly recommended for any deployment reachable over a network.
> **Security**: For network-accessible deployments, always set MCP_API_KEY. By default the server binds to loopback only (127.0.0.1); expose it on 0.0.0.0 only behind a trusted proxy or firewall when you require external access.
Examples:
Use environment variables to set defaults (CLI flags still override):
Or pass flags directly to override env vars:
Notes:
- The stdio transport communicates over standard input/output and ignores host/port.
- The http (streamable HTTP) and sse transports are served via an ASGI app (uvicorn) so host/port are respected when using those transports.
- Add the server configuration to your client configuration file. For example, for Claude Desktop: