Skip to main content

Crate origin_mcp_http

Crate origin_mcp_http 

Source
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>/mcp

The 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.
HttpRequest
HttpResponse
HttpTransport
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 to url, and write the answers to output. Returns when the input ends.