Skip to content

feat: add WebMVC and HttpServlet stateless server transports #432

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

tzolov
Copy link
Contributor

@tzolov tzolov commented Jul 30, 2025

  • Add WebMvcStatelessServerTransport for mcp-spring-webmvc module
  • Add HttpServletStatelessServerTransport for mcp module
  • Implement builder patterns for AsyncToolSpecification and SyncToolSpecification
  • Create AbstractStatelessIntegrationTests base class for shared test functionality
  • Add integration tests for both transport implementations

Add WebMVC and HttpServlet stateless server transports with testing infrastructure, including builder patterns for tool specifications and shared integration test framework.

The existing codebase only had WebFlux support for stateless servers, limiting deployment options for users who prefer or require WebMVC or servlet-based solutions.

How Has This Been Tested?

  • Integration Tests: Both transport implementations include full integration test suites covering:

Breaking Changes

No breaking changes - All additions are backward compatible:

Types of changes

  • 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

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

Implementation Details

  • WebMvcStatelessServerTransport: Uses Spring's functional router (RouterFunction) for endpoint definition, making it easy to integrate into existing WebMVC applications
  • HttpServletStatelessServerTransport: Extends HttpServlet
  • Builder Patterns: Added fluent builder APIs for both sync and async tool specifications to improve code readability and maintainability

- Add WebMvcStatelessServerTransport for mcp-spring-webmvc module
- Add HttpServletStatelessServerTransport for mcp module
- Implement builder patterns for AsyncToolSpecification and SyncToolSpecification
- Create AbstractStatelessIntegrationTests base class for shared test functionality
- Add integration tests for both transport implementations

Signed-off-by: Christian Tzolov <[email protected]>
@tzolov tzolov added this to the 0.11.0 milestone Jul 30, 2025
@tzolov tzolov merged commit 8f03a40 into modelcontextprotocol:main Jul 30, 2025
1 of 2 checks passed
@tzolov tzolov mentioned this pull request Jul 30, 2025
8 tasks
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.

1 participant