Skip to content

fix(filesystem): prevent MCP roots from overriding CLI-provided directories#3994

Open
Will-hxw wants to merge 2 commits intomodelcontextprotocol:mainfrom
Will-hxw:fix/3929-roots-override-cli
Open

fix(filesystem): prevent MCP roots from overriding CLI-provided directories#3994
Will-hxw wants to merge 2 commits intomodelcontextprotocol:mainfrom
Will-hxw:fix/3929-roots-override-cli

Conversation

@Will-hxw
Copy link
Copy Markdown

Summary

  • Added check in updateAllowedDirectoriesFromRoots to skip overriding if CLI directories were explicitly provided
  • When CLI directories are provided via command-line args, MCP roots from the client will not override them

Why

Previously, MCP roots would unconditionally replace allowedDirectories even when the user explicitly provided directories via CLI args. This made it impossible to scope the server to a directory outside the client's project root.

Validation

  • TypeScript build passes
  • Only one file modified with minimal changes
  • Logic: if hasCliDirectories is true, the function returns early without overriding

Related

Fixes Issue #3929

The has_changes() function only considered .py and .ts files when
deciding whether to bump a package version. This caused packages
with only lockfile changes (e.g., uv.lock from dependabot) to be
skipped during release.

Fixes Issue modelcontextprotocol#3870
…tories

When a client sends MCP roots, the server should not override explicitly
CLI-provided directories. This fixes the issue where users could not scope
the filesystem server to a directory outside the client's project root.

If CLI directories are explicitly provided, they take precedence over MCP
roots protocol.

Fixes Issue modelcontextprotocol#3929
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant