[BUG] roots/list response contains only CWD — filesystem MCP server loses configured allowed directories
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Summary
Claude Code's roots/list response only returns the project CWD. This causes @modelcontextprotocol/server-filesystem to replace its allowed directories with just the CWD, making it unable to access any path outside the project root.
Follow-up to #3315, which was auto-closed by stale bot. The original bug (no roots/list implementation) was fixed, but the current implementation is too restrictive.
What Should Happen?
- The
roots/listresponse should include all directories the user intends to be accessible — at minimum the CWD and directories added via/add-dir - When
/add-diris used, aroots/list_changednotification should be sent so MCP servers can update their allowed directories dynamically
Error Messages/Logs
Steps to Reproduce
- Configure a global filesystem MCP in
~/.claude.jsonwith multiple allowed directories (e.g./Users/me/repos/,/Users/me/Documents/) - Start Claude Code in a subdirectory, e.g.
/Users/me/repos/my-project/ - Call
list_allowed_directories— returns only/Users/me/repos/my-project - Attempting to access
/Users/me/repos/other-project/fails with:
> Access denied - path outside allowed directories
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.90
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
Root cause
- Claude Code advertises
rootscapability to MCP servers server-filesystemdetects roots support → callsroots/liston Claude Code- Claude Code responds with only a single root: the project CWD
server-filesystemreplaces itsallowedDirectorieswith the roots response- All other configured directories are lost
Additionally, when directories are added via /add-dir at runtime, no roots/list_changed notification is sent to MCP servers, so they are never made aware of the new directories.
Workaround
None effective. The only workaround is using a client that doesn't advertise roots capability (e.g., OpenAI Codex does not implement roots, so server-filesystem falls back to its startup configuration).
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗