Skip to main content

Prometheus MCP server

The Prometheus MCP Server is a Model Context Protocol server for cloud-native metrics observability, exporter lifecycle management, and TSDB FinOps. It exposes 28 tools, 14 prom:// resources, and 5 guided operational prompts across Prometheus, Thanos, Grafana Mimir, Cortex, and VictoriaMetrics backends.

Core capabilities​

Capability DomainWhat the Server Provides
Safe PromQL ExecutionValidates PromQL syntax prior to execution, enforces rate()/increase() wrapping on counters, and downsamples range queries automatically to 100–200 data points per series.
Application OnboardingRecommends instrumentation strategies (client SDK, sidecar exporter, or built-in /metrics), generates Go/Java/Python/Node.js snippets, validates OpenMetrics output, and provisions ServiceMonitor CRDs.
Exporter Lifecycle (19 Catalog Entries)One-command Kubernetes deployment (Deployment/DaemonSet, Service, RBAC) for 19 common infrastructure exporters with live up{} series verification.
Alert Rule Testing & SimulationDrafts Prometheus alerting rules, validates syntax via promtool, runs synthetic unit tests, and backtests rules against historical TSDB data.
TSDB FinOps & Cardinality ControlIdentifies top-N high-cardinality metric series, generates metric_relabel_configs to drop noisy labels, creates pre-computed recording rules, and configures remote-write pipelines.

Architecture​

Quickstart​

1
Verify prerequisites

Ensure you have network reachability to a Prometheus-compatible HTTP API endpoint (Prometheus, Thanos, Mimir, Cortex, or VictoriaMetrics) and optionally a KUBECONFIG for exporter and ServiceMonitor operations.

2
Start the Prometheus MCP Server container

Run the Docker container pointing to your Prometheus endpoint:

docker run --rm -it \
-p 8767:8767 \
-e PROMETHEUS_BASE_URL=http://host.docker.internal:9090 \
-e MCP_TRANSPORT=http \
talkopsai/prometheus-mcp-server:latest
3
Register the server in your MCP client

Add the server URL to your MCP client configuration:

mcp.json
{
"mcpServers": {
"prometheus": {
"url": "http://localhost:8767/mcp",
"description": "MCP Server for Prometheus observability and monitoring management"
}
}
}

Security and middleware guardrails​

  • 7-layer middleware protection: Enforces response payload caps (100 KB max), token-bucket rate limiting (10 req/s, burst 20), response caching, and structured audit logging.
  • Explicit backend_id targeting: In multi-backend deployments, every tool call requires an explicit backend_id parameter so queries and rule updates never target an unintended environment.
  • Scoped backend access policies: Configure per-backend read-only or allow/deny policies via governance tools.

Project structure​

prometheus-mcp-server/
├── prometheus_mcp_server/
│ ├── tools/ # 28 MCP tools across 10 functional categories
│ ├── resources/ # 14 MCP resources (prom:// URIs)
│ ├── prompts/ # 5 guided workflow prompts
│ ├── services/ # Prometheus HTTP v1 + Kubernetes API services
│ ├── server/ # FastMCP setup + 7-layer middleware stack
│ ├── utils/ # 19-exporter catalog, snippet generator, PromQL parser
│ ├── models/ # Pydantic request/response schemas
│ └── config.py # Multi-backend and environment configuration
├── tests/ # Unit and integration test suites
├── Dockerfile
└── pyproject.toml