feat: Enhance MCP roots implementation and test coverage

- 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
This commit is contained in:
Christian Tzolov 2025-01-04 01:11:34 +01:00
commit 2748260cda
2 changed files with 200 additions and 98 deletions

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 75 KiB

Before After
Before After

View file

@ -31,13 +31,13 @@ Add the following dependency to your Maven project:
== Architecture
image::mcp-layers.svg[width=400,float=right]
The SDK follows a layered architecture with clear separation of concerns:
image::MCP-layers.svg[width=400,align=center]
* *Transport Layer (McpTransport)*: Handles JSON-RPC message serialization/deserialization via StdioTransport (stdin/stdout) and SseTransport (HTTP streaming).
* *Session Layer (McpSession)*: Manages communication patterns and state using DefaultMcpSession implementation.
* *Client/Server Layer*: Both use McpSession for sync/async operations, with McpClient handling client-side protocol operations and McpServer managing server-side protocol operations.
* *Session Layer (McpSession)*: Manages communication patterns and state using DefaultMcpSession implementation.
* *Transport Layer (McpTransport)*: Handles JSON-RPC message serialization/deserialization via StdioTransport (stdin/stdout) and SseTransport (HTTP streaming).
Following class diagram illustrates the layered architecture of the MCP SDK, showing the relationships between core interfaces (McpTransport, McpSession), their implementations, and the client/server components. It highlights how the transport layer connects to sessions, which in turn support both synchronous and asynchronous client/server implementations.