@@ -13,15 +13,14 @@ protocol types from `kotlin-sdk-core` and ships with transports for CLI and Ktor
1313 ` listPrompts ` , ` complete ` , ` setLoggingLevel ` , and subscription helpers for resources.
1414- ** Capability enforcement** : Methods fail fast if the server does not advertise the needed capability; optional
1515 strictness mirrors the protocol options used by the server SDK.
16- - ** Transports** : Ready-to-use implementations for STDIO (CLI interoperability), Ktor SSE (` SSEClientTransport ` with
16+ - ** Transports** : Ready-to-use implementations for STDIO (CLI interoperability), Ktor SSE (` SseClientTransport ` with
1717 POST back-channel), Ktor WebSocket, and Streamable HTTP for environments that prefer request/response streaming.
1818- ** Ktor client integration** : Extension helpers wire MCP over Ktor client engines with minimal setup for SSE,
1919 Streamable HTTP, or WebSocket.
2020
2121## Typical client setup
2222
23- 1 . Declare client capabilities with ` ClientOptions ` (e.g., tools, prompts, resources, logging, roots, sampling,
24- elicitation).
23+ 1 . Declare client capabilities with ` ClientOptions ` (e.g., sampling, roots, elicitation, experimental).
25242 . Create a transport suitable for your environment.
26253 . Connect using ` mcpClient ` or instantiate ` Client ` and call ` connect(transport) ` .
27264 . Use typed APIs to interact with the server; results and errors use the shared MCP types.
@@ -37,7 +36,10 @@ val client = mcpClient(
3736 resources = ClientCapabilities .Resources (subscribe = true ),
3837 )
3938 ),
40- transport = StdioClientTransport (System .`in `.source(), System .out .sink())
39+ transport = StdioClientTransport (
40+ System .`in `.asSource().buffered(),
41+ System .out .asSink().buffered()
42+ )
4143)
4244
4345val tools = client.listTools()
@@ -47,10 +49,12 @@ println(result.content)
4749
4850### Ktor-based transports
4951
50- - ** SSE** (streaming GET + POST back-channel): create ` SSEClientTransport(baseUrl, httpClient) ` ; sessions are keyed by
51- ` sessionId ` managed by the SDK.
52- - ** WebSocket** : use ` WebSocketClientTransport(url, httpClient) ` to get bidirectional messaging in one connection.
53- - ** Streamable HTTP** : ` StreamableHttpClientTransport ` enables MCP over streaming HTTP where WebSockets are unavailable.
52+ - ** SSE** (streaming GET + POST back-channel): create ` SseClientTransport(httpClient, url) ` (or
53+ ` HttpClient.mcpSseTransport(url) ` ); sessions are keyed by ` sessionId ` managed by the SDK.
54+ - ** WebSocket** : use ` WebSocketClientTransport(httpClient, url) ` (or ` HttpClient.mcpWebSocketTransport(url) ` ) to get
55+ bidirectional messaging in one connection.
56+ - ** Streamable HTTP** : ` StreamableHttpClientTransport(httpClient, url) ` enables MCP over streaming HTTP
57+ (or ` HttpClient.mcpStreamableHttpTransport(url) ` ).
5458
5559## Feature usage highlights
5660
0 commit comments