mcpStreamableHttpTransport

fun HttpClient.mcpStreamableHttpTransport(url: String, reconnectionOptions: ReconnectionOptions = ReconnectionOptions(), requestBuilder: HttpRequestBuilder.() -> Unit = {}): StreamableHttpClientTransport(source)

Returns a new Streamable HTTP transport for the Model Context Protocol using the provided HttpClient.

Return

A StreamableHttpClientTransport configured for MCP communication.

Parameters

url

URL of the MCP server.

reconnectionOptions

Options for controlling SSE reconnection behavior.

requestBuilder

Optional lambda to configure the HTTP request.


Deprecated

Use overload with ReconnectionOptions

Replace with

mcpStreamableHttpTransport(url, ReconnectionOptions(initialReconnectionDelay = reconnectionTime ?: 1.seconds), requestBuilder)

Returns a new Streamable HTTP transport for the Model Context Protocol using the provided HttpClient.

Return

A StreamableHttpClientTransport configured for MCP communication.

Parameters

url

URL of the MCP server.

reconnectionTime

Optional duration to wait before attempting to reconnect.

requestBuilder

Optional lambda to configure the HTTP request.