loading…
Search for a command to run...
loading…
A Prometheus Model Context Protocol Server.
A Prometheus Model Context Protocol Server.
codecov Go Report Card FOSSA Status
A Golang-based Model Context Protocol (MCP) server implementation for Prometheus that enables natural language interactions with Prometheus metrics and queries.
Built with Go, prometheus-mcp-server provides a robust, type-safe interface that maintains full consistency with the Prometheus HTTP API, allowing you to query and manage your Prometheus instance through natural language conversations with MCP-compatible clients.
prometheus-mcp-server is designed as a Golang microservice that acts as a bridge between MCP clients and Prometheus servers. It provides:
Pull the pre-built image from GitHub Container Registry:
# Pull the latest image
docker pull ghcr.io/yshngg/prometheus-mcp-server:latest
# Run with stdio transport (for desktop clients)
docker run --rm ghcr.io/yshngg/prometheus-mcp-server:latest --prom-addr="http://host.docker.internal:9090"
# Run with HTTP transport
docker run --rm -p 8080:8080 ghcr.io/yshngg/prometheus-mcp-server:latest --prom-addr="http://host.docker.internal:9090" --transport=http --mcp-addr="0.0.0.0:8080"
Alternatively, build locally:
docker build -t prometheus-mcp-server .
docker run -p 8080:8080 prometheus-mcp-server --prom-addr="http://prometheus:9090" --transport=http
Download the latest release from GitHub:
prometheus-mcp-server Releases# Linux/macOS example
tar -xzf prometheus-mcp-server-<version>.linux-amd64.tar.gz
./prometheus-mcp-server --prom-addr="http://localhost:9090"
# Windows example
unzip prometheus-mcp-server-<version>.windows-amd64.zip
prometheus-mcp-server.exe --prom-addr="http://localhost:9090"
git clone https://github.com/yshngg/prometheus-mcp-server.git
cd prometheus-mcp-server
make build
# Binary will be available as ./prometheus-mcp-server
Install the prometheus-mcp-server binary directly from source:
go install github.com/yshngg/prometheus-mcp-server@latest
Ensure $GOPATH/bin is in your $PATH.
Run the server by specifying your Prometheus address and preferred transport:
# Default (stdio transport) - ideal for desktop clients
prometheus-mcp-server --prom-addr="http://localhost:9090"
# HTTP transport - for web-based integrations
prometheus-mcp-server --prom-addr="http://localhost:9090" --transport=http --mcp-addr="localhost:8080"
# SSE transport - for real-time streaming (deprecated, use HTTP)
prometheus-mcp-server --prom-addr="http://localhost:9090" --transport=sse --mcp-addr="localhost:8080"
| Flag | Description | Default |
|---|---|---|
-help |
Show help information. | N/A |
-mcp-addr |
Address for the MCP server to listen on. | localhost:8080 |
-prom-addr |
Prometheus server URL. | http://localhost:9090 |
-transport |
Communication transport (stdio, http, sse). |
stdio |
-version |
Print version and exit. | N/A |
prometheus-mcp-server maintains 100% compatibility with the Prometheus HTTP API v1. Every tool and endpoint corresponds directly to the official Prometheus API:
| Tool | Prometheus Endpoint | HTTP Method | Purpose |
|---|---|---|---|
| Instant Query | /api/v1/query |
GET/POST | Execute instant queries |
| Range Query | /api/v1/query_range |
GET/POST | Execute range queries |
| Tool | Prometheus Endpoint | HTTP Method | Purpose |
|---|---|---|---|
| Find Series by Labels | /api/v1/series |
GET/POST | Find matching time series |
| List Label Names | /api/v1/labels |
GET/POST | List all label names |
| List Label Values | /api/v1/label/:name/values |
GET | List values for a specific label |
| Target Discovery | /api/v1/targets |
GET | Get target information |
| Target Metadata Query | /api/v1/targets/metadata |
GET | Get metadata from targets |
| Metric Metadata Query | /api/v1/metadata |
GET | Get metric metadata |
| Tool | Prometheus Endpoint | HTTP Method | Purpose |
|---|---|---|---|
| Alert Query | /api/v1/alerts |
GET | Get all active alerts |
| Rule Query | /api/v1/rules |
GET | Get recording/alerting rules |
| Alertmanager Discovery | /api/v1/alertmanagers |
GET | Get alertmanager information |
| Tool | Prometheus Endpoint | HTTP Method | Purpose |
|---|---|---|---|
| Config | /api/v1/status/config |
GET | Get current configuration |
| Flags | /api/v1/status/flags |
GET | Get runtime flags |
| Build Information | /api/v1/status/buildinfo |
GET | Get build information |
| Runtime Information | /api/v1/status/runtimeinfo |
GET | Get runtime information |
| TSDB Stats | /api/v1/status/tsdb |
GET | Get TSDB statistics |
| WAL Replay Stats | /api/v1/status/walreplay |
GET | Get WAL replay status |
| Tool | Prometheus Endpoint | HTTP Method | Purpose |
|---|---|---|---|
| TSDB Snapshot | /api/v1/admin/tsdb/snapshot |
POST/PUT | Create TSDB snapshot |
| Delete Series | /api/v1/admin/tsdb/delete_series |
POST/PUT | Delete time series data |
| Clean Tombstones | /api/v1/admin/tsdb/clean_tombstones |
POST/PUT | Clean deleted data |
| Tool | Prometheus Endpoint | HTTP Method | Purpose |
|---|---|---|---|
| Health Check | /-/healthy |
GET/HEAD | Check Prometheus health |
| Readiness Check | /-/ready |
GET/HEAD | Check if ready to serve |
| Reload | /-/reload |
PUT/POST | Reload configuration |
| Quit | /-/quit |
PUT/POST | Graceful shutdown |
All query parameters, response formats, and error codes match the official Prometheus API specification.
Expression Queries (Core Prometheus functionality):
Metadata Queries (Series and label discovery):
Discovery & Monitoring:
Status & Configuration:
TSDB Admin APIs (Advanced operations):
<datetime>-<rand>Management APIs:
Contributions are welcome! This is a Golang project, so please ensure:
Please submit a pull request or open an issue to discuss improvements.
git clone https://github.com/yshngg/prometheus-mcp-server.git
cd prometheus-mcp-server
go mod download
make build
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"yshngg-pmcp": {
"command": "npx",
"args": []
}
}
}