Skip to content

fix(filesystem): respect CLI directories when client supports MCP roots#3938

Open
ssam18 wants to merge 1 commit intomodelcontextprotocol:mainfrom
ssam18:fix/filesystem-cli-dirs-override
Open

fix(filesystem): respect CLI directories when client supports MCP roots#3938
ssam18 wants to merge 1 commit intomodelcontextprotocol:mainfrom
ssam18:fix/filesystem-cli-dirs-override

Conversation

@ssam18
Copy link
Copy Markdown

@ssam18 ssam18 commented Apr 13, 2026

When a client advertises roots support, the server was unconditionally replacing CLI-provided directories with whatever the client returned, making it impossible to scope the server to a directory outside the project root.

The fix tracks whether directories were passed via CLI args at startup and skips the roots fetch in both the oninitialized handler and the roots/list_changed notification handler when they were. MCP roots now only kick in as a fallback when no CLI args are given. Fixes #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.

MCP roots protocol overrides CLI-provided allowed directories

1 participant