Content
<div align="center">
# Tool List
**Let ChatGPT remotely command Codex and Claude Code on your computer.**
*ChatGPT thinks, your computer does.*
</div>
---
## What is this?
Normally, these three AI tools are confined to their own boxes:
| AI | Strengths | Weaknesses |
|---|---|---|
| **ChatGPT** (web-based) | Planning, research, breaking down tasks | Runs in the cloud, can't interact with your computer or run your code |
| **Claude Code** (local) | Actually modifies files, runs commands, executes tasks | Planning not as good as ChatGPT |
| **Codex** (local) | Actually modifies files, runs commands, code review | Planning not as good as ChatGPT |
Previously, you had to act as a **human relay**: ask ChatGPT for a plan, copy it, and then paste it into the terminal for the local AI to execute.
**This project automates the relay process** - ChatGPT can now assign tasks to your computer, and the results are automatically run and returned to the conversation. You only need to type in ChatGPT.
## How data flows
```
You type a message in ChatGPT
│
▼
ChatGPT (cloud-based · responsible for "thinking")
│ Through an encrypted tunnel (Cloudflare Tunnel)
▼
A small service on your computer (this MCP bridge)
│ Dispatches tasks
├──────────────┐
▼ ▼
Claude Code Codex
(responsible for "execution") (responsible for "review")
│ │
└──────┬───────┘
▼
Actually modifies files on your computer / runs commands
│
▼
Results return to ChatGPT conversation
```
**The three roles work like a small team:** ChatGPT = Project Manager (thinks, assigns tasks) | Claude Code = Engineer who does the work | Codex = Reviewing colleague.
## What can it do (examples)
You type "Help me write a three-step plan and have Codex review it" in ChatGPT, and then:
1. ChatGPT assigns "write a plan" to local **Claude Code** → actually generates a file on your hard drive;
2. Assigns "review" to local **Codex** → Codex actually reads the file and writes a review;
3. The results are returned to the ChatGPT conversation for you to see.
You only need to type in ChatGPT, and your computer will automatically complete the tasks.
## ⚠️ Security warnings (must read before use)
The two execution tools used in this bridge run with **`--dangerously-bypass-approvals-and-sandbox`** (Codex) and **`--dangerously-skip-permissions`** (Claude Code). This means:
> **Anyone who can connect to this endpoint can run arbitrary commands and modify arbitrary files on your computer.**
So, you must:
- 🔒 **Never** expose the endpoint to the public internet. Use `BRIDGE_PATH_SECRET` (an unpredictable secret URL) and `BRIDGE_TOKEN` if possible.
- 🚫 **Never** share the service address with others - this is equivalent to giving them the keys to your computer. If you want to share, please let them **clone this repository and set up their own bridge on their computer**.
- 📁 Use `BRIDGE_WORK_ROOT` to limit the readable and writable range to a single directory, and do not leave it as the entire `$HOME`.
- 🔐 `.env` contains secrets and has been excluded by `.gitignore` - **never commit it**.
This is a personal efficiency tool, not a multi-user production service. Please assume the risk.
## How it works (key techniques)
1. **ChatGPT developer mode**: ChatGPT has a "developer mode" that allows it to connect to external MCP tools. This is the entrance key.
2. **Local MCP bridge**: `app/bridge_server.py`, based on [FastMCP](https://github.com/modelcontextprotocol). It understands ChatGPT's instructions and then calls the local Codex / Claude Code binaries. One set of code for two purposes - `stdio` for local clients, `--http` for tunnels.
3. **Encrypted tunnel**: Use [Cloudflare Tunnel](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/) to securely expose the local server as HTTPS, so ChatGPT in the cloud can access it without directly exposing your computer to the public internet.
4. **Authentication using secret URLs**: ChatGPT Plus developer mode connectors only support "no authentication / OAuth" and cannot send custom request headers - so Bearer Token cannot be used. Instead, use **secret URLs**: change the endpoint from `/mcp` to `/mcp/<unpredictable hex secret>`, and accessing `/mcp` directly returns a 404.
## Exposed tools
| Tool | Function |
|---|---|
| `run_codex` | Assign tasks to local Codex to run (execution / review) |
| `run_claude_code` | Assign tasks to local Claude Code to run (execution) |
| `read_file` | Read files within `BRIDGE_WORK_ROOT` |
| `write_file` | Write files to `BRIDGE_WORK_ROOT` |
| `list_dir` | List directories for planning purposes |
## Quick start
**Prerequisites**: Codex CLI and / or Claude Code are already installed on your computer and can be run in the terminal; you have a [Cloudflare account](https://dash.cloudflare.com).
```bash
# 1) Clone + install dependencies
git clone https://github.com/<your_username>/chatgpt-codex-claude-bridge.git
cd chatgpt-codex-claude-bridge
python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
# 2) Configure: generate secrets, fill in binary paths
cp .env.example .env
python -c "import secrets;print('BRIDGE_PATH_SECRET='+secrets.token_hex(24))" # fill in .env
# Edit .env: fill in CODEX_BIN / CLAUDE_BIN with absolute paths to the binaries (use `which codex` to find,
# but note that shell functions like codex/claude often have wrappers with sound effects, find the actual binary, e.g., ~/.local/bin/codex)
# 3) Start server (HTTP mode, for tunnels)
set -a; source .env; set +a
python -m app.bridge_server --http # listen on 127.0.0.1:8000
# 4) Start tunnel (in another terminal)
cloudflared tunnel --protocol http2 --url http://localhost:8000
# Get the https://xxx.trycloudflare.com address from the output
# 5) Add connector in ChatGPT
# URL = https://xxx.trycloudflare.com/mcp/<your BRIDGE_PATH_SECRET>
# Settings → Connectors → Developer Mode → Add
```
## Troubleshooting (common issues)
| Phenomenon | Cause / Solution |
|---|---|
| `run_codex` reports `exit=-6` + dyld `libllhttp.x.dylib not loaded` | Homebrew upgrade broke node dependencies. `brew reinstall node` to relink. `run_claude_code` normal but `run_codex` fails → likely node runtime is broken (Codex depends on node). |
| ChatGPT claims "security check intercepted" but didn't actually call | It didn't actually send tool calls, but made excuses. Force specify tools (e.g., "now must actually call run_codex") + require original replies, blocking excuses. |
| Tunnel inactive overnight, reports `quic: timeout` | cloudflared quick tunnel uses QUIC/UDP by default. **Must add `--protocol http2`**. |
| ChatGPT accesses endpoint 404 | If secret URL contains `_` / `-` or other special characters, they may be swallowed by URL normalization. `BRIDGE_PATH_SECRET` **must be pure hex** (use `secrets.token_hex`). |
| Local codex/claude not responding | Shell `codex` / `claude` often are function wrappers with sound effects, not interactive shell. `.env` `CODEX_BIN` / `CLAUDE_BIN` must point to **actual binaries**. |
| trycloudflare address changes after restart | Quick tunnel is temporary. To fix the address, configure **named tunnel** ([Cloudflare Tunnel documentation](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/)) and bind your own domain. |
## Environment
- Python 3.10+
- `mcp[cli]` + `uvicorn` (see `requirements.txt`)
- Codex CLI and / or Claude Code (already installed and running on your computer)
- cloudflared
## License
MIT