codex-from-chatgpt
Enables control of a local OpenAI Codex agent, allowing users to start and continue coding tasks, inspect diffs and command output, and respond to approval requests within a workspace.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@codex-from-chatgptrefactor the login function to use async/await"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
codex-from-chatgpt
Use your local Codex from ChatGPT. This project is a personal, single-user MCP
bridge: ChatGPT sends an instruction, the local service translates it into a
codex app-server --stdio thread, and returns a compact summary of what Codex
did.
Community project, not official: this is not an official OpenAI or ChatGPT integration.
The product boundary is deliberately small:
ChatGPT (through a Secure MCP Tunnel)
-> MCP Streamable HTTP (/mcp)
-> compact job API
-> codex app-server --stdio (JSONL)
-> local CodexIt does not use codex mcp-server, does not expose shell or filesystem as MCP
tools, and implements no broker, worker farm, multi-agent orchestration, or
external storage.
Requirements
Node.js 20 or later.
codex-cli 0.147.0on yourPATH, installed and authenticated locally.A workspace directory under the allowed administrative root. That root defaults to
~/workspaceand must exist:mkdir -p ~/workspaceAn OpenAI Platform account that can create tunnels, and a ChatGPT workspace where you can enable developer mode (see Plan availability).
Check your local Codex before wiring anything up:
codex --versionRelated MCP server: codex-mcp-server
Setup overview
The full path from a clean clone to a working Codex job:
clone -> install -> configure -> run locally
-> install tunnel-client -> configure tunnel -> doctor -> run tunnel
-> connect in ChatGPT -> verify tools -> first Codex jobEach step below corresponds to one stage of that sequence.
1. Clone, install, run locally
git clone https://github.com/joseanu/codex-from-chatgpt.git
cd codex-from-chatgpt
npm install
npm run build
npm startThe process listens on loopback only by default:
MCP:
http://127.0.0.1:8787/mcphealth:
http://127.0.0.1:8787/healthzreadiness:
http://127.0.0.1:8787/readyz
2. Verify the local service
In a second terminal, confirm both the service and the Codex app-server are up.
/readyz returns 503 until the app-server has initialized:
curl -fsS http://127.0.0.1:8787/healthz
curl -fsS http://127.0.0.1:8787/readyzTo use a different administrative root or port:
CODEX_WORKSPACE_ROOT=/absolute/path/to/workspaces PORT=8787 npm startLeave this process running. Everything below assumes it is up.
3. Install tunnel-client
ChatGPT does not connect directly to 127.0.0.1. OpenAI's supported path for a
local MCP server is the Secure MCP Tunnel, run by
tunnel-client — a customer-run
agent that bridges a private or localhost MCP server to ChatGPT and Codex over
long-polling HTTPS, keeping the server off the public internet.
ChatGPT
-> OpenAI control plane
-> tunnel-client (on your machine)
-> http://127.0.0.1:8787/mcp
-> codex-from-chatgpt
-> codex app-server --stdioGet the binary from the OpenAI Platform under Tunnels, or from the
release archives. Docker
images are published at ghcr.io/openai/tunnel-client. To build from source:
go build -o bin/tunnel-client ./cmd/clientOpenAI recommends starting with the built-in guide:
tunnel-client help quickstartCredentials, and where each one comes from
Credential | Env var | Used for | Where to create it |
Tunnel ID |
| Identifies your tunnel. Format: | Platform → Tunnels, or |
Runtime API key |
| The credential the daemon and | Platform → API keys |
Admin API key |
| Only for | Platform → Admin keys |
Do not use the admin key as the daemon credential — OpenAI's docs call this
out explicitly. CONTROL_PLANE_API_KEY is the preferred variable;
OPENAI_API_KEY is only a fallback when it is unset.
4. Configure the tunnel
Export the two runtime values:
export CONTROL_PLANE_API_KEY="sk-..."
export CONTROL_PLANE_TUNNEL_ID="tunnel_0123456789abcdef0123456789abcdef"This project is an HTTP MCP server that is already running, so initialize from
the remote-HTTP sample and bind the main channel to its local URL:
tunnel-client init --sample sample_mcp_remote_no_auth \
--profile codex-from-chatgpt \
--tunnel-id "$CONTROL_PLANE_TUNNEL_ID" \
--mcp-server-url http://127.0.0.1:8787/mcpThe resulting profile is YAML, and the main channel is required:
config_version: 1
control_plane:
tunnel_id: tunnel_0123456789abcdef0123456789abcdef
api_key: env:CONTROL_PLANE_API_KEY
base_url: https://api.openai.com
mcp:
server_urls:
- channel: main
url: http://127.0.0.1:8787/mcpProfiles are discovered under $XDG_CONFIG_HOME/tunnel-client or
~/.config/tunnel-client; a single config file can also be passed with
--config or TUNNEL_CLIENT_CONFIG.
5. Doctor, then run the tunnel
Validate before starting the daemon:
tunnel-client doctor --profile codex-from-chatgpt --explainThen run it in the foreground, in its own terminal:
tunnel-client run --profile codex-from-chatgptHost header:
/mcpvalidates theHostheader against the configuredHOST:PORTand rejects anything else with403(see Security and limits). If your tunnel forwards its own hostname instead of the loopback upstream, add it withCODEX_AGENT_ALLOWED_HOSTSand restart this service.
6. Connect it in ChatGPT
Full MCP connectors live behind developer mode. An admin or owner enables it in
Workspace Settings → Permissions & Roles → Connected Data → Developer mode /
Create custom MCP connectors. Then create the custom MCP app pointing at your
tunnel, let ChatGPT scan the tools, and enable it for your chats. Do not enter a
127.0.0.1 URL in ChatGPT — it cannot reach it.
Plan availability
Full MCP support including write actions is in beta for ChatGPT Business, Enterprise, and Edu on ChatGPT web. Pro users can build apps with the Apps SDK and use custom apps in deep research, but for read/fetch actions only.
This matters here: the five tools below are not read-only — they start Codex turns that run commands and change files. On a plan limited to read/fetch, this bridge will not work as intended. This project promises no universal support; only the capabilities your connected ChatGPT environment exposes will be available.
7. Verify the tools
After the scan, ChatGPT should list exactly five tools: codex_start,
codex_get, codex_continue, codex_interrupt, and codex_respond_approval.
If they are missing, re-check tunnel-client doctor and /readyz before
touching anything in ChatGPT.
8. First Codex job
Ask for something read-only first, with an absolute workspace path under the allowed root:
Use codex_start in the workspace "/Users/you/workspace/my-project"
to inspect the git status without modifying any files. Give me the job_id,
then check the result with codex_get.The normal flow is:
codex_startcreates the persistent thread and begins the first turn.codex_getreturns the compact job snapshot.When a turn finishes,
codex_continuesends the next instruction to the same thread.If Codex asks for an approval,
codex_respond_approvalanswers it using the exactrequest_idfrompending_approvals.codex_interruptstops an active turn when needed.
MCP tools
The public surface is exactly this:
Tool | Schema | Semantics |
|
| Validates the workspace, creates a persistent thread, starts a turn. |
|
| Returns a compact job summary. |
|
| Reuses the same thread and starts another turn once the previous one ended. |
|
| Runs |
|
| Answers one specific app-server approval. |
codex_get returns status, job_id, thread_id, turn_id,
final_message, latest_diff, files_changed, commands_executed, error,
pending_approvals, and — for compatibility — pending_approval as an alias
for the first approval. It never returns the raw JSONL stream.
Approvals accept only the values and objects defined by the installed protocol
for command execution, file changes, permissions, and legacy approvals.
request_id is mandatory: two approvals can be pending at once, and one is
never answered by position or by "the last one received".
Lifecycle, persistence, and recovery
States are starting, running, awaiting_approval, interrupting,
completed, interrupted, failed, and recovery_required.
v0.2 allows a single active turn per process/app-server. A concurrent start
or continue returns a semantic backend-busy error; interrupt remains
available for the active turn. A process failure or a timeout with an uncertain
outcome leaves the job in recovery_required — never in an invented
completed.
The minimal job_id → thread_id index, workspace, last turn, and summary are
written atomically to a local file. Its location can be set with
CODEX_AGENT_STATE_FILE. Its contents may include final messages, diffs,
files, commands, and errors, so treat it as potentially sensitive.
On app-server initialization, persisted jobs are rehydrated via thread/read
and, where applicable, thread/resume. If the state cannot be proven, the job
stays in recovery_required rather than silently becoming completed.
Security and limits
The service binds to
127.0.0.1by default./mcpvalidates theHostheader against the configuredHOST:PORTand answers403to anything else. This closes DNS rebinding: a website the user visits cannot resolve its own domain to127.0.0.1and talk to the local service. Add extra hostnames withCODEX_AGENT_ALLOWED_HOSTSif the tunnel rewritesHost.The workspace must be absolute, existing, and under the allowed root.
NUL bytes,
..segments, invalid roots, and symlink escapes afterrealpathare rejected.The remote client cannot choose
config, model, sandbox, or permissions; environment overrides are administrative and local to the process.These tools are not read-only. Review Codex approvals before accepting commands, file changes, or permissions.
Non-loopback binds require the explicit opt-in
CODEX_AGENT_ALLOW_NON_LOOPBACK=1, and only when a tunnel covers the whole transport. The tunnel is not part of this repository.
Administrative configuration
HOSTandPORT: default127.0.0.1:8787.CODEX_AGENT_ALLOW_NON_LOOPBACK=1: permits a non-loopback bind, only with equivalent external protection.CODEX_AGENT_ALLOWED_HOSTS: comma-separated extra hostnames accepted in theHostheader on/mcp. Only needed if the tunnel forwards its ownHostinstead of the loopback upstream.CODEX_BIN: local binary; defaults tocodex.CODEX_RPC_TIMEOUT_MS: generic RPC timeout; defaults to30000ms.CODEX_SHUTDOWN_TIMEOUT_MS: graceful shutdown wait; defaults to2000ms.CODEX_AGENT_STATE_FILE: optional state JSON location.CODEX_WORKSPACE_ROOT: optional administrative root; defaults to~/workspace. Must be an existing absolute path.CODEX_AGENT_MODELandCODEX_AGENT_REASONING_EFFORT: optional local overrides; without them Codex uses its own local configuration.
Protocol compatibility
The implementation is pinned against the observed protocol of
codex-cli 0.147.0, app-server v2. The installed binary is the authority:
OpenAI/Codex can change independently of your local CLI.
The client uses initialize → initialized, bidirectional JSONL, and the
required RPCs thread/start, thread/resume, thread/list, thread/read,
turn/start, and turn/interrupt, plus server-initiated approvals.
The generated TypeScript bindings in protocol/codex-0.147.0-ts/ are tracked
because the code imports them for build-time type safety.
The JSON schemas are not tracked — nothing in the runtime or the build consumes them, so the repository does not carry hundreds of derived files. If you want them as a protocol reference, generate them against your installed binary:
codex app-server generate-json-schema --out protocol/codex-0.147.0-json-schemaThat directory is in .gitignore. To move the pin to another version, install
and verify the new CLI and regenerate the bindings:
codex app-server generate-ts --out protocol/codex-<version>-tsThen review imports, approvals, and tests against the installed binary.
Local validation
npm run typecheck
npm test
npm run build
git diff --checkThe optional integration test against the installed binary:
CODEX_REAL_APP_SERVER=1 npm test -- --test-name-pattern='installed codex'Built using itself
codex-from-chatgpt was built and validated through the same loop it exposes:
ChatGPT coordinated tasks over MCP, the bridge created local Codex threads, and
the app-server returned snapshots to review the result. That loop was used for
the implementation, follow-ups, independent reviews, and for answering Codex
approvals.
It also works for maintaining the project:
Use
codex_startto investigate a change and its risks.Use
codex_continueto implement or fix one concrete part.Use
codex_getto review the diff, files, commands, errors, and pending approvals.Use
codex_respond_approvalto answer specific approvals via their exactrequest_id.Run independent reviews, then
npm run typecheck,npm test, andgit diff --checkbefore calling a change done.
The idea is that the bridge is both the development tool and the artifact that documents how it is used.
Documentation and sources
Official OpenAI documentation this project is built against:
Everything outside those interfaces — the job model, the compact snapshot, the
approval routing by request_id, the recovery semantics, and the workspace
validation — is this project's own design.
License
MIT. See LICENSE.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseCqualityBmaintenanceBridges MCP clients with local Codex CLI to execute autonomous coding tasks, manage threads, and inspect history via SQLite state.139804Apache 2.0
- AlicenseBqualityDmaintenanceAn open-source MCP server that connects your IDE or AI assistant to the Codex CLI, enabling non-interactive automation with codex exec, safe sandboxed edits with approvals, and large-scale code analysis via @ file references.815MIT
- Alicense-qualityBmaintenanceLocal MCP bridge enabling ChatGPT web to access approved local files and execute tasks via local Codex.1MIT
- Flicense-qualityBmaintenanceA self-hosted MCP server that lets claude.ai delegate tasks to OpenAI Codex CLI, billed through the ChatGPT subscription, with tools for job submission, status polling, and result retrieval.
Related MCP Connectors
A paid remote MCP for OpenAI Codex agent coordination MCP, built to return verdicts, receipts, usage
Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer
Search your AI chat history (ChatGPT, Claude, Codex) from any MCP client. Remote, private, read-only
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/joseanu/codex-from-chatgpt'
If you have feedback or need assistance with the MCP directory API, please join our Discord server