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 and --prometheus-token override the environment; the token arg is a
password type, so it comes through the runspec-console secret channel and
never on a command line. 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.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| runspec_prometheus-0.1.0.tar.gz | 9.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| runspec_prometheus-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.6 kB
Release files / runspec_prometheus-0.1.0.tar.gz
| Download URL | runspec_prometheus-0.1.0.tar.gz |
|---|---|
| Size | 9.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4217aee52fe6b0e64bb2133c3fddba24a1f8aff275397b8f4d0581083351e808
|
|
BLAKE2b-256 checksum How to use checksums |
b1bab9a9ec32a2bef6ed68edf519a30fb3d7e50f7a606a6e70caccba4d59e721
|
| 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 12, 2026.
Transparency logRelease files / runspec_prometheus-0.1.0-py3-none-any.whl
| Download URL | runspec_prometheus-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
581cb93350a859147d538073ec3d0cb6ac74475ee88f5153ea3e39071334511b
|
|
BLAKE2b-256 checksum How to use checksums |
fcebdd1bb72b55b101b8bff035be0aa8cb6fe3c5233bf37a54b94847e570b40f
|
| 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 12, 2026.
Transparency log