Skip to main content

MCP Server for Prometheus Alertmanager integration

Project description

Prometheus Alertmanager MCP

GitHub license GitHub stars

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

Apache 2.0


Made with ❤️ by @ntk148v

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

alertmanager_mcp_server-1.0.0.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

alertmanager_mcp_server-1.0.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

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

Hashes for alertmanager_mcp_server-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e9838cad18d386bf0b07523dcd23d70cbf0d7b950b3b506934db1cd2642ec7e7
MD5 3e58276f6a7424b8a876157dc4de291a
BLAKE2b-256 e60b0a9472223e7fd7e2b3bfa0a91b2848513bda0321d50da967cb7d7b77bce4

See more details on using hashes here.

Provenance

The following attestation bundles were made for alertmanager_mcp_server-1.0.0.tar.gz:

Publisher: publish.yaml on ntk148v/alertmanager-mcp-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file alertmanager_mcp_server-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for alertmanager_mcp_server-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 34326d24d192a0f10e8ba056186fc5f34fc202e2f0439dd2709a260cbb8f622d
MD5 553cb1eed2a36b5aa9a4b95da6700cbe
BLAKE2b-256 e447c6b1c4a4d86e8c53c7099b0a6393de77510b8a87995e4cb29d889d9cd319

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page