# Codex Subagent [Health: Active]

**Category:** 🤖 Coding Agents  
**Repository:** https://github.com/parisbs/codex-subagent-mcp  
**GitHub Stars:** 1  
**npm Downloads (last month):** 625  
**Views:** 7  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/codex-subagent

## Description
Delegate coding tasks to the OpenAI Codex CLI, installed separately, with explicit model and effort.

## Tools
Capabilities this server exposes over MCP:

- **codex_doctor** — Check whether the local Codex CLI is installed, recent enough, signed in and able to load its configuration, and report the exact steps to fix it if not. Run this when any other tool reports the CLI is unavailable, or before relying on delegation for the first time. It only inspects the installation; it never installs or repairs anything. Opt in with extended for a slow, networked config.load report from codex doctor --json.
- **list_codex_models** — List the Codex models available on this machine, with the reasoning-effort levels each one supports. Read from the installed Codex CLI, with a warned static fallback if its catalog cannot be read. Call this before codex_delegate when choosing a model explicitly.
- **codex_recommend** — Given a task description, recommend which Codex model and reasoning effort to delegate it with. Runs no model call; applies a documented matrix reconciled against the installed catalog.
- **codex_delegate** — Delegate a task to the local Codex CLI (OpenAI's coding agent), choosing model and reasoning effort. Use it when the user asks for Codex, or when handing work off clearly serves their request: a second opinion from a different model family, or an investigation that would otherwise flood this conversation. When the user has not named a model, call codex_recommend first and present its suggested model and effort to the user in the same message in which you say you are going to delegate, then pass both explicitly here. That recommendation is advice for an already-authorised delegation, not a replacement for the user's own preference. Everything passed in prompt, context and target_files is sent to OpenAI, and every run spends the user's own Codex usage, so do not delegate what you can answer directly, and tell the user when you delegate. Codex runs read-only unless a different default sandbox is configured. Set sandbox to workspace-write to let it edit files, if this server's sandbox ceiling allows it: a correctly configured server states the ceiling in its instructions, and a call above it is refused. Codex cannot see this conversation, so pass everything it needs in prompt, context, and target_files.
- **codex_follow_up** — Send a follow-up message to a previous delegation using its thread_id. Codex retains the earlier context, so only the new instruction needs to be sent. Like a delegation, it is sent to OpenAI and spends the user's Codex usage.
- **codex_job_status** — Report the state and recent activity of a background delegation started with mode=background. Call it with no job_id to list every known job.
- **codex_usage** — Summarise this server's local usage log (CODEX_SUBAGENT_USAGE_LOG) over a window: per group, the number of delegation processes, their outcomes, commands, durations and the tokens the Codex CLI reported. Reads local files only and runs no Codex process. It never reports quota, credits or remaining allowance.
- **codex_job_result** — Return the full output of a finished background delegation. Errors if the job is still running.
- **codex_job_cancel** — Terminate a running background delegation.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "codex-subagent": {
    "command": "npx",
    "args": ["-y","codex-subagent-mcp"],
    "env": {
      "CODEX_SUBAGENT_MAX_BACKGROUND_JOBS": ""
    }
  }
}
```

**Requires environment variables:** `CODEX_SUBAGENT_MAX_BACKGROUND_JOBS` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What Codex Subagent MCP server does

Codex Subagent MCP server connects an MCP client to the OpenAI Codex CLI running locally. The CLI must already be installed, available on `PATH`, and signed in; the MCP server does not hold separate credentials. Prompts are sent to OpenAI through Codex in the same way as direct CLI use.

The server is suited to delegated coding work rather than general API access. An orchestrating agent can ask Codex to inspect files, diagnose failures, review code, write tests, apply changes, or return a structured result. Choosing a different model family can provide an independent review, while the reasoning-effort setting lets each delegation receive an appropriate budget.

## How it works

A client calls `codex_delegate` with a task and optional model, reasoning effort, working directory, sandbox, context, system instructions, and output schema. The call can block until completion or start a background job. Structured output is available when the requested result must conform to a supplied JSON schema.

Background work returns a job identifier. The client can check progress, retrieve the finished output, or cancel a running job. Up to eight background delegations can run simultaneously by default; `CODEX_SUBAGENT_MAX_BACKGROUND_JOBS` can reduce that limit. A follow-up uses the original delegation's `thread_id` and continues its Codex context.

Each completed delegation reports the model, effort, sandbox, directory, duration, token information, and thread identifier when available. It also checks the requested execution settings against what Codex recorded for the run and reports differences or unconfirmed values.

## Setup and configuration

The server requires Node.js 22 or newer and a separately installed Codex CLI. After signing in to Codex and confirming it is on `PATH`, add it to Claude Code with:

```bash
claude mcp add codex-subagent -- npx -y codex-subagent-mcp
```

`codex_doctor` checks the installation and explains corrective steps. Its `extended: true` option performs a slower, networked `config.load` check. The package also supports installation through other MCP client setup methods.

## Tools and capabilities

- `codex_doctor` validates the Codex CLI setup.
- `list_codex_models` reports models and their available reasoning-effort levels.
- `codex_recommend` suggests a model and effort for a described task.
- `codex_delegate` runs a foreground or background delegation, optionally against an output schema.
- `codex_follow_up` resumes a prior delegation by thread ID.
- `codex_job_status`, `codex_job_result`, and `codex_job_cancel` manage background work.
- `codex_usage` summarizes the opt-in local usage log by time window and selected grouping fields.

Delegations are read-only by default. `workspace-write` enables edits within the working directory, while `use_worktree` places edits in a managed Git worktree under `~/.codex/worktrees/`. The sandbox ceiling and additional directories bound where Codex can operate. Results report file changes recorded by Codex.

## Limitations and notes

The server runs another local process, so enabling writes requires care. Unsandboxed execution is unavailable unless explicitly permitted through the configured ceiling. The operating-system sandbox uses Seatbelt on macOS, bubblewrap on Linux and WSL2, and a native sandbox on Windows. Sandbox behavior can be stricter on Windows, and the documented measurements were made on macOS.

Sandbox restrictions apply to commands run by Codex's shell, not to MCP or plugin tools, which run separately with the account's permissions. Cancelling, timing out, or shutting down stops Codex and discoverable child commands, but a command that detached from the process tree may continue. Managed worktrees are not automatically cleaned up and can retain unapplied changes. Codex configuration settings such as network access or extra writable roots may still affect `workspace-write` runs.

_Full upstream README: https://allmcps.com/mcp/codex-subagent/readme_

