The official Kotlin SDK for Model Context Protocol servers and clients. Maintained in collaboration with JetBrains
by modelcontextprotocolKotlin
Last 12 weeks · 122 commits
5 of 6 standards met
Fixes #922. parks on for the lifetime of the standalone GET stream. only called , which flushes and closes the response body but never cancels that coroutine, so the and its connection were never released — one leaked socket per completed session, as measured in the issue. already holds the , so this cancels its job alongside closing the session. Same assumption appeared a second time in the GET-replacement path, where the comment claimed cancels the old coroutine. It doesn't, so a client reconnecting its GET stream leaked the previous one the same way. Fixed and the comment corrected. Two tests, both failing before the change: one for teardown via , one for a replacement stream. Both assert the handler is still suspended before teardown, otherwise they'd pass vacuously — the client-side view can't catch this, since gives the client EOF while the server coroutine stays parked. , , and the JVM test suites pass.
Fixes #922 Summary Cancel the coroutine job associated with each mapped Streamable HTTP request when the transport closes. Cancel replaced standalone GET stream jobs and explicitly closed SSE stream jobs as well. Preserve the current caller job so stateless request cleanup can finish normally. Add a regression test proving that closing the transport cancels a standalone GET SSE handler. Test context All Gradle commands were run in because the host default JDK is 8. — passed, 229 tests, 0 failures, 0 errors. — passed. — passed. — passed across the configured JVM, JS, and native API targets. — passed. — passed.
Summary Replay callbacks registered after . Preserve registration order for callbacks registered before initialization and make the state transition race-safe. Add a handshake-level regression test and document synchronous replay behavior. Fixes #920 Validation — passed — passed — passed — passed — passed — passed
Repository: modelcontextprotocol/kotlin-sdk. Description: The official Kotlin SDK for Model Context Protocol servers and clients. Maintained in collaboration with JetBrains Stars: 1442, Forks: 240. Primary language: Kotlin. Languages: Kotlin (98%), TypeScript (1.7%), Shell (0.3%). Homepage: https://modelcontextprotocol.github.io/kotlin-sdk/ Topics: kotlin-multiplatform, mcp. Latest release: 0.15.0 (3w ago). Open PRs: 15, open issues: 67. Last activity: 3d ago. Community health: 87%. Top contributors: dependabot[bot], devcrocod, kpavlov, e5l, tiginamaria, ignatov, Mr3zee, jclyne, SeanChinJunKai, skarpovdev and others.