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
note: Enhanced with comprehensive security requirements addressing malicious server threats, user consent control, and access revocation mechanisms.
Abstract
This Core Components diagram seems to indicate that the admittedly elegant idea is that the filesystem of the host should be treated as an MCP Resource to be accessed by a locally running MCP server.
However, as can be seen in the MCP filesystem package source code, the filesystem is not truly useful that way; being only accessed using tools/* (even filesystem reads).
This SEP takes the position that there may be an identity crisis between treating the filesystem as a resource in the sense of a Resource in the MCP specification, and treating it as a "first class citizen" directly accessed by the locally running application host process and that the latter would empower MCP greatly if accomplished securely.
It enables MCP servers to access local filesystems of clients using standard JSON-RPC methods (e.g., files/read) with minimal code changes, enabling uniform methods of filesystem access for both remotely and locally hosted MCP servers.
Clients advertise support via a newly introduced filesystemBrokering capability. After consent, the client brokers file operation messages received from the MCP server using the existing MCP transport. This keeps server code simple, promoting wide adoption across diverse runtimes.
Brokering filesystem operation messages means carrying out the requests (read/write) upon the local filesystem while supporting concurrent operations against the same file across multiple MCP clients via comprehensive file locking mechanisms with optional persistent locks; and also protecting against invalid access/exfiltration by leveraging "roots" as an explicit allow list of valid files/directories for those respective operations.
Before (Current)
Filesystem accessed through locally running MCP Server
graph LR
subgraph "Local machine"
subgraph "Application Host Process"
H[Host]
C1[Client 1]
C2[Client 2]
H <--> C1
H <--> C2
end
S1[Server 1<br>Files & Git]
F1[("Local<br>Resource A")]
C1 <--> S1
S1 <--> F1
end
subgraph "Internet"
S2[Server 2<br>External APIs]
R2[("Remote<br>Resource B")]
C2 <--> S2
S2 <--> R2
end
Loading
After
Filesystem access brokered by locally running MCP Client(s) and host OS
graph LR
subgraph "Local machine"
subgraph "Application Host Process"
H[Host]
C1[Client 1]
C2[Client 2]
H <--> C1
H <--> C2
end
S1[Server 1<br>Files & Git]
F1[("Local<br>Filesystem<br>(Not a '*Resource*')")]
C1 <-- Now includes Filesystem RPC Requests --> S1
C1 <-- Brokered Access --> F1
C2 <-- Brokered Access --> F1
end
subgraph "Internet"
S2[Server 2<br>External APIs]
R2[("Remote<br>Resource B")]
S2 <--> R2
C2 <-- Now includes Filesystem RPC Requests --> S2
end
Loading
Motivation
MCP currently limits filesystem access to local servers, where hosts invoke tools to read/write files and directories. While effective for local operations, this restricts innovation, particularly for remote or cloud-hosted MCP servers.
Enabling direct filesystem access for remote servers unlocks significant potential:
Distributed workflows: A single cloud-hosted MCP server could coordinate across multiple geographically dispersed clients, effectively virtualizing today's local filesystem servers.
Compute offloading: Resource-constrained devices (e.g., IoT) can delegate intensive tasks using local data to powerful remote servers, leveraging cheap storage and bandwidth.
Vendor efficiency: Hosted services can directly manipulate local files without indirect host instructions or separate local servers—ideal for proprietary operations on signed binaries, digital assets, or documents.
AI-powered local data processing: Remote servers could run advanced models on user datasets (e.g., personal photos or sensor logs) without uploading sensitive data, enabling privacy-preserving applications like customized health analytics.
Seamless multi-device ecosystems: Users gain unified AI agents accessing files across devices, such as real-time syncing and editing with automatic organization or conflict resolution.
The transformative power of this capability cannot be overstated, but neither can the critical need for robust security.
MCP servers should be deployment-agnostic, letting tool authors use standard RPC calls without rewrites. Remote access is vital for hosted platforms, yet alternatives like NFS, SSHFS, or rclone falter due to firewalls, OS compatibility, and complex setups.
This SEP delivers secure, cross-platform filesystem access through existing MCP transport, with client-brokered enforcement for safety and simplicity.
If filesystemBrokering is false or omitted, server MUST NOT request brokered access.
Servers MUST verify during negotiation: If filesystem access is required but filesystemBrokering is missing or unsupported, throw error early (e.g., in handshake response):
{
"jsonrpc": "2.0",
"error": {
"code": -32603,
"message": "Filesystem access is required but the client is not advertising the filesystemBrokering capability"
},
"id": 1
}
User Consent and Access Control
Servers MUST request user consent before accessing filesystem operations:
Path Validation: Clients MUST validate all filesystem operations against approved paths before execution. Approved paths must be a subset of paths in "roots".
Consent Granularity: Implementations MAY support different consent models (session-wide, per-path-pattern, or just-in-time)
Access Revocation: Implementations SHOULD provide mechanisms for users to revoke filesystem permissions during active sessions
Connection Termination: Clients MUST terminate server connections as the primary revocation mechanism when requested by users
Addressing Malicious Server Concerns
The primary security concern is malicious MCP servers having "direct and non-revocable access" to user filesystems. This SEP addresses these concerns through:
User Consent Control:
Users explicitly approve each path before any access
Clients can implement granular consent (per-directory, operation-specific, time-limited)
No "blanket" filesystem access without explicit approval
Revocation Mechanisms:
Connection termination immediately revokes all filesystem access
Implementations SHOULD provide UI for granular permission management
Server (Node.js) - Using MCP-style JSON-RPC with file locking:
// Atomic file update with persistent lockingasyncfunctionatomicFileUpdate(client,path,updateFunction){letlockId=null;try{// Read with persistent lockconstreadResult=awaitclient.request({method: 'files/read',params: { path,keepLocked: true}});lockId=readResult.lockId;// Modify contentconstupdatedContent=updateFunction(readResult.content);// Write back (file still locked)awaitclient.request({method: 'files/write',params: { path,content: updatedContent}});}catch(error){if(error.code===-32100){// FILE_LOCKEDthrownewError(`Cannot perform atomic update - file is locked: ${error.data?.path}`);}throwerror;}finally{// Always release the lockif(lockId){awaitclient.request({method: 'files/unlock',params: { lockId }});}}}
Error Handling Pattern:
try{constresult=awaitclient.request({method: 'files/read',params: {path: 'config.json'}});}catch(error){if(error.code===-32100){console.log('File is locked, retrying later...');}elseif(error.code===-32601){thrownewError('Client does not support filesystem operations');}}
Security Implications
Critical Security Requirements (MUST)
Mandatory User Consent: Clients MUST obtain explicit user consent before granting any filesystem access to servers
Path Validation: Clients MUST validate all filesystem operations against approved paths and reject unauthorized access attempts
Boundary Enforcement: Clients MUST prevent directory traversal attacks through path canonicalization and symlink validation
Connection Control: Clients MUST provide users the ability to terminate server connections to revoke all filesystem access
Recommended Security Measures (SHOULD)
Access Revocation: Implementations SHOULD provide mechanisms for granular permission revocation during active sessions
User Notifications: Clients SHOULD notify users of filesystem access attempts, especially for sensitive operations
Rate Limiting: Clients SHOULD implement rate limiting to prevent abuse and detect suspicious activity patterns
Operation Monitoring: Clients SHOULD track filesystem operations to detect potential exfiltration attempts
Optional Security Enhancements (MAY)
Audit Logging: Implementations MAY log filesystem operations for security auditing and forensic analysis
Consent Granularity: Clients MAY support fine-grained consent models (per-path, per-operation-type, time-limited access)
Anomaly Detection: Advanced implementations MAY implement behavioral analysis to detect malicious server activity
Threat Model and Mitigations
Malicious Server Scenarios
Unauthorized File Access:
Threat: Server attempts to access files outside approved paths
Mitigation: Strict path validation with PERMISSION_DENIED errors for violations
Data Exfiltration:
Threat: Server reads sensitive files or excessive amounts of data
Mitigation: User consent boundaries, optional monitoring, connection termination
Directory Traversal:
Threat: Server uses ../ or symlinks to escape approved directories
SEP-1708: MCP Client-Brokered Filesystem Access
Preamble
Abstract
This Core Components diagram seems to indicate that the admittedly elegant idea is that the filesystem of the host should be treated as an MCP Resource to be accessed by a locally running MCP server.
However, as can be seen in the MCP filesystem package source code, the filesystem is not truly useful that way; being only accessed using tools/* (even filesystem reads).
This SEP takes the position that there may be an identity crisis between treating the filesystem as a resource in the sense of a Resource in the MCP specification, and treating it as a "first class citizen" directly accessed by the locally running application host process and that the latter would empower MCP greatly if accomplished securely.
It enables MCP servers to access local filesystems of clients using standard JSON-RPC methods (e.g.,
files/read) with minimal code changes, enabling uniform methods of filesystem access for both remotely and locally hosted MCP servers.Clients advertise support via a newly introduced
filesystemBrokeringcapability. After consent, the client brokers file operation messages received from the MCP server using the existing MCP transport. This keeps server code simple, promoting wide adoption across diverse runtimes.Brokering filesystem operation messages means carrying out the requests (read/write) upon the local filesystem while supporting concurrent operations against the same file across multiple MCP clients via comprehensive file locking mechanisms with optional persistent locks; and also protecting against invalid access/exfiltration by leveraging "roots" as an explicit allow list of valid files/directories for those respective operations.
Before (Current)
Filesystem accessed through locally running MCP Server
graph LR subgraph "Local machine" subgraph "Application Host Process" H[Host] C1[Client 1] C2[Client 2] H <--> C1 H <--> C2 end S1[Server 1<br>Files & Git] F1[("Local<br>Resource A")] C1 <--> S1 S1 <--> F1 end subgraph "Internet" S2[Server 2<br>External APIs] R2[("Remote<br>Resource B")] C2 <--> S2 S2 <--> R2 endAfter
Filesystem access brokered by locally running MCP Client(s) and host OS
graph LR subgraph "Local machine" subgraph "Application Host Process" H[Host] C1[Client 1] C2[Client 2] H <--> C1 H <--> C2 end S1[Server 1<br>Files & Git] F1[("Local<br>Filesystem<br>(Not a '*Resource*')")] C1 <-- Now includes Filesystem RPC Requests --> S1 C1 <-- Brokered Access --> F1 C2 <-- Brokered Access --> F1 end subgraph "Internet" S2[Server 2<br>External APIs] R2[("Remote<br>Resource B")] S2 <--> R2 C2 <-- Now includes Filesystem RPC Requests --> S2 endMotivation
MCP currently limits filesystem access to local servers, where hosts invoke tools to read/write files and directories. While effective for local operations, this restricts innovation, particularly for remote or cloud-hosted MCP servers.
Enabling direct filesystem access for remote servers unlocks significant potential:
The transformative power of this capability cannot be overstated, but neither can the critical need for robust security.
MCP servers should be deployment-agnostic, letting tool authors use standard RPC calls without rewrites. Remote access is vital for hosted platforms, yet alternatives like NFS, SSHFS, or rclone falter due to firewalls, OS compatibility, and complex setups.
This SEP delivers secure, cross-platform filesystem access through existing MCP transport, with client-brokered enforcement for safety and simplicity.
Specification
Capability Negotiation
Client advertises:
{ "capabilities": { "roots": { "listChanged": true, "filesystemBrokering": true } } }filesystemBrokeringisfalseor omitted, server MUST NOT request brokered access.filesystemBrokeringis missing or unsupported, throw error early (e.g., in handshake response):{ "jsonrpc": "2.0", "error": { "code": -32603, "message": "Filesystem access is required but the client is not advertising the filesystemBrokering capability" }, "id": 1 }User Consent and Access Control
Servers MUST request user consent before accessing filesystem operations:
{ "jsonrpc": "2.0", "method": "files/consent", "params": { "message": "Server requests access to project files for analysis", "requestedPaths": ["/home/user/project", "/home/user/config.json"] }, "id": 1 }Client responds with approval status:
{ "jsonrpc": "2.0", "result": { "granted": true, "approvedPaths": ["/home/user/project"] }, "id": 1 }Security Requirements
Addressing Malicious Server Concerns
The primary security concern is malicious MCP servers having "direct and non-revocable access" to user filesystems. This SEP addresses these concerns through:
User Consent Control:
Revocation Mechanisms:
Exfiltration Prevention:
Brokered Filesystem Methods
files/read,files/write,files/list,files/create,files/delete,files/rename,files/watch,files/unlock.File Reading
Request:
{ "jsonrpc": "2.0", "method": "files/read", "params": { "path": "project/src/main.py", "encoding": "utf-8", "offset": 0, "length": 1048576, "keepLocked": true }, "id": 1 }Response:
{ "jsonrpc": "2.0", "result": { "content": "# Python file contents...", "size": 1234, "mimeType": "text/x-python", "lockId": "lock_abc123def456" }, "id": 1 }File Writing
Request:
{ "jsonrpc": "2.0", "method": "files/write", "params": { "path": "project/output.txt", "content": "Hello, World!", "encoding": "utf-8", "create": true, "keepLocked": false }, "id": 2 }Response:
{ "jsonrpc": "2.0", "result": { "bytesWritten": 13, "lockId": "lock_def789ghi012" }, "id": 2 }File Locking
Operations can maintain exclusive locks beyond completion using the
keepLockedparameter:Lock Release:
{ "jsonrpc": "2.0", "method": "files/unlock", "params": { "lockId": "lock_abc123def456" }, "id": 3 }Directory Operations
List Directory:
{ "jsonrpc": "2.0", "method": "files/list", "params": { "path": "project/src", "recursive": false, "includeHidden": false }, "id": 4 }Create File/Directory:
{ "jsonrpc": "2.0", "method": "files/create", "params": { "path": "project/new_directory", "type": "directory", "keepLocked": false }, "id": 5 }File Watching
Start Watching:
{ "jsonrpc": "2.0", "method": "files/watch", "params": { "path": "project/src", "recursive": true, "events": ["modified", "created", "deleted"] }, "id": 6 }Client pushes change notifications:
{ "jsonrpc": "2.0", "method": "notifications/files/changed", "params": { "path": "project/src/main.py", "event": "modified", "timestamp": "2025-11-02T12:30:00Z" } }Constraints
Error Codes
FILE_NOT_FOUNDPERMISSION_DENIEDINVALID_PATHIO_ERRORTIMEOUTFILE_LOCKED)Security Error Handling
Clients MUST return
PERMISSION_DENIEDerrors for:../, symbolic links escaping approved areas)Lock Conflict Example:
{ "jsonrpc": "2.0", "id": 10, "error": { "code": -32100, "message": "File is locked", "data": { "path": "project/config.json", "lockId": "lock_existing123", "lockedBy": "previous_operation" } } }File Locking Mechanism
The filesystem operations support exclusive file locking to prevent concurrent access conflicts:
keepLocked: truelockIdreturned in operation resultsfiles/unlockmethod to release persistent lockskeepLockedis true) and on connection disconnectFILE_LOCKED(-32100) errorsLock Lifecycle:
keepLocked: false(default): Lock released on operation completionkeepLocked: true: Lock persists,lockIdreturned for later releasefiles/unlockwithlockIdto explicitly release persistent locksMCP Client Implementation
files/*methods via existing JSON-RPC transportMCP Server Implementation
FILE_LOCKED(-32100) errors for locked filesRationale
Why Client-Brokered
Security Risks & Mitigations
Alternatives Considered
Best Practices
Backward Compatibility
Optional. Local servers unchanged. Remote without support falls back with error -32603. Existing wrappers can adapt.
Reference Implementation
files/*operations with locking:Security Implications
Critical Security Requirements (MUST)
Recommended Security Measures (SHOULD)
Optional Security Enhancements (MAY)
Threat Model and Mitigations
Malicious Server Scenarios
Unauthorized File Access:
PERMISSION_DENIEDerrors for violationsData Exfiltration:
Directory Traversal:
../or symlinks to escape approved directoriesPersistence After Revocation:
Implementation Responsibilities
Transport Security
Best Practices for Implementors