Protocol Revision: 2025-06-18
User Interaction Model
Roots in MCP are typically exposed through workspace or project configuration interfaces. For example, implementations could offer a workspace/project picker that allows users to select directories and files the server should have access to. This can be combined with automatic workspace detection from version control systems or project files. However, implementations are free to expose roots through any interface pattern that suits their needsβthe protocol itself does not mandate any specific user interaction model.Capabilities
Clients that support roots MUST declare theroots
capability during
initialization:
listChanged
indicates whether the client will emit notifications when the list of roots
changes.
Protocol Messages
Listing Roots
To retrieve roots, servers send aroots/list
request:
Request:
Root List Changes
When roots change, clients that supportlistChanged
MUST send a notification:
Message Flow
Data Types
Root
A root definition includes:uri
: Unique identifier for the root. This MUST be afile://
URI in the current specification.name
: Optional human-readable name for display purposes.
Project Directory
Multiple Repositories
Error Handling
Clients SHOULD return standard JSON-RPC errors for common failure cases:- Client does not support roots:
-32601
(Method not found) - Internal errors:
-32603
Security Considerations
-
Clients MUST:
- Only expose roots with appropriate permissions
- Validate all root URIs to prevent path traversal
- Implement proper access controls
- Monitor root accessibility
-
Servers SHOULD:
- Handle cases where roots become unavailable
- Respect root boundaries during operations
- Validate all paths against provided roots
Implementation Guidelines
-
Clients SHOULD:
- Prompt users for consent before exposing roots to servers
- Provide clear user interfaces for root management
- Validate root accessibility before exposing
- Monitor for root changes
-
Servers SHOULD:
- Check for roots capability before usage
- Handle root list changes gracefully
- Respect root boundaries in operations
- Cache root information appropriately