M08: MCP, REST, and CLI compatibility; optional remote mode #93

Closed
opened 2026-09-19 13:08:51 +00:00 by kilo · 1 comment
Member

Goal

Preserve existing users and maintain one authoritative core across all interfaces while adding an optional, explicit remote mode.

Module of the execution-gateway program; architecture and contracts come from A0 (#85). This issue protects compatibility throughout the program — it is a continuous regression surface, not a one-off task.

User value

Existing MCP/CLI/REST users keep working with zero migration; users who want a shared server can opt in explicitly and get identical semantics for identical state/policy.

Relationship to current code

  • Guards the frozen surfaces: MCP tools scarcity_status / scarcity_select / scarcity_simulate (mcp.py, machine_api.py), REST v1 /healthz, /v1/status, /v1/select, /v1/simulate (server.py), CLI status/select/simulate/install-config (cli.py), and the parity suites (tests/test_mcp.py, tests/test_server.py, tests/test_selection_app.py).
  • The remote mode is an ADDITIONAL configured bridge (MCP/control client → central Scarcity Router server); it never replaces local mode, and the selected operating mode is always explicit.

Scope

  • Regression tests and parity tests over the frozen v1 surfaces as the gateway program lands; each module issue must keep them green, and this issue owns the guardrail suite.
  • Continued standalone local stdio MCP operation (no Docker, no worker, no mandatory central HTTP server); continued existing CLI operation; continued existing REST control operation.
  • Optional configured bridge from an MCP/control client to the central server: explicit configuration, explicit failure — if a configured remote server fails, do NOT silently fall back to local state or local policy (the error is surfaced, never silently degraded).
  • MCP remains recommendation/control only: it does not execute inference, does not trigger quota-reset actions, does not mutate provider entitlements, and does not reserve execution capacity unless explicitly designed and versioned later.
  • Preserve actual current tool names and endpoint paths from the repository; version any necessary data-contract changes explicitly (machine-interface v1 additive rules, or a deliberate version bump with a migration decision).
  • Preserve current status freshness semantics unless an explicit migration decision changes them.

Non-goals

  • No new MCP execution tools; no automatic edits to a user's global IDE configuration; no semantic drift in freshness/no-solution/error semantics or endpoint paths.

Contracts / interfaces affected

Machine-interface v1 (preserved; additive only per D-028); optional new remote-mode configuration contract (A0).

Dependencies

  • Depends on: A0 (#85). The remote-bridge portion additionally sequences with M03 (documented inside this issue; deliberately no blocking Forgejo dependency so the guardrail scope never waits on the gateway).
  • Feeds: every module (guardrail), M10.

Acceptance criteria

  • Existing MCP clients still work without server or worker.
  • Equivalent local and remote select / simulate inputs produce equivalent decisions when state/policy are equivalent.
  • Remote authentication failure does not silently trigger local fallback.
  • MCP does not reserve execution capacity and does not execute inference.
  • Scarcity Router does not automatically modify a user's global IDE configuration.
  • The parity suite (direct == CLI == REST == MCP) is extended to cover gateway-era additive fields and stays green throughout the program.
  • Full validation gate green (uv sync --only-dev && make check && uv run basedpyright && git diff --check).

Security considerations

The remote bridge adds the first network client for the control plane: authenticated client identity (A0/M09), verified TLS, no bearer secrets in URLs, explicit mode selection, and no silent fallback. The local stdio and loopback boundaries are unchanged.

Risks

  • Compatibility-suite rot as the gateway adds fields — mitigated by making the parity suite a per-module gate.

Evidence still required

  • None beyond A0's remote-mode contract decision.
## Goal Preserve existing users and maintain one authoritative core across all interfaces while adding an optional, explicit remote mode. Module of the execution-gateway program; architecture and contracts come from A0 (#85). This issue protects compatibility throughout the program — it is a continuous regression surface, not a one-off task. ## User value Existing MCP/CLI/REST users keep working with zero migration; users who want a shared server can opt in explicitly and get identical semantics for identical state/policy. ## Relationship to current code - Guards the frozen surfaces: MCP tools `scarcity_status` / `scarcity_select` / `scarcity_simulate` (`mcp.py`, `machine_api.py`), REST v1 `/healthz`, `/v1/status`, `/v1/select`, `/v1/simulate` (`server.py`), CLI `status`/`select`/`simulate`/`install-config` (`cli.py`), and the parity suites (`tests/test_mcp.py`, `tests/test_server.py`, `tests/test_selection_app.py`). - The remote mode is an ADDITIONAL configured bridge (MCP/control client → central Scarcity Router server); it never replaces local mode, and the selected operating mode is always explicit. ## Scope - Regression tests and parity tests over the frozen v1 surfaces as the gateway program lands; each module issue must keep them green, and this issue owns the guardrail suite. - Continued standalone local stdio MCP operation (no Docker, no worker, no mandatory central HTTP server); continued existing CLI operation; continued existing REST control operation. - Optional configured bridge from an MCP/control client to the central server: explicit configuration, explicit failure — if a configured remote server fails, do NOT silently fall back to local state or local policy (the error is surfaced, never silently degraded). - MCP remains recommendation/control only: it does not execute inference, does not trigger quota-reset actions, does not mutate provider entitlements, and does not reserve execution capacity unless explicitly designed and versioned later. - Preserve actual current tool names and endpoint paths from the repository; version any necessary data-contract changes explicitly (machine-interface v1 additive rules, or a deliberate version bump with a migration decision). - Preserve current status freshness semantics unless an explicit migration decision changes them. ## Non-goals - No new MCP execution tools; no automatic edits to a user's global IDE configuration; no semantic drift in freshness/no-solution/error semantics or endpoint paths. ## Contracts / interfaces affected Machine-interface v1 (preserved; additive only per D-028); optional new remote-mode configuration contract (A0). ## Dependencies - Depends on: A0 (#85). The remote-bridge portion additionally sequences with M03 (documented inside this issue; deliberately no blocking Forgejo dependency so the guardrail scope never waits on the gateway). - Feeds: every module (guardrail), M10. ## Acceptance criteria - [ ] Existing MCP clients still work without server or worker. - [ ] Equivalent local and remote `select` / `simulate` inputs produce equivalent decisions when state/policy are equivalent. - [ ] Remote authentication failure does not silently trigger local fallback. - [ ] MCP does not reserve execution capacity and does not execute inference. - [ ] Scarcity Router does not automatically modify a user's global IDE configuration. - [ ] The parity suite (direct == CLI == REST == MCP) is extended to cover gateway-era additive fields and stays green throughout the program. - [ ] Full validation gate green (`uv sync --only-dev && make check && uv run basedpyright && git diff --check`). ## Security considerations The remote bridge adds the first network client for the control plane: authenticated client identity (A0/M09), verified TLS, no bearer secrets in URLs, explicit mode selection, and no silent fallback. The local stdio and loopback boundaries are unchanged. ## Risks - Compatibility-suite rot as the gateway adds fields — mitigated by making the parity suite a per-module gate. ## Evidence still required - None beyond A0's remote-mode contract decision.
Author
Member

Closeout (v0.1.0 release-readiness reconciliation, 2026-09-21). M08 is implemented and its acceptance criteria are satisfied on develop @ 9d6192e.

  • The frozen surfaces are unchanged and guarded: tests/test_interfaces_guardrails.py (40 tests) plus the parity suites (tests/test_mcp.py, tests/test_server.py, tests/test_selection_app.py) run as the per-module gate (make guardrails); existing MCP clients still work with no server, worker or Docker (recommendation-only e2e RecommendationOnlySurfaceTests; make package-check isolated install exercises MCP discovery and loopback REST without any of the three).
  • Optional remote mode: the configured bridge client (scarcity_router/remote.py) uses explicit configuration, verified TLS, redacted config repr, and explicit failure — a remote authentication failure never silently falls back to local state (guardrail suite pins this; RemoteServerConfig carries no bearer secrets in URLs).
  • MCP remains recommendation/control only: no inference execution, no quota-reset actions, no provider-entitlement mutation, no capacity reservation (asserted in the guardrail suite); the router never edits a user's global IDE configuration (copy-paste recipes only).
  • Parity (direct == CLI == REST == MCP) is extended to gateway-era additive fields and stayed green throughout the program (1868-test gate; Forgejo CI green on develop, run #25).

Closing as complete; docs/roadmap.md now records M08 complete.

**Closeout (v0.1.0 release-readiness reconciliation, 2026-09-21).** M08 is implemented and its acceptance criteria are satisfied on `develop` @ `9d6192e`. - The frozen surfaces are unchanged and guarded: `tests/test_interfaces_guardrails.py` (40 tests) plus the parity suites (`tests/test_mcp.py`, `tests/test_server.py`, `tests/test_selection_app.py`) run as the per-module gate (`make guardrails`); existing MCP clients still work with no server, worker or Docker (recommendation-only e2e `RecommendationOnlySurfaceTests`; `make package-check` isolated install exercises MCP discovery and loopback REST without any of the three). - Optional remote mode: the configured bridge client (`scarcity_router/remote.py`) uses explicit configuration, verified TLS, redacted config repr, and explicit failure — a remote authentication failure never silently falls back to local state (guardrail suite pins this; `RemoteServerConfig` carries no bearer secrets in URLs). - MCP remains recommendation/control only: no inference execution, no quota-reset actions, no provider-entitlement mutation, no capacity reservation (asserted in the guardrail suite); the router never edits a user's global IDE configuration (copy-paste recipes only). - Parity (direct == CLI == REST == MCP) is extended to gateway-era additive fields and stayed green throughout the program (1868-test gate; Forgejo CI green on `develop`, run #25). Closing as complete; `docs/roadmap.md` now records M08 complete.
kilo closed this issue 2026-09-21 17:06:25 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Creatidy/scarcity-router#93
No description provided.