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
@@ -164,6 +164,8 @@ public final class io/modelcontextprotocol/kotlin/sdk/server/StdioServerTranspor
164
164
public final class io/modelcontextprotocol/kotlin/sdk/server/StreamableHttpServerTransport : io/modelcontextprotocol/kotlin/sdk/shared/AbstractTransport {
165
165
public static final field STANDALONE_SSE_STREAM_ID Ljava/lang/String;
166
166
public fun <init> ()V
167
+
public fun <init> (Lio/modelcontextprotocol/kotlin/sdk/server/StreamableHttpServerTransport$Configuration;)V
168
+
public synthetic fun <init> (Lio/modelcontextprotocol/kotlin/sdk/server/StreamableHttpServerTransport$Configuration;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
167
169
public fun <init> (ZZLjava/util/List;Ljava/util/List;Lio/modelcontextprotocol/kotlin/sdk/server/EventStore;Ljava/lang/Long;)V
168
170
public synthetic fun <init> (ZZLjava/util/List;Ljava/util/List;Lio/modelcontextprotocol/kotlin/sdk/server/EventStore;Ljava/lang/Long;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
169
171
public fun close (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
@@ -180,6 +182,22 @@ public final class io/modelcontextprotocol/kotlin/sdk/server/StreamableHttpServe
180
182
public fun start (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
181
183
}
182
184
185
+
public final class io/modelcontextprotocol/kotlin/sdk/server/StreamableHttpServerTransport$Configuration {
186
+
public static final field Companion Lio/modelcontextprotocol/kotlin/sdk/server/StreamableHttpServerTransport$Configuration$Companion;
187
+
public synthetic fun <init> (ZZLjava/util/List;Ljava/util/List;Lio/modelcontextprotocol/kotlin/sdk/server/EventStore;Lkotlin/time/Duration;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
188
+
public synthetic fun <init> (ZZLjava/util/List;Ljava/util/List;Lio/modelcontextprotocol/kotlin/sdk/server/EventStore;Lkotlin/time/Duration;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
189
+
public final fun getAllowedHosts ()Ljava/util/List;
190
+
public final fun getAllowedOrigins ()Ljava/util/List;
191
+
public final fun getEnableDnsRebindingProtection ()Z
192
+
public final fun getEnableJsonResponse ()Z
193
+
public final fun getEventStore ()Lio/modelcontextprotocol/kotlin/sdk/server/EventStore;
194
+
public final fun getRetryInterval-FghU774 ()Lkotlin/time/Duration;
195
+
}
196
+
197
+
public final class io/modelcontextprotocol/kotlin/sdk/server/StreamableHttpServerTransport$Configuration$Companion {
198
+
public final fun getDefault ()Lio/modelcontextprotocol/kotlin/sdk/server/StreamableHttpServerTransport$Configuration;
199
+
}
200
+
183
201
public final class io/modelcontextprotocol/kotlin/sdk/server/WebSocketMcpKtorServerExtensionsKt {
184
202
public static final fun mcpWebSocket (Lio/ktor/server/application/Application;Ljava/lang/String;Lkotlin/jvm/functions/Function0;)V
185
203
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