
Codex Mcp Tool
io.github.x51xxx由 GitHub 帳號 x51xxx 發布v2.2.0更新於 Oct 24, 2026
MCP server bridging AI assistants to OpenAI Codex CLI for code analysis and review
概覽
將 AI 助理連接到 OpenAI Codex CLI,讓它能在本機分析程式碼、進行多輪工作階段、審查變更並產生圖片。
- 可以做什麼
- 用 @ 語法引用檔案或目錄,分析並解釋程式碼,可指定模型、推理強度與工作階段,也能批次執行多個 Codex 任務或執行原生變更審查。執行任務後以 shell 指令驗證並自動重試修正,還可輸出結構化的 OLD/NEW 修補內容用於重構。透過 Codex 內建圖片工具產生或編輯圖片,並儲存到指定路徑。以結構化創意框架進行腦力激盪。檢視工作階段、技能、CLI 健康狀態、版本與連線狀態,並讀取快取的變更模式分段。
- 適用情境
- 適合已在使用 Codex CLI、希望讓 Claude 或 Cursor 等助理把程式碼分析、重構、審查或「執行—驗證—修正」循環交給它完成的情境,也可搭配本機 Ollama 或 LM Studio 模型。同樣適合透過同一個 Codex 登入進行圖片產生與結構化腦力激盪。
- 執行需求
- 透過 npx 以 stdio 在本機執行,需要 Node.js 18+,並已安裝且登入 Codex CLI(0.95.0 或更新版本)。可選環境變數 CODEX_MAX_SESSIONS、CODEX_MCP_CWD、CODEX_SESSION_TTL_MS 用於調整工作階段與工作目錄;使用本機模型需執行 Ollama 或 LM Studio。僅支援桌面用戶端。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Codex Mcp Tool,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
Codex MCP Server
MCP server connecting Claude/Cursor to Codex CLI. Enables code analysis via @ file references, multi-turn conversations, sandboxed edits, and structured change mode.
Features
- File Analysis — Reference files with
@src/,@package.jsonsyntax - Multi-Turn Sessions — Conversation continuity with workspace isolation
- Native Resume — Uses
codex resumefor context preservation (CLI v0.36.0+) - Local OSS Models — Run with Ollama or LM Studio via
localProvider - Web Search — Research capabilities with
search: true - Sandbox Mode — Safe automation with explicit sandbox and approval policies
- Change Mode — Structured OLD/NEW patch output for refactoring
- Brainstorming — SCAMPER, design-thinking, lateral thinking frameworks
- Health Diagnostics — CLI version, features, and session monitoring
- Cross-Platform — Windows, macOS, Linux fully supported
Quick Start
Prerequisites: Node.js 18+, Codex CLI installed and authenticated.
Configuration
Config locations: macOS: ~/Library/Application Support/Claude/claude_desktop_config.json | Windows: %APPDATA%\Claude\claude_desktop_config.json
Usage Examples
Tools
Image generation
image-gen drives Codex's built-in image_gen tool, so it uses your ChatGPT
login and needs no OPENAI_API_KEY. That tool only accepts a prompt and
reference image paths: Codex picks the image model and pixel size, and there
are no size, quality, format or mask arguments. image-gen therefore puts all
steering into a structured prompt (use case, asset type, style, composition,
exact text, reference roles, edit invariants, aspect ratio, presets) and tells
the Codex host model to relay it instead of improvising.
Images are saved by Codex under $CODEX_HOME/generated_images/<thread>/ and
copied to outputPath when given; an existing file is kept and the copy is
written as a -v2 sibling unless overwrite: true. The result reports each
file's dimensions and alpha channel, so a transparentBackground request that
came back opaque is flagged.
Models
By default the model parameter is omitted and Codex CLI applies the
default model from your ~/.codex/config.toml (for example model = "gpt-6.1-sol").
Pass model only when you need to override the configured default for a
single call. Reasoning depth is calibrated per tool:
ask-codex— uses the Codex CLI default reasoning (medium). Increase it only when the task needs more planning or checking.brainstorm,do-act,review-changes— defaultreasoningEffort: "high"(creative ideation, act-check-fix loops, and code review benefit from deeper reasoning).
Sol, Astra and Terra models expose max and ultra reasoning; Luna models top
out at max, and gpt-5.5 at xhigh. ultra may delegate work to subagents;
most tasks should remain on medium or high. Pass a concrete slug — the bare
moving aliases gpt-6 and gpt-5.6 are rejected by the API. gpt-6.1-sol is
rejected by Codex CLI 0.157.x with the same 400 an unknown slug gets; upgrade
with npm install -g @openai/codex@latest.
Key Features
Session Management (v1.4.0+)
Multi-turn conversations with workspace isolation:
Environment:
CODEX_SESSION_TTL_MS- Session TTL (default: 24h)CODEX_MAX_SESSIONS- Max sessions (default: 50)
Codex CLI version
Requires Codex CLI 0.95.0 or newer. On older versions the server fails
with an explicit upgrade message rather than silently dropping unsupported
flags. Upgrade with npm install -g @openai/codex@latest; run the health tool
to see the detected version.
Troubleshooting: "codex not found"
MCP clients launched from a GUI (Dock, Finder, Start menu) inherit a minimal
PATH that excludes Homebrew, nvm, and volta directories, so codex may work
from a terminal but not from the app. The server searches those locations
automatically; if it still cannot find the CLI, pin it explicitly:
Find the value with which codex. Run the health tool to see which
executable was resolved and how.
Local OSS Models (v1.6.0+)
Run with local Ollama or LM Studio instead of OpenAI:
Requirements: Ollama running locally with a model that supports tool calling (e.g. qwen3:8b).
Advanced Options
CLI Compatibility
Validated against Codex CLI 0.144.3. The server keeps older feature guards,
but current releases are recommended. Notable current behavior:
--full-autoand approval policyon-failurehave been removed by Codex CLI.- MCP
sandbox: true/fullAuto: trueremain compatibility aliases for--sandbox workspace-write --ask-for-approval never; they do not bypass the sandbox. - Native
--searchis used without the deprecatedweb_search_requestfeature. - Current
execflags include--strict-config,--ephemeral,--ignore-user-config, and--ignore-rules.
Troubleshooting
Use health tool for diagnostics: 'use health verbose:true'
Migration
v2.5.x → v2.6.0: Codex CLI 0.159.2 model sync and a new image-gen tool.
Added gpt-6.1-sol (needs Codex CLI 0.159+), gpt-6-sol and gpt-6-luna.
Breaking: dropped gpt-5.4-mini, which now returns HTTP 400.
v2.4.x → v2.5.0: Codex CLI 0.153.4 compatibility pass; added
gpt-6-astra. Breaking: dropped gpt-5.4 and the moving alias gpt-5.6
(both now rejected with HTTP 400), and removed the untrusted approval policy,
which Codex CLI 0.153.x no longer parses.
v2.3.x → v2.4.0: Codex CLI 0.144.3 compatibility audit; added GPT-5.6
Sol/Terra/Luna, max/ultra reasoning, current exec flags, native-only search,
and safe compatibility handling for the removed --full-auto flag and
on-failure approval policy.
v2.2.x → v2.3.0: gpt-5.5 as new default, added gpt-5.4-mini, dropped retired models (gpt-5.3-codex-spark, gpt-5.2-codex, gpt-5.1-codex-max, gpt-5.1-codex-mini).
v2.0.x → v2.1.0: gpt-5.4 as new default model, updated fallback chain.
v1.5.x → v1.6.0: Local OSS model support (localProvider, oss), gpt-5.3-codex default model, xhigh reasoning effort.
v1.3.x → v1.4.0: New sessionId parameter, list-sessions/health tools, structured error handling. No breaking changes.
License
MIT License. Not affiliated with OpenAI.
Documentation | Issues | Inspired by jamubc/gemini-mcp-tool
來源:README.md,提交 ab1238f
工具
0版本歷史
1- v2.2.0最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分