From 791f717881f9b60a64156401f8e72183a267f9c7 Mon Sep 17 00:00:00 2001 From: devcrocod Date: Tue, 11 Nov 2025 21:26:29 +0100 Subject: [PATCH 1/3] Update deprecation level of SSEServerTransport and SSEClientTransport to ERROR --- .../kotlin/sdk/client/SSEClientTransport.kt | 2 +- .../kotlin/sdk/server/SSEServerTransport.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kotlin-sdk-client/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/client/SSEClientTransport.kt b/kotlin-sdk-client/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/client/SSEClientTransport.kt index f2b7d3dd..d858c1df 100644 --- a/kotlin-sdk-client/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/client/SSEClientTransport.kt +++ b/kotlin-sdk-client/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/client/SSEClientTransport.kt @@ -33,7 +33,7 @@ import kotlin.concurrent.atomics.AtomicBoolean import kotlin.concurrent.atomics.ExperimentalAtomicApi import kotlin.time.Duration -@Deprecated("Use SseClientTransport instead", ReplaceWith("SseClientTransport"), DeprecationLevel.WARNING) +@Deprecated("Use SseClientTransport instead", ReplaceWith("SseClientTransport"), DeprecationLevel.ERROR) public typealias SSEClientTransport = SseClientTransport /** diff --git a/kotlin-sdk-server/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server/SSEServerTransport.kt b/kotlin-sdk-server/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server/SSEServerTransport.kt index b8c15563..2e1a2852 100644 --- a/kotlin-sdk-server/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server/SSEServerTransport.kt +++ b/kotlin-sdk-server/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server/SSEServerTransport.kt @@ -21,7 +21,7 @@ import kotlin.uuid.Uuid internal const val SESSION_ID_PARAM = "sessionId" -@Deprecated("Use SseServerTransport instead", ReplaceWith("SseServerTransport"), DeprecationLevel.WARNING) +@Deprecated("Use SseServerTransport instead", ReplaceWith("SseServerTransport"), DeprecationLevel.ERROR) public typealias SSEServerTransport = SseServerTransport /** From 4c6ffe0947303bd0455b39b7760439faa7534a98 Mon Sep 17 00:00:00 2001 From: devcrocod Date: Tue, 11 Nov 2025 21:26:51 +0100 Subject: [PATCH 2/3] Remove deprecated MCP function in KtorServer --- kotlin-sdk-server/api/kotlin-sdk-server.api | 1 - .../io/modelcontextprotocol/kotlin/sdk/server/KtorServer.kt | 6 ------ 2 files changed, 7 deletions(-) diff --git a/kotlin-sdk-server/api/kotlin-sdk-server.api b/kotlin-sdk-server/api/kotlin-sdk-server.api index 045addff..11ac161e 100644 --- a/kotlin-sdk-server/api/kotlin-sdk-server.api +++ b/kotlin-sdk-server/api/kotlin-sdk-server.api @@ -1,5 +1,4 @@ public final class io/modelcontextprotocol/kotlin/sdk/server/KtorServerKt { - public static final fun MCP (Lio/ktor/server/application/Application;Lkotlin/jvm/functions/Function1;)V public static final fun mcp (Lio/ktor/server/application/Application;Lkotlin/jvm/functions/Function1;)V public static final fun mcp (Lio/ktor/server/routing/Routing;Ljava/lang/String;Lkotlin/jvm/functions/Function1;)V public static final fun mcp (Lio/ktor/server/routing/Routing;Lkotlin/jvm/functions/Function1;)V diff --git a/kotlin-sdk-server/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server/KtorServer.kt b/kotlin-sdk-server/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server/KtorServer.kt index 8ad4c2f4..2a2f950a 100644 --- a/kotlin-sdk-server/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server/KtorServer.kt +++ b/kotlin-sdk-server/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server/KtorServer.kt @@ -60,12 +60,6 @@ public fun Routing.mcp(block: ServerSSESession.() -> Server) { } } -@Suppress("FunctionName") -@Deprecated("Use mcp() instead", ReplaceWith("mcp(block)"), DeprecationLevel.ERROR) -public fun Application.MCP(block: ServerSSESession.() -> Server) { - mcp(block) -} - @KtorDsl public fun Application.mcp(block: ServerSSESession.() -> Server) { install(SSE) From bdb222160bc3766e089c60c4a9e23ebc58e57f09 Mon Sep 17 00:00:00 2001 From: devcrocod Date: Tue, 11 Nov 2025 21:27:21 +0100 Subject: [PATCH 3/3] Replace `connect` with `createSession` in server samples --- .../kotlin/io/modelcontextprotocol/sample/server/server.kt | 4 ++-- .../io/modelcontextprotocol/sample/server/McpWeatherServer.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/kotlin-mcp-server/src/main/kotlin/io/modelcontextprotocol/sample/server/server.kt b/samples/kotlin-mcp-server/src/main/kotlin/io/modelcontextprotocol/sample/server/server.kt index eb610711..a593377f 100644 --- a/samples/kotlin-mcp-server/src/main/kotlin/io/modelcontextprotocol/sample/server/server.kt +++ b/samples/kotlin-mcp-server/src/main/kotlin/io/modelcontextprotocol/sample/server/server.kt @@ -116,7 +116,7 @@ fun runSseMcpServerWithPlainConfiguration(port: Int, wait: Boolean = true) { routing { sse("/sse") { val transport = SseServerTransport("/message", this) - val serverSession = server.connect(transport) + val serverSession = server.createSession(transport) serverSessions[transport.sessionId] = serverSession serverSession.onClose { @@ -197,7 +197,7 @@ fun runMcpServerUsingStdio() { ) runBlocking { - server.connect(transport) + server.createSession(transport) val done = Job() server.onClose { done.complete() diff --git a/samples/weather-stdio-server/src/main/kotlin/io/modelcontextprotocol/sample/server/McpWeatherServer.kt b/samples/weather-stdio-server/src/main/kotlin/io/modelcontextprotocol/sample/server/McpWeatherServer.kt index a0d19684..181431e1 100644 --- a/samples/weather-stdio-server/src/main/kotlin/io/modelcontextprotocol/sample/server/McpWeatherServer.kt +++ b/samples/weather-stdio-server/src/main/kotlin/io/modelcontextprotocol/sample/server/McpWeatherServer.kt @@ -129,7 +129,7 @@ fun runMcpServer() { ) runBlocking { - val session = server.connect(transport) + val session = server.createSession(transport) val done = Job() session.onClose { done.complete()