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

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

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

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.

stdio

stdio spawns a separate process per MCP server. No ndx start required. Both Claude and Codex support stdio transport.

Claude Code (manual registration):

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

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

Released under the Elastic License 2.0.