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 data class for StreamableHttpServerTransport
Replace the six-parameter flat constructor of StreamableHttpServerTransport with a typed Configuration data class. This improves API ergonomics, enables structural equality and copy(), and provides a stable extension point for future options without further breaking the constructor signature.
Changes:
- Add `Configuration` as a public data 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
-1Lines changed: 0 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -165,7 +165,6 @@ abstract class AbstractResourceIntegrationTest : KotlinTestBase() {
165
165
assertEquals(testResourceContent, content.text, "Resource content should match")
166
166
}
167
167
168
-
@Ignore("Blocked by https://github.com/modelcontextprotocol/kotlin-sdk/issues/249")
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
+29Lines changed: 29 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,33 @@ 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 component1 ()Z
190
+
public final fun component2 ()Z
191
+
public final fun component3 ()Ljava/util/List;
192
+
public final fun component4 ()Ljava/util/List;
193
+
public final fun component5 ()Lio/modelcontextprotocol/kotlin/sdk/server/EventStore;
194
+
public final fun component6-FghU774 ()Lkotlin/time/Duration;
195
+
public final fun copy-BAu0izY (ZZLjava/util/List;Ljava/util/List;Lio/modelcontextprotocol/kotlin/sdk/server/EventStore;Lkotlin/time/Duration;)Lio/modelcontextprotocol/kotlin/sdk/server/StreamableHttpServerTransport$Configuration;
196
+
public static synthetic fun copy-BAu0izY$default (Lio/modelcontextprotocol/kotlin/sdk/server/StreamableHttpServerTransport$Configuration;ZZLjava/util/List;Ljava/util/List;Lio/modelcontextprotocol/kotlin/sdk/server/EventStore;Lkotlin/time/Duration;ILjava/lang/Object;)Lio/modelcontextprotocol/kotlin/sdk/server/StreamableHttpServerTransport$Configuration;
197
+
public fun equals (Ljava/lang/Object;)Z
198
+
public final fun getAllowedHosts ()Ljava/util/List;
199
+
public final fun getAllowedOrigins ()Ljava/util/List;
200
+
public final fun getEnableDnsRebindingProtection ()Z
201
+
public final fun getEnableJsonResponse ()Z
202
+
public final fun getEventStore ()Lio/modelcontextprotocol/kotlin/sdk/server/EventStore;
203
+
public final fun getRetryInterval-FghU774 ()Lkotlin/time/Duration;
204
+
public fun hashCode ()I
205
+
public fun toString ()Ljava/lang/String;
206
+
}
207
+
208
+
public final class io/modelcontextprotocol/kotlin/sdk/server/StreamableHttpServerTransport$Configuration$Companion {
209
+
public final fun getDefault ()Lio/modelcontextprotocol/kotlin/sdk/server/StreamableHttpServerTransport$Configuration;
210
+
}
211
+
183
212
public final class io/modelcontextprotocol/kotlin/sdk/server/WebSocketMcpKtorServerExtensionsKt {
184
213
public static final fun mcpWebSocket (Lio/ktor/server/application/Application;Ljava/lang/String;Lkotlin/jvm/functions/Function0;)V
185
214
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