Skip to main content

Module http

Module http 

Source
Expand description

HTTP/SSE remote transport for MCP (axum + tokio). HTTP/SSE remote transport for MCP.

Exposes an McpServer over HTTP: a JSON-RPC endpoint (POST /mcp) and an SSE endpoint (POST /mcp/sse) that streams the response as a server-sent event. Both reuse the server’s Authorization (Bearer) check, so a server secured for stdio is secured identically over HTTP.

The transport holds the server behind an Arc (shared across request tasks) and dispatches tools/call via McpServer::call_tool_async, so async handlers work transparently over HTTP.

Requires the mcp-http feature (axum + tokio).

Structs§

HttpTransport
Shared MCP server state for the HTTP transport.

Functions§

serve
Run the MCP HTTP transport on addr until the server is stopped.