Skip to main content

runspec-prometheus

A Prometheus runnable for runspec, ported from the official Prometheus MCP server onto the Prometheus HTTP API — not proxying that server. One runnable — prometheus — with a verb per MCP tool. pip install it into a venv and it's discoverable by runspec local, runspec serve (MCP), and runspec-console.

runspec serve flattens each verb into a leaf MCP tool (prometheus_query, prometheus_list-alerts, …). It works against Prometheus and API-compatible servers (Thanos Query, Mimir, Cortex).

Install

pip install runspec-prometheus

Verbs

Reads (all autonomous):

Area Verbs
Queries query, range-query, exemplar-query
Discovery series, label-names, label-values, metric-metadata, targets-metadata
Alerting list-alerts, list-rules, alertmanagers
Targets list-targets (filter by --health down, --scrape-pool, --state)
Server build-info, runtime-info, config, flags, tsdb-stats, wal-replay-status, healthy, ready
Thanos list-stores

Changes: reload, snapshot, clean-tombstones are confirm (an agent asks first); delete-series and quit are manual (refused to an agent, run from the command line or the console's Forms tab). Prometheus itself gates these too: reload/quit need --web.enable-lifecycle, the TSDB admin verbs need --web.enable-admin-api. delete-series refuses to run without both --start and --end.

Times accept Unix seconds, RFC 3339, or a duration back from now (5m, 1h30m, 2d). A range-query with no --step picks one that gives about 250 points. Query and list results are capped by --limit (default 100, 0 = all); the output says truncated: true when it cut something.

Auth — env vars

export PROMETHEUS_URL=https://prometheus.example.com   # default http://127.0.0.1:9090
export PROMETHEUS_TOKEN=<bearer token>                 # or:
export PROMETHEUS_USERNAME=<user> PROMETHEUS_PASSWORD=<password>
export PROMETHEUS_ORG_ID=<tenant>                      # Mimir/Cortex X-Scope-OrgID
export PROMETHEUS_CA_BUNDLE=/etc/pki/internal-ca.pem   # private CA

With no URL set it talks to http://127.0.0.1:9090, so on a fleet host that runs Prometheus it works with no configuration at all. --env <label> reads PROMETHEUS_<LABEL>_* first (--env prod-eu → PROMETHEUS_PROD_EU_URL). --url, --prometheus-token, --prometheus-user and --prometheus-password override the environment; the token and password args are password type, so they come through the runspec-console secret channel and never on a command line. Each auth arg declares the PROMETHEUS_* variables as its env, so a runspec-console credential labelled Prometheus supplies PROMETHEUS_TOKEN (token kind) or PROMETHEUS_USERNAME/PASSWORD (username + password kind) with no extra configuration.

Building your own runnables

The logic lives in runspec-prometheus-core, which has no runspec dependency and surfaces no runnables. A private package can depend on it alone, build a PrometheusConfig in code, and wrap the helpers as narrower runnables — for example a node-health runnable that runs a fixed set of PromQL queries for one team:

from runspec_prometheus_core import config_from_env, query

cfg = config_from_env("prod")
down = query(cfg, 'up{team="payments"} == 0', limit=0)["result"]

Metadata

Release files for runspec-prometheus 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 runspec-prometheus 0.2.0
File Size Uploaded Provenance Actions
runspec_prometheus-0.2.0.tar.gz 11.0 kB With provenance Details for runspec_prometheus-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 20.3 kB

Release files / runspec_prometheus-0.2.0.tar.gz

Download URL runspec_prometheus-0.2.0.tar.gz
Size 11.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8e643f7220b30c2912dc0d6b9ec5190f95898a43436c222d8d61773cd7acbefb
BLAKE2b-256 checksum
How to use checksums
89eef8f165dd2edbaf1c643cf2c714c47a7530d9b96c82104ca1f763671b071b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 18, 2026.

Transparency log

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

Download URL runspec_prometheus-0.2.0-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9119dde9b4e3fa42be407758c778a529580d9162a0567251133db8ebcabe8075
BLAKE2b-256 checksum
How to use checksums
67a7fde4e2e5a5769a40bd1608eddd8a5a980b817f7950ff79830495fe384bde
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 18, 2026.

Transparency log

Security for runspec-prometheus 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 runspec_prometheus-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 Oct 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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

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