Prometheus MCP Server: Query and Analyze Metrics
Query and analyze Prometheus metrics with the MCP server to monitor, visualize, and troubleshoot system performance in real time.
npx -y @pab1it0/prometheus-mcp-serverOverview
Prometheus MCP Server is a lightweight bridge that lets developers query and analyze Prometheus metrics through a simple HTTP API. It connects to an existing Prometheus server, exposes query endpoints, and formats the results for programmatic use — enabling real-time inspection, troubleshooting workflows, and integration with other tools or models that need metric context.
This server is useful when you want a dedicated, minimal layer between consumers (dashboards, automation scripts, or external systems) and Prometheus itself. Instead of calling Prometheus directly, teams can centralize access, apply consistent configuration, and integrate metric queries into automated analysis or monitoring pipelines.
Features
- Exposes Prometheus query endpoints over a clean HTTP API
- Supports instant and range PromQL queries (Prometheus HTTP API compatibility)
- Configurable Prometheus target URL and server bind address
- Docker-friendly: run as a container for easy deployment
- Lightweight and easy to integrate into CI/CD or observability workflows
- Returns JSON results ready for consumption by scripts, UIs, or other services
Installation / Configuration
Clone the repository and run locally, or use Docker.
Clone repository:
Build and run with Go (if repository contains a Go server):
# Build
# Run with environment variables
PROMETHEUS_URL="http://localhost:9090" BIND_ADDR="0.0.0.0:8080"
Run with Docker:
# Build an image (optional)
# Run container
Example configuration (YAML):
prometheus:
url: "http://prometheus.example.local:9090"
server:
bind_addr: "0.0.0.0:8080"
read_timeout: 10s
write_timeout: 10s
Common environment variables:
- PROMETHEUS_URL — full URL to the Prometheus HTTP API (required)
- BIND_ADDR — host:port to bind the MCP server (default: 0.0.0.0:8080)
- LOG_LEVEL — logging verbosity (optional)
Available Resources
The server exposes a small set of HTTP endpoints that mirror common Prometheus operations. Replace Example instant query: Example range query: Refer to the project repository for additional endpoints, health checks, and any custom routes added by the implementation. Troubleshooting incidents Feeding dashboards or analytics tools Automation and runbooks Model context for observability-driven automation For exact configuration keys, runtime flags, and advanced usage, refer to the project README and source files in the repository.Endpoint Method Description /query GET Instant PromQL query. Params: query, time (optional) /query_range GET Range PromQL query. Params: query, start, end, step /targets GET (Optional) List Prometheus scrape targets (if proxied) /health GET Health check for the MCP server
Use Cases
Notes and Next Steps