[BUG] roots/list response contains only CWD — filesystem MCP server loses configured allowed directories

Resolved 💬 2 comments Opened Apr 2, 2026 by ldaniluk Closed May 11, 2026

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?

  1. The roots/list response should include all directories the user intends to be accessible — at minimum the CWD and directories added via /add-dir
  2. When /add-dir is used, a roots/list_changed notification should be sent so MCP servers can update their allowed directories dynamically

Error Messages/Logs

Steps to Reproduce

  1. Configure a global filesystem MCP in ~/.claude.json with multiple allowed directories (e.g. /Users/me/repos/, /Users/me/Documents/)
  2. Start Claude Code in a subdirectory, e.g. /Users/me/repos/my-project/
  3. Call list_allowed_directories — returns only /Users/me/repos/my-project
  4. 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

  1. Claude Code advertises roots capability to MCP servers
  2. server-filesystem detects roots support → calls roots/list on Claude Code
  3. Claude Code responds with only a single root: the project CWD
  4. server-filesystem replaces its allowedDirectories with the roots response
  5. 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).

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗