Serve the bus as an MCP server over stdio (Node only): newline-delimited
JSON-RPC 2.0 on process.stdin in, process.stdout out. This is the
transport MCP clients like Claude Desktop spawn subprocess servers with.
Unparseable lines get a JSON-RPC -32700 parse error; everything else is
routed through createMcpHandler. Returns a stop() function that
detaches from stdin.
Replies are written in COMPLETION order, not arrival order: messages are
dispatched concurrently, so a fast tool answers before a slow one issued
earlier. That is deliberate and JSON-RPC-legal — responses may arrive in any
order and id correlates them — and it is what keeps one slow tool call from
blocking every reply queued behind it.
IMPORTANT: while serving, do not console.log to stdout — it would corrupt
the protocol stream. Log to stderr instead.
Serve the bus as an MCP server over stdio (Node only): newline-delimited JSON-RPC 2.0 on
process.stdinin,process.stdoutout. This is the transport MCP clients like Claude Desktop spawn subprocess servers with.Unparseable lines get a JSON-RPC
-32700parse error; everything else is routed through createMcpHandler. Returns astop()function that detaches from stdin.Two input-driven limits keep a hostile or broken client from growing memory without bound — see McpStdioOptions.maxLineLength and McpStdioOptions.maxInFlight.
Replies are written in COMPLETION order, not arrival order: messages are dispatched concurrently, so a fast tool answers before a slow one issued earlier. That is deliberate and JSON-RPC-legal — responses may arrive in any order and
idcorrelates them — and it is what keeps one slow tool call from blocking every reply queued behind it.IMPORTANT: while serving, do not
console.logto stdout — it would corrupt the protocol stream. Log to stderr instead.