Extract message processing initialization from StdioMcpSessionTransport constructor into a
separate initProcessing() method.
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
Set autoPublish to true in the Maven configuration to
automatically publish artifacts to the Central repository when the release is performed.
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
- Implements a builder pattern for CreateMessageRequest
- Updates corresponding tests to use the new builder syntax
- Add ModelPreferences builder and ModelHint helper
- Use builder pattern for CreateMessageRequest in integration tests
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
This commit introduces a major refactoring of the MCP Java SDK to implement a session-based architecture
for server-side implementations. The changes improve the SDK's ability to handle multiple concurrent
client connections and provide an API better aligned with the MCP specification.
Key changes:
- Introduce McpServerTransportProvider interface to manage client connections
- Rename ClientMcpTransport to McpClientTransport and ServerMcpTransport to McpServerTransport
- Add exchange objects (McpAsyncServerExchange, McpSyncServerExchange) for client interaction
- Update handler signatures to include exchange parameter: (args) -> result to (exchange, args) -> result
- Rename Registration classes to Specification classes
- Update method names (e.g., rootsChangeConsumers to rootsChangeHandlers)
- Deprecate old interfaces and classes for removal in 0.9.0
- Add migration guide (migration-0.8.0.md)
Resolves#9, #15
Co-authored-by: Christian Tzolov <christian.tzolov@broadcom.com>
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
This change uses VirtualTimeScheduler and pretends enough time has
passed to trigger a timeout on the initialization.
Another problem with reliability of the tests was that the used
testcontainer for the SSE server does not support multiple clients and
the existence of both the global client for the entire suite and some
customized local clients in some tests caused responses to be delivered
to the other client at some racing situations. Now each test creates a
dedicated client and performs cleanup locally.
While these tests were improved, two other issues were found and fixed.
The first one is that the closeGracefully of DefaultMcpSession was not
lazy and would trigger connection disposal before the returned Mono was
subscribed. The second one was dealing with closing the StdIo client
before the process was started. In such a case there should not be an
error but rather a warning and successful completion.
- Add configurable initialization timeout separate from request timeout
- Rename ServletSse* test classes to HttpSse* for better naming consistency
- Replace direct .block() calls with StepVerifier for better reactive testing
- Change ping() method to return Mono instead of Mono
- Improve error handling and reactive programming patterns throughout tests
- Chain reactive operations for cleaner test flow
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
* feat(mcp): relax MCP Schema JSON deserialization constraints
- Add @JsonIgnoreProperties(ignoreUnknown = true) annotation to all record
classes in McpSchema to make JSON deserialization more robust by ignoring
unknown properties.
- Make the JsonSchema record public
Resolves#36
This improves compatibility with third-party implementations like Cursor that are not MCP Schema compliant.
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
- The type field and associated methods were redundant in Content implementations (TextContent, ImageContent, EmbeddedResource)
as the type information is already handled by Jackson's polymorphic type handling via @JsonSubTypes annotation.
- Add default implementation that returns the appropriate type string based on the implementing class (text, image, or resource)
- Added comprehensive unit tests for McpSchema to validate serialization/deserialization behavior of all schema components.
- Add deserialization tests for all content types
- Add json-unit-assertj for flexible JSON testing - ignores array order and extra array items, reducing test brittleness while
maintaining functional validation.
Resolves#26
Resolve https://github.com/spring-projects/spring-ai/issues/2350
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
- Add Spring AI MCP documentation section with links to client/server starters
- Fix license link text
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
- 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>