About pmcp
pmcp is a Go-based MCP server that exposes Prometheus query and management capabilities. It is for MCP clients that need to query metrics, inspect metadata, or access server operations and data.
Key features
- 01Instant and range PromQL queries
- 02Metric and label metadata lookup
- 03Target and alert discovery
- 04TSDB administration tools
- 05Prometheus status and runtime resources
Use cases
- 01Querying metrics from an MCP client
- 02Inspecting targets, alerts, and rule metadata
- 03Checking Prometheus runtime and TSDB details
MCP support
The server exposes Prometheus tools, resources, and a metric-listing prompt to MCP clients. It supports stdio and HTTP transports, with optional bearer-token authentication for HTTP.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEPrometheus MCP Server
A Go-based MCP server that exposes Prometheus query capabilities via the Model Context Protocol.
Installation
go install github.com/yshngg/prometheus-mcp-server@latest
Or pull the Docker image:
docker pull ghcr.io/yshngg/prometheus-mcp-server:latest
Usage
prometheus-mcp-server --prom-addr="http://localhost:9090"
Flags
| Flag | Default | Description |
|---|---|---|
-prom-addr | http://localhost:9090 | Prometheus server URL |
-mcp-addr | localhost:8080 | MCP server listen address |
-transport | stdio | stdio or http |
-auth-token | `` | Bearer token for MCP endpoint authentication (optional) |
-version | Print version |
Environment Variables
All flags can be set via environment variables: PROM_ADDR, MCP_ADDR, TRANSPORT, AUTH_TOKEN.
MCP Client Configuration
Add the following config to your MCP client:
{
"mcpServers": {
"prometheus": {
"command": "prometheus-mcp-server",
"args": ["--prom-addr", "http://localhost:9090"]
}
}
}
Note
Install the binary via
go install github.com/yshngg/prometheus-mcp-server@latestor pull the Docker image withdocker pull ghcr.io/yshngg/prometheus-mcp-server:latest.
If you don't have the binary installed, use Docker:
{
"mcpServers": {
"prometheus": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"ghcr.io/yshngg/prometheus-mcp-server:latest",
"--prom-addr",
"http://host.docker.internal:9090"
]
}
}
}
Client-specific configuration
Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"prometheus": {
"command": "prometheus-mcp-server",
"args": ["--prom-addr", "http://localhost:9090"]
}
}
}
With Docker:
{
"mcpServers": {
"prometheus": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"ghcr.io/yshngg/prometheus-mcp-server:latest",
"--prom-addr",
"http://host.docker.internal:9090"
]
}
}
}
OpenCode
Add to opencode.json (guide):
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"prometheus": {
"type": "local",
"command": [
"prometheus-mcp-server",
"--prom-addr",
"http://localhost:9090"
]
}
}
}
HTTP Transport
Run the server with HTTP transport:
prometheus-mcp-server --transport=http --mcp-addr="localhost:8080"
Then configure your client to use http://localhost:8080/mcp.
For authenticated access, set AUTH_TOKEN:
AUTH_TOKEN=my-token prometheus-mcp-server --transport=http
Your client must then include Authorization: Bearer my-token in requests to /mcp.
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
Resources
The server exposes Prometheus data as URI-addressable resources under the prom:/// scheme:
| URI | Description |
|---|---|
prom:///config | Currently loaded configuration (YAML) |
prom:///flags | Command-line flag values |
prom:///runtime-info | Runtime information |
prom:///build-info | Build information |
prom:///tsdb-stats | TSDB cardinality statistics |
prom:///wal-replay-stats | WAL replay state |
Resource Templates
URI templates for dynamic data access:
| Template | Description |
|---|---|
prom:///api/v1/query?query={promql} | Instant PromQL query result |
prom:///api/v1/label/{name}/values | Label values for a given label name |
Prompts
| Name | Arguments | Description |
|---|---|---|
all-available-metrics | prefix (optional) | Lists all metric names in the Prometheus instance |
License
Apache License 2.0
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.