Package-level declarations

Types

Link copied to clipboard
open class Client(clientInfo: Implementation, options: ClientOptions = ClientOptions()) : Protocol

An MCP client on top of a pluggable transport.

Link copied to clipboard
class ClientOptions(val capabilities: ClientCapabilities = ClientCapabilities(), enforceStrictCapabilities: Boolean = true) : ProtocolOptions

Options for configuring the MCP client.

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

Client transport for SSE: this will connect to a server using Server-Sent Events for receiving messages and make separate POST requests for sending messages.

Link copied to clipboard
class StdioClientTransport(input: Source, output: Sink) : AbstractTransport

A transport implementation for JSON-RPC communication that leverages standard input and output streams.

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

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.

Link copied to clipboard
class StreamableHttpError(val code: Int? = null, message: String? = null) : Exception

Error class for Streamable HTTP transport errors.

Link copied to clipboard
class WebSocketClientTransport(client: HttpClient, urlString: String?, requestBuilder: HttpRequestBuilder.() -> Unit = {}) : WebSocketMcpTransport

Client transport for WebSocket: this will connect to a server over the WebSocket protocol.

Functions

Link copied to clipboard
suspend fun HttpClient.mcpSse(urlString: String? = null, reconnectionTime: Duration? = null, requestBuilder: HttpRequestBuilder.() -> Unit = {}): Client

Creates and connects an MCP client over SSE using the provided HttpClient.

Link copied to clipboard
fun HttpClient.mcpSseTransport(urlString: String? = null, reconnectionTime: Duration? = null, requestBuilder: HttpRequestBuilder.() -> Unit = {}): SseClientTransport

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

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

Creates and connects an MCP client over Streamable HTTP using the provided HttpClient.

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

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

Link copied to clipboard
suspend fun HttpClient.mcpWebSocket(urlString: String? = null, requestBuilder: HttpRequestBuilder.() -> Unit = {}): Client

Creates and connects an MCP client over WebSocket using the provided HttpClient.

Link copied to clipboard
fun HttpClient.mcpWebSocketTransport(urlString: String? = null, requestBuilder: HttpRequestBuilder.() -> Unit = {}): WebSocketClientTransport

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