Skip to content

Commit b2516f5

Browse files
chughtapanclaude
andcommitted
Add SEP-2202: Allow Non-File URI Schemes for Roots
Transfers SEP-1573 to the new PR-based SEP workflow per SEP-1850. This SEP proposes removing the restriction that root URIs must begin with file://, allowing servers to work with remote resources through any URI scheme. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 500cc2d commit b2516f5

File tree

1 file changed

+101
-0
lines changed

1 file changed

+101
-0
lines changed

seps/2202-non-file-uri-roots.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# SEP-2202: Allow Non-File URI Schemes for Roots
2+
3+
- **Status**: Draft
4+
- **Type**: Standards Track
5+
- **Created**: 2025-09-29
6+
- **Author(s)**: Tapan Chugh (@chughtapan), Ola (@olaservo); original proposal by @noctonic in #507
7+
- **Sponsor**: Ola (@olaservo)
8+
- **PR**: #2202
9+
- **Original Issue**: #1573 (transferred to new PR-based SEP workflow per SEP-1850)
10+
11+
## Abstract
12+
13+
This SEP proposes removing the restriction that root URIs must begin with `file://`, allowing servers to work with remote resources through any URI scheme. Reference implementations in `python-sdk`, `typescript-sdk`, client (`fast-agent`) a helper for enforcement are provided.
14+
15+
## Motivation
16+
17+
Consider the following scenarios where scoping access to specific resources using roots is highly desirable:
18+
19+
1. **Cloud Storage**: Restricting access to specific S3 buckets or prefixes using `s3://bucket-name/prefix/` roots allows operating only within designated storage areas while preventing access to other buckets or sensitive data paths.
20+
21+
2. **Version Control Repository**: Limiting operations to specific repositories using `https://github.com/owner/repo/` roots limits actions within the current project context without inadvertently affecting other repositories.
22+
23+
3. **Databases**: Restricting databases to `postgres://host/database/table/` roots enables fine-grained control over which schemas, tables, or collections a server can query or modify. No more accidentally deleting the production database.
24+
25+
## Specification
26+
27+
This change was originally proposed in #507 but not followed through. This was due to other time commitments from the original contributor, as well as a lack of a formal SEP governance process at the time, which made it more challenging to move proposals forward.
28+
29+
### Schema Changes
30+
31+
Update the `Root` interface in all schema versions to remove the file:// restriction:
32+
33+
```typescript
34+
export interface Root {
35+
/**
36+
* The URI identifying the root. This can be any valid URI scheme.
37+
* Common schemes include file://, https://, github://, s3://, etc.
38+
* Servers should document which URI schemes they support.
39+
*
40+
* @format uri
41+
*/
42+
uri: string;
43+
44+
/**
45+
* An optional human-readable name for this root.
46+
*/
47+
name?: string;
48+
49+
/**
50+
* Optional metadata for this root.
51+
*/
52+
_meta?: { [key: string]: unknown };
53+
}
54+
```
55+
56+
The specification should include guidance that
57+
58+
1. Servers must document their supported URI schemes and validate them. Clients may provide roots with any URI scheme, and servers must gracefully handle unsupported schemes by returning clear error messages rather than failing silently.
59+
2. Clients SHOULD provide a way to display which Roots are active
60+
61+
## Rationale
62+
63+
The URI field restriction in the current specification is purely a documentation constraint rather than a technical limitation. Resources in MCP already support any URI scheme, and maintaining consistency between resources and roots simplifies the mental model for developers for roots as client-specified resources which the server can access.
64+
65+
### Alternatives Considered
66+
67+
Creating separate mechanisms for local and remote servers does not provide any clear benefits and fragments the ecosystem. The simple approach of allowing any URI maintains complete backward compatibility. Existing clients continue sending file:// roots unchanged, existing servers continue accepting them, and the ecosystem can gradually adopt support for additional schemes as needed
68+
69+
### Future Work
70+
71+
We discussed proposing programmatic discovery mechanisms for which schemes a server supports, but decided to keep this change simple by removing the file restriction. The lack of programmatic discovery follows MCP's existing patterns and shouldn't limit practical usefulness because:
72+
73+
1. Servers will naturally document what they support, clients will implement common patterns, and the ecosystem will converge on standards, just like with resource URIs.
74+
2. When a client provides an unsupported root, the server returns a clear error. In this case clients can gracefully degrade or prompt users to adjust roots.
75+
3. If this becomes a pain point, a future SEP can add discovery without breaking existing implementations.
76+
77+
## Backward Compatibility
78+
79+
This change is fully backward compatible with existing implementations.
80+
81+
## Reference Implementation
82+
83+
**Python SDK:** https://github.com/modelcontextprotocol/python-sdk/pull/1390/files
84+
**Typescript SDK:** https://github.com/modelcontextprotocol/typescript-sdk/pull/997/files
85+
**Client Changes (fast-agent):** https://github.com/chughtapan/fast-agent/pull/3/files
86+
87+
Although current SDKs don't provide support for roots enforcement, an example has been implemented in [github.com/chughtapan/wags](https://github.com/chughtapan/wags/blob/main/src/wags/middleware/roots.py): a helpful decorator is provided for tools to declare which roots are required:
88+
89+
```python
90+
@mcp.tool
91+
@requires_root("https://github.com/{owner}/{repo}")
92+
async def create_issue(self, owner: str, repo: str, title: str, body: str):
93+
# Proceed with edit operation
94+
```
95+
and the `call_tool` tool handlers check that provides a root which satisfies this requirement before proceeding.
96+
97+
## Security Considerations
98+
99+
The documentation should clearly highlight that roots are not enforced at the protocol layer, but advisory for the servers. Malicious or buggy servers might violate user expectations of security.
100+
101+
Clients SHOULD provide a way to display which Roots are active

0 commit comments

Comments
 (0)