Nx provides deep integration with AI coding assistants through the Nx Model Context Protocol (MCP) server, giving your AI assistant comprehensive understanding of your monorepo structure, running processes, and development workflows. When you create a new Nx workspace, it includes AI agent configuration files (CLAUDE.md
and AGENTS.md
) that provide guidelines for working with Nx and the Nx MCP server.
Configure Nx AI Integration
Section titled “Configure Nx AI Integration”Automatic AI Setup
Section titled “Automatic AI Setup”To automatically configure your Nx workspace to work best with AI agents and assistants, run the following command:
npx nx configure-ai-agents
This will prompt you for which AI agents/assistants to configure and make sure you are properly set up with both the Nx MCP as well as corresponding AI agent configuration files (e.g. AGENTS.md
, CLAUDE.md
etc).
Watch our Youtube video for a full walkthrough.
Manual AI Setup
Section titled “Manual AI Setup”You can of course manually configure the Nx MCP for MCP-compatible clients using the following configuration:
{ "servers": { "nx-mcp": { "command": "npx", "args": ["nx-mcp@latest"] } }}
For Claude Code:
claude mcp add nx-mcp npx nx-mcp@latest
What This Integration Enables
Section titled “What This Integration Enables”The Nx AI integration provides your coding assistant with powerful capabilities:
- Workspace Structure Understanding - Deep architectural awareness of your monorepo, project relationships, and dependencies
- Real-time Terminal Integration - AI can read your terminal output, running processes, and error messages without copy-pasting
- CI Pipeline Context - Access to build failures, test results, and deployment status from your CI/CD processes
- Enhanced Code Generation - AI-powered generator suggestions and custom scaffolding with intelligent defaults
- Cross-project Impact Analysis - Understanding the implications of changes across your entire monorepo
- Autonomous Error Debugging - AI independently accesses context to help fix development issues
Configure CI to Leverage AI Capabilities
Section titled “Configure CI to Leverage AI Capabilities”Nx also integrates AI directly into your CI runs to automatically detect failed tasks, analyze the errors, and propose fixes that can be reviewed and applied directly to your PR.
Read more on the Self-Healing CI docs page.
Learn More about Nx and AI
Section titled “Learn More about Nx and AI”Learn more about why Nx and AI work so well together.