feat(@angular/cli): add --root command line option to mcp command - #33746
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a --root option to the MCP command, allowing users to specify allowed root directory paths for filesystem access and workspace discovery. The implementation includes path resolution for these roots, restricting host access accordingly, and utilizing configured roots in the project listing tool when client capabilities are absent. The review feedback highlights two critical issues: first, setRoots should fall back to initialRoots if called with an empty array to prevent locking down the filesystem; second, the fallback logic in the project listing tool should be decoupled so that if the client supports roots but returns an empty list, it still falls back to configured roots or the current working directory.
Add explicit `--root` command line option to the `@angular/cli mcp` command to specify allowed filesystem root directories for sandboxing and workspace discovery. In protocol revision 2026-07-28, the server-initiated `listRoots()` query is deprecated. The `--root` option allows hosts to explicitly pass allowed filesystem roots at startup, supporting multi-root workspaces and non-root CLI invocations. For clients that support `listRoots()`, those provided roots take priority.
|
This PR was merged into the repository. The changes were merged into the following branches:
|
Add explicit
--rootcommand line option to the@angular/cli mcpcommand to specify allowed filesystem root directories for sandboxing and workspace discovery.In protocol revision 2026-07-28, the server-initiated
listRoots()query is deprecated. The--rootoption allows hosts to explicitly pass allowed filesystem roots at startup, supporting multi-root workspaces and non-root CLI invocations. For clients that supportlistRoots(), those provided roots take priority.