Repository navigation
feat(mcp): the door at /mcp: revisions, request trust, the bearer and its limits - #883
Conversation
3472a33 to
413b5bc
Compare
GPT-6.1-Sol review (xhigh), rounds and outcomesRound 1, on 60bf7d6: 1 blocking, 7 should-fix
Round 2, on 3472a33: 1 blocking, 2 should-fix
Round 3, on 413b5bc: nothing blocking, 2 should-fix. Sol judged reading a chunked body to its end acceptable.
Things every round found fine:
|
Acceptance: PASS with notesChecked The corrected Release impact clears the sole failure from the previous two acceptance runs. It now correctly explains both retention after rollback and the explicit reset: This is a reassessment of that correction, not a new interactive acceptance run. I independently synthesized the actual base/head AppStack sources and both reset variants, reran the infrastructure suite, and rechecked head CI. The behavioral evidence below is carried forward from the preceding acceptance at this identical head, whose latest comment was 6348809109; it was not repeated here. It is preserved inline because this comment replaces that verdict. Done means
Golden journeys
Additional same-head evidence retained
Revalidation this run
Rollback answers: passed. The PR now says that a revert leaves host header preservation enabled, because removing the attribute from a template does not reset it. That matches CloudFormation's documented update semantics. The reset instruction now uses the explicit The previous-release compatibility answer remains supported: the MCP gate is the new incoming Host consumer; Clerk's session boundary replaces the incoming Host with the configured public origin, and serving uses that configured origin. No migration or incompatible stored shape is added. Retaining the attribute therefore does not require Not run
Notes
|
2e101dc to
fa4c831
Compare
26e2aef to
1e26a75
Compare
fa4c831 to
cb370f4
Compare
…arer and holds people to their limits A new capability package, packages/mcp, answers MCP at /mcp on 2026-07-28 statelessly and on 2025-11-25 and 2025-06-18 through initialize, with the spec's status table. Host is the gate (421), a malformed or foreign Origin is 403, only an agent connection's work token opens it (401 naming the protected resource metadata and scope), failed checks are limited per address after they fail, a body over 1 MiB and 64 KiB is 413 before parsing, and each person's requests a minute are a token bucket. The four tools are listed for everyone and refuse as not built until their tickets land. Each request's event names the connection, revision, method and tool, and never what the agent sent. ADR-0014 records one door. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… 413 however a body arrives, and counts every request Sol round 1. The door takes an absolute-form target's authority and refuses two Host fields; a trailing dot on either side is the same host; an Origin's host must be a real reg-name, IPv6 or IPvFuture literal. A chunked body is read on past the cap and dropped so its 413 arrives, and an oversized request spends the person's minute. Mcp-Name is checked for prompts/get and resources/read too, and a notification's event names its revision, method and client. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rt a client sent, and refusals keep what a request said Sol round 2. A chunked body is read to its end, keeping only the cap, so its 413 reaches the client however long it runs. The load balancer now preserves Host, port and duplicates included, and an absolute-form target keeps its own port or its scheme's default. A refused request's event still names its method, version and client. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…a limited tool call names its tool Sol round 3. A request refused for its id still records its era, and an initialize its offered version and client; a tool call refused by the person's minute records which of the door's tools it called. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1e26a75 to
be667c3
Compare
) Stacked on #883 (ticket #851); merges with the rest of #833's stack, not alone. ## What changed A person's agent can now find their company's patches through Patchy's MCP and open one to see its agent tools. `find_patches` lists exactly the patches the person can open in the portal; `open_patch` answers one patch's own document. While the company's agent access is off, every tool call is refused and names the admins. Closes #852 ## Look at 1. **Visibility reuses the portal's rule.** `Catalogue.visible` is `Patches.read({ state: "live" })` through `Patches.Openability`, the same call the portal's All patches makes, then one new query, `Patches.agentToolSummaries`, for the current versions' tool marks and words. It doesn't load whole manifests and starts nothing. `apps/server/src/McpDoor.test.ts` checks it against the portal's own rendered list. It publishes through the API across sharing scopes (company, public), lifecycle states (live, retired, deleted, operator-disabled), a deactivated owner and a second company. Then it compares `/patches` with `find_patches` for an owning admin, a non-owning admin, a member and a member who owns only off patches. Every listed patch opens. Every other one, by name, id or address, gets the same refusal, and searching its name finds nothing. Making the door list off patches fails it, and four catalogue tests. 2. **Choices within the spec's words**, for Allison to see: - `search` matches when every word appears in the name, title, description or owner's name, ignoring case. - The cursor is base64url JSON `{ after: { tools, name, id }, search?, detail? }`: a keyset position, so a publish or retire between pages never repeats or skips one. It carries its search and detail, so `{ cursor }` alone continues a walk; a cursor sent with a different search or detail is refused `invalid_args`. A forged cursor only positions within the person's own list: pointing it at a hidden patch, another company's, or none gives the same page. - `patch` resolves an id first (ids never change), then a name through `Patches.resolveName`, so a former name follows its rename as the address does. An address must have this instance's origin and the person's company handle. Every miss is one `not_found` in the same words. - `actingFor` is `{ person, company }`, each cut at 200 characters. A find page is measured as it grows, so its compact JSON never passes 100,000 characters; a patch whose tools alone would pass it (only a version that skipped the publish check could) is listed with their names, or without them. `open_patch` refuses `too_large` past 64 KiB, which only a version that skipped the publish check could reach. - The `agent_access_off` refusal names where an admin turns it on and the active admins by name, nothing else. 3. **Events** gain `patchRef`, `catalogueTotal`, `catalogueListed`, `catalogueEndedEarly`, `catalogueSearched`, `catalogueDetail` and `catalogueContinued`, beside `patchId`, `versionId` and `resultBytes`. Never the search words or the cursor. ## How it was verified - `packages/mcp`: `Catalogue.test.ts` covers a narrower openability rule, order, 55 patches over two pages with a publish and a retire between them, the read cap with `detail: "tools"`, search, cursor tampering, bad arguments, resolution by name/id/address/former name, other instances' and companies' addresses, and the 64 KiB cap. `Door.test.ts` covers the agent access refusal for a member and an admin, with discovery and the tool list still working. The shared harness moved to `src/test/door.ts`. - `packages/patches`: `agentToolSummaries` by version. `packages/api`: summaries keep `open_patch`'s order. - `pnpm verify` on 90262f1: format, lint, typecheck, synth, postgres-concurrency, cli-smoke, tier2-smoke and browser passed. In `test`, 2237 of 2239 passed. The two that timed out under the machine's load are in packages this PR doesn't touch: `cliRepoBuild.test.ts` (30 s) and `SdkApi.test.ts` (5 s). Both pass alone, and in CI. Every CI check is green on 90262f1. clerk-live passed on a rerun: its two live tests had passed and only the cleanup sweep got a Clerk 404. - No migration, so `rollback-rehearsal` has nothing to rehearse. #837 (PR #868) and #838 (PR #867) are both on `main`. - Real clients against a dev instance, on the final head: Claude Code 2.1.308 through real consent, and Codex 0.163.0 with a minted token on both its revisions. Each found Ben's 56 patches over two pages (50 + 6), with `deal-desk` first as the one with agent tools, and opened it, by name and by address. With agent access off, each call was refused naming Ada Park, the admin. <details><summary>Real clients against a dev instance, transcripts</summary> A `pnpm dev up team` environment (Acme Co: Ada Park, admin; Ben Ortiz, member) with `deal-desk`, a tier 2 patch whose `agent/deals.ts` exports `listDeals` and `moveDeal`, and 55 static pages, `standup-week-01` to `-55`, all published by Ada. Every client ran as Ben from a temp dir outside `$HOME`, with only that invocation's MCP config. Tool results are cut to 220 characters here. ### Claude Code 2.1.308 through real consent `claude --setting-sources project --strict-mcp-config --mcp-config ./mcp.json`, then `/mcp` › Authenticate. A stub `xdg-open` on its `PATH` recorded the authorize URL instead of opening a browser. A headless Playwright browser signed in as Ben (`/dev/[email protected]&return=<authorize>`), saw the consent page below and pressed Allow: ~~~text consent <instance>/oauth/authorize — Connect Claude Code to Acme Co? returned to http://localhost:63680/callback?code=…&state=…&iss=<instance> Authentication successful | You can close this tab and return to Claude Code. ❯ /mcp ⎿ Authentication successful. Connected to patchy-dev-852. ~~~  Then `claude -p` with the same config: ~~~text tool_use mcp__patchy-dev-852__find_patches({}) -> {"actingFor":{"person":"Ben Ortiz","company":"Acme Co"},"total":56,"patches":[{"name":"deal-desk","description":"Track the sales team's open deals and move them through stages.","owner":"Ada Park","address":"<instance>/… tool_use mcp__patchy-dev-852__find_patches({"cursor": "eyJhZnRlciI6eyJ0b29scyI6ZmFsc2UsIm5hbWUiOiJzdGFuZHVwLXdlZWstNDkiLCJpZCI6IjhwdXU4d3FqbXhzbSJ9fQ"}) -> {"actingFor":{"person":"Ben Ortiz","company":"Acme Co"},"total":56,"patches":[{"name":"standup-week-50","description":"Team standup notes for week 50: what shipped and what is next.","owner":"Ada Park","address":"<instance>/… tool_use mcp__patchy-dev-852__open_patch({"patch": "deal-desk"}) -> {"name":"deal-desk","description":"Track the sales team's open deals and move them through stages.","owner":"Ada Park","address":"<instance>/acme/deal-desk","tools":[{"name":"listDeal… assistant: Acme Co has **56 patches**, and listing them took **2 pages**. I'm acting for Ben Ortiz. - **Page 1:** 50 patches, which were `deal-desk` and `standup-week-01` through `standup-week-49`. It returned a `next` cursor. - **Page 2:** 6 patches, `standup-week-50` through `standup-week-55`. It had no `next`, so that was the end. That adds up to the server's reported total of 56: one `deal-desk` plus 55 weekly standup notes. **Only one patch has agent tools: `deal-desk`**, owned by Ada Park. It tracks the sales team's open deals and moves them through stages. None of the 55 `standup-week-*` patches (also Ada Park's) have any agent tools, so I can't read or change them through Patchy. Ada Park would need to add tools for that. ### `deal-desk` tools 1. **`listDeals`** (read) - Lists the team's deals, newest first. - You can pass an optional `stage` to see only deals in that stage: `lead`, `proposal`, `negotiation`, `won` or `lost`. - Each deal comes back with its `id`, `company` (the customer), `stage`, `amount` (value in euros), `createdAt` and `updatedAt`. 2. **`moveDeal`** (change) - Moves one deal to a different stage and returns the updated deal. - It returns `null` if no deal has that id. - It needs both an `id` (taken from `listDeals`) and a target `stage` (same five options). - Any move is logged as Ben Ortiz, made through me. I only opened the patch. I haven't listed any deals or moved anything. ~~~ With agent access turned off at Company by Ada: ~~~text tool_use mcp__patchy-dev-852__find_patches({}) -> error: Agent access is off at Acme Co, so Patchy refuses every agent until an admin turns it on at <instance>/company. Acme Co's admin is Ada Park; tell the person to ask them. assistant: The `find_patches` call didn't list any patches. It returned an error. Here is the exact text: > Agent access is off at Acme Co, so Patchy refuses every agent until an admin turns it on at <instance>/company. Acme Co's admin is Ada Park; tell the person to ask them. Acme Co's agent access is turned off, so Patchy blocks every agent request until it's switched on. You'll need to ask Ada Park, Acme Co's admin, to turn it on at that URL. After that, I can run the call again and list the patches. ~~~ Claude Code's stored token for the dev server was cleared afterwards (`/mcp` › Clear authentication). ### Codex 0.163.0 with a minted token `pnpm dev mcp-token ben --client Codex`, then `codex exec --ephemeral --ignore-user-config -s read-only -c 'mcp_servers.patchy.url="<instance>/mcp"' -c 'mcp_servers.patchy.bearer_token_env_var="PATCHY_MCP_TOKEN"'`. With agent access off, before Ada turned it on (on the first head, before the singular "admin is" fix): ~~~text agent: I’ll find the Patchy MCP tool and return its answer exactly. mcp_tool_call patchy.find_patches({}) -> failed: Agent access is off at Acme Co, so Patchy refuses every agent until an admin turns it on at <instance>/company. Acme Co's admins are Ada Park; tell the person to ask one of them. agent: Agent access is off at Acme Co, so Patchy refuses every agent until an admin turns it on at <instance>/company. Acme Co's admins are Ada Park; tell the person to ask one of them. ~~~ On, at Codex's default revision (2025-06-18), asked: "Using the patchy MCP server: list every patch my company has, following next until there are no more pages. Tell me how many there are in all, how many pages it took, and which ones have agent tools. Then open the one with agent tools by its address and tell me what each of its tools does." ~~~text agent: I’ll use the Patchy tools to list every page of patches, then open the patch with agent tools and inspect what they do. mcp_tool_call patchy.find_patches({}) -> completed: {"actingFor":{"person":"Ben Ortiz","company":"Acme Co"},"total":56,"patches":[{"name":"deal-desk","description":"Track the sales team's open deals and move them through stages.","owner":"Ada Park","address":"<instance>/… mcp_tool_call patchy.find_patches({"cursor": "eyJhZnRlciI6eyJ0b29scyI6ZmFsc2UsIm5hbWUiOiJzdGFuZHVwLXdlZWstNDkiLCJpZCI6IjhwdXU4d3FqbXhzbSJ9fQ"}) -> completed: {"actingFor":{"person":"Ben Ortiz","company":"Acme Co"},"total":56,"patches":[{"name":"standup-week-50","description":"Team standup notes for week 50: what shipped and what is next.","owner":"Ada Park","address":"<instance>/… mcp_tool_call patchy.open_patch({"patch": "<instance>/acme/deal-desk"}) -> completed: {"name":"deal-desk","description":"Track the sales team's open deals and move them through stages.","owner":"Ada Park","address":"<instance>/acme/deal-desk","tools":[{"name":"listDeal… agent: The Patchy MCP connection is acting for **Ben Ortiz at Acme Co**. I followed `next` until it was absent: **56 patches across 2 pages** (50 + 6). All patches are owned by Ada Park: - **`deal-desk`** — the only patch with agent tools. - **`standup-week-01` through `standup-week-55`**, inclusive — 55 standup patches with no agent tools. I opened [deal-desk](<instance>/acme/deal-desk) by its address. Its tools are: | Tool | Kind | What it does | |---|---|---| | `listDeals` | Read | Lists deals newest first, optionally filtered by stage. Returns each deal’s ID, customer, stage, value in euros, and creation/update timestamps. | | `moveDeal` | Change | Takes a deal ID from `listDeals` and a target stage, moves the deal, and returns the updated record. Returns `null` if the ID doesn’t exist. | Both tools accept these stages: `lead`, `proposal`, `negotiation`, `won`, `lost`. ~~~ With `--enable mcp_2026_07_28` it made the same three calls, with the same answer. ### The door's request events for the final runs | Status | Client | Era / version | Method | Tool | Code or patchRef | Catalogue | | ---: | --- | --- | --- | --- | --- | --- | | 200 | Codex | legacy 2025-06-18 | tools/call | find_patches | — | Total=56, Listed=50, EndedEarly=False, Continued=False | | 200 | Codex | legacy 2025-06-18 | tools/call | find_patches | — | Total=56, Listed=6, EndedEarly=False, Continued=True | | 200 | Codex | legacy 2025-06-18 | tools/call | open_patch | name | — | | 401 | — | | — | — | missing_token | — | | 200 | Claude Code | modern 2026-07-28 | server/discover | — | — | — | | 200 | Claude Code | modern 2026-07-28 | tools/list | — | — | — | | 200 | Claude Code | modern 2026-07-28 | server/discover | — | — | — | | 200 | Claude Code | modern 2026-07-28 | tools/list | — | — | — | | 200 | Claude Code | modern 2026-07-28 | tools/call | find_patches | — | Total=56, Listed=50, EndedEarly=False, Continued=False | | 200 | Claude Code | modern 2026-07-28 | tools/call | find_patches | — | Total=56, Listed=6, EndedEarly=False, Continued=True | | 200 | Claude Code | modern 2026-07-28 | tools/call | open_patch | name | — | | 200 | Codex | legacy 2025-06-18 | initialize | — | — | — | | 202 | Codex | legacy 2025-06-18 | notifications/initialized | — | — | — | | 200 | Codex | legacy 2025-06-18 | tools/list | — | — | — | | 200 | Codex | legacy 2025-06-18 | tools/call | find_patches | — | Total=56, Listed=50, EndedEarly=False, Continued=False | | 200 | Codex | legacy 2025-06-18 | tools/call | find_patches | — | Total=56, Listed=6, EndedEarly=False, Continued=True | | 200 | Codex | legacy 2025-06-18 | tools/call | open_patch | address | — | | 200 | Codex | modern 2026-07-28 | server/discover | — | — | — | | 200 | Codex | modern 2026-07-28 | tools/list | — | — | — | | 200 | Codex | modern 2026-07-28 | tools/call | find_patches | — | Total=56, Listed=50, EndedEarly=False, Continued=False | | 200 | Codex | modern 2026-07-28 | tools/call | find_patches | — | Total=56, Listed=6, EndedEarly=False, Continued=True | | 200 | Codex | modern 2026-07-28 | tools/call | open_patch | address | — | | 200 | Claude Code | modern 2026-07-28 | server/discover | — | — | — | | 200 | Claude Code | modern 2026-07-28 | tools/list | — | — | — | | 200 | Claude Code | modern 2026-07-28 | tools/call | find_patches | — | Total=56, Listed=50, EndedEarly=False, Continued=False | | 200 | Claude Code | modern 2026-07-28 | tools/call | find_patches | — | Total=56, Listed=6, EndedEarly=False, Continued=True | | 200 | Claude Code | modern 2026-07-28 | tools/call | open_patch | name | — | | 200 | Claude Code | modern 2026-07-28 | server/discover | — | — | — | | 200 | Claude Code | modern 2026-07-28 | tools/list | — | — | — | | 200 | Claude Code | modern 2026-07-28 | tools/call | find_patches | agent_access_off | — | </details> ## Release impact - [ ] **Breaking** — requires action from anyone already running this - [x] **Not breaking** — no action required No migration and no stored data: the catalogue only reads. - **What does a revert leave behind?** Nothing. Clients that called the two tools get "not built" again, as on #883. - **Does the release before it still work with that?** Yes. Built by Claude Opus 5.5 (xhigh) in Claude Code on T3 Code; reviewed and accepted by GPT-6.1-Sol (xhigh).
## What changed This PR adds release 17's What's new entry, written from `5dd94f3`. It covers everything merged since release 16's `through` (`dd3f41f`), and it sets the `patchy` release to `0.17.0` in `packages/patchy/package.json` and `CURRENT_RELEASE`. With this release, people's agents can use their company's patches through Patchy MCP (#833). | Change | PRs | | --- | --- | | New: Your AI agent can use your company's tools | #873, #878, #880, #881, #882, #883, #884, #886, #887 | | New: Admins choose whether agents can use the company's tools | #871 | | Improved: Your machines shows your agents too (Revoke all machines is now Disconnect everything) | #885, #879 | | New: See what agents can do with a tool | #876 | | New: The log says when an agent made a change | #888 | | New: Your agent can make a tool ready for agents | #869, #870, #872, #875, #896 | | Behind the scenes: agents' calls have their own limits, and a server only an agent uses rests a minute after its last call | #889, #892 | | Behind the scenes: New and Improved changes are public, for patchyhq.com | #893 | | Behind the scenes: library updates | #899 | Five merged PRs get no line: - #874 is release 16's own entry. - #894 is dev tooling: worker agent launchers and scenario data. Its one CLI fix lets a `patchy` installed outside a tier 2 repo publish it. The skills have agents use the repo's pinned `pnpm patchy` instead, so that path is off the documented one. - #900 is CI. - #901 rewords an internal skill. ## Look at - **The entry**, at the top of `releases` in `packages/core/src/whatsNew.ts`. - It names only Claude Code and Codex. Both have connected through real consent against dev instances. Hosted clients (Claude.ai, ChatGPT) are checked in production only (`docs/product.md` › Patchy MCP › Acceptance). - Its labels are the pages' own: Agent access on Company, Your machines, What agents can do, Disconnect everything, and "Jordan Lee via Claude". - **Rollback safety, from the live commit `e4243ff` to `5dd94f3`.** - No PR in the range is labelled `one-way`, and every PR answers both Release impact questions with "Yes". - Migrations 0020–0025 are all additive: - three defaulted or nullable columns on `companies`; - `agent_name` on the runtime log, with a widened `credential_kind` check; - the agent connection tables, `agent_consents` and `change_keys`; - two columns on execution bindings. The new tables reference `users` without a cascade, but no release deletes users or companies. Release 16 reads the runtime log only for credential kinds it knows, so rows from agents can't break it. - `rollback-rehearsal` on #892 rehearsed the whole stack, since #892 adds the last migration and the rest of the stack sits below it: `Exercised rollback paths passed: e4243ff → c8bede4 → e4243ff → c8bede4, in 238s.` #896's run skipped, because it changes no migration or handler descriptor. - #883 turns on the load balancer's host header preservation, which the Deploy workflow's app stack deploy applies. A rollback leaves it on. That's harmless, because release 16's server never reads `Host`. - A rollback takes `/mcp` and `/whats-new.json` away. Connected agents get a 404 until this release returns, and then their connections work again, unless one ended in between. Agent tools published in between stay refused to pages, because #837 already shipped in release 16. ## How it was verified - `pnpm check` on `2d528b1`: format, lint, typecheck and synth passed. In the test step, 2,300 of 2,301 tests passed. The one failure was `packages/sdk/src/install.test.ts` › "says how to reach patchy when the prefix's bin is not on PATH", which timed out at 180 s while the shared machine was loaded. Rerun alone, that file passes all 7 tests in 62 s. The release's own tests pass too: `whatsNew.test.ts`, `schemas.test.ts` and `WhatsNewPages.test.ts`. - The live commit was pinned from `/healthz/deep`: `e4243ff`, release 16. The Deploy run updated last succeeded, and none is unfinished. - Each PR in the range was read with `gh pr view`, including its Release impact answers. ## Release impact - [ ] **Breaking** — requires action from anyone already running this - [x] **Not breaking** — no action required This PR changes only the changelog text and the `patchy` version. As with every release, a CLI installed before this deploy is told to upgrade. - **What does a revert leave behind?** Nothing. People whose seen marker reached 17 would just see no new release. - **Does the release before it still work with that?** Yes. If this release misbehaves, roll back to `e4243ff54d2acbbc88b60eeb0cf9b82a26dc9d5d` (release 16). Prepared by Claude Opus 5.5 (xhigh) in Claude Code on T3 Code. Co-authored-by: Claude Opus 5.5 <[email protected]>
Stacked on #882 (ticket #850); merges with the rest of #833's stack, not alone.
What changed
People's agents get one MCP door at
<instance>/mcp. This PR builds the door itself: it serves MCP 2026-07-28, 2025-11-25 and 2025-06-18, refuses requests it shouldn't trust before reading a token, opens only for an agent connection'sworktoken, and holds each person to their requests a minute. It lists the four tools; each answers "not built yet" until #852, #854 and #855 land.Closes #851
Look at
Hostfield; twoHostfields are refused. The door never believes a forwarded host. One infrastructure change, which needs your eyes: by default the ALB drops any port fromHoston its 443 listener, soapps/infranow turns onpreserveHostHeader, an in-place attribute change that ships with the stack's deploy and stays on after a rollback (see Release impact). Nothing else on the server readsHost(Clerk's session check sets its own), and the duplicates preservation lets through are refused by the door. Next, a malformed or duplicatedOrigingets 403 (a dev instance also refuses anyone else's), then GET/HEAD/DELETE get 405, then the bearer. The door never reads cookies;apps/server/src/McpDoor.test.tssigns a persona in and shows the cookie opens/machinesbut gets 401 at/mcp.packages/mcp/src/Revisions.ts). One choice the spec doesn't spell out: a per-request_metanaming a legacy version gets-32022, because legacy versions are served only throughinitialize. A legacy client hears an unknown method over HTTP 200 (-32601), since a 404 means "session ended" to it; modern gets 404.mcp.bearer.failures.perMinute(60 per address) only after they fail. A working token is never refused, even after its address is limited.mcp.requests.perMinute(600, burst 600, per person, company override) is a token bucket: ontools/callit is the tool'srate_limitedrefusal over 200, otherwise 429 withRetry-After.mcp.body.bytesanswers 413 before parsing, withConnection: close, and an oversized request still spends the person's minute. A declared length over the cap is refused unread. A chunked body is read to its end, keeping only the cap, so its 413 arrives however long the body runs (Node's 5-minute request timeout bounds it); the socket test sends 6 MiB chunked and 2 MB declared and gets each 413.Real clients and the Done-means refusals, transcripts
Codex 0.163.0 at its default revision (2025-06-18)
A throwaway
CODEX_HOMEholding only[mcp_servers.patchy](urlandbearer_token_env_var), a token frompnpm dev mcp-token [email protected] --client Codex, run from a temp dir outside$HOME:codex exec --skip-git-repo-check --json "<prompt>".The door's request events for that run:
Codex 0.163.0 with
--enable mcp_2026_07_28Claude Code 2.1.308 finds the protected resource metadata from the 401
No token:
claude --setting-sources project --strict-mcp-config --mcp-config ./mcp.json --debug-file … -p "…"from a temp dir, with the server athttp://127.0.0.1:<port>/mcp. This run was against 60bf7d6. It isn't repeated on the head, because each run leaves discovery state in the user's Claude Code store. The 401 it reads is unchanged since:With a minted token in
headers, on the head, Claude Code speaks 2026-07-28 and lists the four tools:The refusals Done means names, against the same dev instance
How it was verified
packages/mcp: request trust (Host case, trailing dot, default port, DNS-rebinding hosts; Origin shapes, duplicates, dev), the revision classifier against the status table, and the door over a migrated database: 401s and the challenge,buildvswork, an ended connection, the failed-check limit counted after failure, the 413 boundary at exactly 1,114,112 bytes, initialize negotiation, discover and tools/list cache hints, the four tools' annotations, the per-person bucket shared across a person's clients, and one wide event per request that never holds the token, arguments, change key or instructions.apps/server/src/McpDoor.test.ts, the whole server over a raw socket: the request event under/mcp, rebinding hosts, an absolute-form target, twoHostfields, duplicatedOrigin, a real session cookie, HEAD, and the 413 on the wire for chunked and declared bodies over the cap.pnpm dev, with per-invocation config only: a throwawayCODEX_HOME,--mcp-configfrom a temp dir outside$HOME.pnpm test:rollback-rehearsal --live e4243ff(main, which has Tier 2 readers accept handler descriptions, read-only actions and agent tools, and enforce them #837 and Deactivation and Disconnect everything end pending device logins and record when a person's credentials ended #838): "Exercised rollback paths passed: e4243ff → 60bf7d6 → e4243ff → 60bf7d6". The CI check runs against production's commit and passes here only because this PR adds no migration.pnpm verifyruns on the final head before READY.Release impact
Breaking — requires action from anyone already running this
Not breaking — a new route, new registry rows, new wide event fields and one ALB attribute that only the door reads; no migration, and nothing existing changes shape
What does a revert leave behind? No stored data: the door keeps its buckets in memory and writes no rows. The ALB keeps host header preservation on: CloudFormation leaves a load balancer attribute alone when a template stops listing it, so redeploying the template from before this PR doesn't turn it off. Turning it off takes an explicit
loadBalancer.setAttribute("routing.http.preserve_host_header.enabled", "false")inapps/infra/src/AppStack.tsand a deploy;preserveHostHeader: falsewrites nothing, so it wouldn't. Agents connected to/mcpwould get the page fallback's 404 until the door returns.Does the release before it still work with that? Yes. Nothing in it reads
Host: Clerk's session check sets its own, and pages use the configured public origin. A preservedHost, with its port or a secondHostfield, changes nothing for it. The stack ships as one release, and nothing below it reads anything this PR writes, so it isn'tone-way.Built by Claude Opus 5.5 (xhigh) in Claude Code on T3 Code; reviewed and accepted by GPT-6.1-Sol (xhigh).