home / mcp / prometheus mcp server
Reads Prometheus data and exposes discovery and query tools to MCP clients with optional metrics export.
Configuration
View docs{
"mcpServers": {
"brenoepics-prometheus-mcp": {
"command": "prometheus-mcp",
"args": [
"--mcp",
"--prometheus-url",
"http://localhost:9090"
],
"env": {
"PROMETHEUS_URL": "http://localhost:9090",
"PROMETHEUS_RETRIES": "3",
"PROMETHEUS_TIMEOUT": "10",
"PROMETHEUS_PASSWORD": "secret",
"PROMETHEUS_USERNAME": "api",
"PROMETHEUS_CACHE_TTL_SECS": "<PROMETHEUS_CACHE_TTL_SECS>",
"PROMETHEUS_MIN_INTERVAL_MS": "<PROMETHEUS_MIN_INTERVAL_MS>",
"PROMETHEUS_RETRY_BACKOFF_MS": "500"
}
}
}
}This MCP server provides a focused way to read data from Prometheus and expose discovery and query capabilities to MCP-compatible clients. It includes a CLI for local checks, plus optional internal metrics, making it easy to query instant results, fetch metadata, or explore series and label values from Prometheus.
You run the MCP server locally (stdio) and point it at your Prometheus instance. Once running, you can perform quick queries, list metrics, fetch metric metadata, and inspect series and label values from any MCP client.
Prerequisites: you need Rust tooling to build from source or a working container runtime to pull prebuilt images.
Option A: Install via cargo (Rust) and run locally.
# Install the prometheus-mcp CLI from crates.io
cargo install prometheus-mcp
# Start the MCP server, pointing to a local Prometheus instance
prometheus-mcp --mcp --prometheus-url http://localhost:9090Option B: Use Docker to run the MCP server against Prometheus.
# Docker run against a local Prometheus instance
docker run --rm -it brenoepics/prometheus-mcp:latest --mcp \
--prometheus-url http://host.docker.internal:9090
# Alternatively, run with host networking on Linux
# docker run --rm -it --network host brenoepics/prometheus-mcp:latest --mcp --prometheus-url http://localhost:9090To enable the internal Prometheus metrics exporter, run the server with the exporter flag and specify a port.
Example: enable metrics at port 9091.
prometheus-mcp --mcp --metrics-exporter --metrics-port 9091Instant query: fetches the current value for a Prometheus expression.
Range query: evaluates a Prometheus expression over a time window.
Lists available metric names from Prometheus.
Fetches metadata for a specific metric.
Retrieves series matching given selectors.
Returns distinct values for a given label.