Angular CLI MCP and AI-Generated Angular Code

AI can speed up Angular work, but only if the agent sees current docs, local project shape, and hard review rules. The Angular CLI MCP server shipped experimental in v20.2 (August 2025) and has been default-available since v21, though the docs still label it experimental in v22; the protocol itself is a year old after Anthropic open-sourced MCP in November 2024.

The real problem is stale Angular

The risk with AI-generated Angular is not that an assistant writes code. The risk is that it writes Angular from the wrong year: AppModule everywhere, old structural directives by habit, RxJS conversions with no boundary, or experimental APIs treated as stable.

Minko Gechev (Angular team lead) named the gap directly in his LLM-first Web Framework post: 'Often the LLM will generate code that uses deprecated or missing APIs from previous versions.' The Angular CLI MCP server exists to close that gap by giving compatible tools a path to the Angular CLI, official documentation, and workspace context. This is the dev-time side of Angular's AI surface: it helps the assistant write better code at your desk, where the runtime counterpart, WebMCP, exposes typed tools from your shipped app to a browser agent. That improves the starting point. It does not remove review.

What to allow

Use caseAllow?Condition
Search official Angular docsYesUse current docs before accepting an API claim.
Generate a small componentYesThe prompt states version, style, state boundary, and out-of-scope APIs.
Run read-only workspace inspectionYesPrefer read-only mode when the task is discovery.
Run experimental MCP tools that modify codeCarefulRequire explicit review and a small diff.
Put AI API secrets in Angular frontend codeNoSecrets belong behind backend, proxy, or managed provider boundary.

The setup to start with

Start with MCP for documentation and workspace help and ng generate ai-config for repository rules. The server has been default-available since v21, but the official MCP page, built at v22, still calls it experimental and still separates the six standard tools (search_documentation, find_examples, ai_tutor, get_best_practices, list_projects, onpush_zoneless_migration) from seven more behind --experimental-tool: build, e2e, modernize, test, plus a devserver group of three (devserver.start, devserver.stop, devserver.wait_for_build). Since this all runs at dev time, the practical risk is low, but keep policy conservative on anything that can change code.

For code generation, the prompt should state what modern Angular means in this repo. Otherwise the assistant will fill the gaps with whatever pattern it has seen most often.

Angular AI tooling baselinebash
ng mcp
ng generate ai-config --tool agents

What `ng generate ai-config` writes

The command writes a rules file your assistant reads before it touches the code. The --tool flag is an array, defaults to ["none"], and picks which file lands where. The shipped enum in the schematic is exactly these eight values, and each one maps to a path a specific assistant already looks for.

If the target file already exists, the schematic skips it and warns instead of overwriting, so running this on a repo that already has rules is safe. The agents value writes an AGENTS.md; once it exists, the next step is making that file say something useful, which is its own piece.

--toolGenerated fileUse
none(nothing)Default. Skips file generation.
agentsAGENTS.mdTool-agnostic rules many assistants now read.
claude.claude/CLAUDE.mdClaude Code project rules.
copilot.github/copilot-instructions.mdGitHub Copilot repo instructions.
cursor.cursor/rules/cursor.mdcCursor project rules.
gemini.gemini/GEMINI.mdGemini CLI rules.
jetbrains.junie/guidelines.mdJetBrains Junie guidelines.
windsurf.windsurf/rules/guidelines.mdWindsurf rules.

Prompt quality is part of the architecture

A vague prompt pushes the assistant toward the most common Angular shape on the internet. A useful prompt names the local architecture, the Angular version, the state boundary, the testing expectation, and the APIs that are out of scope.

I would reject AI output that ignores those constraints even if the component compiles. The review target is not whether the model produced code; it is whether the diff respects the team model.

Bad prompt vs useful prompttext
# Bad prompt
Create an Angular search component.

# Useful prompt
Create a standalone Angular 21 search component.
Use a Signal for the input text, RxJS for debounce and cancellation, and toSignal only at the component boundary.
Use built-in control flow in the template.
Do not use experimental APIs.
Add a small service-level test or explain why no test changed.

The review checklist

A generated Angular diff should be reviewed like any other production diff, plus a few AI-specific checks: over-conversion to Signals, misplaced providers, accidental global state, fake accessibility, missing tests, and APIs whose status was not checked.

The win is not 'the agent wrote the feature'. The win is a smaller first draft that still respects the team's Angular model.

Repo rule startertext
# Angular AI rules

Use standalone components for new UI.
Prefer `inject` when it matches local style.
Use built-in control flow in touched templates.
Use Signals for local and derived state.
Keep RxJS for streams, cancellation, and async composition.
Do not use experimental APIs without an explicit decision.
Do not place secrets in Angular frontend code.
Every generated diff needs human review.

Reusable artifact

AI-generated Angular review gate

  • Current Angular docs checked through official sources.
  • Prompt states Angular version, architecture style, and out-of-scope APIs.
  • MCP tools that change code are treated as experimental until reviewed.
  • No secrets or provider credentials are added to frontend code.
  • Generated code passes normal tests and a human Angular review.

FAQ

What does `ng generate ai-config` do?

It writes a rules file that your AI assistant reads before working in the repo, so the assistant follows your conventions instead of guessing. The --tool option decides which assistant's file format it generates. It skips and warns if the file already exists.

Which `--tool` options exist?

On Angular v21.2.x the shipped enum is none, agents, claude, copilot, cursor, gemini, jetbrains, and windsurf; none is the default and skips generation. The full list is in the schematic schema, and --tool is an array, so you can pass more than one.

Does it generate an AGENTS.md?

Yes, ng generate ai-config --tool agents writes an AGENTS.md at the repo root, the tool-agnostic file that several assistants read. What goes inside that file to make it useful for Angular is its own piece.

How is this different from WebMCP?

ng generate ai-config and the Angular CLI MCP server are dev-time: they help an assistant write Angular on your machine. WebMCP is runtime, where your shipped app exposes typed tools to the end user's browser agent. Same AI theme, very different blast radius. I lay the two side by side in WebMCP vs the Angular CLI MCP server.

Sources checked

Modern Angular Playbook

This article is one play.

The Modern Angular Playbook collects the diagnostic, the adoption matrix, eleven plays, and the 30-day plan. Free, in English and Portuguese.

You get both PDFs by email, through the Dojo IA list.

Open playbook →

André Ramosavailable for remote roles, UTC−3Get in touch →

Related

Guide · 8 min

The Angular CLI MCP Server: Setup, Tools, and Wiring It to Your AI Assistant

How to set up the Angular CLI MCP server: the exact start command, the client config shape, the tools it exposes, and how to wire it to Claude Code, Cursor, and VS Code.

Read article →

Note · 6 min

WebMCP vs the Angular CLI MCP Server: Runtime Tools vs Dev-Time Help

Which Angular MCP you actually want: the dev-time CLI MCP server that helps an assistant write your code, or runtime WebMCP that lets a browser agent call your shipped app.

Read article →

Guide · 12 min

WebMCP in Angular: How to Expose Tools to the Browser's AI Agent (and When to Wait)

How Angular exposes WebMCP tools to a browser AI agent (bootstrap, routes, services, and Signal Forms), plus the security surface that opens and where I would still wait before shipping.

Read article →