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 整合