Nx MCP
STDIOOfficial为AI工具提供Nx单体仓库深度访问的MCP服务器
为AI工具提供Nx单体仓库深度访问的MCP服务器
A Model Context Protocol server implementation for Nx.
The Nx MCP server gives LLMs deep access to your monorepo’s structure: project relationships, file mappings, runnable tasks, ownership info, tech stacks, Nx generators, and even Nx documentation. With this context, LLMs can generate code tailored to your stack, understand the impact of a change, and apply modifications across connected files with precision. This is possible because Nx already understands the higher-level architecture of your workspace, and monorepos bring all relevant projects into one place.
Read more in our blog post and in our docs.
There are two ways to use this MCP server:
Simply invoke the MCP server via npx or your package manager's equivalent.
Here's an example of a mcp.json configuration:
{ "servers": { "nx-mcp": { "type": "stdio", "command": "npx", "args": ["nx-mcp@latest"] } } }
claude mcp add nx-mcp npx nx-mcp@latest
code --add-mcp '{"name":"nx-mcp","command":"npx","args":["nx-mcp"]}'
Go to Settings -> AI -> Manage MCP Servers -> + Add to add an MCP Server.
Alternatively, use the slash command /add-mcp in the Warp Agent prompt.
{ "nx-mcp": { "command": "npx", "args": ["nx-mcp@latest"] } }
Refer to your AI tool's documentation for how to register an MCP server. For example, Cursor or Claude Desktop support MCP.
If you want to host the server instead of communicating via stdio, you can use the --sse and --port flags. Keep in mind that the Nx MCP server only supports a single concurrent connection right now, so connecting multiple clients at the same time might break in some cases.
Run nx-mcp --help to see what options are available.
If you're using Cursor you can directly install the Nx Console extension which automatically manages the MCP server for you.
More info:
The Nx MCP server provides a comprehensive set of tools for interacting with your Nx workspace.
These tools provide analytics and insights into your Nx Cloud CI/CD data, helping you track performance trends and team productivity:
When no workspace path is specified, only the nx_docs and nx_available_plugins tools will be available.
When connected to an Nx Cloud-enabled workspace, the Nx MCP server automatically exposes recent CI Pipeline Executions (CIPEs) as MCP resources. Resources appear in your AI tool's resource picker, allowing the LLM to access detailed information about CI runs including failed tasks, terminal output, and affected files.
Contributions are welcome! Please see the Nx Console contribution guide for more details.
The basic steps are:
nx-mcp using nx run nx-mcp:build (or nx run nx-mcp:build:debug for debugging with source maps)