fix(identity): /mcp defensive route backstop — worker-first, never the SPA shell (#196) - #237
Merged
unforced merged 2 commits intoAug 11, 2026
Conversation
Adds /mcp to DEFENSIVE_PREFIXES alongside /vault: a Cloudflare zone route (my.parachute.computer/mcp*, already declared in workers/vault/wrangler.toml) is meant to intercept the canonical root MCP connector endpoint before it reaches this worker. If that route ever goes missing or is misconfigured, the identity worker now answers a loud 503 route_missing/mcp_route_missing instead of letting the SPA shell masquerade as a working MCP endpoint. - route-manifest.ts: /mcp added to DEFENSIVE_PREFIXES, third documented parity difference against the parachute-app SW denylist (the SW-side /^\/mcp(\/|$)/ entry is a separate follow-up in that repo). - index.ts: mcpRouteMissing handler mirrors vaultRouteMissing exactly (same response shape, same 503, live on every serving host from deploy). - wrangler.toml: "/mcp", "/mcp/*" added to run_worker_first in both the production and [env.staging] asset blocks. - Tests pinned: route-manifest.test.ts's drift-catcher + P0.3 parity suite, and a new "/mcp defensive backstop" describe block in static-assets-routing.test.ts (GET /mcp, GET /mcp/anything, POST /mcp). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
unforcedagi
force-pushed
the
fix/mcp-route-prefixes
branch
from
August 11, 2026 19:42
6ae8b7e to
8062d1b
Compare
…ash/query probes; verify-spa-routing checks the live backstop (cloud#196 review) Nits from review: static-assets-routing.test.ts's /mcp/anything case checked status + content-type but never error_type (the sibling /mcp case already does); add it, plus two cases for the spellings a hand-typed connector URL most plausibly takes (/mcp/, /mcp?foo=bar). verify-spa-routing.ts never probed any DEFENSIVE_PREFIXES path, so nothing proved run_worker_first actually claims /mcp at the live edge — add the /mcp probe, following the existing probe pattern.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cloud-side half of #196 (the parachute-app service-worker denylist entry is the separate follow-up the issue scopes out).
What
If the Cloudflare zone route dispatching
my.parachute.computer/mcp*to the vault worker ever vanishes, the identity worker now answers a loud503 mcp_route_missinginstead of silently serving the SPA shell to an MCP client:/mcp+/mcp/*added toDEFENSIVE_PREFIXES(route-manifest) with a dedicated 503 handlerrun_worker_firstentries in both prod and staging configs (parity pinned by the existing config tests)Tests (HEAD
d285268)identity 1096 pass / 0 fail (typecheck clean), vault 409 pass / 1 todo against the pinned core, control plane 177 pass. 503 coverage includes
/mcp,/mcp/anything,POST /mcp,/mcp/(trailing slash), and/mcp?foo=bar, all assertingerror_type: mcp_route_missing.scripts/verify-spa-routing.tsgains a live-edge/mcpprobe, closing the gap where a TOML typo would leave/mcpasset-first with every unit test still green.Caveat until the app half lands
On
my.with the PWA installed, a browser navigation to/mcpis still answered from the service worker's cached shell — MCP clients are unaffected. The manifest parity test records/mcpas manifest-only until the app-side denylist entry ships.🤖 Generated with Claude Code