refactor(@angular/cli): declaratively register MCP server tools #30858
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