claude-codex-mcp-bridge
A local MCP bridge that connects Claude Code and OpenAI Codex via a durable SQLite mailbox, with support for orchestrating and resuming Codex sessions.
README
<p align="center"> <a href="https://www.webisitystudio.co.uk/"> <img src="assets/webisity-studio-logo.svg" width="180" alt="WebiSity Studio logo"> </a> </p>
<h1 align="center">Claude Codex MCP Bridge</h1>
<p align="center">Built by <a href="https://www.webisitystudio.co.uk/">WebiSity Studio</a></p>
<p align="center"> <img src="assets/bridge-demo.gif" alt="Claude Codex MCP Bridge send, wait, wake and acknowledge demo" width="900"> </p>
A local MCP bridge for Claude Code and OpenAI Codex. It combines a durable SQLite mailbox with a bounded orchestration loop that can start and resume saved Codex workers.
Claude Code ──stdio MCP──┐
├── local SQLite WAL store
Codex ──stdio MCP──┘
The default mode has no account, cloud relay, HTTP server or listening network port.
Why
Plain MCP tools are request-response. Writing a message to a mailbox does not automatically start a new model turn in another GUI chat.
This project supports two practical patterns:
- Two visible chats: both agents use
bridge_waitbefore going idle. A pending MCP call returns when the matching message arrives. - Claude coordinates Codex: Claude calls
bridge_orchestrate_codex; the bridge starts a saved Codex CLI session, waits for structured output and can resume that exact session after a Fable decision.
See INSTRUCTIONS.md for copy-paste prompts.
Features
- Local SQLite WAL mailbox
- Direct messages and broadcasts
- Stable thread IDs
- Recipient-scoped acknowledgements
- Idempotency keys
- Blocking waits with sender/thread filters
- Durable Codex run state and audit events
- Saved Codex session continuation
- Optional isolated Git worktrees
- Structured worker output
- Round and timeout limits
- Explicit safety boundaries
Tools
| Tool | Purpose |
|---|---|
bridge_register |
Register an agent name and capabilities |
bridge_send |
Send a direct or broadcast message |
bridge_inbox |
Read unread messages immediately |
bridge_wait |
Keep the current turn open until a matching message arrives |
bridge_ack |
Acknowledge handled messages without deleting history |
bridge_thread |
Read a complete thread |
bridge_agents |
List registered agents |
ask_codex |
Handle a normal implementation, investigation or verification request without mailbox setup |
review_with_codex |
Run an evidence-led, read-only Codex repository review |
bridge_orchestrate_codex |
Start a saved Codex worker, optionally in a worktree |
bridge_continue_codex |
Resume the same Codex session with Claude's answer |
bridge_orchestration_status |
Read durable run state and audit events |
Requirements
- Node.js 22.5 or newer
- Claude Code
- OpenAI Codex CLI
- Git, if using worktree isolation
The mailbox works anywhere Node and both MCP clients run. The automated Codex launcher uses CODEX_BIN when set, then the bundled Codex binary inside the macOS ChatGPT app when available, then codex from PATH.
Core tests run on macOS, Linux and Windows in GitHub Actions. The live Claude Desktop/Fable plus Codex Desktop workflow was developed and verified on macOS.
Install
One command
Run directly from the public GitHub repository:
npx --yes --package=github:WebisityStudio/claude-codex-mcp-bridge claude-codex-mcp-bridge setup
The setup command:
- builds the package automatically;
- detects and registers Claude Code and Codex;
- resolves the server's absolute path internally;
- installs the
ask-codex,review-with-codexand coordinator skills; - installs a Claude
codex-teammateagent definition; - points both clients at the same local database.
Open fresh Claude and Codex sessions after setup, then verify the bridge:
npx --yes --package=github:WebisityStudio/claude-codex-mcp-bridge claude-codex-mcp-bridge doctor
npx --yes --package=github:WebisityStudio/claude-codex-mcp-bridge claude-codex-mcp-bridge demo
Other commands:
claude-codex-mcp-bridge status
claude-codex-mcp-bridge setup --force
claude-codex-mcp-bridge uninstall
claude-codex-mcp-bridge uninstall --purge
uninstall keeps the SQLite history unless --purge is explicitly supplied.
Manual fallback
git clone https://github.com/WebisityStudio/claude-codex-mcp-bridge.git
cd claude-codex-mcp-bridge
npm ci
npm run check
node dist/cli.js setup
If Codex is not available as codex on PATH, set CODEX_BIN in the MCP server environment to the full executable path.
Everyday use
After opening a fresh Claude session:
/ask-codex investigate why the authentication tests are flaky
/review-with-codex focus on authentication and tenant isolation
Or simply ask Claude:
Ask Codex to implement this change and verify it.
Have Codex review this repository for security regressions.
The installed skills route these requests through ask_codex and review_with_codex. Users do not need to choose agent names, create mailbox threads or manage acknowledgements for ordinary one-shot work.
Quick start: two visible chats
Pick one canonical thread ID, for example invoice-review-001. Register unique names, send with bridge_send, and wait with:
{
"agent": "claude-main",
"fromAgent": "codex-main",
"threadId": "invoice-review-001",
"timeoutSeconds": 285,
"acknowledge": true
}
Most MCP hosts cut tool calls near five minutes. The bridge caps waits at 290 seconds and defaults to 285. Agents should renew a timed-out wait while the task remains active.
A filtered wait only wakes for the exact sender and thread. Agree the thread ID before either side starts waiting.
Quick start: autonomous Codex worker
Claude calls:
{
"coordinatorAgent": "claude-main",
"projectPath": "/absolute/path/to/repository",
"task": "Implement and test the bounded change",
"threadId": "feature-x",
"useWorktree": true,
"maxRounds": 6
}
If the result is waiting_for_fable, Claude answers the returned question and calls bridge_continue_codex using the same run ID. The bridge resumes the exact Codex session and worktree.
The bridge does not commit, push, merge, deploy or clean worktrees automatically.
Storage
The default database is:
~/.local/share/claude-codex-bridge/bridge.sqlite
Override it in both MCP configurations with:
BRIDGE_DB_PATH=/absolute/path/to/bridge.sqlite
All MCP processes must point to the same database.
Honest limitations
- MCP cannot cold-wake a GUI chat after its model turn has ended.
bridge_waitworks by keeping the current call alive. - Agent registration does not prove active processing.
- A mismatched thread filter can leave valid messages unread.
- Codex session persistence does not guarantee immediate appearance in every desktop app version's thread list.
- The default transport is local to one machine. It is not a cross-machine broker.
Safety
- No credentials are stored by this project.
- Child processes receive a small allowlist of environment variables, not the full parent environment.
- Messages are local but are stored unencrypted in SQLite.
- Do not send secrets through the mailbox unless every connected client is trusted.
- Worker prompts prohibit commits, pushes, deployments, external sends, credential changes, deletion and production mutations unless separately approved.
Development
npm test
npm run build
npm run check
npm audit --omit=dev --audit-level=high
The test suite covers mailbox routing, acknowledgements, idempotency, independent MCP processes, blocking waits, durable orchestration state, session continuation, loop limits and platform-safe process environments.
Related work
This is not the only Claude/Codex bridge. See docs/ALTERNATIVES.md for a comparison with Claude Channels bridges, ACP delegation tools and general agent mailboxes.
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.