Skip to content

mcp: createPageTransport (registry in a page, agent loop elsewhere) - #114

Merged
thorwhalen merged 1 commit into
mainfrom
burn/acture-111
Nov 30, 2026
Merged

thorwhalen merged 1 commit into
mainfrom
burn/acture-111

Conversation

@thorwhalen

Copy link
Copy Markdown
Member

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 }) in acture-mcp-server: a standard MCP SDK Transport with no socket of its own. The page feeds the loop's messages in with transport.receive(msg), and every answer or notification goes out through the post function 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/call and commandIdToToolName already say. Plugging in at the SDK's transport seam reuses all of that: handshake, the tier filter, resources, the name sanitising, and notifications/tools/list_changed when 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, a list_changed after a later register, early messages queued until connect, a failing post surfaces 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.

@thorwhalen
thorwhalen merged commit 387a4f2 into main Nov 30, 2026
2 checks passed
@thorwhalen
thorwhalen deleted the burn/acture-111 branch November 30, 2026 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant