Streamable Http Client Transport
class StreamableHttpClientTransport(client: HttpClient, url: String, reconnectionOptions: ReconnectionOptions = ReconnectionOptions(), requestBuilder: HttpRequestBuilder.() -> Unit = {}) : AbstractClientTransport(source)
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
client
Ktor HTTP client used for all requests
url
MCP endpoint URL
reconnection Options
reconnection backoff and retry-limit settings for the SSE stream
request Builder
builder applied to every outgoing HTTP request, e.g. for adding auth headers
Constructors
Link copied to clipboard
constructor(client: HttpClient, url: String, reconnectionOptions: ReconnectionOptions = ReconnectionOptions(), requestBuilder: HttpRequestBuilder.() -> Unit = {})
constructor(client: HttpClient, url: String, reconnectionTime: Duration?, requestBuilder: HttpRequestBuilder.() -> Unit = {})
Properties
Functions
Link copied to clipboard
Terminates the current session by sending a DELETE request to the server.