1. Conduid
  2. Developer Tools
  3. Codex As MCP
MCP server · Developer Tools

Codex As MCP

Convert codex CLI tool to an MCP — unleash the power of GPT-5

Unclaimed devtools
66Good

Scored 11 days ago · breakdown

About Codex As MCP

Codex As MCP is an MCP server published by kky42 in the Developer Tools category: convert codex CLI tool to an MCP — unleash the power of GPT-5.

The repository has 176 stars and 23 forks, with the last commit 3 months ago. Recent commit activity is the strongest signal that reported issues will get attention.

Install

From source
git clone https://github.com/kky42/codex-as-mcp

This server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.

Ask AI

✦

Ask AI about Codex As MCP

Powered by Claude · Grounded in docs

I know everything about Codex As MCP. Ask me about installation, configuration, usage, or troubleshooting.

Security checks

Static checks derived from the repository 4 days ago. Heuristics on the source, not an audit.

  • ✓README presentThe repository ships documentation.
  • !License declaredNo license file. Legally you have no right to use it in a product.
  • ✓Tests presentA test suite exists in the repository.
  • ✓Dependencies pinnedA lockfile pins dependency versions.
  • ✓No dynamic code executionSource scan found no eval, dynamic Function, or shell execution.
  • !Scoped permissionsDoesn't declare a permission scope. Assume it can do anything its process can.

Releases

v2026.6.29.12026.6.29.1 · 29 Jun 2026Fixed Fix Windows MCP tool-call hangs by sending Codex prompts through stdin using `codex e ... -` and closing stdin after writing. Avoid command-line prompt truncation and quoting issues for long/CJK prompts. Added Cross-platform CI for…
2026.2.2.12026.2.2.1 · 2 Feb 2026Fix: spawned Codex runs now use --dangerously-bypass-approvals-and-sandbox by default (fixes #7).

README

codex-as-mcp

中文版

codex-as-mcp is a small Model Context Protocol (MCP) server that lets MCP clients (Claude Code, Cursor, etc.) delegate work to the Codex CLI.

It exposes two tools that run Codex in the server's current working directory:

  • spawn_agent(prompt: str)
  • spawn_agents_parallel(agents: list[dict])

Under the hood, each agent runs something like: codex exec --cd <server cwd> --skip-git-repo-check --dangerously-bypass-approvals-and-sandbox -.

The prompt is sent through stdin and then closed. This avoids command-line quoting/length issues and prevents Codex from accidentally reading from the MCP server's JSON-RPC stdin pipe.

Note: --dangerously-bypass-approvals-and-sandbox disables sandboxing and confirmation prompts. Use this server only in repos you trust.

Use it in Claude Code

There are two tools in codex-as-mcp tools

You can spawn parallel codex subagents using prompt. alt text

Here's a sample Codex session delegating two tasks in parallel. Codex use case

Quick start

1. Install Codex CLI

Requires Codex CLI >= 0.46.0

npm install -g @openai/codex@latest
codex login

# Verify installation
codex --version

Make sure Codex CLI can run non-interactively on your machine (provider + credentials in ~/.codex/config.toml, or via the provider-specific env var it references).

Example: third-party provider + env_key

If you're using a third-party provider, configure it in Codex config.toml and point model_provider at it. When a provider uses env_key, Codex CLI expects that env var to be present when it runs.

Example:

model_provider = "custom_provider"

[model_providers.custom_provider]
name = "custom_provider"
base_url = "https://..."
wire_api = "responses"
env_key = "PROVIDER_API_KEY"
show_raw_agent_reasoning = true

When using codex-as-mcp, make sure the MCP server process has that env var set, so it can pass it through to the spawned codex process. The env var name must match the env_key value above (here: PROVIDER_API_KEY).

Option A (recommended): set env in your MCP client config (if supported)

{
  "mcpServers": {
    "codex-subagent": {
      "type": "stdio",
      "command": "uvx",
      "args": ["codex-as-mcp@latest"],
      "env": {
        "PROVIDER_API_KEY": "KEY_VALUE"
      }
    }
  }
}

Option B: pass env via server args

uvx codex-as-mcp@latest --env PROVIDER_API_KEY=KEY_VALUE

Option C: add via Codex CLI (codex mcp add)

codex mcp add codex-subagent --env PROVIDER_API_KEY=KEY_VALUE -- uvx codex-as-mcp@latest

Security note: passing secrets via command-line args may be visible via process lists on your machine; prefer option A when possible.

2. Configure MCP

Add to your .mcp.json:

{
  "mcpServers": {
    "codex-subagent": {
      "type": "stdio",
      "command": "uvx",
      "args": ["codex-as-mcp@latest"]
    }
  }
}

Or use Claude Desktop commands:

claude mcp add codex-subagent -- uvx codex-as-mcp@latest

If you're configuring Codex CLI directly (for example ~/.config/codex/config.toml), add:

[mcp_servers.subagents]
transport = "stdio"
command = "uvx"
args = ["codex-as-mcp@latest"]
# Increase if you see ~60s tool-call timeouts when running longer Codex tasks.
# tool_timeout_sec = 600

Tools

  • spawn_agent(prompt: str) – Spawns an autonomous Codex subagent using the server's working directory and returns the agent's final message.
  • spawn_agents_parallel(agents: list[dict]) – Spawns multiple Codex subagents in parallel; each item must include a prompt key and results include either an output or an error per agent.

Maintainer live smoke test

The default CI uses unit tests and a fake subprocess path so it can run safely without credentials. Maintainers can additionally run the manually triggered Live Codex smoke GitHub Actions workflow with a real provider by setting repository secret CODEX_LIVE_API_KEY and providing a Responses-compatible base_url/model in the workflow inputs.

Note: current Codex CLI rejects wire_api = "chat"; chat-completions-only providers such as direct DeepSeek API need either native Codex support for that wire API or a Responses-compatible proxy.

Troubleshooting

spawn_agent times out after ~60s

If you see an error like:

tool call failed for `subagents/spawn_agent`
timed out awaiting tools/call after 60s
deadline has elapsed

This is typically a client-side MCP tool-call timeout. spawn_agent does not return until the spawned codex exec process finishes, which can take longer than 60 seconds.

Fix: increase the tool-call timeout in your MCP client.

Codex CLI

In your Codex config (~/.codex/config.toml or ~/.config/codex/config.toml), set a higher tool_timeout_sec for the MCP server:

[mcp_servers.subagents]
transport = "stdio"
command = "uvx"
args = ["codex-as-mcp@latest"]
tool_timeout_sec = 600

MCP Inspector / mcp dev

If you're testing locally with the MCP Inspector, increase request timeouts (or run ./test.sh, which exports these):

export MCP_SERVER_REQUEST_TIMEOUT=300000
export MCP_REQUEST_TIMEOUT_RESET_ON_PROGRESS=true
export MCP_REQUEST_MAX_TOTAL_TIMEOUT=28800000

README fetched from the repository 4 days ago. The original is authoritative.

Questions

About Codex As MCP

How do I install Codex As MCP?

No package has been published for this server, so install it from source: clone the repository and follow its README.

Is Codex As MCP safe to use with an AI agent?

Its trust score is 66 out of 100 (good). It passes 4 of the 6 static security checks run so far; the failures are listed above. It has no ConduID identity yet, so agent calls to it are not receipted.

Is Codex As MCP still maintained?

Yes — the latest release is v2026.6.29.1 (29 Jun 2026), and the last commit was 3 months ago. The repository has 176 stars and 1 open issues.