codex-mcp-bridge
codex-mcp-bridge
Claude Desktop 用の MCP サーバーで、共有の Codex app-server を介して既存の Codex スレッドに直接プロンプトを送信します。macOS、Windows、Linux で動作します。
codex exec(毎回新しいセッションを作成する方法)ではありません。Bridge は Codex の実際の app-server と JSON-RPC で通信するため、スレッドは履歴、cwd、モデル、rollout ファイルを保持します。
アーキテクチャ
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)App-server はポート単位のシングルトンです。Bridge は
http://127.0.0.1:8791/readyzをプローブし、まだ生きていなければデタッチで自動生成します(codex app-server --listen ws://127.0.0.1:8791)。この app-server は Bridge が終了した後も独立して動作し続けます。同じ URL を指すすべてのクライアントは1 つの app-server を共有します。
threadIdによるthread/resumeは、新しいセッションを開くのではなく、実行中のスレッドに正しく再参加します。Bridge は WebSocket を 1 つだけ保持し、
initializeを 1 回行い、threadIdごとに通知をルーティングするため、複数のスレッドを並行実行しても混線しません。
Related MCP server: webgpt MCP
ツール
Tool | 説明 |
| プロンプトを |
| スレッドを一覧表示します(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-<ngày>-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 の spawn は shebang の時点で失敗します。
macOS
launchd で App-server をバックグラウンド実行
node scripts/install-launch-agent.mjs~/Library/LaunchAgents/com.codex-mcp-bridge.app-server.plist を作成し(RunAtLoad + クラッシュ時の KeepAlive、ThrottleInterval 10 秒)、launchctl bootstrap gui/$UID を実行します。App-server はログイン時から起動しているため、Bridge が自分で spawn する必要はなく、スレッドは常にライブ状態です。
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 の作業をリアルタイムで確認できるようにする方法です。完了後に ~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl を読み返す必要はありません。
macOS の制限事項
Codex デスクトップアプリは stdio 経由で独自の app-server を起動し(
ChatGPT.app/Contents/Resources/codex … app-server)、外部エンドポイントを受け付けません。アプリで開いたスレッドには Bridge 経由で送信できますが、ライブアタッチではなく rollout.jsonlからの再開メカニズムになります。デスクトップアプリでターン実行中のスレッドには送信しないでください — 2 つの app-server が同じ rollout に書き込むと履歴が壊れる可能性があります。先にlist_codex_threadsでstatusを確認し、idle/notLoadedのときだけ送信します。デュアルブート機の NTFS パーティション(
/Volumes/...)にあるリポジトリは macOS では読み取り専用です — macOS は NTFS を読み取り専用でマウントします。実行と編集には APFS ボリュームに別のチェックアウト(例:~/code/codex-mcp-bridge)を用意してください。codex app-server daemon startは transportunix://とコントロールソケット~/.codex/app-server-control/app-server-control.sockを使用します。Bridge はこの経路を使用しません(WebSocket とは異なるフレームプロトコルで、公開 API がありません)。常にws://で通信します。
環境変数
変数 | デフォルト | 意味 |
|
| 共有 app-server のエンドポイント。 |
| 自動検出 | autostart に使う |
|
|
|
|
| Codex からの承認リクエストへの応答方法。拒否するには |
| OS に応じて自動検出 |
|
| 自動検出 | 2 つのインストールスクリプトで |
approval について: approval_policy が never 以外の場合、Codex はコマンド/パッチの承認を求めます。Claude Desktop の前に誰も座ってクリックするわけではないので、Bridge は CODEX_BRIDGE_APPROVAL に従って自動的に応答し、stderr にログを出力します。デフォルトの approve は ~/.codex/config.toml の approval_policy = "never" + sandbox_mode = "danger-full-access" という設定と一致します。sandbox を厳しくする場合は deny への変更を検討してください。
対話型 Codex セッションと app-server を共有する
同じエンドポイントを指す TUI を開くと、TUI のスレッドと Bridge のスレッドが同じものとして見えます:
codex --remote ws://127.0.0.1:8791app-server を手動で実行する場合(Bridge の autostart に依存しない):
codex app-server --listen ws://127.0.0.1:8791テスト
npm run checkクイックチェック: Bridge を起動し、必要に応じて app-server を autostart し、スレッドを一覧表示します。
npm run smokeスモークテストでは、新しいスレッドを作成し、2 つのターンを連続で送信して、Codex が前のターンのコードワードを覚えていることを確認します。つまり、スレッドが毎回新しいセッションではなく、実際に継続していることを確認します。
Claude 内から環境を確認するには、ツール codex_bridge_status を呼び出します。
This server cannot be installed
Maintenance
Related MCP Servers
- AlicenseBqualityDmaintenanceMCP server for managing Claude Code conversation sessions12503MIT
- Flicense-qualityCmaintenanceLocal MCP server for Codex to send prompts to ChatGPT Web Pro extension and manage repository tasks safely.
- Alicense-qualityBmaintenanceAn 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.13MIT
- AlicenseAqualityCmaintenanceMCP 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.4911MIT
Related MCP Connectors
A paid remote MCP for OpenAI Codex agent coordination MCP, built to return verdicts, receipts, usage
Hosted Amazon Seller and Vendor MCP server for Claude, ChatGPT, Cursor, Codex, Gemini, Copilot.
Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/buidangminh23/codex-mcp-bridge'
If you have feedback or need assistance with the MCP directory API, please join our Discord server