Expand description
MCP over a local loopback HTTP endpoint (G16).
The stdio transport covers “the app is not running yet”: the client starts the application as a child process. It does not cover the more common case where the GUI is already open and an MCP-capable client wants to attach to the running instance. This adapter fills that gap.
CLI / stdio (no GUI running) HTTP loopback (GUI already running)
──────────────────────────── ─────────────────────────────────
client ──spawn──▶ app ──stdio client ──POST──▶ 127.0.0.1:<port>/mcpThe endpoint binds to 127.0.0.1:0 — the same pattern as the OAuth redirect
(ADR-0015): the OS picks a free port, so two instances never collide. The port is
published in a discovery file so a client can find it, and access is gated by a
bearer token (G19).
Structs§
- Activity
- A cloneable view of when the endpoint last served a request.
- Discovery
- How a client reaches a running instance.
- Http
Request - Http
Response - Http
Transport - A bound loopback endpoint, ready to serve.
- Token
- A bearer token guarding the endpoint (G19).
Constants§
- MCP_
PATH - The path an MCP client posts to. One well-known path keeps the discovery file trivial.
Functions§
- handle
- Answer one request. Pure apart from the server call, so it is unit-testable.
- is_
alive - Whether an endpoint is reachable and speaking MCP.
- parse_
request - Parse one request from
buffer. - post
- Send one JSON-RPC message to an endpoint and return the response body.
- proxy_
streams - Read JSON-RPC lines from
input, forward each tourl, and write the answers tooutput. Returns when the input ends.