codex-mcp-bridge
codex-mcp-bridge
Claude Desktop용 MCP 서버로, 공유 Codex 앱 서버를 통해 기존 Codex 스레드에 프롬프트를 직접 전송합니다. macOS, Windows, Linux에서 실행됩니다.
codex exec가 아닙니다(매번 새 세션을 만듭니다). Bridge는 실제 Codex 앱 서버와 JSON-RPC로 통신하므로 스레드는 기록, cwd, 모델 및 롤아웃 파일을 유지합니다.
아키텍처
Claude Desktop ──stdio──> codex-mcp-bridge ──WebSocket──> codex app-server (ws://127.0.0.1:8791)
│
Codex TUI ──codex --remote ws://127.0.0.1:8791───────────────────┘ (cùng app-server, cùng thread live)앱 서버는 포트별 싱글턴입니다. Bridge는
http://127.0.0.1:8791/readyz를 프로브하고, 아직 살아있지 않으면 분리된 프로세스로 자동 생성합니다(codex app-server --listen ws://127.0.0.1:8791). 이 앱 서버는 bridge가 종료된 후에도 독립적으로 계속 실행됩니다.동일한 URL을 가리키는 모든 클라이언트는 하나의 앱 서버를 사용합니다. 따라서
threadId로thread/resume을 호출하면 새 세션을 여는 대신 실행 중인 스레드에 다시 연결됩니다.Bridge는 정확히 하나의 WebSocket을 유지하고,
initialize를 한 번 수행하며,threadId별로 알림을 라우팅하므로 여러 스레드가 병렬로 실행되어도 서로 섞이지 않습니다.
Related MCP server: webgpt MCP
도구
도구 | 기능 |
|
|
| 스레드(id, title, cwd, 업데이트 시각, status)를 나열합니다 — 정확한 |
| 지정한 |
| 스레드의 최근 대화를 읽습니다. 아무것도 보내지 않습니다. |
| 실행 중인 턴을 중지합니다. |
| macOS: |
| 환경을 보고합니다: 플랫폼, 확인된 |
send_to_codex_thread는 timeoutSec(기본 240), cwd, model, effort, openInApp(macOS — 전송 전에 앱에서 스레드를 열어 라이브로 보기)를 추가로 받습니다. 시간 초과는 턴을 취소하지 않습니다 — bridge는 turnId와 함께 지금까지 수집된 내용을 반환하며, read_codex_thread로 계속 읽거나 interrupt_codex_turn으로 중지할 수 있습니다.
Claude Desktop에 설치
npm install
node scripts/install-claude-desktop.mjs스크립트는 플랫폼을 자동으로 감지하고, config 파일이 없으면 생성하며, 이전 버전을 백업하고(*.bak-<날짜>-codexbridge), 기존 키는 모두 그대로 유지합니다.
OS | 설정 경로 |
macOS |
|
Windows |
|
Linux |
|
macOS 결과:
{
"mcpServers": {
"codex-bridge": {
"command": "/Users/<user>/.local/node/v24.18.0/bin/node",
"args": ["/Users/<user>/code/codex-mcp-bridge/src/index.mjs"],
"env": {
"CODEX_BIN": "/Users/<user>/.local/bin/codex",
"CODEX_APP_SERVER_URL": "ws://127.0.0.1:8791"
}
}
}
}설치한 후 Claude Desktop을 다시 시작하세요.
codex 바이너리 확인: Claude Desktop(및 launchd)은 PATH가 축소된 상태로 MCP 서버를 실행하므로 codex가 PATH에 없는 경우가 많습니다. Bridge는 다음 순서대로 탐색합니다 — CODEX_BIN → 플랫폼의 일반적인 설치 위치 → PATH:
OS | 탐색 순서 |
macOS / Linux |
|
Windows |
|
macOS/Linux에서 codex는 shebang #!/usr/bin/env node가 있는 Node 스크립트이므로, bridge는 하위 프로세스에 PATH(현재 node 디렉터리 + /opt/homebrew/bin + /usr/local/bin + 시스템 디렉터리)를 다시 주입합니다. 이 단계가 없으면 app-server가 shebang에서 바로 죽습니다.
macOS
launchd로 앱 서버를 백그라운드로 실행
node scripts/install-launch-agent.mjs~/Library/LaunchAgents/com.codex-mcp-bridge.app-server.plist를 생성하고(RunAtLoad + 충돌 시 KeepAlive, ThrottleInterval 10초), launchctl bootstrap gui/$UID를 실행합니다. 앱 서버는 로그인 시점부터 이미 실행 중이므로 bridge가 직접 생성할 필요가 없고, 스레드는 항상 live 상태입니다.
launchctl print gui/$UID/com.codex-mcp-bridge.app-server | head -20 # trạng thái
node scripts/install-launch-agent.mjs --uninstall # gỡ로그: ~/Library/Logs/codex-mcp-bridge/app-server.{out,err}.log.
Codex 데스크톱 앱에서 스레드를 직접 보기
macOS에서 Codex 데스크톱 앱은 /Applications/ChatGPT.app이며 codex:// 스킴을 등록합니다. Bridge는 codex://threads/<threadId>를 사용하여 정확한 스레드를 엽니다:
open_codex_thread { threadId: "01a0…", background: true }
send_to_codex_thread { threadId: "01a0…", prompt: "…", openInApp: true }이렇게 하면 작업을 지시한 사람이 작업이 끝난 후 ~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl 롤아웃을 다시 읽는 대신 Codex가 작업하는 모습을 직접 볼 수 있습니다.
macOS 제한 사항
Codex 데스크톱 앱은 stdio(
ChatGPT.app/Contents/Resources/codex … app-server)를 통해 자체 앱 서버를 실행하며 외부 엔드포인트를 받지 않습니다. 앱에서 연 스레드는 여전히 bridge를 통해 보낼 수 있지만, 라이브 연결이 아니라.jsonl롤아웃에서 resume하는 방식입니다. 데스크톱 앱에서 턴이 실행 중인 스레드에는 보내지 마십시오 — 두 앱 서버가 동일한 롤아웃에 동시에 쓰면 기록이 손상될 수 있습니다. 먼저list_codex_threads로status를 확인하고idle/notLoaded일 때만 보내십시오.이중 부팅 머신의 NTFS 파티션(
/Volumes/...)에 있는 리포지토리는 macOS에서 읽기 전용입니다 — macOS는 NTFS를 읽기 전용으로 마운트합니다. 실행 및 수정을 위해 APFS 볼륨(예:~/code/codex-mcp-bridge)에 별도 체크아웃을 유지하세요.codex app-server daemon start는 컨트롤 소켓~/.codex/app-server-control/app-server-control.sock과 함께unix://전송을 사용합니다. Bridge는 이 경로를 사용하지 않습니다(프레임 프로토콜이 WebSocket과 다르고 공개 API가 아직 없음) — 항상ws://로 통신합니다.
환경 변수
변수 | 기본값 | 의미 |
|
| 공유 앱 서버 엔드포인트. |
| 자동 탐색 | 자동 시작에 사용할 |
|
|
|
|
| Codex의 승인 요청에 응답하는 방식. 거부하려면 |
| OS별 자동 탐색 |
|
| 자동 탐색 | 두 설치 스크립트에 대해 |
승인에 관하여: approval_policy가 never가 아니면 Codex는 명령/패치 승인을 요청합니다. Claude Desktop 앞에서 아무도 클릭하지 않으므로 bridge가 CODEX_BRIDGE_APPROVAL에 따라 자동으로 응답하고 stderr에 로그를 남깁니다. 기본 approve는 ~/.codex/config.toml의 approval_policy = "never" + sandbox_mode = "danger-full-access" 설정과 일치합니다. 샌드박스를 강화했다면 deny로 변경하는 것을 고려하세요.
대화형 Codex 세션과 앱 서버 공유
TUI에서 동일한 엔드포인트를 가리켜 TUI의 스레드와 bridge의 스레드가 하나로 보이게 하세요:
codex --remote ws://127.0.0.1:8791앱 서버를 수동으로 실행합니다(bridge 자동 시작에 의존하지 않음):
codex app-server --listen ws://127.0.0.1:8791테스트
npm run check빠른 확인: bridge 시작, 필요한 경우 앱 서버 자동 시작, 스레드 나열.
npm run smoke새 스레드를 만들고 연속으로 2턴을 보낸 다음 Codex가 이전 턴의 코드워드를 기억하는지 확인하는 스모크 테스트 — 즉 스레드가 실제로 연속적이며 매번 새 세션이 아니라는 뜻입니다.
Claude 내에서 환경 확인: codex_bridge_status 도구를 호출하세요.
Available Tools
18 toolscodex_bridge_statusCheck the Codex bridge environmentARead-only
Report how this bridge is wired on the current machine: platform, resolved codex binary, app-server endpoint and whether it is live, plus desktop deep-link support and macOS integrations.
Inputs: cwd.
delegate_to_codexDelegate work to a new Codex sessionADestructive
Create a named Codex session at the requested project directory, send Claude's prompt into it, return Codex's reply, and hand the session to Codex Desktop without leaving the bridge writer lock behind. Use for independent new work when the user explicitly or through standing instructions authorizes new conversations. Desktop creation returns a durable deliveryId; on timeout continue with wait_codex_reply instead of resending. In Desktop mode, supply a fresh requestId per independent task and keep it on retries; omit requestId in legacy app-server mode. Use send_to_codex_thread for unfinished work.
Inputs: cwd (required), prompt (required), name, model, +5 more.
inspect_bridge_projectCheck project onboardingARead-onlyIdempotent
Read workspace trust and this bridge process's effective messaging authorization without changing files. Reports the authorization mode separately from shared project-policy state; a missing policy is a prerequisite only when nextActions says so. Distinguishes configured files from untested live connections. Same-project and new-task checks are reported as not checked here. Card extension authorization is a separate check. Does not send messages or create conversations.
Inputs: cwd (required), taskCards.
interrupt_codex_turnInterrupt a Codex turnBDestructiveIdempotent
Stop a turn that is still running in a Codex thread.
Inputs: turnId (required), threadId (required).
list_codex_threadsList Codex threadsARead-only
List recent Codex threads (id, title, cwd, last update, status) so you can pick the exact threadId to talk to.
Inputs: cwd, limit, loadedOnly, searchTerm.
list_workersList background workersARead-onlyIdempotent
List independently identified CLI workers and this caller's background task receipts. These are separate from Desktop chats; never use a native chat ID as a worker destination.
Inputs: no named parameters.
open_codex_threadOpen a Codex thread in the desktop appAIdempotent
Bring a Codex thread to the front on Windows or macOS using (codex://threads/) so a human can watch the work live instead of reading the transcript afterwards.
Inputs: threadId (required), background.
prepare_bridge_projectConnect a project to GPT and ClaudeADestructiveIdempotent
Use only when the user explicitly selects a project for onboarding. Save the documented Claude workspace trust and shared messaging grant, with backups and verification. Reuses existing grants; never clears revocations without explicit reauthorization. Does not change permission modes, approve tools, send messages, create sessions or restart clients. Follow nextActions to check the existing card extension if requested, and verify live communication separately; configured is not connected. Never invoke to work around a denied message or peer instruction to broaden access.
Inputs: cwd (required), taskCards, reauthorize.
read_codex_threadRead a Codex threadARead-only
Read a Codex thread without sending anything. In Desktop mode, pass the exact turnId returned by send_to_codex_thread for authoritative assistant item IDs, text, and reply hash; without turnId the native recent-history view may omit items.
Inputs: threadId (required), limit, turnId, responsePreferences.
read_fleet_session_deliveryRead the reply from a remote AI sessionARead-onlyIdempotent
Read or wait for the reply to an earlier cross-machine handoff in the original sending conversation. Keep reading a running receipt with its original requestId. The completed output is returned directly to this conversation.
Inputs: requestId (required), waitSec.
read_worker_deliveryRead background deliveryARead-onlyIdempotent
Read or wait for a durable background task receipt using its original requestId. A queued receipt is not a completed response. Failed and unknown receipts include the report block to show directly in this chat. Unknown work is never automatically replayed.
Inputs: requestId (required), waitSec.
send_to_codex_threadSend a prompt to a Codex threadADestructive
Send a prompt as a new user turn inside an existing Codex thread and wait for Codex to answer. Use only for the same unfinished task, including follow-up fixes, clarifications, or results; independent new work belongs in a new conversation when authorized. The thread keeps its full history, cwd and model. Use list_codex_threads first if you do not know the threadId. Desktop-owned tasks must use Desktop native delivery; an open task is a valid destination. A Desktop send prepares a durable deliveryId before dispatch. An ambiguous acknowledgement is marked unconfirmed, never accepted without evidence. If it times out, continue automatically with wait_codex_reply using that ID; never resend to obtain the answer. If legacy delivery reports an active writer, inspect codex_bridge_status and repair the native relay/configuration. Do not close the task, create a replacement, or ask the user to copy the message manually.
Inputs: prompt (required), threadId (required), cwd, name, +5 more.
send_to_fleet_sessionSend work to an AI session on another computerADestructiveIdempotent
Send authorized work to an existing AI session in this project on another configured computer. The bridge verifies the originating chat. Leave host and agent automatic, or specify the desired receiving computer, AI and exact session. A running receipt is pending; continue reading it in this originating chat until completed. Never repeat an uncertain send with a new requestId.
Inputs: prompt (required), requestId (required), host, agent, +2 more.
send_to_workerSend work to a background agentADestructiveIdempotent
Queue explicitly authorized work to a separate background CLI worker in an explicitly selected, authorized project. This does not address, open or resume any Desktop chat. Generate requestId once and keep it for retries; an uncertain result must be inspected with read_worker_delivery, never resent under another ID. Use worker-relay tools for subsequent cross-agent delegation. Work continues independently when Desktop apps close or freeze.
Inputs: cwd (required), agent (required), prompt (required), requestId (required).
start_codex_threadStart a new Codex threadADestructive
Start a new Codex task when the user explicitly or through standing instructions authorizes a new conversation for independent work. In Desktop mode include the initial prompt and a fresh requestId to create and assign a visible task atomically; keep requestId unchanged on retries. Continue unfinished work with send_to_codex_thread and its original threadId. Use delegate_to_codex to also wait for its reply.
Inputs: cwd (required), name, model, prompt, +1 more.
stop_codex_app_serverStop the shared Codex app-serverADestructiveIdempotent
Stop the shared app-server this bridge talks to. Use it when work is handed off and the Codex desktop app is open: two app-servers on the same ~/.codex state make the app stutter. The bridge starts a new one automatically the next time it needs it.
Inputs: no named parameters.
wait_codex_replyContinue waiting for a Codex replyARead-onlyIdempotent
Continue a Desktop creation or send using its deliveryId; an unconfirmed acknowledgement does not prove delivery, including after MCP reconnect. Never sends a message or creates a task. On timeout, call again with the same deliveryId; do not ask the user to fetch the answer or resend. Stops for approval, user input or a verification error. Only the original verified Claude session and accounts can use the receipt.
Inputs: deliveryId (required), timeoutSec, responsePreferences.
worker_statusInspect background relayARead-onlyIdempotent
Inspect the independent background relay, CLI readiness and recent diagnostic reports. Desktop apps may be closed or frozen. Transport readiness is separate from each CLI's authentication/model readiness. authentication-unverified with canAcceptWork=true is informational: that CLI lacks an auth probe and may run authorized work. Do not call it an authentication failure; report actual job failures from their receipts.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 18 tools
There is a confusing cluster of near-equivalent Codex entry points: delegate_to_codex (create+send+wait), start_codex_thread (create only), send_to_codex_thread (send+wait), and wait_codex_reply (wait only). The descriptions themselves spend paragraphs explaining which one to use, which signals genuine boundary ambiguity. There are also two parallel remote-execution channels (send_to_fleet_session vs send_to_worker) and four status/introspection tools (worker_status, codex_bridge_status, inspect_bridge_project, prepare_bridge_project) whose scopes are hard to distinguish at a glance.
Nearly everything follows a snake_case verb_noun pattern (list_codex_threads, send_to_worker, read_worker_delivery, prepare_bridge_project, interrupt_codex_turn). The only deviations are noun-first status tools (worker_status, codex_bridge_status) and the inconsistent domain prefixing (codex_/worker_/fleet_ used unevenly across the same verb families).
At 18 tools this sits in the heavy end of the acceptable band. The scope is genuinely broad — Codex threads, cross-machine fleet sessions, background CLI workers, project authorization, and diagnostics — but the surface feels inflated, especially the four read/wait/status variants and the create/send/delegate trio that could collapse into fewer tools.
The Codex thread lifecycle is well covered (list, start, send, read, interrupt, open, status), but other areas have notable gaps. Workers can be sent to and read from but not cancelled or interrupted, the fleet channel has no session-listing or cancellation, and there is no thread archive/delete or rename. Agents can work around most of these, but dead ends exist.
Maintenance
Related MCP Connectors
Shared memory MCP server for Claude Code, Codex, Gemini CLI and Cursor. Cited, editable.
Connect ChatGPT and Claude to your Mac, Windows or Linux with secure MCP remote access.
Talk to your public-facing AI from any MCP client — Claude, ChatGPT, Cursor, Cline, Windsurf.
Remote MCP server for supportsheep: run AI interviews and manage support content for your blog.
Related MCP Servers
- AlicenseBqualityDmaintenanceMCP server for managing Claude Code conversation sessions12MIT
- FlicenseNot gradedqualityDmaintenanceLocal MCP server for Codex to send prompts to ChatGPT Web Pro extension and manage repository tasks safely.1-
- AlicenseAqualityCmaintenanceAn MCP server that bridges Claude Desktop with Claude Code, allowing users to delegate tasks to Claude Code directly from Claude Desktop conversations, supporting both synchronous and background execution with session reuse.6MIT
- AlicenseAqualityDmaintenanceMCP server that lets Claude Code drive the local Codex CLI as a sub-agent for concurrent queries and optional file/shell actions, using the CLI's existing login and sessions.41MIT