Expand description
The bridge: a majordomus mcp process that found the repository’s shared server
already running forwards its client’s stdio frames to that server’s /mcp endpoint
and writes the answers back, one HTTP request per message, and pings on the side so
that the server keeps the session. It carries no index and no registry of its own,
which is why it starts in milliseconds. The HTTP client below is the few lines a
loopback request needs (the server always answers with Content-Length, never
chunked); no HTTP library is pulled in for it.
A message is sent a second time only when the server provably did not run it: the
connection was never made, or the server answered 404 (the session is unknown) or 409
(the lease is lost), both before it looks at the message. A message that was sent and
never answered — a timeout, a dropped connection, a 5xx — may have run, so it is sent
again only when it is idempotent: every method but tools/call, and a tool whose
declared execution hints say so (idempotent). Anything else is the caller’s to
report as an outcome nobody knows (BridgeError::may_resend).
Structs§
Enums§
- Bridge
Error - Why the bridge could not get an answer.
Constants§
- CONNECT_
TIMEOUT - How long a bridge waits to connect.
- HEARTBEAT
- How often a bridge pings the server so that its session is not forgotten.
- MAX_
REPLY_ BYTES - The largest reply
requestreads. Far above what an answer of this server weighs — atools/listof every capability is a few megabytes — and finite, so that a peer, a rendezvous hub or a broken proxy that never stops sending costs a bounded buffer (I2147). - REQUEST_
TIMEOUT - How long a bridge waits for one answer, unless it was made with
Bridge::with_timeout.
Functions§
- idempotent
- Whether sending
messagetwice changes nothing that sending it once did not. - request
- One HTTP/1.1 request to
base_url(http://host:port), withConnection: close.