You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: introduce Configuration class for StreamableHttpServerTransport
Replace the six-parameter flat constructor of StreamableHttpServerTransport with a typed Configuration class. This improves API ergonomics and provides a stable extension point for future options without further breaking the constructor signature.
Changes:
- Add `Configuration` as a public class nested directly on `StreamableHttpServerTransport`, with `enableJsonResponse` as the first
parameter (most commonly set)
- Change the primary constructor to accept `Configuration`
- Rename `retryIntervalMillis: Long?` to `retryInterval: Duration?` in Configuration, aligning with Kotlin's type-safe time API
- Deprecate the old flat constructor with a compatibility bridge
- Update KotlinTestBase integration test to use the new constructor
Copy file name to clipboardExpand all lines: integration-test/src/jvmTest/kotlin/io/modelcontextprotocol/kotlin/sdk/integration/kotlin/AbstractResourceIntegrationTest.kt
Copy file name to clipboardExpand all lines: integration-test/src/jvmTest/kotlin/io/modelcontextprotocol/kotlin/sdk/integration/kotlin/KotlinTestBase.kt
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -148,7 +148,9 @@ abstract class KotlinTestBase {
148
148
// Create StreamableHTTP server transport
149
149
// Using JSON response mode for simpler testing (no SSE session required)
150
150
val transport =StreamableHttpServerTransport(
151
-
enableJsonResponse =true, // Use JSON response mode for testing
151
+
StreamableHttpServerTransport.Configuration(
152
+
enableJsonResponse =true, // Use JSON response mode for testing
153
+
),
152
154
)
153
155
// Use stateless mode to skip session validation for simpler testing
Copy file name to clipboardExpand all lines: kotlin-sdk-server/api/kotlin-sdk-server.api
+18Lines changed: 18 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -195,6 +195,8 @@ public final class io/modelcontextprotocol/kotlin/sdk/server/StdioServerTranspor
195
195
public final class io/modelcontextprotocol/kotlin/sdk/server/StreamableHttpServerTransport : io/modelcontextprotocol/kotlin/sdk/shared/AbstractTransport {
196
196
public static final field STANDALONE_SSE_STREAM_ID Ljava/lang/String;
197
197
public fun <init> ()V
198
+
public fun <init> (Lio/modelcontextprotocol/kotlin/sdk/server/StreamableHttpServerTransport$Configuration;)V
199
+
public synthetic fun <init> (Lio/modelcontextprotocol/kotlin/sdk/server/StreamableHttpServerTransport$Configuration;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
198
200
public fun <init> (ZZLjava/util/List;Ljava/util/List;Lio/modelcontextprotocol/kotlin/sdk/server/EventStore;Ljava/lang/Long;)V
199
201
public synthetic fun <init> (ZZLjava/util/List;Ljava/util/List;Lio/modelcontextprotocol/kotlin/sdk/server/EventStore;Ljava/lang/Long;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
200
202
public fun close (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
@@ -211,6 +213,22 @@ public final class io/modelcontextprotocol/kotlin/sdk/server/StreamableHttpServe
211
213
public fun start (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
212
214
}
213
215
216
+
public final class io/modelcontextprotocol/kotlin/sdk/server/StreamableHttpServerTransport$Configuration {
217
+
public static final field Companion Lio/modelcontextprotocol/kotlin/sdk/server/StreamableHttpServerTransport$Configuration$Companion;
218
+
public synthetic fun <init> (ZZLjava/util/List;Ljava/util/List;Lio/modelcontextprotocol/kotlin/sdk/server/EventStore;Lkotlin/time/Duration;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
219
+
public synthetic fun <init> (ZZLjava/util/List;Ljava/util/List;Lio/modelcontextprotocol/kotlin/sdk/server/EventStore;Lkotlin/time/Duration;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
220
+
public final fun getAllowedHosts ()Ljava/util/List;
221
+
public final fun getAllowedOrigins ()Ljava/util/List;
222
+
public final fun getEnableDnsRebindingProtection ()Z
223
+
public final fun getEnableJsonResponse ()Z
224
+
public final fun getEventStore ()Lio/modelcontextprotocol/kotlin/sdk/server/EventStore;
225
+
public final fun getRetryInterval-FghU774 ()Lkotlin/time/Duration;
226
+
}
227
+
228
+
public final class io/modelcontextprotocol/kotlin/sdk/server/StreamableHttpServerTransport$Configuration$Companion {
229
+
public final fun getDefault ()Lio/modelcontextprotocol/kotlin/sdk/server/StreamableHttpServerTransport$Configuration;
230
+
}
231
+
214
232
public final class io/modelcontextprotocol/kotlin/sdk/server/WebSocketMcpKtorServerExtensionsKt {
215
233
public static final fun mcpWebSocket (Lio/ktor/server/application/Application;Ljava/lang/String;Lkotlin/jvm/functions/Function0;)V
216
234
public static final fun mcpWebSocket (Lio/ktor/server/application/Application;Lkotlin/jvm/functions/Function0;)V
Copy file name to clipboardExpand all lines: kotlin-sdk-server/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server/StreamableHttpServerTransport.kt
0 commit comments