Skip to content

Commit 7da7675

Browse files
committed
fix: revert deprecated StreamableHttpServerTransport default constructor
- Revert default constructor and mark it as deprecated - Add ReplaceWith expression for multi-parameter constructor
1 parent ca4ad58 commit 7da7675

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

kotlin-sdk-server/api/kotlin-sdk-server.api

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ public final class io/modelcontextprotocol/kotlin/sdk/server/StdioServerTranspor
194194

195195
public final class io/modelcontextprotocol/kotlin/sdk/server/StreamableHttpServerTransport : io/modelcontextprotocol/kotlin/sdk/shared/AbstractTransport {
196196
public static final field STANDALONE_SSE_STREAM_ID Ljava/lang/String;
197+
public fun <init> ()V
197198
public fun <init> (Lio/modelcontextprotocol/kotlin/sdk/server/StreamableHttpServerTransport$Configuration;)V
198199
public fun <init> (ZZLjava/util/List;Ljava/util/List;Lio/modelcontextprotocol/kotlin/sdk/server/EventStore;Ljava/lang/Long;)V
199200
public synthetic fun <init> (ZZLjava/util/List;Ljava/util/List;Lio/modelcontextprotocol/kotlin/sdk/server/EventStore;Ljava/lang/Long;ILkotlin/jvm/internal/DefaultConstructorMarker;)V

kotlin-sdk-server/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server/StreamableHttpServerTransport.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ private data class SessionContext(val session: ServerSSESession?, val call: Appl
7474
@Suppress("TooManyFunctions")
7575
public class StreamableHttpServerTransport(private val configuration: Configuration) : AbstractTransport() {
7676

77+
@Deprecated("Use default constructor with explicit Configuration()")
78+
public constructor() : this(configuration = Configuration())
79+
7780
/**
7881
* Secondary constructor for `StreamableHttpServerTransport` that simplifies initialization by directly taking the
7982
* configurable parameters without requiring a `Configuration` instance.
@@ -91,9 +94,12 @@ public class StreamableHttpServerTransport(private val configuration: Configurat
9194
* @param retryIntervalMillis Retry interval in milliseconds for event handling or reconnection attempts.
9295
* Defaults to `null`.
9396
*/
97+
@Suppress("MaxLineLength")
9498
@Deprecated(
9599
"Use constructor with Configuration: StreamableHttpServerTransport(Configuration(enableJsonResponse = ...))",
96-
level = DeprecationLevel.WARNING,
100+
replaceWith = ReplaceWith(
101+
"StreamableHttpServerTransport(Configuration(enableJsonResponse = enableJsonResponse, enableDnsRebindingProtection = enableDnsRebindingProtection, allowedHosts = allowedHosts, allowedOrigins = allowedOrigins, eventStore = eventStore, retryIntervalMillis = retryIntervalMillis))",
102+
),
97103
)
98104
public constructor(
99105
enableJsonResponse: Boolean = false,

0 commit comments

Comments
 (0)