feat: Add Spring WebMVC streamable server transport provider#425
Merged
tzolov merged 22 commits intomodelcontextprotocol:mainfrom Jul 30, 2025
Merged
feat: Add Spring WebMVC streamable server transport provider#425tzolov merged 22 commits intomodelcontextprotocol:mainfrom
tzolov merged 22 commits intomodelcontextprotocol:mainfrom
Conversation
…raction Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
…sync server tests Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
8 tasks
Closed
ba7756f to
9e660d1
Compare
tzolov
commented
Jul 28, 2025
| return ServerResponse.status(HttpStatus.SERVICE_UNAVAILABLE).body("Server is shutting down"); | ||
| } | ||
|
|
||
| McpTransportContext transportContext = this.contextExtractor.apply(request); |
Contributor
Author
There was a problem hiding this comment.
How to make use of this?
tzolov
commented
Jul 28, 2025
| return ServerResponse.notFound().build(); | ||
| } | ||
|
|
||
| return session.delete().then(ServerResponse.ok().build()); |
Contributor
Author
There was a problem hiding this comment.
I guess we need to remove the session from the sessions maps as well?
e.g. this.sessions.remove(sessionId);
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
5c1d0d5 to
5290f39
Compare
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
6e7c16c to
fd8d7bb
Compare
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
…protocol#425) - Add WebMvcStreamableServerTransportProvider with SSE support for streamable sessions - Support GET, POST, DELETE endpoints for MCP protocol operations - Implement thread-safe SSE operations using ReentrantLock in WebMvcSseServerTransportProvider - Add test infrastructure with AbstractMcpClientServerIntegrationTests - Refactor WebMvcStreamableIntegrationTests to use parameterized tests - Support testing with both HttpClient and WebFlux transports - Add streamable transport tests for both async and sync server modes - Refactor existing WebMVC SSE integration tests to use shared test base - Add error handling improvements in McpStreamableServerSession - Update dependencies: add json-unit-assertj for enhanced JSON testing - Reorganize POM dependencies and add mcp-spring-webflux test dependency This change enables Spring WebMVC applications to use the streamable MCP transport protocol with proper thread safety guarantees and comprehensive test coverage. Related to modelcontextprotocol#72 Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
- Wrap consumer, tool, resource, prompt, and completion handler calls with Mono.defer() - Ensures proper lazy evaluation and error handling in reactive streams Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
fd8d7bb to
8a2e978
Compare
This was referenced Oct 14, 2025
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.
Related to #72
NOTE: built on top and depending on the #420
This PR adds Spring WebMVC streamable server transport provider support to the MCP Java SDK, providing a non-reactive alternative to the existing WebFlux implementation for HTTP/SSE-based MCP servers.
How Has This Been Tested?
The implementation has been thoroughly tested with:
WebMcpStreamableMcpAsyncServerTestsextending the abstract test suiteWebMvcStreamableIntegrationTestswith comprehensive scenarios including:Breaking Changes
No breaking changes.
Types of changes
Checklist
Additional context
Implementation Details:
WebMvcStreamableServerTransportProviderimplementsMcpStreamableServerTransportProviderRouterFunctionfor endpoint handling (GET, POST, DELETE)ServerResponse.sse()for streaming responsesConcurrentHashMapfor thread safetyKey Features:
Testing Strategy:
AbstractMcpAsyncServerTeststo useprepareAsyncServerBuilder()pattern