fix(server): notifications not delivered over Streamable HTTP (#587)#599
Merged
fix(server): notifications not delivered over Streamable HTTP (#587)#599
Conversation
…eline file for expected test failures
…esponse format in ConformanceTools
…deFlow implementation
… directory resolution and disabling redundant shellcheck warning
…bump conformance tool version to 0.1.15
…ow implementation
fixes #589 ## How Has This Been Tested? conformance tests ## Breaking Changes NaN ## Types of changes - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update ## Checklist - [x] I have read the [MCP Documentation](https://modelcontextprotocol.io) - [x] My code follows the repository's style guidelines - [x] New and existing tests pass locally - [ ] I have added appropriate error handling - [ ] I have added or updated documentation as needed
fixes #588 ## How Has This Been Tested? conformance test ## Breaking Changes NaN ## Types of changes - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update ## Checklist - [x] I have read the [MCP Documentation](https://modelcontextprotocol.io) - [x] My code follows the repository's style guidelines - [x] New and existing tests pass locally - [ ] I have added appropriate error handling - [ ] I have added or updated documentation as needed
…ared factory method
…rios to matrix, and update conformance test baseline
…fine JWT assertion audience handling
Add configurable SSE reconnection with exponential backoff and server-driven retry delays to `StreamableHttpClientTransport` closes #590 closes #420 ## How Has This Been Tested? New unit tests and pass conformance test ## Breaking Changes old constructors are Deprecated `close` no longer calls `terminateSession` ## Types of changes - [x] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update ## Checklist - [x] I have read the [MCP Documentation](https://modelcontextprotocol.io) - [x] My code follows the repository's style guidelines - [x] New and existing tests pass locally - [x] I have added appropriate error handling - [x] I have added or updated documentation as needed
- Introduced `list` command in `run-conformance.sh` to display available scenarios. - Updated README with details about the new `list` command and its purpose.
… troubleshooting documentation - Integrate KotlinLogging for debug messages in `test_tool_with_logging`. - Add logging configuration via `simplelogger.properties`. - Expand README with network traffic capture tools and usage examples.
- Add `awaitCancellation()` to prevent premature stream closure in SSE handler.
…selines Following tests are now passing: - tools-call-with-logging - tools-call-with-progress - tools-call-sampling - tools-call-elicitation - elicitation-sep1034-defaults
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This was referenced Mar 12, 2026
Merged
devcrocod
reviewed
Mar 12, 2026
kpavlov
added a commit
that referenced
this pull request
Mar 12, 2026
…th retry support (#596) (#585) Adds a comprehensive conformance test suite for the Kotlin MCP SDK, covering core protocol operations, tool calls, elicitation, resources, prompts, and 20 OAuth/auth scenarios - Conformance server and client implementations - OAuth/auth test scenarios: JWT, authorization code flow, client credentials, PKCE, scope handling, cross-app access, client registration - CI workflow - Baseline file for tracking expected failures - Shell script fixes: - #592 - #593 - #596 ## Remaining known failures (tracked issues, will be fixed directly in `main`) - [x] `tools-call-with-logging`, `tools-call-with-progress`, `tools-call-sampling`, `tools-call-elicitation`, `elicitation-sep1034-defaults`- see #599, - [x] `elicitation-sep1330-enums` - #587 #600 - [x] `initialize` - #588 - [x] `tools_call`, `auth/scope-step-up`, `auth/scope-retry-limit` - #589 - [ ] `elicitation-sep1034-client-defaults` - #414 - [x] `sse-retry` - #590 - [ ] `resources-templates-read` - #591 ## Breaking Changes from #596 - `StreamableHttpClientTransport` and `mcpStreamableHttp`/`mcpStreamableHttpTransport`: old constructors accepting `Duration` timeout are now `@Deprecated` — use the new overloads with `ReconnectionOptions` instead - `StreamableHttpClientTransport.close()` no longer calls `terminateSession()` automatically ## Types of changes - [x] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [x] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update ## Checklist - [x] I have read the [MCP Documentation](https://modelcontextprotocol.io) - [x] My code follows the repository's style guidelines - [x] New and existing tests pass locally - [x] I have added appropriate error handling - [x] I have added or updated documentation as needed --------- Co-authored-by: Konstantin Pavlov <1517853+kpavlov@users.noreply.github.com>
# Conflicts: # conformance-test/conformance-baseline.yml # conformance-test/src/main/kotlin/io/modelcontextprotocol/kotlin/sdk/conformance/ConformanceTools.kt # conformance-test/src/main/resources/simplelogger.properties
…scenarios - Removed 5 server tests (`tools-call-with-logging`, `tools-call-with-progress`, `tools-call-sampling`, `tools-call-elicitation`, `elicitation-sep1034-defaults`) that now pass.
devcrocod
approved these changes
Mar 12, 2026
| @@ -114,16 +114,11 @@ Tests the conformance server against all server scenarios: | |||
| 8 scenarios are expected to fail due to current SDK limitations (tracked in [ | |||
Contributor
There was a problem hiding this comment.
Please reduce the number of expected failed scenarios
Contributor
Author
There was a problem hiding this comment.
Will do it in the next PR
kpavlov
added a commit
that referenced
this pull request
Mar 12, 2026
…ep1330_enums (#600) ## Correct SEP-1330 enum schemas in test_elicitation_sep1330_enums **NB! This PR contains changes from #599 and should be rebased and merged after #599 is merged.** Update conformance test according to [test requirements](https://github.com/modelcontextprotocol/conformance/blob/main/src/scenarios/server/elicitation-enums.ts#L14C1-L35C9). - Fix legacyEnum: was using `oneOf` with const/title pairs; now correctly uses `enum` + `enumNames` arrays per LegacyEnumSchema spec - Fix titledMulti: items were using `oneOf` with extra `type:"string"`; now correctly uses `anyOf` per TitledMultiSelectEnumSchema spec - Fix return text format to match expected "Elicitation completed: action=..., content=..." - Remove _elicitation-sep1330-enums_ from conformance baseline (test now passes) ## How Has This Been Tested? ```shell ./conformance-test/run-conformance.sh server ``` ## Breaking Changes No ## Types of changes - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply. --> - [x] I have read the [MCP Documentation](https://modelcontextprotocol.io) - [x] My code follows the repository's style guidelines - [x] New and existing tests pass locally - [ ] I have added appropriate error handling - [ ] I have added or updated documentation as needed --------- Co-authored-by: devcrocod <devcrocod@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Motivation and Context
Two bugs in StreamableHttpServerTransport caused server-to-client notifications (e.g. notifications/message during tool calls) to be silently dropped.
Bug 1 — GET SSE stream closed immediately
handleGetRequestrejected GET requests with 405 whenenableJsonResponse = true(whichmcpStreamableHttpalways sets). Since the Ktorsse {}handler commits response headers before the body runs, the reject failed silently and the function returned, causing Ktor to close the SSE stream. There was also noawaitCancellation()to keep the connection alive.Bug 2 — Notifications discarded in JSON mode
In
send(), notifications with a relatedRequestId entered the POST-stream path but hitif (!isTerminated) returnwithout being forwarded anywhere.Fix
awaitCancellation()to keep the GET SSE connection open until the client disconnects or the transport closes.send(), route notifications with a relatedRequestId to the standalone GET SSE stream whenenableJsonResponse = true.How Has This Been Tested?
Verified against the MCP conformance test suite — the ToolsCallWithLogging scenario now passes. ngrep confirms the
GET /mcpstream stays open andnotifications/messageevents arrive before thetools/callresponse.Breaking Changes
Types of changes
Checklist
Additional context
Fixes #587
Requires #585 to be merged first.