codex-bridge
Bridges OpenAI Codex (CLI and Desktop) so another agent can drive it as an executor/sub-agent: creates Codex threads with a chosen model, reasoning effort, sandbox/permission profile, approval policy and title, queues prompts, tails the rollout to return structured results, supports strict JSON Schema output, mid-turn steering/interrupt, thread listing and reading, plus Hooks/callbacks that stream Codex lifecycle events (Stop, PermissionRequest, PostToolUse, SessionEnd, Interrupt) back to the Leader.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
codex-bridge
Turn OpenAI Codex (CLI + Desktop) into a real-time observable, agent-friendly Executor / Sub-Agent for any Leader agent (Antigravity, Claude Code, Cursor, Gemini CLI, or custom agents) via zero-dependency MCP + Skill + Codex Hooks.
把 OpenAI Codex(CLI + Desktop)变成任意 Agent 可自由编排、人类可在 Codex Desktop 实时围观轨迹的通用 Executor / Sub-Agent 桥梁。
Why codex-bridge?
Standard codex exec runs are hidden from Codex Desktop's sidebar (source="exec"), while driving a live thread directly through an external app-server holds an exclusive writer lock (~/.codex/thread-writer-locks/*.lock), causing Codex Desktop to show "This is open in another app".
codex-bridge solves both problems with a dual-mode architecture:
desktop_live(Default — Real-Time Streaming in Codex Desktop)Spins up a lightweight
codex app-server --stdio(~0.15s) to create the thread with exactcwd,model,effort,sandbox/permissions,approval_policy,approvals_reviewer,title, and optional/goal, then exits immediately to release the writer lock.Queues the prompt into Codex's cross-process queue (
codex queue) and openscodex://threads/<id>.Codex Desktop takes ownership cleanly (zero lock conflict, zero refresh) and streams every reasoning/tool step live under the matching project.
codex-bridgetails the rollout JSONL read-only to return structured results to the Leader.
headless_rpc(Direct App-Server Control & Parallel Workers)Runs
codex app-server --stdiodirectly for features that need an active JSON-RPC stream:output_schema: strict JSON Schema outputenable_ask_leader=true: injects anask_leaderdynamic tool (item/tool/call) so Codex can pause mid-turn and ask the Leader for decisionscodex_steer/codex_interrupt: live mid-turn steering or cancellationParallel background fan-out without stealing macOS window focus
Releases the writer lock cleanly on turn completion so the thread renders natively in Codex Desktop.
Bidirectional Linkage & Traceability
SQLite Ledger (
~/.codex-bridge/ledger.sqlite): groups multiple Codex threads under aleader_task_id, stores deep links (codex://threads/<id>), and indexes Hook/callback events.Codex Hooks (
~/.codex/hooks.json): streamsStop,PermissionRequest,PostToolUse,SessionEnd, andInterruptevents back to the Leader — even when the human continues a thread manually in Codex Desktop.
Related MCP server: Lumen Bridge
Zero-Dependency Quickstart
Requires Python 3.9+ and Codex CLI (codex on PATH or CODEX_BIN). No pip install or venv required.
One-Click Setup
# Install for Antigravity + Codex Hooks
python3 install.py --target antigravity --target codex-hooks
# Or install for Claude Code / Cursor / Gemini CLI / all
python3 install.py --target claude-code
python3 install.py --target cursor
python3 install.py --target gemini-cli
python3 install.py --target all
# Or inspect ready-to-paste snippets without modifying files
python3 install.py --print-configsNote for Codex Hooks: After running
--target codex-hooks, open Codex CLI or Desktop and run/hooksonce to review and trust thecodex-bridgehooks.
Manual MCP Configuration (Any MCP Client)
Add to your agent's MCP config (~/.gemini/config/mcp_config.json, ~/.claude.json, ~/.cursor/mcp.json, ~/.gemini/settings.json, etc.):
{
"mcpServers": {
"codex-bridge": {
"command": "python3",
"args": ["/ABSOLUTE/PATH/TO/codex-bridge/src/codex_bridge/mcp_server.py"]
}
}
}For Claude Code CLI:
claude mcp add --scope user codex-bridge -- python3 /ABSOLUTE/PATH/TO/codex-bridge/src/codex_bridge/mcp_server.pyExposed MCP Tools (15 Tools)
Category | Tools |
Discovery |
|
Execution |
|
Async & Results |
|
History & Threads |
|
Projects |
|
Two-Way Wakeup |
|
Included Agent Skill (skills/codex-leader/)
Point any Agent Skills-compatible client at skills/codex-leader/SKILL.md (done automatically by install.py) to teach your Leader agent:
When to pick
desktop_livevsheadless_rpcHow to route models, reasoning efforts, permissions, and
/goalHow to correlate multi-step invocations with
leader_task_idand reportcodex://threads/<id>links back to the user
Standalone CLI
python3 src/codex_bridge/cli.py capabilities
python3 src/codex_bridge/cli.py run --cwd /path/to/repo --model gpt-6.2-sol --effort medium --prompt "Run tests and summarize"
python3 src/codex_bridge/cli.py send --thread <THREAD_ID> --prompt "Now fix the failing test"
python3 src/codex_bridge/cli.py threads --cwd /path/to/repo
python3 src/codex_bridge/cli.py projects list
python3 src/codex_bridge/cli.py events --ackRepository Structure
codex-bridge/
├── install.py # Universal one-click installer (Antigravity, Claude Code, Cursor, Gemini CLI, Codex Hooks)
├── pyproject.toml # Zero-dependency Python 3.9+ package
├── configs/ # Example MCP & Codex Hooks JSON configs
├── skills/codex-leader/ # Generic Leader Agent Skill + references
├── src/codex_bridge/
│ ├── config.py # Path & Codex binary discovery
│ ├── rpc.py # Thread-safe stdio & Unix WebSocket JSON-RPC clients
│ ├── ledger.py # SQLite Leader traceability & events ledger
│ ├── rollout.py # Read-only rollout JSONL parser & live tailer
│ ├── engine.py # Core desktop_live & headless_rpc orchestrator
│ ├── mcp_server.py # Zero-dependency MCP stdio server (15 tools)
│ ├── hook_bridge.py # Codex lifecycle Hook bridge
│ └── cli.py # Standalone CLI
└── tests/test_bridge.py # Unit & MCP protocol smoke testsLicense
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Coordination hub for AI coding agents: message teammates, ask humans, audit every event.
Agent operating kit for Claude Code and Codex: rules, hooks, work ledger, protocols and rig doctor.
Live SEO workflow tools for Claude Code, Codex, and AI agents.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables Codex/ChatGPT to coordinate OpenCode agents, managing tasks, sessions, parallel execution, and project context through 25 local tools.254 npm1MIT
- AlicenseNot gradedqualityDmaintenanceEnables MCP clients and external AI supervisors to oversee and steer native Codex sessions through a thin local stdio bridge. It exposes eleven codex_* supervisory tools for tasks such as listing threads, starting turns, observing progress, steering, responding to approvals, interrupting, checkpointing, and rolling over work.MIT
- AlicenseNot gradedqualityBmaintenanceEnables other agents to list, read, start, and steer Codex chats in the macOS ChatGPT desktop app, including sending follow-ups, choosing model/reasoning/speed, interrupting work, and answering approvals. It can run locally or behind bearer-token-protected tunnels for remote monitoring and control.MIT
- AlicenseNot gradedqualityCmaintenanceEnables Codex to launch and orchestrate local agent sessions, delegate tasks, return clickable live web links, and independently verify actual workspace changes.1MIT