Skip to content

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:

toml
[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 manual claude mcp add needed.
  • Codex: automatic via .codex/config.toml, generated by ndx init.

HTTP — single project only

Start the unified server, then register the MCP endpoints with your assistant:

sh
# 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/sourcevision

Any 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:

ToolClaude CodeCodex
PRD statusmcp__rex__get_prd_statusget_prd_status
Next taskmcp__rex__get_next_taskget_next_task
File infomcp__sourcevision__get_file_infoget_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

ToolDescription
get_prd_statusPRD tree with completion stats
get_next_taskNext actionable task
add_itemAdd epic/feature/task/subtask
update_task_statusUpdate item status
edit_itemEdit item content (title, description, priority)
get_itemGet full item details with parent chain
move_itemReparent an item
merge_itemsConsolidate duplicate items
verify_criteriaMap acceptance criteria to tests
reorganizeDetect and fix structural issues
healthPRD structure health score
facetsList configured facets
get_recommendationsSourceVision-based recommendations
append_logWrite to the execution log
sync_with_remoteSync with remote adapter (e.g. Notion)
get_capabilitiesServer capabilities and configuration

SourceVision MCP Tools

ToolDescription
get_overviewProject summary statistics
get_file_infoFile inventory, zone, and imports
search_filesSearch inventory by path, role, or language
get_zoneArchitectural zone details
get_findingsAnalysis findings (anti-patterns, suggestions)
get_next_stepsPrioritized improvement recommendations
get_importsImport graph edges
get_classificationsFile archetype classifications
get_route_treeRoute structure (pages, API routes, layouts)
set_file_archetypeOverride archetype classification for a file

Migrating from stdio to HTTP (Claude)

sh
# 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

See the Skills Reference for the workflow slash commands installed alongside MCP by ndx init.

Released under the Elastic License 2.0.