codex-cli-sync-mcp
Summary: Delegate one bounded coding task synchronously to the local Codex CLI and get back a compact report with diff/status context.
Run a single
codex_executetool call that blocks until the task completes.Execute a bounded coding task requiring goal, constraints, files, acceptance criteria, and a verification command (
task, min 10 chars).Target a specific repo/directory via an absolute
cwdpath.Override the Codex model (e.g.,
gpt-5.1-codex).Control the internal timeout (
timeoutMs, default 15 min, max 1 hour, min 1 s).Resume an existing Codex thread via
resumeThreadIdinstead of starting a new one.Optionally bypass approvals and sandbox with
dangerouslyBypassSandboxfor externally sandboxed environments (defaults to--approve-for-me).Receive a JSON report containing
ok,exitCode,threadId, final model message (text),diffStat, andstatusShort.No parallel execution within one tool call; one task per synchronous run, and the calling session blocks until done.
Allows delegating code-writing tasks to OpenAI's Codex CLI, with configurable model, timeout, and sandbox approval modes, returning the model's final message along with git diff and status summaries.
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-cli-sync-mcp Add a slugify() helper in src/lib/slug.ts with tests and run them."
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-cli-sync-mcp
MCP-сервер, который позволяет Claude Code (или любому другому
MCP-клиенту) делегировать выполнение ограниченных задач по написанию кода
локальному Codex CLI. Один инструмент —
codex_execute — синхронно запускает codex exec --json --skip-git-repo-check --approve-for-me -o <last-message-file> "<task>",
дожидается завершения и возвращает компактный отчёт: финальное сообщение
модели, git diff --stat, git status --short, код возврата и
threadId.
Написан по образцу opencode-v2-mcp/cursor-agent-sync-mcp: один вызов
тула блокируется до готового результата. В отличие от них, здесь не было
предыдущей рабочей MCP-обёртки для замены — существующая
@etheaven/codex-mcp-server построена под устаревший контракт флагов
(--full-auto/--ask-for-approval не существуют в установленной
codex-cli 0.155.1, вызов с sandbox/fullAuto/approvalPolicy падает
с unexpected argument '--full-auto'). Этот сервер вызывает codex exec
напрямую актуальными флагами, без слоя трансляции.
Требования
Codex CLI, установленный и авторизованный (
codex exec --version,codex login/действующий~/.codex/auth.json).Бинарь ищется в
PATH; путь можно переопределить переменнойCODEX_BIN.Node.js 18+.
Related MCP server: Codex to OpenCode MCP Server
Установка
Вариант 1 — из npm (рекомендуется)
Пакет опубликован как codex-cli-sync-mcp
— полностью публичный, ставится без авторизации:
npm install -g codex-cli-sync-mcpВариант 2 — из исходников
git clone git@github.com:yuriisamohvalov-creator/codex-mcp.git ~/tools/codex-mcp
cd ~/tools/codex-mcp
npm installВариант 3 — из GitHub Packages
Тот же пакет также зеркалирован в GitHub Packages под именем
@yuriisamohvalov-creator/codex-cli-sync-mcp.
Важно: в отличие от npmjs.org, GitHub Packages требует аутентификации
даже для доступа к пакету (репозиторий приватный) — понадобится .npmrc
со scoped-registry и GitHub-токеном с правом read:packages:
# ~/.npmrc или в проекте
echo "@yuriisamohvalov-creator:registry=https://npm.pkg.github.com" >> ~/.npmrc
npm login --registry=https://npm.pkg.github.com --scope=@yuriisamohvalov-creator
npm install -g @yuriisamohvalov-creator/codex-cli-sync-mcpПодключение к Claude Code
При установке из npm (npm install -g codex-cli-sync-mcp) бинарник уже
в PATH:
claude mcp add --scope user codex -- codex-cli-sync-mcpПри установке из исходников:
NODE_BIN="$(which node)"
claude mcp add --scope user codex -- "$NODE_BIN" "$HOME/tools/codex-mcp/server.mjs"Проверка:
claude mcp get codex
# Status: ✔ ConnectedПосле подключения новой сессии Claude Code (или рестарта текущей)
инструмент доступен как mcp__codex__codex_execute.
Важно про имя сервера: если у вас уже была подключена другая
MCP-обёртка под именем codex-cli (например, @etheaven/codex-mcp-server),
регистрируйте новую под другим именем (как выше — codex), а не
переиспользуйте codex-cli. На практике харнесс Claude Code Desktop может
закэшировать набор тулов под старым именем сервера и не сбросить кэш даже
после нескольких полных рестартов приложения, хотя сам MCP-процесс уже
переключился на новый бинарник (дерево процессов это подтверждает).
Регистрация под новым именем обходит проблему мгновенно.
Использование инструмента
{
"task": "Add a slugify() helper in src/lib/slug.ts with tests. Acceptance: kebab-case, trims whitespace. Verify with `npm test -- slug`.",
"cwd": "/absolute/path/to/project",
"model": "gpt-5.1-codex", // опционально
"timeoutMs": 900000 // опционально, по умолчанию 15 минут
}Ответ:
{
"ok": true,
"exitCode": 0,
"threadId": "...",
"text": "...финальное сообщение модели...",
"diffStat": "...git diff --stat...",
"statusShort": "...git status --short..."
}Одобрение команд
По умолчанию используется --approve-for-me — безопасный режим через
workspace-write sandbox (файловые правки и команды в пределах рабочей
директории без ручного подтверждения). Флаг dangerouslyBypassSandbox
переключает на --dangerously-bypass-approvals-and-sandbox — используйте
только в средах, уже изолированных снаружи (например, контейнер/VM без
доступа к остальной системе).
--approve-for-me и явный -s/--sandbox нельзя комбинировать —
codex-cli 0.155.1 отклоняет такой вызов ошибкой; обёртка это учитывает
и не передаёт оба одновременно.
Ограничения
Одна задача — один синхронный запуск
codex exec, без параллелизма в рамках одного вызова инструмента.Долгая задача блокирует вызывающую сессию на всё время выполнения — контролируйте через
timeoutMs.Не подменяет ревью: вызывающая сторона должна самостоятельно проверять
diffStat/statusShort, а не доверять только полюok.
Связанные пакеты
Тот же синхронный паттерн:
opencode-v2-mcp,
cline-sync-mcp,
cursor-agent-sync-mcp.
Лицензия
MIT
Available Tools
1 toolcodex_executeA
Execute one bounded coding task through Codex CLI (synchronous, blocks until done) and return a compact JSON report with diff/status context.
Inputs: cwd (required), task (required), model, timeoutMs, +2 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 1 tool
With only one tool, there is zero ambiguity in selecting between tools. The purpose is clear and singular.
The single tool name follows a clear verb_noun pattern (codex_execute), which is consistent and readable. No conflicting conventions exist.
The server exposes only one tool, which is well below the typical 3-15 range. While the narrow focus may justify a minimal surface, it feels too sparse for a general-purpose coding task executor, especially given the server name suggests broader sync functionality.
The server provides only a single execute operation with no supporting tools for status, history, configuration, or cancellation. This leaves significant gaps in the expected lifecycle of a coding task execution service, likely causing agent dead-ends.
Maintenance
Related MCP Connectors
A paid remote MCP for OpenAI Codex agent coordination MCP, built to return verdicts, receipts, usage
A paid remote MCP for OpenAI Codex context compressor, built to return verdicts, receipts, usage log
Hand a brief from ChatGPT, Claude or Gemini to your own coding agent or Grok Bot. Send only.
No-data MCP handoff for local Claude Code to Codex harness moves. $49 lifetime.
Related MCP Servers
- AlicenseCqualityDmaintenanceBridges MCP clients with local Codex CLI to execute autonomous coding tasks, manage threads, and inspect history via SQLite state.134Apache 2.0
- AlicenseAqualityDmaintenanceEnables Codex to delegate coding tasks to an OpenCode CLI locally, returning structured results such as exit codes, session summaries, tool calls, and git diffs.2MIT
- AlicenseAqualityBmaintenanceEnables MCP clients to run non-interactive Codex CLI sessions via codex and codex-reply tools, including resuming conversations by thread ID and passing codex exec flags.2360 PyPIMIT
- AlicenseAqualityCmaintenanceEnables MCP-compatible coding agents to execute the local Codex CLI as a coding agent, including code reviews, session resume/fork, and CLI diagnostics.9MIT