Fix kotlin-mcp-server example and update samples#345
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes the kotlin-mcp-server example by consolidating the multiplatform setup into a simpler JVM-only configuration and updates SDK versions across all samples. The WASM implementation has been removed to reduce complexity while maintaining all core functionality.
Key changes:
- Updated dependency versions (Kotlin 2.2.20→2.2.21, MCP SDK 0.7.3→0.7.4, Ktor 3.3.x→3.2.3)
- Consolidated kotlin-mcp-server from multiplatform to JVM-only with standard Gradle application plugin
- Moved STDIO functionality from platform-specific to main source set
Reviewed Changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| samples/weather-stdio-server/gradle/libs.versions.toml | Updated dependency versions |
| samples/kotlin-mcp-server/src/main/kotlin/io/modelcontextprotocol/sample/server/server.kt | Fixed package name, improved SSE error handling, moved STDIO function from JVM-specific code |
| samples/kotlin-mcp-server/src/main/kotlin/io/modelcontextprotocol/sample/server/main.kt | Updated package declaration and moved main function to common source |
| samples/kotlin-mcp-server/src/jvmMain/kotlin/main.jvm.kt | Removed JVM-specific entry point (functionality moved to main) |
| samples/kotlin-mcp-server/gradle/libs.versions.toml | Updated versions and switched from multiplatform to JVM plugin |
| samples/kotlin-mcp-server/build.gradle.kts | Simplified from multiplatform to single-platform JVM configuration |
| samples/kotlin-mcp-server/README.md | Updated documentation to reflect JVM-only setup and improved examples |
| samples/kotlin-mcp-client/gradle/libs.versions.toml | Updated dependency versions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| dependencies { | ||
| implementation(libs.mcp.kotlin.server) | ||
| implementation(libs.ktor.server.cio) |
There was a problem hiding this comment.
It's better to use Netty as server engine, because CIO does not support Http2 and Netty is de-facto a standard for high-performance servers for decades.
There was a problem hiding this comment.
This example is essentially crossplatform
Therefore, I think it’s better to keep cio as the default ktor engine, since ktor itself uses it in its own examples
| "--sse-server" -> runSseMcpServerWithPlainConfiguration(port) | ||
| else -> { | ||
| error("Unknown command: $command") | ||
| System.err.println("Unknown command: $command") |
There was a problem hiding this comment.
Would it exit with 0? Is it the right behavior?
There was a problem hiding this comment.
Oh, this seems to be an unexpected behavior after the refactoring
I’ll fix it
| @@ -1,4 +1,4 @@ | |||
| package shared | |||
| package io.modelcontextprotocol.sample.server | |||
2e1cb8b to
51b814d
Compare
…esign, add Standard I/O transport, and simplify build scripts
…d cleanup unused imports
25364df to
a13636a
Compare
kotlin-mcp-serverexample (Fix samples/kotlin-mcp-server #331)Motivation and Context
Removed the WASM example, as it duplicates the JVM example and only adds unnecessary complexity
How Has This Been Tested?
Locally
Breaking Changes
No
Types of changes
Checklist