Purpose
pmcp is a Prometheus Model Context Protocol Server written in the Go language, intended to expose Prometheus's query capabilities through the Model Context Protocol (MCP) for MCP clients to call.
Main Capabilities
The server provides the following categories of tools:
- Expression: instant_query, range_query
- Metadata: find_series_by_labels, list_label_names, list_label_values, target_metadata_query, metric_metadata_query
- Discovery: target_discovery, alert_query, rule_query, alertmanager_discovery
- TSDB Admin: tsdb_snapshot, delete_series, clean_tombstones
- Management: health_check, readiness_check, reload, quit In addition, the server exposes Prometheus data as URI-addressable resources under the prom:/// scheme, and provides URI Templates for dynamic data access.
Usage
Installation:
- Install the binary via go install github.com/yshngg/prometheus-mcp-server@latest
- Or pull the Docker image: docker pull ghcr.io/yshngg/prometheus-mcp-server:latest
Configuration: All flags can be set via environment variables: PROM_ADDR, MCP_ADDR, TRANSPORT, AUTH_TOKEN.
Client configuration: Add the corresponding configuration to the MCP client, such as claude_desktop_config.json or opencode.json. If the binary is not installed, Docker can be used.
HTTP transport: After running the server with HTTP transport, configure the client to use http://localhost:8080/mcp。若需认证访问,设置 AUTH_TOKEN, when the client requests /mcp it must include Authorization: Bearer my-token.
Applicable Scenarios
Suitable for scenarios that require AI clients or MCP clients to access Prometheus metrics, execute queries, obtain labels and metadata, discover targets and alerts, and perform TSDB management operations.
Limitations
The materials do not provide specific version requirements, performance metrics, supported Prometheus version ranges, security considerations, and other details, so they are not provided for now.
License: Apache License 2.0.