- Change most INFO logs to DEBUG level for operational messages
- Keep stderr messages at INFO level
- Rename errorHandler to stdErrorHandler in StdioClientTransport
- Add debug logging for JSON message deserialization
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
Accept HTTP status codes 200, 201, 202, and 206 as valid responses
for SSE stream connection. Improves error message to include actual
status code. Removes unused main method.
Resolves#68
Implement protocol version negotiation between MCP client and server to ensure
compatibility and graceful version handling.
The server will now suggest the latest supported version when an
unsupported version is requested, while the client will verify
version compatibility during initialization.
- Support multiple protocol versions in both client and server
- Negotiate compatible version during initialization
- Fall back to latest version when unsupported version requested
- Add comprehensive test coverage for version negotiation
Resolves#71
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
Introduce new builder patterns and enhance type safety
- Add new builder patterns for McpClient and McpServer with sync/async variants
- Introduce dedicated McpClientFeatures and McpServerFeatures classes
- Enhance type safety and reactive support with proper Mono integration
- Add migration guide for 0.6.0 release
- Mark old builder methods as deprecated
- Update documentation to reflect new APIs
BREAKING CHANGE: The old builder patterns using McpClient.using() and McpServer.using()
are now deprecated in favor of new sync() and async() builders that provide
better type safety and clearer sync/async separation. Follow the migration guide.
Resolves#48
Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
Co-authored-by: Christian Tzolov <ctzolov@vmware.com>
This commit updates the WebFluxSseServerTransport, WebMvcSseServerTransport, and HttpServletSseServerTransport classes to accept the SSE endpoint path as a constructor argument.
This change provides more flexibility in configuring the SSE endpoint, allowing it to be customized instead of being hardcoded to "/sse".
It also aligns the Java SDK's behavior with the Python SDK's SseServerTransport, which already supports this customization.
A default SSE endpoint of "/sse" is maintained for backward compatibility.
Also, addressed minor code quality issues identified by SonarLint and reordered modifiers for static final fields to conform with the Java Language Specification.
Signed-off-by: Alexandros Pappas <alexandros.pappas@yiluhub.com>
- Add tests for HttpServletSseServerTransport implementation
- Add tests for HttpClientSseClientTransport implementation
- Rename STDIO transport test classes for clarity
Introduces a new Server-Sent Events (SSE) Server transport implementation
based on the Servlet API that enables MCP integration with any Java HTTP
server application supporting Servlets.
This implementation complements the existing WebFlux and WebMvc transports
by providing a generic Servlet-based option that works with any Java web
server, not just Spring applications.
Key changes:
- Add HttpServletSseServerTransport with async Servlet 6.0 support
- Add integration tests with embedded Tomcat
- Add servlet dependencies with externalized versions:
- jakarta.servlet-api 6.1.0 (provided)
- tomcat-embed-core 11.0.2 (test)
- tomcat-embed-websocket 11.0.2 (test)
Resolves#61
- Add comprehensive Javadoc for SSE transport implementations
- Document key features and implementation details for WebFlux/WebMVC transports
- Refactor FlowSseClient to use records for better immutability
- Fix typo in prompt property name
- Remove unused code and improve readability
Replaces Spring's SseEmitter with a custom BlockingQueue-based SSE implementation in
WebMvcSseServerTransport for improved event delivery control and connection management.
The new implementation:
- Uses BlockingQueue for reliable event queuing and delivery
- Adds proper session management with dedicated SSEEvent record
- Improves error handling and timeout management
- Adds comprehensive integration tests
Resolves#57
Split the transport implementations into dedicated modules to improve modularity
and reduce core dependencies.
Added shared test module for common test utilities.
Key changes:
- Create mcp-transport/mcp-webflux-sse-transport module
- Move SseClientTransport → WebFluxSseClientTransport
- Move SseServerTransport → WebFluxSseServerTransport
- Move related tests and utilities
- Create mcp-transport/mcp-webmvc-sse-transport module
- Add new WebMvcSseServerTransport implementation
- Add corresponding tests and integration tests
- Add framework-independent SSE client implementations to core module
- Add FlowSseClient using java.net.http
- Add HttpClientSseClientTransport using java.net.http
- Keep StdioClientTransport/StdioServerTransport in core (no external deps)
- Create mcp-test module for shared test infrastructure
- Move abstract test base classes
- Move shared test utilities and mocks
- Update test dependencies
The modular approach allows users to choose between:
- Framework-specific implementations (WebFlux/WebMVC)
- Pure Java implementations (java.net.http)
- Basic implementations (STDIO)
Add breaking changes readme: 0.5.0-BREAKING-CHANGES.md
Resolves#54
- Make McpSchema final and add private constructor
- Add JsonSchema record for structured schema representation
- Change Tool.inputSchema type from Map<String, Object> to JsonSchema.
- Use the String JSON Schema constructor when creating the Tool programaticaly.
- Enhance StdioClientTransport error logging with more context
- Add ToolHelper utility class for:
- Converting Spring AI FunctionCallbacks to MCP tools
- Generating JSON schemas for tool input validation
- Facilitating integration between Spring AI functions and MCP tools
- Update tests and samples to use the new Tool schema format
Resolves#52
Move Logback dependency to test scope to make it possible for applications using this library to choose their implementation of the SLF4J API. For example, Spring Boot provides one out of the box already.
Fixes gh-49
Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
- Execute tool calls, resource reads and prompt handling in a non-blocking
manner using Schedulers.boundedElastic(). This prevents blocking operations
from impacting server responsiveness.
- Added integration tests to verify non-blocking behavior with tools that
make HTTP calls to external services.
Related to #48
This is a temp patch until #48 is resolved properly.
- Replace Utils.isEmpty check with null check for roots map
- Add specialized error messages for method not found errors
- Extend McpError to include JSONRPCError information
- Add comprehensive tests for roots functionality including:
- Empty roots list handling
- Missing capability scenarios
- Multiple consumers
- Server closure with active subscriptions
- Add proper ListRootsResult wrapping in async client
- Implement paginated listRoots methods in server components
- Fix roots notification handling in async server
- Add roots integration tests
- Update architecture diagram and documentation layout
The changes improve the roots feature implementation with proper result
types, and robust notification handling. Adds thorough
test coverage for roots functionality including async notifications and
root addition/removal scenarios.
Resolves#46
Improves error handling by enforcing sampling handler presence when sampling capabilities are enabled. Adds a builder pattern for CreateMessageResult to improve API ergonomics.
Implement client-side sampling features in the Model Context Protocol (MCP) server:
- Add createMessage method to McpAsyncServer and McpSyncServer for LLM sampling
- Move MockMcpTransport to separate file for reusability
- Add integration tests for sampling functionality
- Test error handling for uninitialized clients and missing capabilities
The sampling implementation allows servers to request LLM completions from
clients while maintaining client-side control over model access and permissions.
Resolves#42
- Implement roots change notification handler in McpAsyncServer
- Add rootsChangeConsumer builder methods to support single and multiple consumers
- Rename info() builder method to serverInfo() for clarity
- Add comprehensive tests for roots change notification functionality
- Add default server info implementation in Builder
Resolves#39
Add getter methods to expose server and client capabilities and implementation
info in McpAsyncClient and McpSyncClient. Store server metadata received during
initialization for later access.
Add getter methods to expose server and client capabilities and implementation
information in both McpAsyncServer and McpSyncServer classes. Store client
metadata received during initialization for later retrieval.
- Add client and server-side logging capabilities with configurable severity levels
- Implement logging message notifications with DEBUG to EMERGENCY levels
- Add logging consumers for client-side log handling
- Update documentation with logging examples and configuration
- Add comprehensive tests for logging functionality
- Fix typo in README.md (notificaiotn -> notification)
- Centralize MCP method names as constants
- Move all JSON-RPC method names to McpSchema class as static constants
- Replace hardcoded method strings with constant references in McpAsyncClient
and McpAsyncServer
- Update test cases to use new method name constants
Resolves#35
- Reorganize McpAsyncServer code into logical sections (Lifecycle, Tool, Resource, Prompt Management)
- (bug) Fix resource registration to use URI instead of name as map key
- Improve error logging in StdioServerTransport with helper methods
- Clean up documentation and add transport mode descriptions
- Update sample server configuration with clearer method names and organization