Skip to main content

serve_stdio

Function serve_stdio 

Source
pub async fn serve_stdio<R, W>(
    ctx: &McpContext,
    reader: R,
    writer: &mut W,
) -> Result<()>
Available on crate feature mcp only.
Expand description

Drive an MCP session over any byte streams: read newline-delimited JSON-RPC from reader, write each response (one JSON object per line) to writer. Blank lines are skipped; notifications produce no output. Returns when the reader hits EOF. The faucet mcp stdio command wraps stdin/stdout with this; tests drive it with in-memory buffers.