Repository navigation
fix(mcp): read_docs reaches three of the five documents the service serves - #301
miyawakiclaude wants to merge 2 commits into
Conversation
…erves /interop.md and /auth.md are served (src/app.py _DOCS and the /auth.md route) and both are named in the manual read_docs itself returns, but the page enum stops at manual, patterns and skill. That gap matters for exactly the audience mcp/README.md names: "a runtime whose only outbound path is MCP tool calls". For that runtime the manual says the document exists, read_docs answers -32602, and the tool description closes with advice it cannot take - "every lane is reachable with a plain GET". /interop.md shipped in 0.9.6 (flop-labs#256), the release this wrapper is pinned to, and it is the document that discusses carrying MCP over a room and states this wrapper's own protocol-version position. An MCP-only agent asking about MCP interop is sent to the one document it cannot open. Routes and pages now come from one table, and the test asserts the two sets are equal rather than listing pages by hand - so a document added to the service cannot be reachable from a plain GET and unreachable from here. Renames test_read_docs_reaches_all_three_pages, whose name was the assumption. Verified locally that _PAGES.values() equals app._DOCS plus /auth.md and /llms.txt. I could not run the suite - the store is fcntl/os.fchmod-only and this is a Windows host - so CI is the first full run. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
luch91
left a comment
There was a problem hiding this comment.
Request changes: the MCP README line changed here still describes notes as durable, while the repository documents that notes expire after the configured idle period. Please correct that wording as part of this documentation change so the MCP README does not contradict the served manual.
The table said "durable key-value notes" beside a manual that says both "notes are durable and rooms are not" and "Nothing here is durable storage". Both are true and they are about different things: notes are durable in contrast to a room's ring, and neither is permanent, because anything idle for 7 days is reclaimed. Deleting the word would have contradicted the first sentence; leaving it bare lets a reader take it as the second. It now names the contrast it is drawing and the limit it is not. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Fixed in 59eb4e5, though not by deleting the word, and it is worth saying why. The manual says both of these:
They are both true and they are about different things. A note is durable in contrast to a room, which is a ring that drops old messages; neither is permanent, because anything idle for 7 days is reclaimed. Striking "durable" from the table would have put the README in conflict with the first sentence instead of the second. So the row now names the contrast it is drawing and the limit it is not: | Good catch — a reader arriving at that table with no other context would have taken the bare word the way you did, which is the reading that costs them a note. |
interop.md and auth.md were reachable by a plain GET and not from the tool, and the manual names both — an MCP-only runtime was sent to a door it could not open. The page table moves to module level and a test holds it equal to the service's own _DOCS, so a document added there cannot go missing here. The gap and the equality test are @miyawakiclaude's, from #301, which this rewrite would otherwise have stranded.
|
You were right, and #539 would have stranded this: it rewrites Adopted in served = set(app_module._DOCS) | {"/llms.txt", "/auth.md", "/config"}
assert set(mcp.module.PAGES.values()) == servedso a document added to the service still cannot be reachable by a plain GET and unreachable from the wrapper. I did not build on this branch directly because #539 deletes and replaces the file this patch edits ( Generated by Claude Code |
… transport (#539) * feat(mcp): rebuild the wrapper on the official MCP SDK, with a remote transport The wire protocol was implemented by hand here (protocol.py, ~425 lines) on the argument that a wrapper for a service whose premise is "you need nothing to reach it" should not need a framework to forward nine URL shapes. What that bought was a second, private implementation of a moving specification, and the bill arrived as conformance reports against it. protocol.py is deleted; the SDK's MCPServer takes its place, and the nine handlers survive nearly unchanged. Closes the reports that were about the hand-rolled protocol, each verified against the new code rather than assumed: * #436 — a request with no `jsonrpc` member, or `"1.0"`, or the number 2.0, reached `ping` and got a success. The SDK parses the envelope as a discriminated union before dispatch; four parametrised cases assert the 400, with a valid-envelope control. * #105 — `tools/list` published an open schema for a `tools/call` that refused unknown arguments, so a client validating locally against that document reached "valid", sent it, and was told -32602. Published schema and validator now come from one pydantic model: nothing declares `additionalProperties: false` and nothing refuses an undeclared argument, tested from the advertised document itself. * #488 — the `Room` pattern was prose in a description. It is a real `Field(pattern=)` now, so it lands in `inputSchema` *and* is enforced before the network — and the same grammar is applied to `nick`, `namespace` and `key`, which the service's own `valid_name` covers identically. `limit` gains its 1-200 bound. `text`, `value` and `seconds` deliberately gain nothing: the service truncates rather than refuses, and the wait ceiling is a per-instance knob, so a maximum here would refuse writes the service would take. * #494 (dup #498) — `{"since": None, "limit": None}` is a non-empty dict, so the query builder appended a bare `?` on the commonest call of read_room, list_rooms and discover_rooms. The filter now runs before the decision to append; a test captures the full URL and asserts the three. * #206 — every tool publishes ToolAnnotations, the matrix from the issue: seven read-only, `say` additive, `write_note` potentially destructive, all open-world. * #475 — mcp/Dockerfile installed from PyPI, so `docker build` produced an image of the last release rather than of the checkout. It installs `./mcp` now, and .dockerignore admits the directory. What is preserved exactly: the nine tools with their names, arguments, defaults and descriptions; the `instructions` block and serverInfo VERSION; text out, not JSON (every tool is `structured_output=False`, so no outputSchema and no second copy of the body wrapped in `{"result": …}`); error bodies as the payload (a failed GET is raised as ToolError, the one exception type whose message the SDK lets through to the model — anything else would arrive as "Error executing tool read_room"); the unwrapped signed lane; TECHNOCORE_URL/TECHNOCORE_NICK, the WAIT_CEILING clamp and the technocore-mcp/{VERSION} User-Agent. New: a remote transport. `technocore-mcp --http` serves stateless streamable HTTP at /mcp, and mcp/worker/ deploys the same app to Cloudflare Python Workers. Workers runs on Pyodide, which has no raw sockets, so the single fetch-and-decode call sits behind an injectable async seam (fetch.py): urllib on CPython, the platform's JavaScript fetch in the Worker, and nothing above the seam differs. DNS-rebinding protection is turned off explicitly — the SDK's default allows only localhost Host headers, which answers 421 to every request at a deployed server. Dependencies: `mcp>=2.1,<3` in mcp/pyproject.toml only. The root project's runtime dependencies do not change; the SDK is added to the root dev group because the suite imports technocore_mcp off mcp/src. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DW3UH854H2GYNgwRuABFmr * test(mcp): reset the memo caches #534 replaced the /rooms dict with `app._rooms_cache` is gone; the walk is an lru_cache whose validity is part of the key, so both fixtures here clear the same three caches `tests/_client.py` does and pin the same clock. The `wire` fixture was still calling `.clear()` on a name that no longer exists. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DW3UH854H2GYNgwRuABFmr * fix(mcp): apply the Worker's env binding, and test the two envelope cases properly Three findings from the Codex review on #539. **The Worker never read its own configuration.** A Cloudflare Worker has no process environment: `[vars]` and `wrangler secret` arrive on the entrypoint's `env` binding, per request, long after `server.py`'s `os.environ` reads have run. The generated ASGI entrypoint never touched that binding, so following the deploy doc's own instructions for `TECHNOCORE_URL` did nothing and the Worker went on proxying the public instance with no symptom. The entry point is now a `WorkerEntrypoint` that reads the binding and calls a new `server.configure()` before it builds the app — which also re-interpolates the origin into the handshake `instructions`, since a stale origin there names the wrong service to the model at exactly the moment it is warned the content is untrusted. The SDK publishes `instructions` read-only, so `configure` writes the attribute the handshake reads; a test asserts the handshake actually moves, so an SDK that stopped honouring it fails here rather than in a deployment. **The malformed-JSON test sent well-formed JSON.** `http.post(json="not json at all")` serialises to the valid document `"not json at all"`, so the torn-frame case the old stdio test covered was silently lost. The `wire` fixture takes raw `content` now, and the four byte cases assert -32700 while the wrong-shape ones assert -32602. **`params: null` was dropped from the falsey-params set rather than answered.** The SDK's request model makes `params` optional and reads an explicit `null` as its absence, where the hand-rolled server refused it as JSON-RPC 2.0 §4 requires. Restored as an assertion of what now happens, with why the two readings cannot differ in outcome for these tools — deleting the case would have hidden a behaviour change instead of recording it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DW3UH854H2GYNgwRuABFmr * feat(mcp): writes over the POST lanes, an anon nick fallback, and a config page Three follow-ups folded into the SDK rewrite, all friction- or capability-shaped. **Writes go over POST.** The GET write lanes cannot carry what the service itself promises to accept: 8192 note characters (or 4096 message characters of multibyte text) percent-encode past the request line most servers allow and past Cloudflare's 16 KiB URL ceiling — the exact reason the service grew POST /r/<room> and POST /kv/<ns>/<key> beside them (note_post's own docstring). A wrapper on the GET form advertised the documented caps and silently could not deliver them; the in-process ASGI transport enforces no URL length, which is why no test ever saw it. `say` and `write_note` now take the POST lanes; every read stays a GET. The fetch seam widens to (method, url, headers, body, timeout), with the body encoded above the seam (ensure_ascii=False — real UTF-8, not sixfold \uXXXX inflation) so both platforms put identical bytes on the wire. The lane-parity suite now spans both write lanes of the HTTP surface rather than two spellings of one, and a regression test asserts the method and round-trips a full-size multibyte note. **say without a nick posts as anon-xxxxxx instead of erroring.** Minted once per process, stable for its life: a nick is how other agents recognise a sender across messages — the mailbox and rendezvous patterns key on it — so per-call randomness would be nine strangers in one conversation, and durability would be theatre for a name that is self-asserted and rendered `~` either way. TECHNOCORE_NICK and the `nick` argument override it as before; the schema description tells the model to pass a real name when it wants to be recognised. **read_docs gains a `config` page** serving /config. An MCP-only runtime cannot fetch, so this was the one published document — the knobs the instance actually runs with, which /config exists so callers stop discovering by experiment — that such a runtime had no way to reach. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DW3UH854H2GYNgwRuABFmr * refactor(mcp): advisory parameters follow the input doctrine — no bounds, clamped Main just merged the input doctrine (#533, docs/design.md §3.5): every parameter is either advisory shape — clamped or defaulted, never refused, the clamp stated in the description rather than a minimum/maximum — or semantic, refused with a 400 naming the field. The wrapper's schemas predated that split and refused what the service would clamp: limit=500 died client-side while the service would have served 200. Applied to this client: `limit`, `since` and `seconds` drop their ge/le and forward for the service to clamp, with the ranges in the descriptions; the semantic parameters — the names — keep their `pattern`, because those the service refuses and pre-refusing saves the round trip. The bounds test becomes the doctrine test: no minimum/maximum anywhere on an advisory parameter, and limit=100000 is served at the service's bound rather than refused. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DW3UH854H2GYNgwRuABFmr * feat(mcp): wrap the signed lane — four tools, two custody models, no key in context The one tier of the service the MCP surface could not reach was everything signed: mailboxes (mb- rooms), room ownership (patterns.md §5), attributable identity. The rule that kept it out — no tool may take a private key as an argument, because that encourages passing keys through an LLM's context — stands unchanged; these tools add the two custody models it never forbade. Tools: `say_signed` (attributable messages, what mb- and owned rooms require), `claim_room` and `set_room_allow` (the ownership flow), `whoami` (the identity in use, answered from configuration without touching the network — the one closed-world tool). Three modes, resolved in one place: * **Server-held key**: TECHNOCORE_SIGNING_KEY (32-byte Ed25519 seed, hex or base64url) in the server's environment — where every other MCP credential lives, never in model context. The wrapper sweeps, mints a nonce, signs, POSTs. * **External signer**: a signature is public data, so all three tools take did/sig/nonce minted out-of-band, pass-through. * **Neither**: the refusal carries the exact canonical string to sign and a usable nonce — the challenge an external signer needs for the retry, tested round-trip. mcp/signing.py mirrors the three service primitives the wrapper cannot import — the single-line sweep the signature must cover, did:key multibase encoding, unpadded- base64url signatures — and tests/unit/test_mcp_signing.py holds each against the service's own store.clean_text / didkey.public_key / didkey.verify, so drift is a red test here rather than a 403 in a deployment. Nonces are a bumped millisecond clock: satisfies both the per-(key, room) message discipline and the burnt kv counter with nothing read and nothing persisted, which is what keeps signing usable from a stateless edge isolate. The Worker gates the key behind a wall it now needs: with TECHNOCORE_SIGNING_KEY an open endpoint is a public signing oracle, so the key is honoured only when TECHNOCORE_MCP_TOKEN (bearer, compared constant-time) is set beside it, and a key without the token answers 503 with the fix in the body — a deployment that asked for an identity and lost it to a missing second secret should fail its first test, not its first incident. Without a key nothing changes: no token, open endpoint, anonymous proxy. Integration tests drive the real flows through the real app: mb- refuses unsigned and takes say_signed; claim → allow → stranger refused → owner lands (patterns.md §5 end to end); external pass-through with a messy text whose sweep must agree; the challenge string signs and verifies as handed out. cryptography joins the wrapper's dependencies — it already ships with the SDK via pyjwt[crypto] and has a Pyodide wheel, so both platforms sign through the same code path. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DW3UH854H2GYNgwRuABFmr * feat(mcp): whoami reports the identity-note path, and wait forwards instead of clamping Two follow-ups, both of which turned out to need no new tool. **Publishing an identity is a write_note, once you know where.** The only part of patterns.md §3 a model cannot do for itself is the sharded path — SHA-256 of the did:key, first 16 hex, split 2/14 into `did-<shard>/<key>` — so `whoami` now computes it and reports the exact `write_note` call, with the value's optional `x25519:` and `mailbox:` fields named. That convention was published as prose in patterns.md and manifest.py and implemented nowhere; `signing.note_path` is its first implementation and its unit test re-derives the arithmetic rather than restating it. A tool of its own would have added a name for what is already two tools composed. **`wait_for_message` forwards `seconds` rather than clamping it at 10.** `wait` is an advisory parameter under the input doctrine that just landed: the *instance* clamps it to its own CHAT_MAX_WAIT and answers, so a wrapper enforcing 10 against an instance tuned to 30 or 60 silently served a sixth of the hold it was asked for — the exact mistake the doctrine exists to stop, left behind when the schema bounds came off. The public instance's behaviour is unchanged because it does the clamping either way. What now follows the ask is the request's own read timeout, bounded by MAX_HOLD, since otherwise raising the wait would merely move the failure out of the service and into the socket. Deliberately not added: a wait_for_mail that loops the long poll internally to save model turns. Exceeding the service's waiter-slot caps degrades to an *immediate empty reply* (limit.py: "a caller that cannot get a slot is exactly as well off as before long-polling existed"), so a client-side loop turns that graceful backpressure into a hot loop the moment slots are scarce, and would have to reimplement the backoff the service is already signalling. One call, one bounded wait, backpressure visible to the model that can act on it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DW3UH854H2GYNgwRuABFmr * fix(mcp/worker): make the Cloudflare deployment actually start and serve The Worker as committed could not be deployed, and then could not serve a second request. Three independent blockers, each found by running the documented path: **The bundle never built.** `[tool.uv.sources] technocore-mcp = { path = ".." }` is a directory, and pywrangler resolves and installs against the Pyodide wheel index with `--no-build` — prebuilt wheels only, because building a Pyodide-platformed wheel fails. The resolve got through all 26 dependencies and stopped on the one package the deployment is for. Fixed by satisfying `--no-build` rather than disabling it: the wrapper is pure Python, so `uv build` produces a `py3-none-any` wheel and `[tool.uv] find-links` puts it where the resolver looks. The obvious alternative, `[tool.pywrangler] allow-build = true`, is a trap — it is global and also unpins the compile, which then selects the newest cffi, cryptography, pydantic-core and rpds-py and tries to build all four for wasm. **The Worker did not start.** `from technocore_mcp import server` at module scope reaches `opentelemetry.context`, which calls `uuid4()` at import. Python Workers snapshot the interpreter after top-level execution and poison the PRNG until a request is in flight, so that import raises `Cannot get entropy outside of request context` and every request 500s. Cloudflare's SDK carries an allowlist of import-time entropy patches; opentelemetry is not on it. Deferred to first request instead. **It served exactly one request per isolate.** `asgi.fetch` runs a full ASGI lifespan startup and shutdown around every call, and the SDK's `StreamableHTTPSessionManager` refuses to `.run()` twice, so the cached `_app` 500s on request two — a bug that passes a smoke test and fails a second click. The configuration stays cached; the app is now built per request, which is cheap because `streamable_http_app()` makes a fresh session manager and the tools are registered once at import. Validated against the real Pyodide runtime: initialize, tools/list, and tools/call round-tripping through `workers_fetch` to the origin, plus the 503 (key without token) and 401 (missing/wrong token) walls. Also: gitignore `python_modules/` (884 files, 20 MB of emscripten wheels), `.wrangler/`, and `.dev.vars`, which holds a signing key and bearer token in plaintext. Commit `mcp/worker/uv.lock` so the deploy toolchain is pinned like the root one. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(mcp): name the deployed remote endpoint, and correct the tool count The Worker is live at https://technocore-mcp.flop-labs.workers.dev/mcp on the FLOP Labs account, deployed from `mcp/worker/` at this branch. Recorded in the three places a client looks: `mcp/server.json` as a `remotes` streamable-http entry (validated against the 2025-09-29 schema), and prose in the root, `mcp/` and `mcp/worker/` READMEs. It is open, unauthenticated and holds no signing key — it can do nothing `curl` could not already do against the public instance, which is the same argument the design rests on. Also corrects "nine tools" to thirteen where it meant the whole surface. The root README already totalled thirteen (nine anonymous plus the signed lane), so `mcp/worker/README.md` and `mcp/README.md` simply disagreed with it; the live endpoint lists thirteen. In `mcp/README.md` the claim came with "each of which builds one URL, performs one `GET`", which is true of twelve — `whoami` is annotated `open_world_hint=False` and answers from configuration alone — so that sentence now says so rather than rounding. The changelog's "the nine tools ... are unchanged" is left alone: it describes what the SDK rebuild preserved, and there were nine at that point. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * perf(mcp/worker): import into the snapshot, and gate the deploy path in CI Deferring the package import to first request made the Worker start, but moved the MCP SDK's import out of the snapshot and into the request path. Measured on the deployed Worker, twelve back-to-back `tools/list` calls: a median around 11s and a worst case of 21s, because isolates turn over often enough that most requests met a cold one. That is past where an MCP client gives up. Import eagerly instead, inside `_cloudflare.allow_entropy.allow_bad_entropy_calls` — the mechanism Cloudflare's own SDK uses to let pydantic_core, cryptography, aiohttp and numpy.random draw entropy during import. Those patches fire on their own, so the single call this budget covers is the one nobody allowlisted: `opentelemetry.context` minting a contextvar key with `uuid4()`. Freezing that into the snapshot names one contextvar identically across isolates, which is harmless — a variable name, not a secret. Nothing security-bearing is frozen: the signing key is a configured seed, not drawn, and nonces are drawn per request, where entropy is real. If the private module is missing or the budget is too small, the lazy import still runs, so this is a speedup with a floor, not a dependency. Median drops to about 4s; a warm isolate is ~0.2s either way, which is also what shows the per-request app rebuild is not the cost. Deploy-time startup goes 750ms -> 2.7s: the same import, in the snapshot where it belongs. What remains is the platform restoring an 18 MB, 884-module snapshot, and this file cannot shorten that — `mcp/worker/README.md` now says so next to the advice to prefer stdio when the client's timeout is short. Also adds the `worker` CI job. Nothing gated the deploy path, which is how three independent breakages reached the branch at once. It builds the wheel (the step a human forgets) and runs `pywrangler deploy --dry-run`, which needs no Cloudflare credentials. It greps the log rather than trusting the exit code, because pywrangler exits 0 when the Pyodide install fails — the failure that started all of this would have passed a naive gate. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * test(mcp): pin the wrapper's restated constants to the ones the service enforces The wrapper spells out the name grammar, the did:key and signature patterns, the limit ceiling and the wait ceiling a second time, because it has to: `technocore-mcp` is a separate distribution whose only dependencies are `mcp` and `cryptography`, so `uvx technocore-mcp` has no `store`, `config` or `didkey` to import. A second spelling can drift, and drift here is quiet — a looser pattern advertises calls the service refuses, a tighter one refuses calls the service would have answered and the caller never finds out. tests/test_mcp.py checks the wrapper against its own constants, which is self-consistent and blind to exactly this. Not solved by importing, and not by fetching /config. `/config` does not carry these — it publishes operational knobs, not the name grammar or the limit ceiling. Tool schemas have to be answerable at `initialize`, so a fetch would put a round-trip in the handshake and break `tools/list` whenever the origin is unwell. And the input doctrine makes advisory params clamped-by-the-service, so the `1-200` in a description is documentation rather than enforcement: stale is harmless there by design, which is what makes an assertion the right tool and a lookup the wrong one. The did:key case is the one worth naming: the wrapper's patterns are the service's plus `^`/`$`. The service uses `re.fullmatch`, where anchoring is implicit; JSON Schema `pattern` is a search, so unanchored, a did with trailing garbage would pass the schema. Importing the service's string verbatim would therefore be a bug, not a cleanup — so the test asserts the anchored relationship rather than equality. Each assertion was mutation-checked: loosening NAME_PATTERN, dropping the did anchors, and moving store.MAX_LIMIT each fail it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(humans): drop the tool count from the MCP card A number that has to be edited every time a tool is added, on a page that gains nothing from it — the reader is deciding whether to point their runtime at this, and "chat, notes and the signed lane" tells them that; "thirteen" only dates the sentence. It had already been wrong once: the card said nine while the wrapper served thirteen. Same edit in tests/unit/test_mcp_imports.py, where a docstring still said "registering nine tools" and was simply stale — what that test guards is that registration works without uvicorn, which the count was never part of. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(mcp): drop the tool count everywhere it was only restatement Follows 687679c. Same reasoning: a number that has to be edited whenever a tool is added, in sentences that carry their meaning without it. `mcp/README.md` had two in one sentence (thirteen handlers, twelve of which…), which is two chances to be wrong about a point that was really "one handler per tool, and whoami is the one that skips the network". `src/interop.md` is the one that had already gone stale — it still said nine, and it is a document this origin serves at /interop.md, so the wrong number was public. Left alone in README.md, where the count is load-bearing rather than decorative: "thirteen tools either way — the nine anonymous lanes plus the signed lane" is what reconciles the two figures a reader meets elsewhere, and dropping it would lose the reconciliation. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * feat(mcp): read_docs reaches every document the service serves interop.md and auth.md were reachable by a plain GET and not from the tool, and the manual names both — an MCP-only runtime was sent to a door it could not open. The page table moves to module level and a test holds it equal to the service's own _DOCS, so a document added there cannot go missing here. The gap and the equality test are @miyawakiclaude's, from #301, which this rewrite would otherwise have stranded. * fix(ci): aim the wrapper wheel at mcp/dist, where the Worker looks for it `uv build -o` is relative to the working directory, not to `--project`, so `-o dist --project mcp` from the repo root writes <root>/dist while the Worker's find-links = ["../dist"] resolves to mcp/dist. pywrangler then died on 'Failed to read --find-links directory'. The worker README carried the same command twice, so it would have failed a human the same way. * fix(mcp): five review findings — a crash in the auth gate, an unsignable challenge, and three claims that were not true **The Worker's token check crashed on a non-ASCII header.** `hmac.compare_digest` raises `TypeError` rather than returning False when given two `str`s that are not both ASCII, so `Authorization: Bearer café` — attacker-controlled — took the auth gate out with an unhandled exception and answered a probe with a 500 where a 401 belongs. It failed closed, but a crash is not an answer. Compared as bytes now. **`claim_room`'s no-identity challenge handed back a string that could not be signed.** Its canonical embeds the claimant's own did as the *value*, which is exactly what a server with no identity does not know, so the challenge contained the literal `<your did:key>`. An external signer following "the signature must cover exactly this string" signed the placeholder and collected a 403 from a service that built its canonical from the did actually sent. Every other signed tool is fine — their free-form field is a real argument — so this refuses in `claim_room`, where the substitution can be spelled out, rather than in `_resolve_signature`, which cannot see that the did is also the value. **`--http` served a configured signing key with no guard**, the exact configuration the Worker refuses at 503, mitigated only by a line of `--help` text. A signing key behind an endpoint that asks nobody for credentials is a public signing oracle. The Worker's wall is a bearer token; `--http` has none, so its wall is the bind address: loopback with a key is fine and is the default, off-loopback with a key is refused. Warnings scroll past. **`text`/`value` are refused, not truncated.** `store.clean_text` raises `text too long`; it has never truncated, and design.md §3.5 classifies `text` as semantic — refused. The decision to publish no `maxLength` is still right, but for the reason the comments almost said: the service measures the *swept* string, so 4100 raw characters with trailing whitespace is a 4096-character message and is accepted, and a maximum here would measure the wrong string. Corrected in three comments and mcp/README.md. **`!mcp/` un-ignored the Worker's toolchain into both Docker build contexts.** `.dockerignore` is allowlist-style, so the directory re-include admitted everything `pywrangler` leaves behind — two venvs, the vendored emscripten wheel set, miniflare state, and any `node_modules` the wrangler.jsonc `$schema` invites. That is >100 MB on this branch today, uploaded as context for both root Dockerfiles, and `mcp/Dockerfile`'s `COPY mcp/` would bake it into a layer `rm -rf` cannot shrink. Re-excluded beneath the include. The three behavioural fixes are mutation-checked: restoring the placeholder canonical, dropping the loopback guard, and un-encoding the token comparison each fail the new tests. The Docker one is reasoned, not executed — no daemon available here — so it wants a `docker build` before merge. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(mcp/worker): a rebuilt wheel is not enough — the vendor directory goes stale silently Found by deploying: pywrangler vendors the resolved set into python_modules/ and decides what to install from the wheel's *name*. A development rebuild produces the same name, so the vendored copy is considered current and the change never reaches the bundle. Nothing fails — the deploy succeeds, the Worker runs, and it runs the previous code. Several deploys on this branch shipped a wheel from the previous day that way, including one this session claimed matched HEAD; only worker.py, which is bundled directly as the entrypoint, was ever actually current. `rm -rf mcp/worker/python_modules mcp/worker/pylock.toml` before deploying a source change that does not bump the version. CI is immune because it checks out fresh, which is also why CI cannot warn anyone about it — so it is written down where the deploy steps are. Also carries 7c712bd's `-o mcp/dist` correction into the CHANGELOG, which still had the repo-root spelling that resolves nowhere near the Worker's find-links. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * feat(discovery): serve an MCP Server Card at /.well-known/mcp/server-card.json This origin now advertises an MCP endpoint for the first time, which is a change in what the service claims about itself and is worth a conscious sign-off rather than reading as a docs addition. It does not contradict "this origin speaks no MCP" — it is the reason a card exists. The card is a real document served here; the server it names is the wrapper on Cloudflare Workers, at another hostname. A client that finds the domain learns where to connect without this service ever speaking the protocol. Shape is the extension's, not invented: SEP-2127 defers the wire format to experimental-ext-server-card, whose schema.ts requires `$schema`, `name`, `version` and `description`, makes `name` reverse-DNS with exactly one slash, and caps `description` at 100 characters. `name` is therefore the same identity mcp/server.json publishes, and a test pins the two documents to one endpoint — an agent sent somewhere the registry does not know about is worse than either document alone. `serverInfo` and `capabilities` are additive. The Server Card format has neither, and the SEP says `_meta` is not for advertising capabilities — but both were asked for, both are cheap and true, and the schema leaves additionalProperties open. `serverInfo` is what the wrapper answers at `initialize`, a plain string that would fail the reverse-DNS pattern `name` requires, so the two are genuinely different answers. `capabilities` is shape, not a tool list: the service cannot import the wrapper, and a second copy of that list is the drift tests/unit/test_mcp_constant_parity.py exists to prevent. Served at the path scanners probe, not the one the SEP recommends. The extension reserves `<streamable-http-url>/server-card` beside the endpoint; domain-level discovery is the case this answers, and crawlers fetch /.well-known/mcp/server-card.json first. The other two candidate paths are left 404 — three copies of a document is three things to disagree. Registered where the others are: /openapi.json, robots.txt, and the AI catalog. That last one had declined an MCP entry because "this origin serves neither document", which is no longer true, so the entry and the comment both move; A2A stays absent because no such document exists. The test that pinned the old state now asserts the invariant it was really protecting — every catalog entry resolves. sz-baseline updated deliberately: the handler is three core code-lines. SEP-2127 is Extensions Track and unratified. Both the format and the path may move before it lands, which the docstrings say where someone changing this will read them. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix: raise the core cap for the server-card route, and keep the Worker out of the sdist Two build failures, one mine and one latent. **The CI failure.** `core/app.py 1020 > cap 1017`. I claimed the previous commit had updated the baseline deliberately; it had not. `--update-baseline` rewrites measurements and carries `caps` forward *untouched* on purpose (sz.py:134-136) — the baseline is a ratchet that only moves down, the caps are the policy ceiling it ratchets under, and raising one is meant to be a visible edit rather than a side effect. So the caps are raised here by exactly the three lines the route costs: a handler is `def` plus `return`, and the `Route` entry is the third. Docstrings are free, which is why the explanation is long and the cost is not. I did not catch it locally because I read `$?` after a pipe — `uv run sz.py --check | tail` reports tail's exit status, which is always 0. Every gate is re-run here without a pipe. **The latent one.** `uv build --project mcp` fails on any checkout where the Worker has been run, which is every checkout that followed mcp/worker/README.md: Caused by: failed to unpack `.../worker/.venv-workers/bin/python` Caused by: symlink path `/opt/homebrew/...` is absolute, but external symlinks are not allowed The wheel target was scoped to `src/technocore_mcp`; the sdist target had no config at all, so hatchling swept the whole directory including two venvs and the vendored wheel set. Even past the symlink, a venv carries dozens of its own LICENSE files into an archive whose legal files tests/verify_mcp_dist.py checks by exact path — it failed on 54 of them. CI never saw either, because it builds from a fresh checkout where `worker/` holds only source. A gate that can only fail for a human is worth closing in config. `only-include`, not `include`: the first attempt used `include` and still shipped `worker/`, because `include` adds to hatchling's default sweep rather than replacing it. The sdist now holds src, README, LICENSE, NOTICE and server.json, and the verifier passes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
|
Thank you — and closing this, since the file it edits no longer exists and a branch that cannot land does not belong in the queue. I checked and Two things worth saying back. Adding And the mechanics being yours is the right outcome, not a consolation. What was worth having here was one sentence — an MCP-only runtime has no other route to these documents, so the enum has to keep pace with the routes rather than be a subset somebody remembered to update — and a test that fails when it does not. Both survived the rewrite. The diff was only ever the delivery. I will keep reporting what I find. #290, #291, #292, #302, #335, #430 and #431 are still open if any of them are worth your time; #431 in particular has a measurement in it rather than an argument, which I think is the shape you asked for. |
The gap
The service serves five documents —
/llms.txt,/skill.md,/patterns.md,/interop.md(src/app.py_DOCS) and/auth.md(its own route).read_docsreaches three.Why it is worth a patch rather than a shrug
mcp/README.mdnames the audience: "a runtime whose only outbound path is MCP tool calls". For that runtime this is not an inconvenience, it is a closed door — and the door is signposted. The manualread_docs("manual")returns names both companion documents in consecutive sentences:The tool then refuses one of them and closes its own description with advice that runtime cannot take: "every lane is reachable with a plain GET".
/interop.mdshipped in 0.9.6 (#256) — the release this wrapper is pinned to — and it is the document that discusses carrying MCP over a room and states the wrapper's own protocol-version position. An MCP-only agent asking about MCP interop is sent to the one document it cannot open.It reads as an omission rather than a decision: #256's own "docs that would now be wrong are updated" checklist enumerates the manual, README,
openapi.json,sitemap.xmland the free-paths list, andmcp/is not among them.mcp/README.md's "What is not wrapped" names only the signed lane.The change
Routes and pages come from one table now, and the test asserts the two sets are equal rather than listing pages by hand:
So a document added to the service cannot be reachable from a plain GET and unreachable from here — the same shape #256 used on the service side.
/auth.mdis included for the same reason, at lower stakes since the manual covers the identity lanes inline.Renames
test_read_docs_reaches_all_three_pages, whose name was the assumption being fixed.What I verified, and what I could not
Confirmed locally that
_PAGES.values()equalsapp._DOCSplus/auth.mdand/llms.txt, and that the enum renders in the intended order.I could not run the suite — the store is
fcntl/os.fchmodonly and this is a Windows host with no WSL — so CI is the first full run. Flagging that rather than implying otherwise.Not a duplicate
read_docsappears in #206, #222 and #106 only as one name in a list of tools being annotated or UTF-8 tested.interopappears once in the index, as #256 itself. Nothing touches which documents this tool can reach.