Codex Octopus
Wraps the OpenAI Codex SDK to provide specialized AI agents for coding tasks, allowing for the configuration of specific models, sandbox environments, and reasoning effort levels for use cases like code review and test generation.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Codex Octopus write thorough unit tests for the user authentication logic in auth.js"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Codex Octopus
One brain, many arms.
An MCP server that wraps the OpenAI Codex SDK, letting you run multiple specialized Codex agents — each with its own model, sandbox, effort, and personality — from any MCP client.
Why
Codex is powerful. But one instance does everything the same way. Sometimes you want a strict code reviewer in read-only sandbox. A test writer with workspace-write access. A cheap quick helper on minimal effort. A deep thinker on xhigh.
Codex Octopus lets you spin up as many of these as you need. Same binary, different configurations. Each one shows up as a separate tool in your MCP client.
Related MCP server: Codex MCP Server
Prerequisites
Node.js >= 18
Codex CLI — the Codex SDK spawns the Codex CLI under the hood, so you need it installed (
@openai/codex)OpenAI API key (
CODEX_API_KEYenv var) or inherited from parent process
Install
npm install codex-octopusOr use npx directly in your .mcp.json (see Quick Start below).
Quick Start
Add to your .mcp.json:
{
"mcpServers": {
"codex": {
"command": "npx",
"args": ["codex-octopus@latest"],
"env": {
"CODEX_SANDBOX_MODE": "workspace-write",
"CODEX_APPROVAL_POLICY": "never"
}
}
}
}This gives you two tools: codex and codex_reply. That's it — you have Codex as a tool.
Multiple Agents
The real power is running several instances with different configurations:
{
"mcpServers": {
"code-reviewer": {
"command": "npx",
"args": ["codex-octopus@latest"],
"env": {
"CODEX_TOOL_NAME": "code_reviewer",
"CODEX_SERVER_NAME": "code-reviewer",
"CODEX_DESCRIPTION": "Strict code reviewer. Read-only sandbox.",
"CODEX_MODEL": "o3",
"CODEX_SANDBOX_MODE": "read-only",
"CODEX_APPEND_INSTRUCTIONS": "You are a strict code reviewer. Report real bugs, not style preferences.",
"CODEX_EFFORT": "high"
}
},
"test-writer": {
"command": "npx",
"args": ["codex-octopus@latest"],
"env": {
"CODEX_TOOL_NAME": "test_writer",
"CODEX_SERVER_NAME": "test-writer",
"CODEX_DESCRIPTION": "Writes thorough tests with edge case coverage.",
"CODEX_MODEL": "gpt-5-codex",
"CODEX_SANDBOX_MODE": "workspace-write",
"CODEX_APPEND_INSTRUCTIONS": "Write tests first. Cover edge cases. TDD."
}
},
"quick-qa": {
"command": "npx",
"args": ["codex-octopus@latest"],
"env": {
"CODEX_TOOL_NAME": "quick_qa",
"CODEX_SERVER_NAME": "quick-qa",
"CODEX_DESCRIPTION": "Fast answers to quick coding questions.",
"CODEX_EFFORT": "minimal"
}
}
}
}Your MCP client now sees three distinct tools — code_reviewer, test_writer, quick_qa — each purpose-built.
Agent Factory
Don't want to write configs by hand? Add a factory instance:
{
"mcpServers": {
"agent-factory": {
"command": "npx",
"args": ["codex-octopus@latest"],
"env": {
"CODEX_FACTORY_ONLY": "true",
"CODEX_SERVER_NAME": "agent-factory"
}
}
}
}This exposes a single create_codex_mcp tool — an interactive wizard. Tell it what you want ("a strict code reviewer with read-only sandbox") and it generates the .mcp.json entry for you.
Tools
Each non-factory instance exposes:
Tool | Purpose |
| Send a task to the agent, get a response + |
| Continue a previous conversation by |
Per-invocation parameters (override server defaults):
Parameter | Description |
| The task or question (required) |
| Working directory override |
| Model override |
| Extra directories the agent can access |
| Reasoning effort ( |
| Sandbox override (can only tighten, never loosen) |
| Approval override (can only tighten, never loosen) |
| Enable network access from sandbox |
| Web search: |
| Additional instructions (prepended to prompt) |
Configuration
All configuration is via environment variables in .mcp.json. Every env var is optional.
Identity
Env Var | Description | Default |
| Tool name prefix ( |
|
| Tool description shown to the host AI | generic |
| MCP server name in protocol handshake |
|
| Only expose the factory wizard tool |
|
Agent
Env Var | Description | Default |
| Model ( | SDK default |
| Working directory |
|
|
|
|
|
|
|
|
| SDK default |
| Extra directories (comma-separated) | none |
| Allow network from sandbox |
|
|
|
|
Instructions
Env Var | Description |
| Replaces the default instructions |
| Appended to the default (usually what you want) |
Advanced
Env Var | Description |
|
|
Authentication
Env Var | Description | Default |
| OpenAI API key for this agent | inherited from parent |
Security
Sandbox defaults to
read-only— the agent can't write files unless you explicitly setworkspace-writeordanger-full-access.cwdoverrides preserve agent knowledge — when the host overridescwd, the agent's configured base directory is automatically added toadditionalDirectories.Security overrides narrow, never widen — per-invocation
sandboxModeandapprovalPolicycan only tighten (e.g.,workspace-write→read-only), never loosen._replytool respects persistence — not registered whenCODEX_PERSIST_SESSION=false.API keys are redacted — the factory wizard never exposes
CODEX_API_KEYin generated configs.
Architecture
┌─────────────────────────────────┐
│ MCP Client │
│ (Claude Desktop, Cursor, etc.) │
│ │
│ Sees: code_reviewer, │
│ test_writer, quick_qa │
└──────────┬──────────────────────┘
│ JSON-RPC / stdio
┌──────────▼──────────────────────┐
│ Codex Octopus (per instance) │
│ │
│ Env: CODEX_MODEL=o3 │
│ CODEX_SANDBOX_MODE=... │
│ CODEX_APPEND_INSTRUCTIONS │
│ │
│ Calls: Codex SDK thread.run() │
└──────────┬──────────────────────┘
│ in-process
┌──────────▼──────────────────────┐
│ Codex SDK → Codex CLI │
│ Runs autonomously: reads files,│
│ writes code, runs commands │
│ Returns result + thread_id │
└─────────────────────────────────┘Known Limitations
minimaleffort + web_search: OpenAI does not allowweb_searchtools withminimalreasoning effort. Uselowor higher if web search is needed.
Development
pnpm install
pnpm build # compile TypeScript
pnpm test # run tests (vitest)
pnpm test:coverage # coverage reportLicense
ISC - Xiaolai Li
Available Tools
2 toolscodexA
Send a task to an autonomous Codex agent. It reads/writes files, runs shell commands, searches codebases, and handles complex software engineering tasks end-to-end. Returns the result text plus a thread_id for follow-ups via codex_reply.
Inputs: prompt (required), cwd, model, additionalDirs, +6 more.
codex_replyA
Continue a previous codex conversation by thread ID. Use this for follow-up questions, iterative refinement, or multi-step workflows that build on prior context.
Inputs: thread_id (required), prompt (required), cwd, model.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools have clearly distinct purposes: `codex` initiates a new autonomous task and returns a thread_id, while `codex_reply` explicitly requires that thread_id to continue an existing conversation. No functional overlap exists.
Both tools share the `codex` prefix which groups them logically, and `codex_reply` clearly indicates its action. However, the base tool `codex` lacks a descriptive action verb (e.g., `codex_send` or `codex_start`) despite its description emphasizing sending tasks, creating a minor inconsistency in the naming pattern.
With only 2 tools, the set is borderline thin for a server claiming to handle 'complex software engineering tasks end-to-end.' While the initiate-respond loop is functional, the lack of supporting operations (list threads, check status, cancel) makes the surface feel constrained rather than comprehensively scoped.
The core conversational workflow is covered (start thread, continue thread), but significant lifecycle operations are missing: there is no way to list active threads, retrieve thread history without continuing, cancel running tasks, or delete threads. These gaps limit agent ability to manage long-running or parallel autonomous tasks.
Maintenance
Related MCP Connectors
MCP server for building and testing AI agents with multi-model experimentation and insights.
An MCP server that gives your AI access to the source code and docs of all public github repos
MCP server that lets your AI assistant build and deploy apps, hosting each one at a live URL.
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP server that wraps OpenAI's Codex CLI to automate repository cloning and code analysis tasks. It enables users to execute complex coding requests on specific Git branches and subfolders using standardized MCP tools.9 npm45MIT
- FlicenseBqualityNot gradedmaintenanceAn MCP server for the OpenAI Codex CLI that provides coding assistance with multi-turn session management and reasoning depth control. It enables users to perform code analysis, generation, and refactoring through Claude with native resume support for conversational context.41,352 npm1-
- AlicenseNot gradedqualityCmaintenanceA universal MCP server for spawning agents with any OpenAI-compatible LLM, supporting cloud and local models, and integrating with Claude Code, OpenCode, and Codex CLI.31 PyPIMIT
- AlicenseAqualityDmaintenanceAn MCP server that provides technical consultation, code review, and code explanation by integrating with OpenAI's Codex CLI, enabling AI-powered coding assistance in a sandboxed, read-only environment.340 npm1MIT