codex-mcp-bridge
A policy layer between ChatGPT and the official Codex MCP server, adding safety controls like read-only sessions, approval policies, and secret scanning for secure daily use.
README
codex-mcp-bridge
A small policy layer between ChatGPT and the official local Codex MCP server.
ChatGPT
-> OpenAI Secure MCP Tunnel
-> codex-mcp-bridge (loopback HTTP)
-> codex mcp-server (stdio)
-> one explicitly allowed repository
The official Codex MCP server already provides codex and codex-reply. This bridge intentionally adds only the controls needed for safer daily use from ChatGPT:
bridge_status: inspect the active policy.codex_read: force a read-only Codex session.codex_run: start a policy-limited read or write session.codex_reply: continue only a thread created through this bridge.codex_job_status: retrieve a long-running result.
Security defaults
- Binds to
127.0.0.1. - Allows one current working directory unless roots are explicitly configured.
- Uses the
read-onlyCodex sandbox. - Uses the
on-requestapproval policy. - Never exposes
danger-full-access. - Blocks workspace writes unless the bridge owner starts a write profile.
- Rejects paths outside the configured real-path roots.
- Refuses repositories containing common secret-file names unless the owner explicitly disables the preflight.
- Limits prompt size and concurrent Codex jobs.
- Suppresses upstream Codex stderr unless local debug logging is enabled.
These controls are a policy layer, not OS-level isolation. Use a staging copy, container, VM, or separate OS user when hard isolation is required.
Requirements
- Node.js 20 or later; Node.js 22 is recommended.
- Codex CLI installed, authenticated, and providing
codex mcp-server. tunnel-clientand an OpenAI Secure MCP Tunnel for ChatGPT access.
Official references:
Install
npm ci
npm run check
Local smoke test
Local mode never creates a public endpoint:
npm run bridge:local -- --root /absolute/path/to/repository
The MCP endpoint is http://127.0.0.1:8876/mcp and the health endpoint is http://127.0.0.1:8876/healthz.
Secure MCP Tunnel
Create a tunnel in OpenAI Platform, then provide its runtime credentials outside this repository:
export CONTROL_PLANE_API_KEY="<runtime-key>"
export CONTROL_PLANE_TUNNEL_ID="tunnel_..."
npm run bridge:secure -- --root /absolute/path/to/repository
The launcher builds the bridge, starts it on loopback, initializes the tunnel profile, runs tunnel-client doctor, and keeps the tunnel client running.
For a deliberate write session:
npm run bridge:secure -- --root /absolute/path/to/repository --write
Do not leave a write profile running when it is not needed.
macOS Keychain
security add-generic-password -a "$USER" -s "codex-mcp-bridge:control-plane-api-key" -w "<runtime-key>" -U
security add-generic-password -a "$USER" -s "codex-mcp-bridge:control-plane-tunnel-id" -w "tunnel_..." -U
CODEX_MCP_BRIDGE_ROOT=/absolute/path/to/repository npm run bridge:secure:keychain
Use bridge:secure:write:keychain only for an intentional write session.
Configuration
| Variable | Default | Purpose |
|---|---|---|
CODEX_MCP_BRIDGE_ROOTS |
current directory | Comma-separated absolute allowed roots |
CODEX_MCP_BRIDGE_DEFAULT_SANDBOX |
read-only |
read-only or workspace-write |
CODEX_MCP_BRIDGE_ALLOW_WRITE |
unset | Must be 1 before write mode is accepted |
CODEX_MCP_BRIDGE_APPROVAL_POLICY |
on-request |
on-request or untrusted |
CODEX_MCP_BRIDGE_MAX_CONCURRENT_JOBS |
2 |
Maximum active Codex calls |
CODEX_MCP_BRIDGE_MAX_PROMPT_CHARS |
50000 |
Maximum prompt length per tool call |
CODEX_MCP_BRIDGE_UPSTREAM_TIMEOUT_MS |
180000 |
Codex MCP call timeout |
CODEX_MCP_BRIDGE_FAST_RETURN_MS |
25000 |
Delay before returning a job ID |
CODEX_MCP_BRIDGE_JOB_TTL_MS |
21600000 |
Completed job retention |
CODEX_MCP_BRIDGE_DISABLE_SECRET_SCAN |
unset | Explicitly bypass filename preflight |
CODEX_MCP_BRIDGE_DEBUG |
unset | Emit local diagnostic errors and Codex stderr |
The old CODEX_GPT_BRIDGE_* variable prefix is accepted temporarily for upstream compatibility.
ChatGPT setup
Upstream
This repository is derived from DeepCogNeural/codex-gpt-bridge under the MIT License. See UPSTREAM.md for the scope of this fork.
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.
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.
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.
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.