Skip to content

feat: add MCP roots protocol support to everything server #2573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AjayKumbham
Copy link

Description

This PR adds MCP roots protocol support to the everything server to provide complete MCP feature coverage. The implementation includes:

  • 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

Server Details

  • Server: everything
  • Changes to: capabilities, tools, notification handlers, initialization logic

Motivation and Context

Resolves #2552

The everything server is designed to demonstrate all MCP protocol features for client developers to test against. However, it was missing roots protocol support, which is an important MCP capability that allows clients to specify which directories servers can access. This change ensures the everything server truly covers "everything" in the MCP specification.

While this server doesn't actually access files, implementing roots support provides:

  1. A complete reference implementation for client developers
  2. A way to test roots protocol implementation in MCP clients
  3. Educational value showing how servers should handle the roots protocol

How Has This Been Tested?

  • ✅ TypeScript compilation passes without errors
  • ✅ Server builds successfully with npm run build
  • ✅ Server can be instantiated and includes the new capabilities
  • ✅ Code follows the same patterns used in the filesystem server's roots implementation
  • ✅ Manual verification that the server declares roots capability and includes the listRoots tool

The implementation follows the established patterns from the filesystem server's roots implementation, ensuring consistency with the existing codebase.

Breaking Changes

No breaking changes. This is purely additive functionality that doesn't affect existing server behavior or client configurations.

Types of changes

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Protocol Documentation
  • My changes follows MCP security best practices
  • I have updated the server's README accordingly
  • I have tested this with an LLM client
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have documented all environment variables and configuration options

Additional context

The implementation is based on the filesystem server's roots handling but adapted for the everything server's demonstration purposes. Key design decisions:

  1. Non-intrusive: Added roots support without modifying existing functionality
  2. Educational: Includes comprehensive logging to show roots protocol flow
  3. Consistent: Uses the same patterns and error handling as the filesystem server
  4. Complete: Handles both initialization and runtime roots updates

The listRoots tool provides a practical way for developers to verify that their MCP client's roots implementation is working correctly, even though this server doesn't perform file operations.

- 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 modelcontextprotocol#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Everything server does not support every thing
1 participant