StreamableHttpClientTransport
Client transport implementing the MCP Streamable HTTP transport specification.
Sends messages via HTTP POST and receives messages via HTTP GET with Server-Sent Events. Supports automatic SSE reconnection with exponential backoff, stream resumption via the Last-Event-ID header, and explicit session termination.
Parameters
Ktor HTTP client used for all requests
MCP endpoint URL
reconnection backoff and retry-limit settings for the SSE stream
maximum size, in characters, of a single inline SSE event parsed from a POST response; a server that exceeds it (including by never terminating an event) fails the send with io.modelcontextprotocol.kotlin.sdk.shared.TooLongFrameException. Defaults to 16 MiB.
builder applied to every outgoing HTTP request, e.g. for adding auth headers
Constructors
Properties
Functions
Sends one or more messages with optional resumption support. This is the main send method that matches the TypeScript implementation.
Terminates the current session by sending a DELETE request to the server.