Expand description
Runtime components for bidirectional transport
This module provides unified bidirectional communication support for all duplex transports (STDIO, TCP, Unix Socket, HTTP, WebSocket) with full MCP 2025-06-18 compliance.
§Architecture
Generic Abstraction: TransportDispatcher<T> works with any Transport
- Sends server-initiated requests via transport
- Correlates responses with pending requests
- Implements
ServerRequestDispatchertrait
Specialized Implementations:
StdioDispatcher: Optimized for stdin/stdout (line-delimited JSON)TransportDispatcher<TcpTransport>: For TCP socketsTransportDispatcher<UnixTransport>: For Unix domain socketshttp::HttpDispatcher: For HTTP + SSE sessions (feature-gated)websocket::WebSocketDispatcher: For WebSocket connections (feature-gated)
All share the same request correlation and error handling logic.
Structs§
- Stdio
Dispatcher - STDIO dispatcher for server-initiated requests
- Transport
Dispatcher - Generic dispatcher for any Transport implementation
Enums§
- Stdio
Message - Internal message type for STDIO transport
Functions§
- run_
stdio_ bidirectional - Run MCP server over STDIO transport with full bidirectional support
- run_
transport_ bidirectional - Run MCP server with any Transport implementation with full bidirectional support