Skip to content

feat(@angular/cli): add --root command line option to mcp command - #33746

Merged
alan-agius4 merged 1 commit into
angular:mainfrom
clydin:mcp-root-option
Aug 4, 2026
Merged

feat(@angular/cli): add --root command line option to mcp command#33746
alan-agius4 merged 1 commit into
angular:mainfrom
clydin:mcp-root-option

Conversation

@clydin

@clydin clydin commented Aug 4, 2026

Copy link
Copy Markdown
Member

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.

@angular-robot angular-robot Bot added detected: feature PR contains a feature commit area: @angular/cli labels Aug 4, 2026
@clydin
clydin marked this pull request as ready for review August 4, 2026 16:11

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread packages/angular/cli/src/commands/mcp/host.ts
Comment thread packages/angular/cli/src/commands/mcp/tools/projects.ts
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.
@clydin clydin added the target: minor This PR is targeted for the next minor release label Aug 4, 2026
@clydin
clydin requested a review from alan-agius4 August 4, 2026 16:19
@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Aug 4, 2026
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Aug 4, 2026
@alan-agius4
alan-agius4 merged commit 41555df into angular:main Aug 4, 2026
41 of 42 checks passed
@alan-agius4

Copy link
Copy Markdown
Collaborator

This PR was merged into the repository. The changes were merged into the following branches:

@clydin
clydin deleted the mcp-root-option branch August 4, 2026 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/cli detected: feature PR contains a feature commit target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants