Prometheus MCP server
A maintained Prometheus MCP server: run PromQL instant and range queries, discover metrics and metadata, and inspect scrape targets from your agent.
prometheus-mcp-server is an actively maintained Model Context Protocol server that lets an AI client query and analyze a Prometheus instance directly. It hands the agent the core observability primitives: execute PromQL instant queries for a point-in-time value, run range queries over a start/end window with a step to chart a trend, list the available metrics with pagination and filtering, fetch metadata for one metric or in bulk, and inspect all scrape targets to see what is up and being collected. A health-check tool rounds it out for container monitoring. Together these let an agent investigate a spike, confirm which series exist before writing a query, and check whether a target is reporting — without you hand-writing every PromQL expression.
It connects to any Prometheus-compatible HTTP API via the required PROMETHEUS_URL, and supports basic-auth (PROMETHEUS_USERNAME / PROMETHEUS_PASSWORD), bearer-token (PROMETHEUS_TOKEN), multi-tenant ORG_ID, custom headers, and request timeouts. The canonical way to run it is the published Docker image ghcr.io/pab1it0/prometheus-mcp-server over stdio; it is also published to PyPI as prometheus-mcp-server. The project is open source under the MIT license.
Quick install
Copy-paste configs are provided for all 8 supported clients. Pick your client below.
Add to ~/.claude.json
{
"mcpServers": {
"prometheus": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"PROMETHEUS_URL",
"ghcr.io/pab1it0/prometheus-mcp-server:latest"
],
"env": {
"PROMETHEUS_URL": "<PROMETHEUS_URL>",
"PROMETHEUS_USERNAME": "<PROMETHEUS_USERNAME>",
"PROMETHEUS_PASSWORD": "<PROMETHEUS_PASSWORD>",
"PROMETHEUS_TOKEN": "<PROMETHEUS_TOKEN>",
"ORG_ID": "<ORG_ID>"
}
}
}
}claude mcp add prometheus -- docker run -i --rm -e PROMETHEUS_URL ghcr.io/pab1it0/prometheus-mcp-server:latestAvailable tools
| Tool | Description |
|---|---|
| health_check | Health-check endpoint for container monitoring and status verification. |
| execute_query | Executes a PromQL instant query against Prometheus. |
| execute_range_query | Executes a PromQL range query with start time, end time, and step interval. |
| list_metrics | Lists all available metrics in Prometheus, with pagination and filtering support. |
| get_metric_metadata | Gets metadata for one metric, or bulk metadata with optional filtering. |
| get_targets | Gets information about all scrape targets. |
Required configuration
- PROMETHEUS_URLRequired
Base URL of your Prometheus-compatible HTTP API, e.g. http://localhost:9090.
- PROMETHEUS_USERNAMEOptional
Username for HTTP basic auth. Optional.
- PROMETHEUS_PASSWORDOptional
Password for HTTP basic auth. Optional.
- PROMETHEUS_TOKENOptional
Bearer token for authentication. Optional.
- ORG_IDOptional
Organization/tenant ID header for multi-tenant setups. Optional.
- PROMETHEUS_REQUEST_TIMEOUTOptional
Request timeout in seconds for Prometheus API calls. Optional.
- PROMETHEUS_CUSTOM_HEADERSOptional
Custom headers to send with every Prometheus request. Optional.
What you can do with it
Investigate a metric spike
The agent runs a range query over the window around an incident to chart the trend, then drills into related series with instant queries to find the dimension — pod, instance, or status code — driving the spike.
Write correct PromQL without guessing
Before composing a query the agent lists available metrics and pulls metric metadata to confirm names, types, and help text, then checks scrape targets to verify the data is actually being collected.
FAQ
- Is it free?
- Yes. prometheus-mcp-server is free and open source under the MIT license. You only need access to a Prometheus-compatible endpoint; there is no separate fee for the server.
- Does it support remote/OAuth?
- No. It runs locally over stdio (via the Docker image or the PyPI package) and connects to your Prometheus HTTP API. It supports basic-auth, a bearer token, and custom headers rather than an interactive OAuth flow.
- Does it work with Mimir, Cortex, or Thanos?
- Yes. It targets the Prometheus HTTP API, so any compatible backend works; set ORG_ID for multi-tenant setups and PROMETHEUS_TOKEN or basic-auth credentials as your gateway requires.