MCP Integration
Rex and SourceVision expose Model Context Protocol servers for AI tool integration. This lets Claude Code, Codex, or any MCP client query your codebase and manage your PRD directly.
Setup by Assistant
Claude Code
ndx init writes a tracked .mcp.json at the project root (cwd-relative commands, e.g. {"command":"ndx","args":["rex","mcp","."]}) and read-only tool permissions to .claude/settings.local.json. .mcp.json is committed to the repo, so every worktree and teammate clone gets a working registration without any claude mcp add call — MCP works out of the box after init. Claude Code shows a one-time approval prompt for a project's servers the first time it opens the checkout.
If ndx isn't on PATH, run the CLI through npx instead: npx -y @n-dx/core rex mcp . / npx -y @n-dx/core sv mcp .. Pass --mcp-scope=local to ndx init to fall back to the older claude mcp add --scope local registration (per-machine, absolute paths) instead of .mcp.json.
For multi-project setups, HTTP transport is available but is only safe with one n-dx project running at a time until the multi-project hub (0.7.0) lands — see Transport Options below.
Codex
ndx init writes MCP server definitions to .codex/config.toml using stdio transport. Codex reads this file automatically — no manual registration required.
The generated config looks like:
[mcp_servers.rex]
command = "node"
args = ["node_modules/@n-dx/rex/dist/cli/index.js", "mcp", "."]
[mcp_servers.sourcevision]
command = "node"
args = ["node_modules/@n-dx/sourcevision/dist/cli/index.js", "mcp", "."]Transport Options
stdio (default)
stdio spawns a separate process per MCP server. No ndx start required. Both Claude and Codex support stdio transport, and ndx init registers it automatically for both:
- Claude Code: tracked
.mcp.json(see Setup by Assistant above) — no manualclaude mcp addneeded. - Codex: automatic via
.codex/config.toml, generated byndx init.
HTTP — single project only
Start the unified server, then register the MCP endpoints with your assistant:
# 1. Start the server (dashboard + MCP on one port)
ndx start .
# 2. Register HTTP MCP servers (Claude example)
claude mcp add --transport http rex http://localhost:3117/mcp/rex
claude mcp add --transport http sourcevision http://localhost:3117/mcp/sourcevisionAny MCP-compatible assistant can connect to these HTTP endpoints.
The server runs on port 3117 by default. Custom port: --port=N or ndx config web.port N .
HTTP transport uses Streamable HTTP with session management. Sessions are created automatically and identified by the Mcp-Session-Id header.
Benefits of HTTP: single process, shared port with dashboard, session management, no per-tool process overhead.
Caveat — safe for one project at a time. http://localhost:3117/mcp/rex isn't scoped to a project — it points at whichever ndx start currently holds port 3117. If a second n-dx project starts its own server, its registration silently redirects to the newer project's port owner instead of failing. Stick to stdio if you work across multiple n-dx projects; a multi-project hub landing in 0.7.0 will make HTTP registration safe to share.
Tool Name Prefixes
MCP tool names differ by assistant due to vendor-specific conventions:
| Tool | Claude Code | Codex |
|---|---|---|
| PRD status | mcp__rex__get_prd_status | get_prd_status |
| Next task | mcp__rex__get_next_task | get_next_task |
| File info | mcp__sourcevision__get_file_info | get_file_info |
Claude uses double-underscore prefixes (mcp__{server}__{tool}) to namespace tools. Codex uses bare tool names. Both invoke the same underlying MCP server — the prefix is a transport-layer convention, not a functional difference.
Rex MCP Tools
| Tool | Description |
|---|---|
get_prd_status | PRD tree with completion stats |
get_next_task | Next actionable task |
add_item | Add epic/feature/task/subtask |
update_task_status | Update item status |
edit_item | Edit item content (title, description, priority) |
get_item | Get full item details with parent chain |
move_item | Reparent an item |
merge_items | Consolidate duplicate items |
verify_criteria | Map acceptance criteria to tests |
reorganize | Detect and fix structural issues |
health | PRD structure health score |
facets | List configured facets |
get_recommendations | SourceVision-based recommendations |
append_log | Write to the execution log |
sync_with_remote | Sync with remote adapter (e.g. Notion) |
get_capabilities | Server capabilities and configuration |
SourceVision MCP Tools
| Tool | Description |
|---|---|
get_overview | Project summary statistics |
get_file_info | File inventory, zone, and imports |
search_files | Search inventory by path, role, or language |
get_zone | Architectural zone details |
get_findings | Analysis findings (anti-patterns, suggestions) |
get_next_steps | Prioritized improvement recommendations |
get_imports | Import graph edges |
get_classifications | File archetype classifications |
get_route_tree | Route structure (pages, API routes, layouts) |
set_file_archetype | Override archetype classification for a file |
Migrating from stdio to HTTP (Claude)
# 1. Start the server
ndx start --background .
# 2. Remove old stdio servers
claude mcp remove rex
claude mcp remove sourcevision
# 3. Add HTTP servers
claude mcp add --transport http rex http://localhost:3117/mcp/rex
claude mcp add --transport http sourcevision http://localhost:3117/mcp/sourcevisionSee the Skills Reference for the workflow slash commands installed alongside MCP by ndx init.
