MCP Server for Prometheus Alertmanager integration
Project description
Table of Contents
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
- Query Alertmanager status, alerts, silences, receivers, and alert groups
- Create, update, and delete silences
- Create new alerts
- Authentication support (Basic auth via environment variables)
- 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. Local Run
- Clone the repository:
# Clone the repository
$ git clone https://github.com/ntk148v/alertmanager-mcp-server.git
- Configure the environment variables for your Prometheus server, either through a .env file or system environment variables:
# Set environment variables (see .env.sample)
ALERTMANAGER_URL=http://your-alertmanager:9093
ALERTMANAGER_USERNAME=your_username # optional
ALERTMANAGER_PASSWORD=your_password # optional
- Add the server configuration to your client configuration file. For example, for 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 Run
- Run it with pre-built image (or you can build it yourself):
$ 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
- Running with Docker in Claude Desktop:
{
"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"
}
}
}
}
This configuration passes the environment variables from Claude Desktop to the Docker container by using the -e flag with just the variable name, and providing the actual values in the env object.
4. Tools
The MCP server exposes tools for querying and managing Alertmanager, following its API v2:
- Get status:
get_status() - List alerts:
get_alerts() - List silences:
get_silences() - Create silence:
post_silence(silence_dict) - Delete silence:
delete_silence(silence_id) - List receivers:
get_receivers() - List alert groups:
get_alert_groups()
See src/alertmanager_mcp_server/server.py for full API details.
5. Development
Contributions are welcome! Please open an issue or submit a pull request if you have any suggestions or improvements.
This project uses uv to manage dependencies. Install uv following the instructions for your platform.
# 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. License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file alertmanager_mcp_server-1.0.0.tar.gz.
File metadata
- Download URL: alertmanager_mcp_server-1.0.0.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9838cad18d386bf0b07523dcd23d70cbf0d7b950b3b506934db1cd2642ec7e7
|
|
| MD5 |
3e58276f6a7424b8a876157dc4de291a
|
|
| BLAKE2b-256 |
e60b0a9472223e7fd7e2b3bfa0a91b2848513bda0321d50da967cb7d7b77bce4
|
Provenance
The following attestation bundles were made for alertmanager_mcp_server-1.0.0.tar.gz:
Publisher:
publish.yaml on ntk148v/alertmanager-mcp-server
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
alertmanager_mcp_server-1.0.0.tar.gz -
Subject digest:
e9838cad18d386bf0b07523dcd23d70cbf0d7b950b3b506934db1cd2642ec7e7 - Sigstore transparency entry: 212805708
- Sigstore integration time:
-
Permalink:
ntk148v/alertmanager-mcp-server@95f88cdd2231f0e1b66dfb6f8949b793a55981d0 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/ntk148v
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@95f88cdd2231f0e1b66dfb6f8949b793a55981d0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file alertmanager_mcp_server-1.0.0-py3-none-any.whl.
File metadata
- Download URL: alertmanager_mcp_server-1.0.0-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34326d24d192a0f10e8ba056186fc5f34fc202e2f0439dd2709a260cbb8f622d
|
|
| MD5 |
553cb1eed2a36b5aa9a4b95da6700cbe
|
|
| BLAKE2b-256 |
e447c6b1c4a4d86e8c53c7099b0a6393de77510b8a87995e4cb29d889d9cd319
|
Provenance
The following attestation bundles were made for alertmanager_mcp_server-1.0.0-py3-none-any.whl:
Publisher:
publish.yaml on ntk148v/alertmanager-mcp-server
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
alertmanager_mcp_server-1.0.0-py3-none-any.whl -
Subject digest:
34326d24d192a0f10e8ba056186fc5f34fc202e2f0439dd2709a260cbb8f622d - Sigstore transparency entry: 212805711
- Sigstore integration time:
-
Permalink:
ntk148v/alertmanager-mcp-server@95f88cdd2231f0e1b66dfb6f8949b793a55981d0 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/ntk148v
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@95f88cdd2231f0e1b66dfb6f8949b793a55981d0 -
Trigger Event:
push
-
Statement type: