- 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
Add comprehensive documentation for the MCP Java SDK implementation
Add architecture diagrams showing layered design and class relationships
Reorganize documentation structure with dedicated pages for:
Overview and introduction
MCP Java SDK reference
Spring AI MCP integration
Include detailed examples and usage patterns for both sync and async APIs
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
- Replace bounded elastic schedulers with single thread executors
- Add timeouts to MCP server tests
- Enhance error handling in StdioServerTransport
- Comment out unused PaginatedRequest unmarshalling
- Simplify shutdown logic in StdioServerTransport
Removes custom stream injection capability from StdioServerTransport and
simplifies it to only use System.in/out.
Updates related tests to use System streams instead of piped streams.
- Add isClosing flag to coordinate graceful shutdown
- Synchronize output stream writes to prevent race conditions
- Enhance error handling in stream processing
- Add delay for pending message processing during shutdown
- Improve connection state tracking in tests
- Implement MCP server with async/sync support and builder pattern configuration
- Add Server stdio/SSE transport layers with robust error handling
- Convert McpClient and McpServer to interfaces for better extensibility
- Add sampling capabilities for LLM interactions (text/image)
- Implement dynamic root management and runtime tool management
- Add comprehensive prompt and resource capabilities
- Add support for dynamic root management (add/remove roots at runtime)
Architecture Changes
- Introduce registration records for tools, resources, and prompts
- Improve thread safety with concurrent collections
- Enhance resource template handling
- Implement builder patterns for Server/Client capabilities
- Add support for server capabilities and implementation info
Transport Layer:
- Implement SseServerTransport with SSE endpoints
- Add StdioServerTransport for process-based communication
- Reorganize transport packages for better organization
- Improve transport error handling and shutdown processes
Documentation:
- Add detailed MCP reference documentation
- Include architecture diagrams and API documentation
- Add comprehensive test coverage for all components
- Include sample projects demonstrating stdio/SSE transports
BREAKING CHANGES:
Transport Package Reorganization
- Move StdioClientTransport to o.s.ai.mcp.client.transport
- Move SseClientTransport to o.s.ai.mcp.client.transport
- Move ServerParameters to o.s.ai.mcp.client.transport
- StdioClientTransport.errorHandler changed to private with
setter method Migration: Use setErrorHandler() method
instead of direct field access
API Changes
- Replace static factory methods with builder pattern
- Update ServerCapabilities to use builder pattern
- Make StdioClientTransport.errorHandler private with setter
- Replace rootsListProvider with direct root management
- Remove deprecated static factory methods
Resolves #27,#25,#24,#11
Related to #12
- Adds default logging for tools, resources and prompts change notifications.
- Introduces Utils class with collection and string helper methods.
- Ensures notification handlers are always registered with at least a default logging consumer.
- Add resourcesChangeNotificationHandler and promptsChangeNotificationHandler with non-blocking execution
- Add builder methods for resources and prompts change consumers
- Add test coverage for all notification handlers
- Update documentation to cover all three notification types (tools, resources, prompts)
- Consolidate notification documentation under unified Change Notifications section
- Ensure consistent non-blocking behavior using boundedElastic scheduler
All notification handlers follow the same pattern of non-blocking execution and error handling,
providing a consistent approach to change notifications across the system.
Resolves#20
- Add toolsChangeNotificationHandler with non-blocking consumer execution using boundedElastic scheduler
- Add toolsChangeConsumer builder method to McpClient for easy configuration
- Add comprehensive test coverage for tools change notifications
- Update documentation with tools change notification features and examples
The implementation ensures consumers are executed non-blockingly on the boundedElastic scheduler,
preventing performance impact from blocking implementations while maintaining proper error handling and logging.
Part of #20