Support MCP `roots` capability with `listChanged` notifications
Summary
Claude Code currently does not implement the MCP roots capability as an MCP client. It would be valuable for Claude Code to:
- Declare the
rootsclient capability withlistChanged: trueduring MCP initialization - Respond to
roots/listrequests from MCP servers - Emit
notifications/roots/list_changedwhenever the active set of working directories changes
Motivation
The roots feature is how MCP servers learn which workspace/project boundaries the client is operating within. Without it, servers have to either guess, require manual configuration, or fall back to process-cwd heuristics — none of which match what the user is actually working on inside Claude Code.
Claude Code is a particularly good fit for this capability because the set of roots is not static during a session:
claude --add-dir <path> [<path> ...]lets users start a session with multiple directories- The
/add-dirslash command lets users add additional directories mid-session
Every /add-dir invocation is exactly the kind of event the notifications/roots/list_changed notification was designed for. Today, MCP servers connected to Claude Code have no way to learn that the user just expanded the workspace, so any server logic scoped to "the current project" silently goes stale.
Use cases this would unlock
- Code-search / indexing servers that want to (re-)index only the directories the user is actively working in
- Linter / formatter / test-runner servers that need to know project boundaries to locate config files
- Documentation servers that scope results to the current workspace
- Any server that today requires a redundant
cwdargument on every tool call
Current state
Claude Code already supports list_changed notifications for tools, prompts, and resources (per the MCP servers docs). Adding roots would round out client-side coverage of the MCP spec's listChanged notifications and bring Claude Code in line with other MCP clients.
References
- MCP spec — Roots: https://modelcontextprotocol.io/specification/2025-06-18/client/roots
- Claude Code
--add-dir//add-dir: https://code.claude.com/docs/en/cli-reference.md
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗