-
Notifications
You must be signed in to change notification settings - Fork 11.9k
refactor(@angular/cli): declaratively register MCP server tools #30858
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2e9202a
to
48c852a
Compare
devversion
approved these changes
Aug 11, 2025
Changes to a declarative approach for registering tools with the MCP server. Previously, each tool was registered imperatively. This change refactors each tool to export a `ToolDeclaration` object, which encapsulates its name, description, schema, and factory function. A new central `registerTools` function now iterates over these declarations, simplifying the server setup and ensuring a consistent registration process. This approach improves maintainability, readability, and type safety by co-locating all aspects of a tool's definition.
This change introduces a `--read-only` flag to the `ng mcp` command. When this flag is present, the MCP server will only register tools that are explicitly marked as read-only. This provides a way for host applications to connect to the Angular CLI MCP server with a restricted set of capabilities, ensuring that no tools capable of modifying the user's workspace are exposed.
This change introduces a `--local-only` flag to the `ng mcp` command. When this flag is present, the MCP server will only register tools that are explicitly marked as `isLocalOnly`. This provides a way for host applications to connect to the Angular CLI MCP server in an offline or restricted environment, ensuring that no tools that require internet access are exposed.
This change introduces an `--experimental-tool` flag (with a `-E` alias) to the `ng mcp` command. This flag allows users to enable specific experimental tools by providing their names. Experimental tools are kept separate from the main toolset and are only registered if explicitly enabled via this option. This provides a mechanism for safely developing and testing new tools without exposing them to all users by default.
This change moves the `find_examples` and `modernize` tools to the experimental toolset. They can now be enabled by passing the `--experimental-tool <tool_name>` flag to the `ng mcp` command. For backward compatibility, the `find_examples` tool will also be enabled if the `NG_MCP_CODE_EXAMPLES=1` environment variable is set.
48c852a
to
8869cb8
Compare
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes to a declarative approach for registering tools with the MCP server.
Previously, each tool was registered imperatively. This change refactors each tool to export a
ToolDeclaration
object, which encapsulates its name, description, schema, and factory function. A new centralregisterTools
function now iterates over these declarations, simplifying the server setup and ensuring a consistent registration process.This approach improves maintainability, readability, and type safety by co-locating all aspects of a tool's definition.
Introduces a
--read-only
flag to theng mcp
command. When this flag is present, the MCP server will only register tools that are explicitly marked as read-only.This provides a way for host applications to connect to the Angular CLI MCP server with a restricted set of capabilities, ensuring that no tools capable of modifying the user's workspace are exposed.
Introduces a
--local-only
flag to theng mcp
command. When this flag is present, the MCP server will only register tools that are explicitly marked asisLocalOnly
.This provides a way for host applications to connect to the Angular CLI MCP server in an offline or restricted environment, ensuring that no tools that require internet access are exposed.
Introduces an
--experimental-tool
flag (with a-E
alias) to theng mcp
command. This flag allows users to enable specific experimental tools by providing their names.Experimental tools are kept separate from the main toolset and are only registered if explicitly enabled via this option. This provides a mechanism for safely developing and testing new tools without exposing them to all users by default.
REVIEWER NOTE: Use hide whitespace option