Enhance Your LLM

Monorepos provide an ideal foundation for AI-powered development, enabling cross-project reasoning and code generation. However, without proper context, LLMs struggle to understand your workspace architecture, seeing only individual files rather than the complete picture.

Nx's transforms your AI assistant by providing rich workspace metadata that enables it to:

  • Understand your workspace architecture and project relationships
  • Identify project owners and team responsibilities
  • Access Nx documentation for accurate guidance
  • Leverage code generators for consistent scaffolding
  • Connect to your CI pipeline to help fix failures

The goal is to transform your AI assistant from a generic code helper into an architecturally-aware collaborator that understands your specific workspace structure and can make intelligent, context-aware decisions.

How Nx MCP Enhances Your LLM

The Model Context Protocol (MCP) is an open standard that enables AI models to interact with your development environment through a standardized interface. Nx implements an MCP server via the Nx Console that exposes workspace metadata to compatible AI assistants like GitHub Copilot, Claude, and others.

With the Nx MCP server, your AI assistant gains a "map" of your entire system being able to go from just reasoning at the file level to seeing the more high level picture. This allows the LLM to move between different abstraction levels - from high-level architecture down to specific implementation details:

Different abstraction levels

These are some of the available tools which the Nx MCP server exposes:

  • nx_workspace: Provides a comprehensive view of your Nx configuration and project graph
  • nx_project_details: Returns detailed configuration for specific projects
  • nx_docs: Retrieves relevant documentation based on queries
  • nx_generators: Lists available code generators in your workspace
  • nx_generator_schema: Provides detailed schema information for generators
  • nx_visualize_graph: Opens interactive project or task graph visualizations
  • nx_cloud_cipe_details: Returns information about CI pipelines from Nx Cloud
  • nx_cloud_fix_cipe_failure: Provides detailed information about CI failures to help fix issues

Setting Up Nx MCP

The Nx MCP server is part of Nx Console and can be easily configured in supported editors:

VS Code / Cursor Setup

  1. Install Nx Console from the marketplace
  2. You'll receive a notification to "Improve Copilot/AI agent with Nx-specific context"
  3. Click "Yes" to automatically configure the MCP server

If you miss the notification, run the nx.configureMcpServer command from the command palette (Ctrl/Cmd + Shift + P).

VS Code showing the Nx MCP installation prompt

Other MCP-Compatible Clients

For other MCP-compatible clients (that do not have Nx Console available) like Claude Desktop you can use the Nx MCP by configuring it manually as follows:

mcp.json
1{ 2 "servers": { 3 "nx-mcp": { 4 "command": "npx", 5 "args": ["nx-mcp@latest", "/path/to/your/workspace"] 6 } 7 } 8} 9

Replace /path/to/your/workspace with the absolute path to your Nx workspace.

Powerful Use Cases

Understanding Your Workspace Architecture

Ask your AI assistant about your workspace structure and get detailed, accurate responses about projects, their types, and relationships:

1What is the structure of this workspace? 2How are the projects organized? 3

With Nx MCP, your AI assistant can:

  • Identify applications and libraries in your workspace
  • Understand project categorization through tags
  • Recognize technology types (feature, UI, data-access)
  • Determine project ownership and team responsibilities

Example of LLM understanding project structure

You can also get informed suggestions about where to implement new functionality:

1Where should I implement a feature for adding products to cart? 2

Example of LLM providing implementation guidance

Learn more about workspace architecture understanding in our blog post Nx Just Made Your LLM Way Smarter.

Instant CI Failure Resolution

When a CI build fails, Nx Console can notify you directly in your editor:

Nx Console shows the notification of the CI failure

Your AI assistant can then:

  1. Access detailed information from Nx Cloud about the failed build
  2. Analyze your git history to understand what changed in your PR
  3. Understand the error context and affected files
  4. Help implement the fix right in your editor

This integration dramatically improves the development velocity because you get immediately notified when an error occurs, you don't even have to leave your editor to understand what broke, and the LLM can help you implement or suggest a possible fix.

Learn more about CI integration in our blog post Save Time: Connecting Your Editor, CI and LLMs.

Smart Code Generation with AI-Enhanced Generators

Nx generators provide predictable code scaffolding, while AI adds intelligence and contextual understanding. Instead of having the AI generate everything from scratch, you get the best of both worlds:

1Create a new React library into the packages/orders/feat-cancel-orders folder 2and call the library with the same name of the folder structure. Afterwards, 3also connect it to the main shop application. 4

Your AI assistant will:

  1. Identify the appropriate generator and its parameters
  2. Open the Nx Console Generate UI with preset values
  3. Let you review and customize the options
  4. Execute the generator and help integrate the new code with your existing projects

LLM invoking the Nx generate UI

This approach ensures consistent code that follows your organization's best practices while still being tailored to your specific needs. Learn more about AI-enhanced generators in our blog post Enhancing Nx Generators with AI.

Documentation-Aware Configuration

Get accurate guidance on Nx configuration without worrying about hallucinations or outdated information:

1Can you configure Nx release for the packages of this workspace? 2Update nx.json with the necessary configuration using conventional commits 3as the versioning strategy. 4

The AI assistant will:

  1. Query the Nx docs for the latest information on release configuration
  2. Understand your workspace structure to identify packages
  3. Generate the correct configuration based on your specific needs
  4. Apply the changes to your nx.json file

Learn more about documentation-aware configuration in our blog post Making Cursor Smarter with an MCP Server For Nx Monorepos.

Cross-Project Dependency Analysis

Understand the impact of changes across your monorepo with questions like:

1If I change the public API of feat-product-detail, which other projects 2might be affected by that change? 3

Your AI assistant can:

  • Analyze the project graph to identify direct and indirect dependencies
  • Visualize affected projects using the nx_visualize_graph tool
  • Suggest strategies for refactoring that minimize impact
  • Identify which teams would need to be consulted for major changes

This architectural awareness is particularly powerful in larger monorepos where understanding project relationships is crucial for making informed development decisions.

Learn more about dependency analysis in our blog post Nx MCP Now Available for VS Code Copilot.