MCP server that launches Claude Code/Codex sub-agents and routes tasks to Claude Messages or OpenAI-compatible API providers.
$git clone https://github.com/heretyc/subagent-mcpInstalls into the current project.
Install subagent-mcp by running `git clone https://github.com/heretyc/subagent-mcp`, then use it for the current task and follow its documentation at https://github.com/heretyc/subagent-mcp.
| 1 | # subagent-mcp |
| 2 | |
| 3 | [](https://www.npmjs.com/package/@heretyc/subagent-mcp) |
| 4 | [](LICENSE) |
| 5 | [](https://www.npmjs.com/package/@heretyc/subagent-mcp) |
| 6 | [](https://github.com/Heretyc/subagent-mcp/actions/workflows/claude-routine.yml) |
| 7 | |
| 8 | ## Core Premise |
| 9 | |
| 10 | subagent-mcp is an MCP stdio server that turns an AI coding assistant (Claude |
| 11 | Code, Codex, Gemini CLI) into a manager of local Claude and Codex sub-agents on |
| 12 | macOS, Linux, and Windows. It orchestrates the locally authenticated `claude` |
| 13 | and `codex` CLIs you already signed into, and can route tasks to direct API |
| 14 | providers (Claude Messages API and OpenAI-compatible) configured in |
| 15 | `providers.jsonc`. Provider credentials stay out of config: `providers.jsonc` |
| 16 | names env vars, and key values live in the adjacent gitignored `.env`. API HTTP |
| 17 | is confined to `src/providers/provider-client.ts`. |
| 18 | |
| 19 |  |
| 20 | |
| 21 | *7 h 38 min one-shot coding session, several hundred tool calls, Fable 5, July 15 2026 - 41% context used, no auto-compaction, orchestrated via subagent-mcp.* |
| 22 | |
| 23 | The orchestrator monitors but does not read or write project files itself. Work |
| 24 | is delegated to fresh sub-agents, so the orchestrator keeps summaries instead |
| 25 | of raw file context. The main invariants are: |
| 26 | |
| 27 | - one machine-global, provider-agnostic concurrency cap (default 20, minimum 10) |
| 28 | - fail-safe orchestration ON on hookless hosts |
| 29 | - state authority only from harness-verified `<subagent-mcp state="...">` tags |
| 30 | - `launch_agent` as the only supported sub-agent launch channel in both states |
| 31 | - setup/init defense-in-depth suppression for known native host agent launchers |
| 32 | - sub-agents gated by default with permission ceiling `auto` |
| 33 | - automatic model, provider, and effort routing per task category |
| 34 | |
| 35 | ## Install |
| 36 | |
| 37 | ### What You Need First |
| 38 | |
| 39 | - Node.js 20 or newer (`node --version`) |
| 40 | - `claude` CLI, installed and signed in (`claude --version`) |
| 41 | - `codex` CLI, installed and signed in (`codex --version`; optional if you only |
| 42 | use Claude or Gemini as the host) |
| 43 | |
| 44 | Building from source needs extra developer tools. See |
| 45 | [CONTRIBUTING.md](CONTRIBUTING.md). |
| 46 | |
| 47 | ### Install The Package |
| 48 | |
| 49 | Marketplace plugin for Claude Code: |
| 50 | |
| 51 | ```bash |
| 52 | claude plugin marketplace add Heretyc/subagent-mcp |
| 53 | claude plugin install subagent-mcp@subagent-mcp |
| 54 | ``` |
| 55 | |
| 56 | Marketplace plugin for Codex: |
| 57 | |
| 58 | ```bash |
| 59 | codex plugin marketplace add Heretyc/subagent-mcp |
| 60 | codex plugin add subagent-mcp@subagent-mcp |
| 61 | ``` |
| 62 | |
| 63 | Or Codex MCP registration: |
| 64 | |
| 65 | ```bash |
| 66 | codex mcp add subagent-mcp -- node /abs/path/to/subagent-mcp/dist/index.js |
| 67 | ``` |
| 68 | |
| 69 | Or install the npm package globally: |
| 70 | |
| 71 | ```bash |
| 72 | npm install -g @heretyc/subagent-mcp |
| 73 | ``` |
| 74 | |
| 75 | Organizations pinning the package through GitHub Packages should see |
| 76 | [docs/registration/prerequisites-and-install.md](docs/registration/prerequisites-and-install.md). |
| 77 | |
| 78 | ### Wire It Into Your Assistant |
| 79 | |
| 80 | ```bash |
| 81 | subagent-mcp setup |
| 82 | ``` |
| 83 | |
| 84 | Installing the package only ships the program. It does not connect anything on |
| 85 | its own. `subagent-mcp setup` finds your Claude Code, Codex, or Gemini install |
| 86 | and registers the supported server, hook, and native-agent suppression config |
| 87 | for that host. For Claude Code it also registers or wraps `statusLine` so the |
| 88 | hook can read Claude's authoritative context percentage without replacing your |
| 89 | custom statusline, and deploys the `smcp-handoff` Agent Skill to your Claude |
| 90 | user scope. |
| 91 | Preview first with `subagent-mcp setup --dry-run`. |
| 92 | |
| 93 | For provider config, run `subagent-mcp config init`, edit the generated `.env` |
| 94 | keys under your subagent-mcp config home, then run |
| 95 | `subagent-mcp config validate`. See [skills/smcp-help/SKILL.md](skills/smcp-help/SKILL.md) |
| 96 | for details. |
| 97 | |
| 98 | ### Restart, Then Turn On The Invariant |
| 99 | |
| 100 | Restart your Claude Code or Codex session so it picks up the new tools. On |
| 101 | Codex, run `/hooks` and trust the new hook. Then, recommended: |
| 102 | |
| 103 | ```bash |
| 104 | subagent-mcp init --global |
| 105 | ``` |
| 106 | |
| 107 | This writes a managed "always delegate" rule block into your global assistant |
| 108 | config once. For one project only, use |
| 109 | `subagent-mcp init --root /path/to/project`. Full per-platform wiring (Gemini |
| 110 | CLI, Claude Desktop, manual setup) is in |
| 111 | [docs/registration.md](docs/registration.md). |
| 112 | |
| 113 | ## How To Operate It |
| 114 | |
| 115 | ### Orchestration Mode |
| 116 | |
| 117 | - **ON**: your assistant acts as a pure manager. It delegates every step to |
| 118 | sub-agents. Best for big, long-running jobs. |
| 119 | - **OFF**: your assistant works normally, with no delegation rules. |
| 120 | |
| 121 | Flip it with the `orchestration-mode` tool. Desktop apps can toggle the mode but |
| 122 | do not receive per-turn hook reminders. |
| 123 | |
| 124 | ### Tools |
| 125 | |
| 126 | The server exposes `launch_agent`, `poll_agent`, `kill_agent`, `send_message`, |
| 127 | `list_agents`, `wait`, `respond_permission`, `orchestration-mode`, and |
| 128 | `model-selection-mode`; `get_status` returns `pr |