adev/src/content/ai/mcp-server-setup.md
The Angular CLI includes a Model Context Protocol (MCP) server that enables AI assistants (like Cursor, Antigravity, JetBrains AI, etc.) to interact directly with the Angular CLI. It provides tools for code generation, workspace analysis, and running builds/tests.
<docs-callout title="Integration with Angular AI Agent Skills"> If your host environment supports custom Agent Skills (such as Antigravity), you can combine the Angular CLI MCP server with the official [Angular AI Skills](https://angular.dev/ai/skills). While the skills provide the agent with deep instruction-level guidance and coding standards, the MCP server provides the action tools (like compiling, running tests, and analyzing workspaces) to execute those guidelines, resulting in a complete and powerful development agent. </docs-callout>To use the MCP server, you configure your host environment (IDE or CLI) to run npx @angular/cli mcp.
```json
{
"mcpServers": {
"angular-cli": {
"command": "npx",
"args": ["-y", "@angular/cli", "mcp"]
}
}
}
```
```json
{
"mcpServers": {
"angular-cli": {
"command": "npx",
"args": ["-y", "@angular/cli", "mcp"]
}
}
}
```
```json
{
"servers": {
"angular-cli": {
"command": "npx",
"args": ["-y", "@angular/cli", "mcp"]
}
}
}
```
When the MCP server is enabled, AI agents have access to the following tools:
| Name | Description |
|---|---|
ai_tutor | Launches an interactive AI-powered Angular tutor. |
devserver.start | Asynchronously starts a dev server (ng serve). Returns immediately. |
devserver.stop | Stops the dev server. |
devserver.wait_for_build | Returns the logs of the most recent build in a running dev server. |
get_best_practices | Retrieves the Angular Best Practices Guide (crucial for standalone components, typed forms, etc.). |
list_projects | Lists all applications and libraries in the workspace by reading angular.json. |
onpush_zoneless_migration | Analyzes code and provides a plan to migrate it to OnPush change detection (prerequisite for zoneless). |
run_target | Executes a configured target (e.g., build, test, lint, e2e, deploy). |
search_documentation | Searches the official documentation at https://angular.dev. |
These workflows demonstrate how AI assistants coordinate different MCP tools to automatically achieve complex developer stories.
The AI agent optimizes change detection performance and migrates components to a zoneless-ready state.
list_projects to locate components, projects, and style/test configurations in the workspace.ng generate commands (e.g., Signal Inputs, Signal Queries).onpush_zoneless_migration with the absolute path of the directory or component file.run_target with the target parameter set to "test".onpush_zoneless_migration again to retrieve the next step, repeating until the tool indicates the migration is complete.The AI agent automates research, implementation, and verification when developing new features.
search_documentation to look up Angular APIs or syntax rules (e.g., @defer block options).get_best_practices with the workspace path to load Angular version-aligned coding rules.devserver.start.devserver.wait_for_build to watch build logs and ensure compilation succeeds as it edits the code.list_projects, writes the corresponding test file, and runs the tests using run_target with "test".devserver.stop.The AI agent guides the developer through Angular concepts in an interactive sandbox.
list_projects to scan the workspace and identify the codebase structure.ai_tutor to load the curriculum instructions, persona, and tutoring guidelines.run_target with "test" or "build".You can pass arguments to the MCP server in the args array of your configuration:
--read-only: Only registers tools that do not modify the project.--local-only: Only registers tools that do not require an internet connection.Example for read-only mode:
"args": ["-y", "@angular/cli", "mcp", "--read-only"]