pub async fn serve_stdio<H>(handler: H) -> Result<(), McpxError>where
H: ServerHandler + 'static,Expand description
Serve an MCP server over stdin/stdout (stdio transport).
§Security warnings
- No authentication: the parent process has full, unrestricted access.
- No RBAC: all tools are available regardless of policy.
- No TLS: messages travel over OS pipes in plaintext.
- Single client: only the parent process can connect.
- No Origin validation: not applicable to stdio.
Use this only when the MCP client spawns the server as a trusted subprocess
(e.g. Claude Desktop, VS Code Copilot). For network-accessible deployments,
use serve() (Streamable HTTP) instead.
§Errors
Returns McpxError::Startup if the handler fails to initialize or the
transport disconnects unexpectedly.