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 automatically registers stdio MCP servers and writes read-only tool permissions to .claude/settings.local.json. For most users, MCP works out of the box after init.
For production use, upgrade to HTTP transport:
# 1. Start the server (dashboard + MCP on one port)
ndx start .
# 2. Switch to HTTP MCP servers
claude mcp remove rex && claude mcp remove sourcevision
claude mcp add --transport http rex http://localhost:3117/mcp/rex
claude mcp add --transport http sourcevision http://localhost:3117/mcp/sourcevisionCodex
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
HTTP (Recommended)
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.
stdio
stdio spawns a separate process per MCP server. No ndx start required. Both Claude and Codex support stdio transport.
Claude Code (manual registration):
claude mcp add rex -- rex mcp .
claude mcp add sourcevision -- sv mcp .Codex (automatic via .codex/config.toml — generated by ndx init).
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/sourcevision