rapier-runtime 0.5.3__tar.gz → 0.6.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/CHANGELOG.md +15 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/PKG-INFO +2 -2
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/docs/STATUS.md +16 -6
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/docs/mcp-server-scope.md +4 -2
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/pyproject.toml +4 -4
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/mcp/server.py +51 -36
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/tests/test_mcp.py +32 -10
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/tests/test_mcp_resources.py +6 -6
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/.claude/scripts/loom-deploy-nonprod.sh +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/.claude/scripts/loom-deploy-prod.sh +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/.claude/scripts/loom-env-check.sh +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/.claude/scripts/loom-state-docs.sh +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/.githooks/pre-commit +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/.github/workflows/secret-scan.yml +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/.gitignore +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/.gitleaks.toml +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/.loom/audits/smuggled-virtue.done +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/.loom/project.json +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/LICENSE +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/README.md +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/SECURITY.md +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/docs/chatlogs/.gitkeep +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/docs/chatlogs/202607301413.checkpoint.handoff-cut-0-5-0-to-pypi.md +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/docs/chatlogs/20260802-explainability-reminder.md +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/docs/threat-model.md +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/manifests/echo.yaml +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/manifests/sparring.frame.yaml +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/manifests/sparring.full.yaml +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/manifests/sparring.proposer.yaml +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/manifests/sparring.spar.yaml +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/site/README.md +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/site/coming-soon.html +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/site/index.html +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/site/rapier-logo.png +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/__init__.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/_json.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/cli.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/convergence.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/envelope.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/ledger.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/manifest.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/mcp/__init__.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/mcp/tools.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/models.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/onboarding.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/pipeline.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/presets.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/secrets.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/stage.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/stages/__init__.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/stages/echo.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/stages/frame.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/stages/proposer/__init__.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/stages/proposer/phase_stages.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/stages/proposer/phases.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/stages/proposer/traceability_gate.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/stages/reconcile.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/stages/resolver/__init__.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/stages/resolver/_binding.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/stages/resolver/_extract.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/stages/resolver/anchored_fix.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/stages/resolver/author.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/stages/resolver/citation_gate.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/stages/resolver/compose.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/stages/resolver/cross_review.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/stages/resolver/definitiveness_gate.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/verify/__init__.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/verify/_bootstrap.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/verify/_llm_shim.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/verify/_vendor/PROVENANCE.md +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/verify/_vendor/cite_check.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/verify/_vendor/lib_llm.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/verify/_vendor/spar_cross_review.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/verify/_vendor/spar_definitiveness_gate.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/verify/_vendor/spar_verify_gate.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/verify/_vendor/verify_grounding.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/verify/rider_record.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/verify/service.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/tests/test_cite_check_evidence_union.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/tests/test_cli.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/tests/test_convergence.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/tests/test_envelope.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/tests/test_extract_json.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/tests/test_frame_stage.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/tests/test_full_ceremony.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/tests/test_manifest.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/tests/test_models_vendors.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/tests/test_onboarding.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/tests/test_persistence_default.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/tests/test_pipeline.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/tests/test_policy.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/tests/test_proposer_g2.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/tests/test_proposer_stages.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/tests/test_proposer_traceability_gate.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/tests/test_reconcile.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/tests/test_resolver_stages.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/tests/test_rider_record.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/tests/test_secrets.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/tests/test_single_vendor_report.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/tests/test_vendor_policy_v4.py +0 -0
- {rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/tests/test_verify_service.py +0 -0
|
@@ -4,6 +4,21 @@ Notable changes to `rapier-runtime`. Earlier releases are summarized in
|
|
|
4
4
|
[`docs/STATUS.md`](docs/STATUS.md) and on the
|
|
5
5
|
[Releases](https://github.com/muddyone/rapier-runtime/releases) page.
|
|
6
6
|
|
|
7
|
+
## 0.6.0 — 2026-10-16
|
|
8
|
+
|
|
9
|
+
### Changed: the MCP server now runs on the mcp 2.x SDK
|
|
10
|
+
|
|
11
|
+
The `[mcp]` extra now requires `mcp>=2.3,<3` (it was `>=1.2,<2`), and the
|
|
12
|
+
server is built on the SDK's `MCPServer`. Tools, their results and the run
|
|
13
|
+
resources behave as before. Two visible differences:
|
|
14
|
+
|
|
15
|
+
- **Progress shows the stage.** Each stage's progress update now carries the
|
|
16
|
+
stage name as its message. mcp 2.x sends log messages only to clients that
|
|
17
|
+
ask for them, so the progress message is what every client will show.
|
|
18
|
+
- **`pip install -U "rapier-runtime[mcp]"` upgrades the SDK.** An environment
|
|
19
|
+
pinned to mcp 1.x will be moved to 2.x. If a 1.x SDK is installed anyway,
|
|
20
|
+
`rapier mcp` says so and gives the command that fixes it.
|
|
21
|
+
|
|
7
22
|
## 0.5.3 — 2026-10-16
|
|
8
23
|
|
|
9
24
|
### Added: saved runs as MCP resources
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rapier-runtime
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
4
4
|
Summary: A code-orchestrated engine that runs the SPARRING method: grounded, cross-vendor adversarial review for AI-in-the-loop decisions.
|
|
5
5
|
Project-URL: Homepage, https://rapierruntime.com
|
|
6
6
|
Project-URL: Repository, https://github.com/muddyone/rapier-runtime
|
|
@@ -25,7 +25,7 @@ Requires-Dist: requests>=2.31
|
|
|
25
25
|
Provides-Extra: dev
|
|
26
26
|
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
27
27
|
Provides-Extra: mcp
|
|
28
|
-
Requires-Dist: mcp<2
|
|
28
|
+
Requires-Dist: mcp<3,>=2.3; extra == 'mcp'
|
|
29
29
|
Description-Content-Type: text/markdown
|
|
30
30
|
|
|
31
31
|
# Rapier Runtime
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
# Rapier — dev status
|
|
2
2
|
|
|
3
|
-
_Last updated: 2026-10-16 (tag v0.5.
|
|
3
|
+
_Last updated: 2026-10-16 (tag v0.5.3, 249 tests with the mcp SDK)._ A running "where we are /
|
|
4
4
|
what's next" so a new session can continue without reconstructing from git log.
|
|
5
5
|
|
|
6
6
|
## Done
|
|
7
|
+
- **RELEASED (2026-10-16) — `rapier-runtime` 0.5.3 on PyPI. Saved runs as MCP
|
|
8
|
+
resources, and `rapier mcp` starts again on a fresh install.** Git tag
|
|
9
|
+
`v0.5.3`; https://pypi.org/project/rapier-runtime/0.5.3/. Resources:
|
|
10
|
+
`rapier://runs`, `rapier://runs/{run_id}`, `rapier://runs/{run_id}/record`;
|
|
11
|
+
each saved run is listed individually, including runs saved after the server
|
|
12
|
+
started. The fix: `[mcp]` allowed any `mcp>=1.2`, so new installs got mcp
|
|
13
|
+
2.3.0, which renamed FastMCP, and 0.5.2's `rapier mcp` failed with a message
|
|
14
|
+
pointing at the wrong cause. Capped at `mcp<2`. Verified from PyPI in a clean
|
|
15
|
+
environment: the install resolved mcp 1.30.0 and the server listed its runs.
|
|
7
16
|
- **RELEASED (2026-10-16) — `rapier-runtime` 0.5.2 on PyPI. The report stops
|
|
8
17
|
calling a same-vendor review independent.** Git tag `v0.5.2`;
|
|
9
18
|
https://pypi.org/project/rapier-runtime/0.5.2/. A live 0.5.1 run with only an
|
|
@@ -173,11 +182,12 @@ what's next" so a new session can continue without reconstructing from git log.
|
|
|
173
182
|
door / `--depth` / `--seed`.~~ **DONE (2026-10-16).** The landing line is live.
|
|
174
183
|
Saved runs are MCP resources (`rapier://runs`, `rapier://runs/{run_id}`,
|
|
175
184
|
`rapier://runs/{run_id}/record`); the `list_runs` / `get_run` tools stay for
|
|
176
|
-
tool-only clients.
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
185
|
+
tool-only clients. Released in 0.5.3.
|
|
186
|
+
4. ~~**Port the MCP server to the mcp 2.x SDK.**~~ **DONE (2026-10-16), not yet
|
|
187
|
+
released.** `MCPServer` replaces `FastMCP`; the `[mcp]` extra is now
|
|
188
|
+
`mcp>=2.3,<3`. 250 tests pass on mcp 2.3.0, and a built wheel was checked over
|
|
189
|
+
real stdio: tools, resources, a live `frame` call with progress, and the new
|
|
190
|
+
run appearing in the next listing. Ships with the next release.
|
|
181
191
|
|
|
182
192
|
_(M4 publish is **DONE** — v0.4.0 on PyPI + the full landing live; see Done above.
|
|
183
193
|
Loom submodule pin bumped to the v0.4.0 release commit `514df56`.)_
|
|
@@ -104,8 +104,10 @@ run is listed as its own resource every time a client asks, including runs saved
|
|
|
104
104
|
after the server started. The `list_runs` / `get_run` tools remain for clients
|
|
105
105
|
that only call tools.
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
The server is built on the mcp **2.x** SDK (`MCPServer`; ported 2026-10-16), and
|
|
108
|
+
the `[mcp]` extra requires `mcp>=2.3,<3`. Stage progress is sent as the
|
|
109
|
+
`notifications/progress` message, because 2.x delivers log messages only to
|
|
110
|
+
clients that opt in.
|
|
109
111
|
|
|
110
112
|
## Open decisions
|
|
111
113
|
1. `rapier mcp` subcommand (recommended) vs a separate `rapier-mcp` entry point.
|
|
@@ -9,7 +9,7 @@ build-backend = "hatchling.build"
|
|
|
9
9
|
|
|
10
10
|
[project]
|
|
11
11
|
name = "rapier-runtime"
|
|
12
|
-
version = "0.
|
|
12
|
+
version = "0.6.0"
|
|
13
13
|
description = "A code-orchestrated engine that runs the SPARRING method: grounded, cross-vendor adversarial review for AI-in-the-loop decisions."
|
|
14
14
|
readme = "README.md"
|
|
15
15
|
requires-python = ">=3.10"
|
|
@@ -50,9 +50,9 @@ Paper = "https://doi.org/10.5281/zenodo.21210264"
|
|
|
50
50
|
dev = ["pytest>=8.0"]
|
|
51
51
|
# The MCP server (`rapier mcp`) — kept out of the core so the tiny runtime stays
|
|
52
52
|
# `requests` + `pyyaml`. Install with: pip install "rapier-runtime[mcp]".
|
|
53
|
-
#
|
|
54
|
-
# the server
|
|
55
|
-
mcp = ["mcp>=
|
|
53
|
+
# Built on the mcp 2.x SDK (MCPServer). Capped below the next major, because 2.0
|
|
54
|
+
# renamed the server API and an uncapped >=1.2 broke `rapier mcp` (0.5.2).
|
|
55
|
+
mcp = ["mcp>=2.3,<3"]
|
|
56
56
|
|
|
57
57
|
[project.scripts]
|
|
58
58
|
rapier = "rapier.cli:main"
|
|
@@ -15,8 +15,10 @@ minutes, so the tools **stream per-stage progress** to the client: the engine's
|
|
|
15
15
|
run-log lines are bridged from the worker thread to MCP ``info`` + ``report_progress``
|
|
16
16
|
notifications, so the client shows life instead of a hang.
|
|
17
17
|
|
|
18
|
+
Built on the mcp 2.x SDK (``MCPServer``; it was ``FastMCP`` in 1.x).
|
|
19
|
+
|
|
18
20
|
NOTE: this module deliberately does *not* use ``from __future__ import
|
|
19
|
-
annotations`` —
|
|
21
|
+
annotations`` — MCPServer evaluates each tool's signature, and the lazily-imported
|
|
20
22
|
``Context`` annotation must be a real class object at definition time, not a
|
|
21
23
|
string it cannot resolve.
|
|
22
24
|
"""
|
|
@@ -39,8 +41,13 @@ async def _run_with_progress(
|
|
|
39
41
|
**kwargs: Any,
|
|
40
42
|
) -> dict:
|
|
41
43
|
"""Run a blocking tool ``fn(log=…, cancel=…, ledger_root=…, **kwargs)`` in a
|
|
42
|
-
worker thread while streaming its log lines to the MCP client
|
|
43
|
-
|
|
44
|
+
worker thread while streaming its log lines to the MCP client, with
|
|
45
|
+
cooperative cancellation and an optional timeout.
|
|
46
|
+
|
|
47
|
+
Every line goes out as an ``info`` log message, and each ``stage:`` line also
|
|
48
|
+
ticks progress with that line as the progress message. The mcp 2.x SDK
|
|
49
|
+
deprecates the logging helpers and delivers them only to clients that opt in,
|
|
50
|
+
so the progress message is what keeps every client showing the stage.
|
|
44
51
|
|
|
45
52
|
``ctx`` may be ``None`` (a unit test with no session), in which case the run
|
|
46
53
|
proceeds silently. On client cancellation or timeout the cancel flag is set,
|
|
@@ -76,11 +83,14 @@ async def _run_with_progress(
|
|
|
76
83
|
if msg is sentinel:
|
|
77
84
|
return
|
|
78
85
|
if ctx is not None:
|
|
79
|
-
|
|
86
|
+
try:
|
|
87
|
+
await ctx.info(msg)
|
|
88
|
+
except Exception:
|
|
89
|
+
pass # logging is best-effort; never fail a run over it
|
|
80
90
|
if msg.startswith("stage:"):
|
|
81
91
|
done += 1
|
|
82
92
|
try:
|
|
83
|
-
await ctx.report_progress(done, total)
|
|
93
|
+
await ctx.report_progress(done, total, message=msg)
|
|
84
94
|
except Exception:
|
|
85
95
|
pass # progress is best-effort; never fail a run over it
|
|
86
96
|
|
|
@@ -106,22 +116,26 @@ async def _run_with_progress(
|
|
|
106
116
|
|
|
107
117
|
|
|
108
118
|
def build_server():
|
|
109
|
-
"""Construct the
|
|
119
|
+
"""Construct the MCP server with Rapier's tools and run resources.
|
|
110
120
|
|
|
111
121
|
Raises ``ImportError`` if the ``mcp`` extra is not installed (handled by
|
|
112
122
|
:func:`serve`).
|
|
113
123
|
"""
|
|
114
|
-
|
|
124
|
+
import warnings
|
|
125
|
+
|
|
126
|
+
from mcp.server.mcpserver import Context, MCPServer # optional dependency
|
|
127
|
+
from mcp.shared.exceptions import MCPDeprecationWarning
|
|
128
|
+
from mcp.types import Resource
|
|
115
129
|
|
|
116
130
|
from .. import __version__
|
|
117
131
|
from ..presets import load_preset
|
|
118
132
|
from . import tools
|
|
119
133
|
|
|
120
|
-
|
|
121
|
-
#
|
|
122
|
-
#
|
|
123
|
-
|
|
124
|
-
|
|
134
|
+
# ctx.info is deprecated (SEP-2577) but still reaches clients that opt in to
|
|
135
|
+
# logs; keep sending it without the SDK warning on the server's stderr. The
|
|
136
|
+
# warning is raised inside the SDK, so match its text, not the calling module.
|
|
137
|
+
warnings.filterwarnings("ignore", message="The logging capability is deprecated",
|
|
138
|
+
category=MCPDeprecationWarning)
|
|
125
139
|
# Run persistence (governance default: ON). Ceremonies are written to a
|
|
126
140
|
# durable run dir and become retrievable via list_runs / get_run. Precedence:
|
|
127
141
|
# RAPIER_NO_PERSIST opts out entirely; else RAPIER_MCP_LEDGER pins the location
|
|
@@ -133,6 +147,26 @@ def build_server():
|
|
|
133
147
|
else:
|
|
134
148
|
ledger_root = os.environ.get("RAPIER_MCP_LEDGER") or default_runs_root()
|
|
135
149
|
|
|
150
|
+
class _RapierServer(MCPServer):
|
|
151
|
+
async def list_resources(self):
|
|
152
|
+
# MCPServer lists only resources registered at startup, so runs saved
|
|
153
|
+
# after the server started would never appear. Add each saved run's
|
|
154
|
+
# report as a concrete resource every time a client asks.
|
|
155
|
+
listed = await super().list_resources()
|
|
156
|
+
index = tools.run_index(ledger_root)
|
|
157
|
+
for run in (index.get("runs") or [])[:_MAX_LISTED_RUNS]:
|
|
158
|
+
listed.append(Resource(
|
|
159
|
+
uri=run["report_uri"],
|
|
160
|
+
name=run["run_id"],
|
|
161
|
+
title=f"{run['kind']}: {run['topic']}" if run["topic"] else run["run_id"],
|
|
162
|
+
description=f"verdict: {run['verdict']}" if run["verdict"] else None,
|
|
163
|
+
mime_type="text/plain",
|
|
164
|
+
))
|
|
165
|
+
return listed
|
|
166
|
+
|
|
167
|
+
# The version goes in the initialize handshake; without it 2.x reports "".
|
|
168
|
+
server = _RapierServer("rapier", version=__version__)
|
|
169
|
+
|
|
136
170
|
def _stage_total(name: str, settle: int = 0, verify: str = "gate",
|
|
137
171
|
seed: list | None = None, depth: str = "standard") -> int:
|
|
138
172
|
try:
|
|
@@ -245,26 +279,6 @@ def build_server():
|
|
|
245
279
|
def run_record(run_id: str) -> str:
|
|
246
280
|
return json.dumps(tools.run_record(ledger_root, run_id), indent=2, default=str)
|
|
247
281
|
|
|
248
|
-
# FastMCP lists only resources registered at startup, so runs saved after the
|
|
249
|
-
# server started would never appear. Replace the list handler with one that adds
|
|
250
|
-
# each saved run's report as a concrete resource every time a client asks.
|
|
251
|
-
from mcp.types import Resource
|
|
252
|
-
|
|
253
|
-
async def _list_resources():
|
|
254
|
-
listed = await server.list_resources()
|
|
255
|
-
index = tools.run_index(ledger_root)
|
|
256
|
-
for run in (index.get("runs") or [])[:_MAX_LISTED_RUNS]:
|
|
257
|
-
listed.append(Resource(
|
|
258
|
-
uri=run["report_uri"],
|
|
259
|
-
name=run["run_id"],
|
|
260
|
-
title=f"{run['kind']}: {run['topic']}" if run["topic"] else run["run_id"],
|
|
261
|
-
description=f"verdict: {run['verdict']}" if run["verdict"] else None,
|
|
262
|
-
mimeType="text/plain",
|
|
263
|
-
))
|
|
264
|
-
return listed
|
|
265
|
-
|
|
266
|
-
server._mcp_server.list_resources()(_list_resources)
|
|
267
|
-
|
|
268
282
|
return server
|
|
269
283
|
|
|
270
284
|
|
|
@@ -282,11 +296,12 @@ def serve() -> int:
|
|
|
282
296
|
server = build_server()
|
|
283
297
|
except ImportError:
|
|
284
298
|
installed = _installed_mcp_version()
|
|
285
|
-
|
|
299
|
+
major = installed.split(".")[0] if installed else ""
|
|
300
|
+
if major.isdigit() and int(major) != 2:
|
|
286
301
|
print(
|
|
287
|
-
f"The MCP server needs the mcp SDK
|
|
288
|
-
"(
|
|
289
|
-
' pip install "mcp>=
|
|
302
|
+
f"The MCP server needs the mcp SDK 2.x, but {installed} is installed\n"
|
|
303
|
+
"(its server API differs). Install a 2.x SDK:\n"
|
|
304
|
+
' pip install "mcp>=2.3,<3"',
|
|
290
305
|
file=sys.stderr,
|
|
291
306
|
)
|
|
292
307
|
else:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""MCP-0 — tool logic (no SDK needed) + graceful behaviour when the extra is absent.
|
|
2
2
|
|
|
3
|
-
The
|
|
3
|
+
The MCPServer wiring itself is exercised only when the optional ``mcp`` extra is
|
|
4
4
|
installed; these tests lock in the parts that must hold regardless.
|
|
5
5
|
"""
|
|
6
6
|
from __future__ import annotations
|
|
@@ -66,8 +66,8 @@ def test_run_with_progress_streams_stage_progress():
|
|
|
66
66
|
async def info(self, m):
|
|
67
67
|
self.infos.append(m)
|
|
68
68
|
|
|
69
|
-
async def report_progress(self, done, total=None):
|
|
70
|
-
self.progress.append((done, total))
|
|
69
|
+
async def report_progress(self, done, total=None, message=None):
|
|
70
|
+
self.progress.append((done, total, message))
|
|
71
71
|
|
|
72
72
|
def _fn(log=None, **kw):
|
|
73
73
|
log("stage: author (transform)")
|
|
@@ -78,7 +78,9 @@ def test_run_with_progress_streams_stage_progress():
|
|
|
78
78
|
ctx = _Ctx()
|
|
79
79
|
out = anyio.run(server._run_with_progress, _fn, ctx, 2)
|
|
80
80
|
assert out == {"ok": True, "report_md": "R"}
|
|
81
|
-
|
|
81
|
+
# one tick per 'stage:' line, carrying that line as the progress message
|
|
82
|
+
assert ctx.progress == [(1, 2, "stage: author (transform)"),
|
|
83
|
+
(2, 2, "stage: compose (transform)")]
|
|
82
84
|
assert any("substitution" in m for m in ctx.infos) # every line streamed as info
|
|
83
85
|
|
|
84
86
|
|
|
@@ -111,9 +113,19 @@ def test_build_server_advertises_rapier_version_not_sdk():
|
|
|
111
113
|
pytest.importorskip("mcp")
|
|
112
114
|
from rapier import __version__
|
|
113
115
|
|
|
116
|
+
anyio = pytest.importorskip("anyio")
|
|
117
|
+
from mcp import Client
|
|
118
|
+
|
|
114
119
|
srv = server.build_server()
|
|
115
|
-
|
|
116
|
-
|
|
120
|
+
|
|
121
|
+
async def go():
|
|
122
|
+
async with Client(srv) as client:
|
|
123
|
+
return client.server_info
|
|
124
|
+
|
|
125
|
+
# The initialize handshake must report rapier's name and version (2.x
|
|
126
|
+
# reports "" when a server passes none).
|
|
127
|
+
info = anyio.run(go)
|
|
128
|
+
assert (info.name, info.version) == ("rapier", __version__)
|
|
117
129
|
|
|
118
130
|
|
|
119
131
|
# --- MCP-2: timeout + ledger-run access ---
|
|
@@ -171,12 +183,22 @@ def test_runs_disabled_without_ledger():
|
|
|
171
183
|
assert tools.get_run(None, "x")["ok"] is False
|
|
172
184
|
|
|
173
185
|
|
|
174
|
-
def
|
|
186
|
+
def test_serve_names_an_old_mcp_sdk_when_that_is_why_import_failed(monkeypatch, capsys):
|
|
175
187
|
def _raise():
|
|
176
|
-
raise ImportError("No module named 'mcp.server.
|
|
188
|
+
raise ImportError("No module named 'mcp.server.mcpserver'")
|
|
177
189
|
|
|
178
190
|
monkeypatch.setattr(server, "build_server", _raise)
|
|
179
|
-
monkeypatch.setattr(server, "_installed_mcp_version", lambda: "
|
|
191
|
+
monkeypatch.setattr(server, "_installed_mcp_version", lambda: "1.30.0")
|
|
180
192
|
assert server.serve() == 1
|
|
181
193
|
err = capsys.readouterr().err
|
|
182
|
-
assert "
|
|
194
|
+
assert "1.30.0 is installed" in err and 'pip install "mcp>=2.3,<3"' in err
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def test_serve_without_sdk_points_at_the_extra(monkeypatch, capsys):
|
|
198
|
+
def _raise():
|
|
199
|
+
raise ImportError("No module named 'mcp'")
|
|
200
|
+
|
|
201
|
+
monkeypatch.setattr(server, "build_server", _raise)
|
|
202
|
+
monkeypatch.setattr(server, "_installed_mcp_version", lambda: None)
|
|
203
|
+
assert server.serve() == 1
|
|
204
|
+
assert 'pip install "rapier-runtime[mcp]"' in capsys.readouterr().err
|
|
@@ -60,9 +60,9 @@ def test_report_rejects_traversal_and_unknown_ids(ledger, bad):
|
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
def test_resources_over_the_protocol(ledger, monkeypatch):
|
|
63
|
-
pytest.importorskip("mcp.server.
|
|
63
|
+
pytest.importorskip("mcp.server.mcpserver")
|
|
64
64
|
anyio = pytest.importorskip("anyio")
|
|
65
|
-
from mcp
|
|
65
|
+
from mcp import Client
|
|
66
66
|
|
|
67
67
|
from rapier.mcp.server import build_server
|
|
68
68
|
|
|
@@ -71,10 +71,10 @@ def test_resources_over_the_protocol(ledger, monkeypatch):
|
|
|
71
71
|
server = build_server()
|
|
72
72
|
|
|
73
73
|
async def go():
|
|
74
|
-
async with
|
|
74
|
+
async with Client(server) as client:
|
|
75
75
|
listed = {str(r.uri): r for r in (await client.list_resources()).resources}
|
|
76
|
-
templates = {t.
|
|
77
|
-
(await client.list_resource_templates()).
|
|
76
|
+
templates = {t.uri_template for t in
|
|
77
|
+
(await client.list_resource_templates()).resource_templates}
|
|
78
78
|
|
|
79
79
|
# A run saved after the server started still shows up in the next listing.
|
|
80
80
|
_save_run(ledger, "20261016110000-sparring", request="Later run")
|
|
@@ -89,7 +89,7 @@ def test_resources_over_the_protocol(ledger, monkeypatch):
|
|
|
89
89
|
listed, templates, relisted, index, report, record = anyio.run(go)
|
|
90
90
|
|
|
91
91
|
assert "rapier://runs" in listed
|
|
92
|
-
assert listed["rapier://runs/20261016095044-spar"].
|
|
92
|
+
assert listed["rapier://runs/20261016095044-spar"].mime_type == "text/plain"
|
|
93
93
|
assert "rapier://runs/20261016100000-spar" not in listed # unfinished run not listed
|
|
94
94
|
assert {"rapier://runs/{run_id}", "rapier://runs/{run_id}/record"} <= templates
|
|
95
95
|
assert "rapier://runs/20261016110000-sparring" in relisted
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/docs/chatlogs/20260802-explainability-reminder.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/stages/proposer/traceability_gate.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/stages/resolver/definitiveness_gate.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/verify/_vendor/spar_cross_review.py
RENAMED
|
File without changes
|
{rapier_runtime-0.5.3 → rapier_runtime-0.6.0}/src/rapier/verify/_vendor/spar_definitiveness_gate.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|