StreamableHttpClientTransport

class StreamableHttpClientTransport(client: HttpClient, url: String, reconnectionTime: Duration? = null, requestBuilder: HttpRequestBuilder.() -> Unit = {}) : AbstractTransport(source)

Client transport for Streamable HTTP: this implements the MCP Streamable HTTP transport specification. It will connect to a server using HTTP POST for sending messages and HTTP GET with Server-Sent Events for receiving messages.

Constructors

Link copied to clipboard
constructor(client: HttpClient, url: String, reconnectionTime: Duration? = null, requestBuilder: HttpRequestBuilder.() -> Unit = {})

Properties

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open suspend override fun close()
Link copied to clipboard
open override fun onClose(block: () -> Unit)
Link copied to clipboard
open override fun onError(block: (Throwable) -> Unit)
Link copied to clipboard
open override fun onMessage(block: suspend (JSONRPCMessage) -> Unit)
Link copied to clipboard
open suspend override fun send(message: JSONRPCMessage)

Sends a single message with optional resumption support

suspend fun send(message: JSONRPCMessage, resumptionToken: String?, onResumptionToken: (String) -> Unit? = null)

Sends one or more messages with optional resumption support. This is the main send method that matches the TypeScript implementation.

Link copied to clipboard
open suspend override fun start()
Link copied to clipboard
suspend fun terminateSession()

Terminates the current session by sending a DELETE request to the server.