feat: add MCP roots protocol support to everything server

- Add roots capability declaration with listChanged: true
- Implement roots/list_changed notification handler
- Add initialization handler to request initial roots from client
- Add new listRoots tool to demonstrate roots functionality
- Add comprehensive logging for roots protocol events
- Update README.md with roots documentation

Resolves #2552

The everything server now demonstrates all MCP features including the roots protocol.
This provides a complete reference implementation for client developers to test
their roots protocol implementation against, even though this server doesn't
access files directly.
This commit is contained in:
Kumbham Ajay Goud
2025-08-18 15:31:23 +05:30
parent 7e1d9d9ede
commit cf9f66c14e
2 changed files with 155 additions and 9 deletions

View File

@@ -89,6 +89,13 @@ This MCP server attempts to exercise all the features of the MCP protocol. It is
- `structuredContent` field conformant to the output schema
- A backward compatible Text Content field, a SHOULD advisory in the specification
11. `listRoots`
- Lists the current MCP roots provided by the client
- Demonstrates the roots protocol capability even though this server doesn't access files
- No inputs required
- Returns: List of current roots with their URIs and names, or a message if no roots are set
- Shows how servers can interact with the MCP roots protocol
### Resources
The server provides 100 test resources in two formats:
@@ -129,6 +136,18 @@ Resource features:
- Returns: Multi-turn conversation with an embedded resource reference
- Shows how to include resources directly in prompt messages
### Roots
The server demonstrates the MCP roots protocol capability:
- Declares `roots: { listChanged: true }` capability to indicate support for roots
- Handles `roots/list_changed` notifications from clients
- Requests initial roots during server initialization
- Provides a `listRoots` tool to display current roots
- Logs roots-related events for demonstration purposes
Note: This server doesn't actually access files, but demonstrates how servers can interact with the roots protocol for clients that need to understand which directories are available for file operations.
### Logging
The server sends random-leveled log messages every 15 seconds, e.g.: