refactor(@angular/cli): declaratively register MCP server tools#30858
Merged
clydin merged 5 commits intoangular:mainfrom Aug 11, 2025
Merged
refactor(@angular/cli): declaratively register MCP server tools#30858clydin merged 5 commits intoangular:mainfrom
clydin merged 5 commits intoangular:mainfrom
Conversation
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. |
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
ToolDeclarationobject, which encapsulates its name, description, schema, and factory function. A new centralregisterToolsfunction 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-onlyflag to theng mcpcommand. 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-onlyflag to theng mcpcommand. 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-toolflag (with a-Ealias) to theng mcpcommand. 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