Nexus MCP

An MCP server that enables AI models to invoke AI CLI agents (Codex, Claude Code, OpenCode) as
tools. Provides durable workspace-scoped jobs, parallel execution, automatic retries with
exponential backoff, JSON-first response parsing, discoverable prompt templates, model tier
classification, and persistent preferences through MCP tools, resources, and prompts.
Use Cases
Nexus MCP is useful whenever a task benefits from querying multiple AI agents in
parallel rather than sequentially:
- Research & summarization β fan out a topic to multiple agents, then
synthesize their responses into a single summary with diverse perspectives
- Code review β send different files or review angles (security, correctness,
style) to separate agents simultaneously
- Multi-model comparison β prompt the same question to different models and
compare outputs side-by-side for quality or consistency
- Bulk content generation β generate multiple test cases, translations, or
documentation pages concurrently instead of one at a time
- Second-opinion workflows β get independent answers from separate agents
before making a decision, reducing single-model bias
Features
- Parallel execution β
batch_prompt fans out tasks with asyncio.gather and a configurable
semaphore (default concurrency: 3)
- Durable jobs β start, observe, cancel, and resume normalized agent work through stable job and
session identities backed by a private per-user SQLite database
- Automatic retries β exponential backoff with full jitter for transient errors (HTTP 429/503)
- Output handling β JSON-first parsing, brace-depth fallback for noisy stdout, temp-file
spillover for outputs exceeding 50 KB
- Execution modes β
default (safe, no auto-approve), yolo (full auto-approve)
- CLI detection β auto-detects binary path, version, and JSON output capability at startup
- Persistent preferences β set defaults for execution mode, model, retries, output limit, and timeout; preferences persist across MCP sessions via the backing store (MemoryStore default, FileTreeStore/RedisStore for restart persistence)
- Prompt templates β 10 discoverable workflow scaffolds (code review, debug, research, implement feature, etc.) via
list_prompts/get_prompt; each returns structured messages with expert framing the client can use or ignore
- Model tier classification β heuristic-based model classification into quick/standard/thorough tiers; clients can override with sampling or live benchmarks. The
nexus://runners resource includes tier data per model
- Tool timeouts β configurable safety timeout (default 15 min) cancels long-running tool calls to prevent the server from blocking indefinitely
- Client-visible logging β runner events (retries, output truncation, error recovery) are sent to MCP clients via protocol notifications, not just server stderr
- Elicitation β interactive parameter resolution via MCP elicitation; disambiguates missing CLI, offers model selection, confirms YOLO mode, and prompts for elaboration on vague prompts. Auto-detects client support and skips gracefully when unavailable. Suppression flags prevent repeat prompts within a session
- Benchmark data sources β server instructions include URLs for Artificial Analysis, OpenRouter, Chatbot Arena, and LLM Stats so clients can fetch live model benchmarks without API keys
- Extensible β implement
build_command + parse_output, register in RunnerFactory
| Agent | Status |
|---|
| Codex | Supported |
| Claude Code | Supported |
| OpenCode | Supported |
Installation
Run with uvx (recommended)
uvx installs the package in an ephemeral virtual environment and runs it β no cloning required.
To check the installed version:
To update to the latest version:
uvx --reinstall nexus-mcp
MCP Client Configuration
Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"nexus-mcp": {
"command": "uvx",
"args": ["nexus-mcp"],
"env": {
"NEXUS_CODEX_MODEL": "gpt-5.2",
"NEXUS_CODEX_MODELS": "gpt-5.4,gpt-5.4-mini,gpt-5.3-codex,gpt-5.2-codex,gpt-5.2,gpt-5.1-codex-max,gpt-5.1-codex-mini",
"NEXUS_CLAUDE_MODEL": "claude-sonnet-4-6",
"NEXUS_CLAUDE_MODELS": "claude-sonnet-4-6,claude-haiku-4-5-20251001",
"NEXUS_OPENCODE_MODEL": "ollama-cloud/kimi-k2.5",
"NEXUS_OPENCODE_MODELS": "ollama-cloud/glm-5,ollama-cloud/kimi-k2.5,ollama-cloud/qwen3-coder-next,ollama-cloud/minimax-m2.5,ollama/gemini-3-flash-preview"
}
}
}
}
Cursor (.cursor/mcp.json in your project or ~/.cursor/mcp.json globally):
{
"mcpServers": {
"nexus-mcp": {
"command": "uvx",
"args": ["nexus-mcp"],
"env": {
"NEXUS_CODEX_MODEL": "gpt-5.2",
"NEXUS_CODEX_MODELS": "gpt-5.4,gpt-5.4-mini,gpt-5.3-codex,gpt-5.2-codex,gpt-5.2,gpt-5.1-codex-max,gpt-5.1-codex-mini",
"NEXUS_CLAUDE_MODEL": "claude-sonnet-4-6",
"NEXUS_CLAUDE_MODELS": "claude-sonnet-4-6,claude-haiku-4-5-20251001",
"NEXUS_OPENCODE_MODEL": "ollama-cloud/kimi-k2.5",
"NEXUS_OPENCODE_MODELS": "ollama-cloud/glm-5,ollama-cloud/kimi-k2.5,ollama-cloud/qwen3-coder-next,ollama-cloud/minimax-m2.5,ollama/gemini-3-flash-preview"
}
}
}
}
Claude Code (CLI):
claude mcp add nexus-mcp \
-e NEXUS_CODEX_MODEL=gpt-5.2 \
-e NEXUS_CODEX_MODELS=gpt-5.4,gpt-5.4-mini,gpt-5.3-codex,gpt-5.2-codex,gpt-5.2,gpt-5.1-codex-max,gpt-5.1-codex-mini \
-e NEXUS_CLAUDE_MODEL=claude-sonnet-4-6 \
-e NEXUS_CLAUDE_MODELS=claude-sonnet-4-6,claude-haiku-4-5-20251001 \
-e NEXUS_OPENCODE_MODEL=ollama-cloud/kimi-k2.5 \
-e NEXUS_OPENCODE_MODELS=ollama-cloud/glm-5,ollama-cloud/kimi-k2.5,ollama-cloud/qwen3-coder-next,ollama-cloud/minimax-m2.5,ollama/gemini-3-flash-preview \
-- uvx nexus-mcp
Generic stdio config (any MCP-compatible client):
{
"command": "uvx",
"args": ["nexus-mcp"],
"transport": "stdio",
"env": {
"NEXUS_CODEX_MODEL": "gpt-5.2",
"NEXUS_CLAUDE_MODEL": "claude-sonnet-4-6",
"NEXUS_OPENCODE_MODEL": "ollama-cloud/kimi-k2.5"
}
}
All env keys are optional β see Configuration for the full list.
Setup for Development
Prerequisites:
- Python 3.13+ (download)
- uv dependency manager (install guide)
curl -LsSf https://astral.sh/uv/install.sh | sh
Optional (for integration tests):
- Codex β check with
codex --version
- Claude Code β check with
claude --version
- OpenCode β check with
opencode --version
Claude Code note: Nexus invokes Claude Code non-interactively via claude -p.
Anthropic says claude -p and Agent SDK usage draw from separate monthly Agent SDK
credits starting 2026-06-15, while interactive Claude Code usage remains on plan usage
limits:
https://support.claude.com/en/articles/15036540-use-the-claude-agent-sdk-with-your-claude-plan
Note: Integration tests are optional. Unit tests run without CLI dependencies via subprocess mocking.
# 1. Clone the repository
git clone <repository-url>
cd nexus-mcp
# 2. Install dependencies
uv sync
# 3. Install pre-commit hooks (runs linting/formatting on commit)
uv run pre-commit install
# 4. Verify installation
uv run pytest # Run tests
uv run mypy src/nexus_mcp # Type checking
uv run ruff check . # Linting
# 5. Run the MCP server
uv run python -m nexus_mcp
OpenCode Server (Docker) β experimental
β οΈ Experimental β This integration has not been validated end-to-end by the maintainer. Expect rough edges in setup, auth, and tool exposure. The MCP tools surfaced from upstream OpenCode track the upstream project and may change without notice. Feedback and bug reports are welcome.
Run an isolated OpenCode server for HTTP-based agent execution alongside the CLI runner. Provides session management, file search, permissions, and 38 additional MCP tools when the server is healthy.
Quick start:
- Copy
.env.example to .env and set PROJECT_DIR to your project path:
cp .env.example .env
# Edit .env: set PROJECT_DIR=/path/to/your/project
- Start the server:
- Authenticate with your provider:
docker exec -it opencode-server opencode auth login
- Verify the server is healthy:
curl -u opencode:nexus http://localhost:4096/global/health
The server binds to 127.0.0.1 (localhost only) by default for security. See docs/opencode-server-setup.md for the full guide including remote access, multi-project setup, and network security.
Usage