Skip to content

Fix duplicate SSE plugin installation in Ktor application helpers (#1079) - #1092

Open
soulkeykim wants to merge 1 commit into
modelcontextprotocol:mainfrom
soulkeykim:fix/1079-reuse-sse-plugin
Open

soulkeykim wants to merge 1 commit into
modelcontextprotocol:mainfrom
soulkeykim:fix/1079-reuse-sse-plugin

Conversation

@soulkeykim

Copy link
Copy Markdown

Fixes #1079.

Summary

  • Install Ktor's SSE plugin only when it is absent in Application.mcp and the shared Application.mcpStreamableHttp setup.
  • Preserve an application's existing SSE plugin while keeping automatic installation for the usual single-endpoint setup.
  • Add regression coverage for preinstalled SSE in both helpers and two Streamable HTTP endpoints in the same application. Each streamable endpoint completes an MCP initialization and closes its session.

The production change is one import and two guards. There are no public API changes.

Testing

Using JDK 21.0.12.1 and the repository's Gradle 9.8.0 wrapper:

  • Before the production fix, ./gradlew :kotlin-sdk-server:jvmTest --tests '*KtorExtensionsTest' ran 8 cases: the 3 duplicate-install regressions failed with DuplicatePluginException, and the other 5 passed.
  • After the fix, the same command passed all 8 cases.
  • ./gradlew :kotlin-sdk-server:jvmTest passed all 167 server JVM tests, with no failures or skips.
  • ./gradlew :kotlin-sdk-server:ktlintCheck passed.
  • ./gradlew :kotlin-sdk-server:detekt passed, including detektMainJvm.
  • git diff --check passed.

Full :kotlin-sdk-server:checkKotlinAbi could not complete in the validation environment: Kotlin/Native's MinGW dependency download (msys2-mingw-w64-x86_64-2.tar.gz) was blocked by an HTTP 403 from the environment proxy. The ABI result is therefore unverified and should be checked in CI. JS and Wasm compilation completed during the first ABI attempt; non-JVM runtime tests and the full repository build were not run.

@soulkeykim
soulkeykim marked this pull request as ready for review October 1, 2026 23:28

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mcpStreamableHttp fails when the SSE plugin is already installed

1 participant