Codex Octopus

io.github.xiaolai由 GitHub 账号 xiaolai 发布v1.0.1更新于 Oct 24, 2026

Spawn multiple specialized Codex agents as MCP servers, each independently configured.

发布方自己的服务:Octopus.do

已验证STDIO仅桌面开发者工具AI 与机器学习

概览

AI 生成的概览

封装 OpenAI Codex SDK,让助手把多个各自独立配置的 Codex 代理作为工具运行,每个代理有自己的模型、沙箱和指令。

可以做什么
向已配置的 Codex 代理发送任务或问题,获得回复和用于后续对话的 thread_id,并可按次覆盖工作目录、模型、推理强度、额外目录、沙箱与审批策略、网络访问和网页搜索模式。在启用会话持久化时,按 thread_id 继续之前的代理对话。并行运行多个实例,每个以独立工具名暴露,拥有各自的模型、沙箱、推理强度和附加指令。使用工厂实例时只暴露一个向导工具,根据对所需代理的自然语言描述生成现成的配置条目。
适用场景
适合在同一个 MCP 客户端中同时使用多个不同调校的编码代理,例如只读的严格代码审查者、可写工作区的测试编写者和低成本的快速问答助手,而不是单一的通用 Codex 实例。
运行要求
通过 npx 或 npm 运行的本地进程;需要 Node.js 18 或更高版本,并安装 Codex CLI 包,因为 SDK 会在底层启动它。OpenAI API 密钥通过 CODEX_API_KEY 环境变量提供,或从父进程继承。所有配置均通过环境变量完成。
安装前请注意
代理自主运行,可读取文件、编写代码并执行命令;沙箱默认只读,但 workspace-write 或 danger-full-access 会放宽限制,网络访问默认关闭。按次调用的沙箱与审批覆盖只能收紧,不能放宽。API 密钥是可计费的 OpenAI 凭据;工厂向导会在生成的配置中隐去它。提示词和文件内容会发送给 OpenAI。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Codex Octopus,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

[Codex Octopus]

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.

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_KEY env var) or inherited from parent process

Install

bash
npm install codex-octopus

Or use npx directly in your .mcp.json (see Quick Start below).

Quick Start

Add to your .mcp.json:

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:

json
{  "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:

json
{  "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:

ToolPurpose
<name>Send a task to the agent, get a response + thread_id
<name>_replyContinue a previous conversation by thread_id

Per-invocation parameters (override server defaults):

ParameterDescription
promptThe task or question (required)
cwdWorking directory override
modelModel override
additionalDirsExtra directories the agent can access
effortReasoning effort (minimal to xhigh)
sandboxModeSandbox override (can only tighten, never loosen)
approvalPolicyApproval override (can only tighten, never loosen)
networkAccessEnable network access from sandbox
webSearchModeWeb search: disabled, cached, live
instructionsAdditional instructions (prepended to prompt)

Configuration

All configuration is via environment variables in .mcp.json. Every env var is optional.

Identity

Env VarDescriptionDefault
CODEX_TOOL_NAMETool name prefix (<name> and <name>_reply)codex
CODEX_DESCRIPTIONTool description shown to the host AIgeneric
CODEX_SERVER_NAMEMCP server name in protocol handshakecodex-octopus
CODEX_FACTORY_ONLYOnly expose the factory wizard toolfalse

Agent

Env VarDescriptionDefault
CODEX_MODELModel (gpt-5-codex, o3, codex-1, etc.)SDK default
CODEX_CWDWorking directoryprocess.cwd()
CODEX_SANDBOX_MODEread-only, workspace-write, danger-full-accessread-only
CODEX_APPROVAL_POLICYnever, on-failure, on-request, untrustedon-failure
CODEX_EFFORTminimal, low, medium, high, xhighSDK default
CODEX_ADDITIONAL_DIRSExtra directories (comma-separated)none
CODEX_NETWORK_ACCESSAllow network from sandboxfalse
CODEX_WEB_SEARCHdisabled, cached, livedisabled

Instructions

Env VarDescription
CODEX_INSTRUCTIONSReplaces the default instructions
CODEX_APPEND_INSTRUCTIONSAppended to the default (usually what you want)

Advanced

Env VarDescription
CODEX_PERSIST_SESSIONtrue/false — enable session resume (default: true)

Authentication

Env VarDescriptionDefault
CODEX_API_KEYOpenAI API key for this agentinherited from parent

Security

  • Sandbox defaults to read-only — the agent can't write files unless you explicitly set workspace-write or danger-full-access.
  • cwd overrides preserve agent knowledge — when the host overrides cwd, the agent's configured base directory is automatically added to additionalDirectories.
  • Security overrides narrow, never widen — per-invocation sandboxMode and approvalPolicy can only tighten (e.g., workspace-write → read-only), never loosen.
  • _reply tool respects persistence — not registered when CODEX_PERSIST_SESSION=false.
  • API keys are redacted — the factory wizard never exposes CODEX_API_KEY in 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

  • minimal effort + web_search: OpenAI does not allow web_search tools with minimal reasoning effort. Use low or higher if web search is needed.

Development

bash
pnpm installpnpm build       # compile TypeScriptpnpm test        # run tests (vitest)pnpm test:coverage  # coverage report

License

ISC - Xiaolai Li

来源:README.md,提交 c504a77

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v1.0.1最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

其他 Octopus 集成