Skip to main content

Prometheus MCP Server

Prometheus MCP Server & Agent Plugin (v0.2.0)

An Agent Plugins v1.0.0 compliant Prometheus observability suite combining 6 Progressive-Disclosure Agent Skills (methodology, runbooks, and zero-network local CLI generators) with a focused 19-Tool / 11-Resource MCP Execution Server for Prometheus 3.0+, Thanos, Mimir, Cortex, and VictoriaMetrics.

License Python 3.12+ MCP Prometheus


Architecture: Strict Skill & Execution Separation

Following the TalkOps Skill & Execution Separation Architecture (docs/skill-and-execution-separation.md), this repository separates how to think (Agent Skills) from how to act (MCP Execution Layer):

src/prometheus-mcp-server/
├── plugin.json                                     # Agent Plugins v1.0.0 manifest
├── mcp.json                                        # Portable MCP launcher config
├── skills/                                         # 6 Progressive-Disclosure Agent Skills
│   ├── triaging-prometheus-incidents-and-slos/     # RED/USE triage, multi-window SLOs, exemplars
│   ├── authoring-promql-and-analyzing-metrics/     # PromQL 3.0, Native Histograms, UTF-8 syntax
│   ├── authoring-and-testing-prometheus-rules/     # Alerting/recording rules & promtool testing
│   ├── optimizing-tsdb-cardinality-and-finops/     # Cardinality FinOps, relabeling, remote-write
│   ├── configuring-prometheus-scraping-and-discovery/ # ServiceMonitor/PodMonitor/Probe/ScrapeConfig/file_sd
│   └── onboarding-exporters-and-instrumentation/   # OpenMetrics snippets & 19-exporter K8s catalog
└── prometheus_mcp_server/                          # FastMCP Execution Server (19 Tools, 11 Resources)
    ├── tools/                                      # 5 Toolsets (diagnostics, query, rules, scrape, exporters)
    ├── resources/                                  # 11 Dynamic prom:// Resources
    ├── services/                                   # Prometheus HTTP API v1 + Kubernetes CRD merge services
    └── utils/                                      # Redaction, JSONL audit trail, PromQL 3.0 token-boundary AST

Clear Bounded Context (Zero Overlap with Sibling MCP Servers)

  • prometheus-mcp-server strictly owns Prometheus signal generation, PromQL querying (including Native Histograms and UTF-8 names), Exemplar extraction (/api/v1/query_exemplars), TSDB cardinality & health (/api/v1/status/tsdb, /api/v1/status/walreplay), scrape targets (ServiceMonitor, PodMonitor, Probe, ScrapeConfig, file_sd), promtool validation/unit testing, and Prometheus's own /api/v1/rules & /api/v1/alerts rule evaluation state.
  • alertmanager-mcp-server (src/alertmanager-mcp-server) exclusively owns Alertmanager v2 APIs (/api/v2/alerts, /api/v2/silences, routing trees, receivers, and inhibition rules).
  • tempo-mcp-server (src/tempo-mcp-server) owns distributed trace retrieval using trace_id values extracted via prom_query_exemplars.

6 Bundled Agent Skills (skills/)

Skill Directory Purpose Local Deterministic Script (scripts/)
triaging-prometheus-incidents-and-slos Incident triage using RED/USE, Google SRE multi-window multi-burn-rate SLOs, and Exemplar-to-Trace handoffs scripts/generate_slo_rules.py
authoring-promql-and-analyzing-metrics Safe PromQL 3.0 query construction, Native Histograms, and anomaly period comparisons scripts/lint_promql.py
authoring-and-testing-prometheus-rules Alerting & recording rule lifecycle, promtool unit tests, and safe multi-group CRD merges scripts/build_promtool_test_suite.py
optimizing-tsdb-cardinality-and-finops TSDB cardinality investigation, metric_relabel_configs, and remote-write FinOps scripts/generate_finops_config.py
configuring-prometheus-scraping-and-discovery Kubernetes Operator CRDs (ServiceMonitor, PodMonitor, Probe, ScrapeConfig) and VM file_sd scripts/validate_scrape_manifest.py
onboarding-exporters-and-instrumentation Language SDK instrumentation (Go/Python/Java/Node) and 19-exporter K8s lifecycle scripts/render_exporter_bundle.py

19 MCP Tools Across 5 Toolsets

Every tool has $\le 8$ parameters and explicit MCP ToolAnnotations (readOnlyHint, destructiveHint, idempotentHint, openWorldHint).

1. diagnostics Toolset (2 Read-Only Tools)

Tool Description
prom_get_diagnostics Consolidated control-plane & TSDB diagnostics (overview, runtime_config, tsdb, wal_replay, scrape_pools).
prom_analyze_cardinality Live TSDB cardinality analysis combining /api/v1/status/tsdb with per-metric label fanout via /api/v1/series.

2. query Toolset (7 Read-Only Tools)

Tool Description
prom_explore_metrics Unified discovery of metric names, metadata (TYPE/HELP/UNIT), series matches, or label values.
prom_query_instant Execute point-in-time PromQL query (or validate_only=True syntax/counter preflight check).
prom_query_range Execute time-range PromQL query with automatic downsampling and summary/full/chart response modes.
prom_query_exemplars Query /api/v1/query_exemplars to extract OpenTelemetry trace_id/span_id exemplars for tempo-mcp-server.
prom_compare_periods Compare current range query against a baseline offset (e.g. 1d, 7d) with delta% and z-score shift.
prom_analyze_service_red Compound RED (Rate, Error ratio, Latency p50/p95/p99) analysis supporting classic and Native Histograms.
prom_evaluate_slo_burn Compound Google SRE multi-window multi-burn-rate SLO evaluation (1h/5m, 6h/30m, 24h/2h, 72h/6h).

3. rules Toolset (3 Read-Only, 1 Write, 1 Destructive)

Tool Description
prom_get_firing_alerts Inspect active (pending/firing) alerts from Prometheus /api/v1/alerts & /api/v1/rules.
prom_validate_rules Validate rule group YAML via promtool check rules and optional promtool test rules unit tests.
prom_simulate_rule_firing Backtest an alert expression against historical range data (mode="historical") or synthetic series (mode="synthetic").
prom_upsert_rule_group Create/update a rule group via yaml_only, local_file, k8s_crd (non-destructive group merge), or http_ruler.
prom_delete_rule_group Delete a rule group (preserves sibling groups in PrometheusRule CRDs; deletes CRD only when last group removed).

4. scrape Toolset (1 Read-Only, 1 Write, 1 Destructive)

Tool Description
prom_verify_metrics_endpoint Scrape and validate a /metrics endpoint + optional Prometheus up{} series verification.
prom_apply_scrape_config Apply servicemonitor, podmonitor, probe, scrapeconfig, or file_sd target configuration.
prom_delete_scrape_config Delete a Kubernetes scrape CRD or remove a file_sd job entry.

5. exporters Toolset (1 Write, 1 Destructive)

Tool Description
prom_install_exporter Deploy one of 19 supported exporters to Kubernetes (dry_run=True by default).
prom_uninstall_exporter Uninstall a previously deployed exporter from Kubernetes (confirm=True required).

11 Dynamic prom:// Resources

Resource URI Description
prom://system/backends All configured Prometheus backends with health status
prom://system/backends/{backend_id} Detailed capabilities, version, and build info for a single backend
prom://config/runtime Secret-redacted runtime configuration, flags, and TSDB summary
prom://topology/targets Consolidated service topology and failed/down scrape targets
prom://metadata/catalog Live metric catalog (TYPE, HELP, UNIT)
prom://tsdb/cardinality Live TSDB cardinality overview from /api/v1/status/tsdb
prom://rules/groups Summary of all alerting and recording rule groups
prom://rules/{backend_id}/groups/{group_name} Full YAML/JSON definition and evaluation health of a specific rule group
prom://kubernetes/scrape-crds Inventory of ServiceMonitor, PodMonitor, Probe, ScrapeConfig, and PrometheusRule CRDs
prom://kubernetes/manifests/{kind}/{namespace}/{name} Secret-redacted Kubernetes CRD manifest
prom://audit/recent Recent mutating action audit log entries (ring buffer + optional JSONL persistence)

CLI Flags & Environment Configuration

# Default (Read-Only safe mode: mutating tools are hidden unless --allow-write is set)
uv run prometheus-mcp-server --prometheus-url http://localhost:9090

# Enable write tools and restrict to specific toolsets
uv run prometheus-mcp-server \
  --prometheus-url http://localhost:9090 \
  --allow-write \
  --toolsets diagnostics,query,rules \
  --tenant-id team-payments \
  --audit-log-path ./audit.jsonl
Environment Variable CLI Flag Default Description
PROMETHEUS_BASE_URL --prometheus-url http://localhost:9090 Prometheus HTTP API base URL
PROMETHEUS_ALLOW_WRITE --allow-write / --read-only false Register mutating/destructive tools (false = read-only)
PROMETHEUS_TOOLSETS --toolsets all Comma-separated toolsets (diagnostics,query,rules,scrape,exporters)
PROMETHEUS_TENANT_ID --tenant-id (none) Default X-Scope-OrgID header for Mimir/Cortex/Thanos
PROMETHEUS_RULER_URL — (none) Optional Mimir/Thanos Ruler base URL
PROMETHEUS_AUDIT_LOG_PATH --audit-log-path (none) Optional JSONL file path for persistent mutation audit trail

Running Tests

The repository includes a 3-tier verification suite (115 tests across unit, integration, and skill/plugin compliance):

cd src/prometheus-mcp-server
uv run pytest -v

License

Apache 2.0 — see LICENSE.

Metadata

Release files for talkops-prometheus-mcp-server 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for talkops-prometheus-mcp-server 0.2.0
File Size Uploaded Provenance Actions
talkops_prometheus_mcp_server-0.2.0.tar.gz 231.7 kB With provenance Details for talkops_prometheus_mcp_server-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for talkops-prometheus-mcp-server 0.2.0
File Interpreter ABI Platform Actions
talkops_prometheus_mcp_server-0.2.0-py3-none-any.whl Python 3 none any Details for talkops_prometheus_mcp_server-0.2.0-py3-none-any.whl

Total release size: 336.0 kB

Release files / talkops_prometheus_mcp_server-0.2.0.tar.gz

Download URL talkops_prometheus_mcp_server-0.2.0.tar.gz
Size 231.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f5938d907c84d3b75757affce7a709a1a8b3e24d261d2b19cf6e48cc5db69d65
BLAKE2b-256 checksum
How to use checksums
d6a56679d9a4eeb7f3feba8a1bc331fefdc5897da5d073e2bfc7037c37733981
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / talkops_prometheus_mcp_server-0.2.0-py3-none-any.whl

Download URL talkops_prometheus_mcp_server-0.2.0-py3-none-any.whl
Size 104.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
889c75881bc26b833b1adc3f9f1202244677780acd7e0d7d29fdfd5dc7b21417
BLAKE2b-256 checksum
How to use checksums
1cbd58e94ab4622bc86ed3641f2a997efe159855ba54baf16f211ec8d7d824f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Security for talkops-prometheus-mcp-server 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for talkops_prometheus_mcp_server-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page