Skip to content

filesystem: a client Root is allowed only in its realpath form, unlike command-line directories #5183

Closed

Description

@cliffhall

Problem

Command-line directories and client Roots are resolved differently. resolveAllowedDirectories in src/filesystem/index.ts keeps both the spelling a directory was given in and its realpath when the two differ, so on macOS /tmp and /private/tmp are both allowed. parseRootUri in src/filesystem/roots-utils.ts keeps only the realpath of each client Root.

When a client's Roots take over, a request that uses the Root's own spelling (for example /tmp/x for the root file:///tmp, a symlinked project directory, or a Windows mapped drive that resolves to a UNC path) fails the containment check in validatePath (src/filesystem/lib.ts) with "Access denied", although it names a path inside the Root.

Expected

A Root admits both its advertised form and its resolved form, as command-line directories do. Every requested path is still realpath'd and re-checked in validatePath, so access stays bounded by the resolved directories. The POSIX symlink case can be reproduced directly; the Windows mapped-drive case is unverified. #4129 was closed as a duplicate of #235, whose fix covered command-line directories only.

Prior work

The PR(s) above targeted the pre-refactor code and are closed as part of the backlog triage in #4875; this issue is where the work continues, with the PR(s) as a prototype. Thank you to their authors.

Activity

  1. added
    bugSomething isn't working
    server-filesystemReference implementation for the Filesystem MCP server - src/filesystem
    on Oct 20, 2026
  2. cliffhall commented on Oct 20, 2026

    @cliffhall
    MemberAuthor

    Triage: Priority Medium (total 7)

    Filed from the PR backlog triage (#4877). Board: Servers V2 (#43), Status Incoming, awaiting maintainer review (no milestone yet).

  3. added this to the v2.2.0 milestone on Oct 25, 2026
  4. self-assigned this
    on Oct 27, 2026
  5. added 2 commits that reference this issue on Oct 27, 2026
    1216a93
    d98c856
  6. cliffhall commented on Oct 27, 2026

    @cliffhall
    MemberAuthor

    Fixed by #5317, merged into v2/main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingserver-filesystemReference implementation for the Filesystem MCP server - src/filesystemv2

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions