Repository navigation
mcp: createPageTransport (registry in a page, agent loop elsewhere) - #114
Merged
Merged
Conversation
This was referenced Nov 30, 2026
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.
First slice of #111 (refs, does not close it): the browser-side seam, item 1 of the proposal, plus the docs section (item 3). Item 2 (a matching Python client transport) is left for a follow-up.
What
createPageTransport({ post })inacture-mcp-server: a standard MCP SDKTransportwith no socket of its own. The page feeds the loop's messages in withtransport.receive(msg), and every answer or notification goes out through thepostfunction the host supplies. You then connect the existing server to it:createMcpServer(registry, opts).connect(transport).Why a transport and not a new message handler
The issue's "two private messages plus a mapping from command ids to tool names" are exactly what MCP's
tools/list/tools/callandcommandIdToToolNamealready say. Plugging in at the SDK's transport seam reuses all of that: handshake, the tier filter, resources, the name sanitising, andnotifications/tools/list_changedwhen the registry changes, with no second protocol to maintain. The confirmation gate stays where it already belongs: wrapped around dispatch in the page.Tests
A real SDK
Client(the loop) talks to the page through the transport over a JSON round trip: list and call a tool, alist_changedafter a laterregister, early messages queued until connect, a failingpostsurfaces as a rejected send, close is clean.Docs: new subsection in
docs/hand-written-assistant-runtime.md(Piece 3) covering where the gate sits, registry changes, and what the loop sees when the page disappears mid-call (give calls a time limit on the loop side; the SDK client's request timeout does it). Minor changeset included.