You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Model Context Protocol (MCP) provides a standardized way for clients to expose filesystem roots to servers. Roots define the boundaries of where servers can operate within the filesystem, allowing them to understand which directories and files they have access to. Servers can request the list of roots from supporting clients and receive notifications when that list changes.
11
+
The Model Context Protocol (MCP) provides a standardized way for clients to expose filesystem "roots" to servers. Roots define the boundaries of where servers can operate within the filesystem, allowing them to understand which directories and files they have access to. Servers can request the list of roots from supporting clients and receive notifications when that list changes.
12
12
13
13
## User Interaction Model
14
14
15
-
Roots in MCP are typically exposed through workspace or project configuration interfaces. A recommended implementation pattern is 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.
15
+
Roots in MCP are typically exposed through workspace or project configuration interfaces.
16
+
17
+
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:
16
18
17
19

18
20
19
-
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.
21
+
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.
20
22
21
23
## Capabilities
22
24
23
-
Clients that support roots MUST include a`roots` capability in their `ClientCapabilities` during initialization:
25
+
Clients that support prompts **MUST** declare the`roots` capability during [initialization]({{< ref "/specification/basic/lifecycle#initialization" >}}):
24
26
25
27
```json
26
28
{
@@ -32,13 +34,13 @@ Clients that support roots MUST include a `roots` capability in their `ClientCap
32
34
}
33
35
```
34
36
35
-
The `listChanged`property indicates whether the client supports notifications about changes to the root list.
37
+
`listChanged` indicates whether the client will emit notifications when the list of roots changes.
36
38
37
39
## Protocol Messages
38
40
39
41
### Listing Roots
40
42
41
-
To retrieve available roots, servers send a `roots/list` request:
43
+
To retrieve roots, servers send a `roots/list` request:
42
44
43
45
**Request:**
44
46
```json
@@ -99,8 +101,8 @@ sequenceDiagram
99
101
100
102
A root definition includes:
101
103
102
-
-`uri`: Unique identifier for the root (currently restricted to `file://`URIs)
103
-
-`name`: Optional human-readable name for display purposes
104
+
-`uri`: Unique identifier for the root. This **MUST** be a `file://`URI in the current specification.
105
+
-`name`: Optional human-readable name for display purposes.
104
106
105
107
Example roots for different use cases:
106
108
@@ -131,7 +133,6 @@ Example roots for different use cases:
131
133
Clients SHOULD return standard JSON-RPC errors for common failure cases:
132
134
133
135
- Client does not support roots: `-32601` (Method not found)
134
-
- Access denied: `-32002`
135
136
- Internal errors: `-32603`
136
137
137
138
Example error:
@@ -151,34 +152,27 @@ Example error:
151
152
152
153
## Security Considerations
153
154
154
-
1. Clients MUST:
155
+
1. Clients **MUST**:
155
156
- Only expose roots with appropriate permissions
156
157
- Validate all root URIs to prevent path traversal
157
158
- Implement proper access controls
158
159
- Monitor root accessibility
159
160
160
-
2. Servers SHOULD:
161
+
2. Servers **SHOULD**:
161
162
- Handle cases where roots become unavailable
162
163
- Respect root boundaries during operations
163
164
- Validate all paths against provided roots
164
165
165
166
## Implementation Guidelines
166
167
167
-
1. Clients SHOULD:
168
+
1. Clients **SHOULD**:
169
+
- Prompt users for consent before exposing roots to servers
168
170
- Provide clear user interfaces for root management
169
-
- Support automatic root detection where applicable
0 commit comments