Skip to content

fix(server): preserve id on duplicate initialize errors#868

Open
jstar0 wants to merge 1 commit into
modelcontextprotocol:mainfrom
jstar0:fix/streamable-http-reject-id
Open

fix(server): preserve id on duplicate initialize errors#868
jstar0 wants to merge 1 commit into
modelcontextprotocol:mainfrom
jstar0:fix/streamable-http-reject-id

Conversation

@jstar0

@jstar0 jstar0 commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #866.

Changes

  • Preserve the parsed JSON-RPC request id when Streamable HTTP rejects a duplicate initialize request.
  • Keep pre-parse and transport-level rejection paths unchanged when the request id is not available.
  • Extend the duplicate-initialize regression test to assert the error response id as well as the HTTP status.

Verification

./gradlew :kotlin-sdk-server:jvmTest --tests 'io.modelcontextprotocol.kotlin.sdk.server.StreamableHttpServerTransportTest.second initialization request returns JSON-RPC error with request id'
./gradlew :kotlin-sdk-server:jvmTest --tests 'io.modelcontextprotocol.kotlin.sdk.server.StreamableHttpServerTransportTest'
./gradlew :kotlin-sdk-server:jvmTest
./gradlew :kotlin-sdk-server:ktlintCheck :kotlin-sdk-server:detekt

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.

Streamable HTTP transport omits JSON-RPC id when rejecting parsed requests

1 participant