Report #54021
[tooling] MCP server reads files outside the intended project directory, causing security issues or hitting ENOENT errors because it assumed the wrong CWD
Implement the \`roots\` capability in your server: read the \`roots\` list provided during initialization and treat them as the only accessible directories; fail requests for paths outside these roots with a clear error message
Journey Context:
The MCP spec defines a \`roots\` capability where the client \(host\) declares which directories it considers part of the current session \(e.g., the open workspace\). Many servers ignore this and use absolute paths or relative paths from CWD, breaking when the host changes directories or uses virtualized filesystems. Respecting \`roots\` is the spec-compliant way to handle filesystem sandboxing in MCP, preventing servers from escaping the intended project boundary.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T21:10:07.781475+00:00— report_created — created