KA

kaznak/alertmanager-mcp

效率工作流

本页由 AI 翻译,技术细节请以原文为准。 查看原文

10 stars 4 forks 质量 64 趋势 18MIT

A Model Context Protocol (MCP) server that integrates with Prometheus Alertmanager

概览

This project implements a Model Context Protocol (MCP) server that integrates with Prometheus Alertmanager. It serves as a bridge between Claude AI and Alertmanager, allowing Claude to interact with and manage alerts through a standardized interface. 1. : Fetches and formats current alerts from Alertmanager with optional filtering capabilities. 2. : Provides detailed information about specific alerts when referenced by their fingerprint. 3. : Offers tools to create, list, and delete silences that suppress notifications for specific alerts. 4. : Retrieves alert groups as organized by Alertmanager. - Built using TypeScript and the MCP SDK - Communicates with Alertmanager's HTTP API (v2) - Runs as a stdio-based process compatible with Claude for Desktop - Implements proper error handling and timeout management - Provides strongly-typed interfaces for alert and silence data - Access to a running Prometheus Alertmanager instance - For Claude for Desktop: Node.

README

以下为原文 README 节选,完整内容请查看原文。

Prometheus Alertmanager MCP Server

This project implements a Model Context Protocol (MCP) server that integrates with Prometheus Alertmanager. It serves as a bridge between Claude AI and Alertmanager, allowing Claude to interact with and manage alerts through a standardized interface.

Core Features

  1. Alert Retrieval: Fetches and formats current alerts from Alertmanager with optional filtering capabilities.

  2. Alert Details: Provides detailed information about specific alerts when referenced by their fingerprint.

  3. Silence Management: Offers tools to create, list, and delete silences that suppress notifications for specific alerts.

  4. Alert Grouping: Retrieves alert groups as organized by Alertmanager.

Technical Implementation

Installation

Prerequisites

Setup

The package is available on npm and can be used directly with npx:

npx alertmanager-mcp

For global installation:

npm install -g alertmanager-mcp
alertmanager-mcp

Usage with Claude for Desktop

  1. Configure Claude for Desktop to use the MCP server by editing the configuration file:
{
  "mcpServers": {
    "alertmanager": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "--network=host",
        "-e", "ALERTMANAGER_URL=http://your-alertmanager-url:9093",
        "ghcr.io/kaznak/alertmanager-mcp:latest"
      ],
      "env": {}
    }
  }
}
  1. Restart Claude for Desktop to load the new configuration.

  2. You can now ask Claude to interact with Alertmanager using natural language:

    • “Show me current alerts”
    • “Filter alerts related to CPU issues”
    • “Get details for this alert”
    • “Create a silence for this alert for the next 2 hours”

Available Tools

get-alerts

Retrieves a list of alerts with optional filtering.

Parameters:

  • filter: (optional) Filtering query (e.g., alertname=~'.*CPU.*')
  • silenced: (optional) Include silenced alerts
  • inhibited: (optional) Include inhibited alerts
  • active: (optional) Include active alerts (default: true)

get-alert-details

Gets detailed information about a specific alert.

在 GitHub 查看完整 README

安装

docker run --rm -i --network=host -e ALERTMANAGER_URL=http://your-alertmanager-url:9093 ghcr.io/kaznak/alertmanager-mcp:latest
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "alertmanager": { "command": "docker", "args": [ "run", "--rm", "-i", "--network=host", "-e", "ALERTMANAGER_URL=http://your-alertmanager-url:9093", "ghcr.io/kaznak/alertmanager-mcp:latest" ], "env": {} } } }