Angular MCP Server đ
The Angular CLI has a built-in Model Context Protocol (MCP) server. Once your AI assistant is connected to it, the assistant can search the official docs, load Angular best practices that match your projectâs Angular version, discover the projects in your workspace, and build, test and serve your app â through safe, structured tools instead of guessing shell commands.
What youâll learn
Section titled âWhat youâll learnâ- What MCP is and what the Angular CLI MCP server adds to your assistant
- How to connect it in VS Code (Copilot), Cursor, Claude Code, Gemini CLI, JetBrains IDEs, OpenAI Codex and Antigravity
- Every tool the server offers in Angular 22.2 and when the agent uses it
- The
--read-only,--local-onlyand--rootoptions - Typical agent workflows (feature + tests, OnPush/zoneless migration, learning)
What is MCP?
Section titled âWhat is MCP?âMCP (Model Context Protocol) is an open standard that lets AI assistants call tools provided by external programs. Your editor or CLI agent (the host) starts an MCP server, asks which tools it has, and the model can then call those tools with structured arguments.
The Angular CLIâs server runs locally over stdio. You donât start it yourself â your AI tool starts it with this command:
npx -y @angular/cli mcpFastest setup: let the CLI write the config
Section titled âFastest setup: let the CLI write the configâThe CLI can generate the right MCP config file (and a rules file) for your tool:
# new projectng new my-app --ai-config=vscode
# existing projectng generate ai-config --tool=cursorChoices are claude-code, cursor, gemini-cli, open-ai-codex, vscode (or none). Details are on AI Config, Rules & Skills. If you prefer to set things up by hand, use the snippets below.
Manual setup per tool
Section titled âManual setup per toolâAll tools run the same command; only the config file and its format differ.
VS Code (GitHub Copilot)
Section titled âVS Code (GitHub Copilot)âCreate .vscode/mcp.json in your project. VS Code uses a servers key:
{ "servers": { "angular-cli": { "command": "npx", "args": ["-y", "@angular/cli", "mcp"] } }}VS Code shows a Start button above the server entry when you open the file. To check itâs running, open the Command Palette and run MCP: List Running Servers â angular-cli should be listed. In Copilot Chat, use Agent mode so it can call tools.
Create .cursor/mcp.json in the project root (or ~/.cursor/mcp.json for all projects):
{ "mcpServers": { "angular-cli": { "command": "npx", "args": ["-y", "@angular/cli", "mcp"] } }}Claude Code
Section titled âClaude CodeâClaude Code reads project servers from .mcp.json in the project root:
{ "mcpServers": { "angular-cli": { "command": "npx", "args": ["-y", "@angular/cli", "mcp"] } }}Or add it from the terminal (--scope project writes the .mcp.json above so your team shares it):
claude mcp add --transport stdio --scope project angular-cli -- npx -y @angular/cli mcpRun /mcp inside Claude Code to confirm the server is connected.
Gemini CLI
Section titled âGemini CLIâCreate .gemini/settings.json in the project:
{ "mcpServers": { "angular-cli": { "command": "npx", "args": ["-y", "@angular/cli", "mcp"] } }}JetBrains IDEs (WebStorm, IntelliJ IDEAâŠ)
Section titled âJetBrains IDEs (WebStorm, IntelliJ IDEAâŠ)âOpen Settings | Tools | AI Assistant | Model Context Protocol (MCP), click Add, choose the JSON option and paste:
{ "mcpServers": { "angular-cli": { "command": "npx", "args": ["-y", "@angular/cli", "mcp"] } }}OpenAI Codex
Section titled âOpenAI CodexâCodex uses TOML. Add this to .codex/config.toml in the project (or to your global ~/.codex/config.toml):
[mcp_servers.angular-cli]command = "npx"args = ["-y", "@angular/cli", "mcp"]Antigravity
Section titled âAntigravityâCreate .antigravity/mcp.json in the project root:
{ "mcpServers": { "angular-cli": { "command": "npx", "args": ["-y", "@angular/cli", "mcp"] } }}Available tools (Angular 22.2)
Section titled âAvailable tools (Angular 22.2)âEvery tool below is enabled by default.
| Tool | What it does | Changes files / runs code? | Needs internet? |
|---|---|---|---|
list_projects | Reads angular.json files to list workspaces, applications and libraries, their builders, test framework and paths. Agents are told to call this first. | No | No |
get_best_practices | Returns the Angular best-practices guide. Given a workspace path, it loads the guide shipped with that projectâs installed @angular/core, so advice matches your version. | No | No |
search_documentation | Searches the official Angular documentation (angular.dev) and returns the best matches. | No | Yes |
ai_tutor | Loads the Angular AI Tutor curriculum and persona, turning the assistant into an interactive tutor. | No | No |
onpush_zoneless_migration | Analyzes a file or directory and returns the next single step to migrate to OnPush change detection / zoneless. Call repeatedly until done. | No (the agent applies the step) | No |
run_target | Runs a configured target such as build, test, lint or e2e (tests run headless, no watch). | Yes | No |
devserver_start | Starts ng serve in the background and returns immediately. | Yes | No |
devserver_wait_for_build | Waits for the current dev-server build and returns its logs (errors included). The agent calls it after each edit. | No | No |
devserver_stop | Stops the dev server and returns the full log. | Yes | No |
The server also exposes the best-practices guide as an MCP resource (instructions://best-practices) for hosts that support resources.
Command options
Section titled âCommand optionsâAdd options to the end of the args array.
| Option | Effect |
|---|---|
--read-only | Registers only tools that donât modify the project or run commands (drops run_target and devserver_start/devserver_stop). Good for âreview onlyâ agents. |
--local-only | Registers only tools that work offline (drops search_documentation). |
--root <path> | (22.2) Directory the server may read and search. Repeat it for several roots. |
"args": ["-y", "@angular/cli", "mcp", "--read-only"]"args": ["-y", "@angular/cli", "mcp", "--root", "/home/me/work/shop", "--root", "/home/me/work/admin"]How file access is limited: the server only touches files inside its allowed roots. By default thatâs the folder the host started it in. --root replaces that default. If your host shares its workspace folders with the server (the MCP ârootsâ feature, supported by VS Code and others), those folders are used instead. Paths outside the roots are rejected with âAccess deniedâ.
How agents use the tools: three workflows
Section titled âHow agents use the tools: three workflowsâ1. Build a feature with tests
Section titled â1. Build a feature with testsâlist_projectsâ find the project, its test runner (Vitest by default in new projects) and paths.get_best_practicesâ load the rules for your Angular version.search_documentationâ look up an API it isnât sure about (for example@defertriggers).devserver_start, then edit code and calldevserver_wait_for_buildafter each change to catch compile errors.- Write a spec and run it with
run_target(target: "test"). devserver_stopwhen finished.
Example prompt:
Using the angular-cli MCP tools, add a "favorites" page to the shop app.Follow get_best_practices for this workspace, keep the dev server runningand fix any build errors, then add Vitest tests and run them.2. Migrate to OnPush / zoneless
Section titled â2. Migrate to OnPush / zonelessâlist_projectsto find the project.- Run any prerequisite schematics (for example signal inputs/queries migrations).
onpush_zoneless_migrationwith the absolute path of a component or folder â returns one actionable change.- Apply it, run tests with
run_target, and callonpush_zoneless_migrationagain until it reports completion.
Since v22, components are OnPush by default, and this tool also understands ChangeDetectionStrategy.Eager. See Zoneless.
3. Learn Angular with the AI tutor
Section titled â3. Learn Angular with the AI tutorâAsk âlaunch the Angular AI tutorâ in a new project. The agent calls ai_tutor, then guides you through building a âSmart Recipe Boxâ app, checking your files after each exercise. More in AI Config, Rules & Skills.
Security tips
Section titled âSecurity tipsâ- MCP tools run on your machine with your permissions. Only add servers you trust.
run_targetand the dev-server tools execute your projectâs build/test/serve targets. Use--read-onlyfor agents that should only read and advise.- Use
--root(or your hostâs workspace roots) so the server only sees the project folders it needs. - Review what the agent changed before committing â the tools help it verify its work, but youâre still the reviewer.
Combine MCP with rules and skills
Section titled âCombine MCP with rules and skillsâThe MCP server gives the agent actions (search, build, test). A rules file and agent skills give it knowledge of how you want code written. Together they produce the best results â see AI Config, Rules & Skills.
Key takeaways
Section titled âKey takeawaysâ- Configure your host to run
npx -y @angular/cli mcp;ng generate ai-configcan write the config for you. - VS Code uses a
serverskey; Cursor, Claude Code, Gemini CLI, JetBrains and Antigravity usemcpServers; Codex uses TOML[mcp_servers.angular-cli]. - 22.2 ships nine tools:
list_projects,get_best_practices,search_documentation,ai_tutor,onpush_zoneless_migration,run_targetand threedevserver_*tools. --read-only,--local-onlyand--rootlimit what the server can do and see.
Next steps
Section titled âNext stepsâ- Generate rules files and install skills: AI Config, Rules & Skills
- Learn to prompt and review effectively: Prompting Best Practices
- Let agents inspect your running app: AI Runtime Debugging