The Model Context Protocol (MCP) provides a standardized way for clients to expose filesystem “roots” to servers. Roots inform servers about the directories and files the client considers relevant, so that servers can focus their operations accordingly. They are informational guidance rather than an access-control mechanism. The protocol does not enforce that servers stay within roots. Servers can request the list of roots from supporting clients.Documentation Index
Fetch the complete documentation index at: https://modelcontextprotocol.io/llms.txt
Use this file to discover all available pages before exploring further.
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 in
_meta.io.modelcontextprotocol/clientCapabilities on each request:
Protocol Messages
Listing Roots
To retrieve roots during the processing of a client request, servers send anIncompleteResponse
containing a roots/list request:
Request:
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
If an error occurs, the client does not need to replay the initial call with an error message as the server is not waiting for a response with theIncompleteResponse pattern.
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
- Respect root boundaries in operations
- Cache root information appropriately