MCP server for AI-driven Prometheus monitoring — PromQL, exporters, TSDB FinOps, and alerting
5.0K
A comprehensive Model Context Protocol (MCP) server that gives AI assistants the power to query, instrument, and manage Prometheus monitoring — from backend discovery to exporter deployment, PromQL execution, TSDB optimization, and governance. Supports Prometheus, Thanos, Mimir, Cortex, and VictoriaMetrics.
rate()/increase()), automatic range-query downsampling to ~200 points per series, and query validation before execution./metrics endpoints, and wire up ServiceMonitors.backend_id on every call — no hidden defaults.This Docker image runs an MCP server that connects to your Prometheus-compatible backend(s). AI assistants (Claude, Cline, Cursor, or any MCP client) connect to the server over HTTP, SSE, or stdio.
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
The server is now listening on http://localhost:8767/mcp.
Then configure your MCP client to connect:
{
"mcpServers": {
"prometheus": {
"url": "http://localhost:8767/mcp",
"description": "MCP Server for Prometheus observability and monitoring management"
}
}
}
To enable exporter deployment and ServiceMonitor management, mount your kubeconfig:
docker run --rm -it \
-p 8767:8767 \
-v ~/.kube:/app/.kube:ro \
-e PROMETHEUS_BASE_URL=http://host.docker.internal:9090 \
-e K8S_KUBECONFIG=/app/.kube/config \
-e MCP_TRANSPORT=http \
talkopsai/prometheus-mcp-server:latest
Tip: Mount the full
~/.kubedirectory (not justconfig) so certificate paths referenced in your kubeconfig are available inside the container.
Connect to multiple Prometheus-compatible backends simultaneously:
docker run --rm -it \
-p 8767:8767 \
-e MCP_TRANSPORT=http \
-e PROMETHEUS_BACKENDS='[
{"id": "prod", "base_url": "https://prom-prod.example.com", "type": "prometheus"},
{"id": "staging", "base_url": "https://thanos-staging.example.com", "type": "thanos"}
]' \
talkopsai/prometheus-mcp-server:latest
To use this image over stdio transport directly inside Claude Desktop:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"prometheus-mcp-server": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e", "PROMETHEUS_BASE_URL=http://host.docker.internal:9090",
"-e", "MCP_TRANSPORT=stdio",
"-e", "MCP_LOG_LEVEL=INFO",
"talkopsai/prometheus-mcp-server:latest"
]
}
}
}
To include Kubernetes access, add volume and environment variable args:
{
"mcpServers": {
"prometheus-mcp-server": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-v", "/Users/YOUR_USERNAME/.kube:/app/.kube:ro",
"-e", "PROMETHEUS_BASE_URL=http://host.docker.internal:9090",
"-e", "K8S_KUBECONFIG=/app/.kube/config",
"-e", "MCP_TRANSPORT=stdio",
"-e", "MCP_LOG_LEVEL=INFO",
"talkopsai/prometheus-mcp-server:latest"
]
}
}
}
Replace /Users/YOUR_USERNAME/.kube with your actual kubeconfig path (e.g. C:\Users\YourUser\.kube on Windows).
| Variable | Default | Description |
|---|---|---|
MCP_TRANSPORT | http | Transport protocol: http, sse, streamable-http, or stdio |
MCP_HOST | 0.0.0.0 | Host interface to bind to |
MCP_PORT | 8767 | Port for HTTP server |
MCP_PATH | /mcp | MCP endpoint path |
MCP_LOG_LEVEL | INFO | Log level: DEBUG, INFO, WARNING, ERROR |
MCP_LOG_FORMAT | json | Log format: json or text |
MCP_HTTP_TIMEOUT | 300 | HTTP server timeout (seconds) |
| Variable | Default | Description |
|---|---|---|
PROMETHEUS_BASE_URL | http://localhost:9090 | Prometheus HTTP API base URL |
PROMETHEUS_BACKEND_ID | default | Backend identifier used in tool calls |
PROMETHEUS_TYPE | prometheus | Backend type: prometheus, thanos, mimir, cortex, victoriametrics |
PROMETHEUS_AUTH_HEADER | (empty) | Authorization header (e.g. Bearer <token>) |
PROMETHEUS_VERIFY_SSL | true | Verify SSL certificates |
PROMETHEUS_TIMEOUT | 30 | HTTP timeout for Prometheus API calls (seconds) |
PROMETHEUS_BACKENDS | (empty) | JSON array for multi-backend config (overrides single-backend vars) |
| Variable | Default | Description |
|---|---|---|
K8S_KUBECONFIG | (empty) | Path to kubeconfig file inside the container |
K8S_CONTEXT | (empty) | Specific Kubernetes context to use |
K8S_IN_CLUSTER | true | Set true when running inside a Kubernetes pod |
K8S_ENABLED | true | Enable Kubernetes integration |
latest — Latest stable release0.1.0 — Initial releaseExecute, validate, and explore Prometheus metrics with safety rails.
| Tool | Description |
|---|---|
prom_validate_promql | Check PromQL syntax before executing |
prom_query_instant | Point-in-time PromQL query with counter enforcement |
prom_query_range | Time-range PromQL query with automatic downsampling |
prom_explore_labels | Discover label names and top values for a metric |
prom_suggest_promql | Generate PromQL from natural language |
Instrument apps and wire up scrape targets.
| Tool | Description |
|---|---|
prom_recommend_instrumentation | Recommend direct instrumentation vs exporter vs builtin |
prom_test_endpoint | Validate Prometheus/OpenMetrics /metrics endpoints |
prom_apply_servicemonitor | Generate and apply ServiceMonitor CRDs |
prom_apply_probe | Generate and apply Probe CRDs |
prom_manage_file_sd | Manage static targets in file_sd_configs |
Deploy and manage 19 built-in exporters on Kubernetes.
| Tool | Description |
|---|---|
prom_recommend_exporter | Get exporter recommendations for a service type |
prom_install_exporter | Deploy exporter to Kubernetes (Deployment/DaemonSet + Service) |
prom_uninstall_exporter | Remove exporter from Kubernetes |
prom_verify_exporter | End-to-end health check (endpoint + Prometheus up{} series) |
Analyze cardinality and generate optimization configs.
| Tool | Description |
|---|---|
prom_optimize_cardinality | Analyze top-N cardinality metrics with strategies |
prom_plan_relabel | Generate metric_relabel_configs YAML |
prom_create_recording_rule | Generate recording rule group YAML |
prom_configure_remote_write | Generate remote_write config for long-term storage |
Author, validate, and simulate alerting and recording rules.
| Tool | Description |
|---|---|
prom_get_rule_group | Get rule group details by name |
prom_upsert_rule_group | Create/update rule groups (YAML, CRD, or HTTP Ruler) |
prom_delete_rule_group | Delete a rule group |
prom_draft_alert_rule | Generate an alert rule from natural language |
prom_tune_alert_rule | Suggest adjustments based on firing history |
prom_check_rule_group | Validate syntax via promtool |
prom_run_rule_tests | Run promtool test rules with synthetic scenarios |
prom_simulate_firing_synthetic | Synthetic alert firing test via promtool |
prom_simulate_firing_historical | Evaluate against real historical data |
prom_analyze_firing_history | Analyze firing frequency and duration |
The server exposes discoverable MCP resources that AI assistants read for context:
| Resource | Description |
|---|---|
prom://system/backends | All backends with health status — start here |
prom://topology/services | Service catalog derived from scrape targets |
prom://metadata/catalog | Metric names, types, and HELP text |
prom://tsdb/cardinality | Top-N high-cardinality metrics |
prom://rules/groups | Alerting and recording rule inventory |
prom://exporters/catalog | 19-exporter catalog with deploy configs |
prom://best-practices | Prometheus monitoring best practices |
prom://onboarding-guide | Step-by-step app onboarding guide |
:ro so the container cannot modify your credentials.services:
prometheus-mcp-server:
image: talkopsai/prometheus-mcp-server:latest
ports:
- "8767:8767"
environment:
- PROMETHEUS_BASE_URL=http://prometheus:9090
- MCP_TRANSPORT=http
- MCP_LOG_LEVEL=INFO
depends_on:
- prometheus
prometheus:
image: prom/prometheus:latest
ports:
- "9090:9090"
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
If you find this MCP server useful, consider leaving a ⭐ on the GitHub repository!
Content type
Image
Digest
sha256:12b71ee0d…
Size
130.4 MB
Last updated
4 months ago
docker pull talkopsai/prometheus-mcp-server