codex-supervisor
A local MCP bridge that lets a compatible host start, monitor, steer, interrupt, resume, and approve Codex app-server work while enforcing repository-root security.
README
Codex Supervisor MCP
A local Model Context Protocol (MCP) bridge that lets a compatible host start, monitor, steer, interrupt, resume, and approve Codex app-server work.
It wraps codex app-server; it does not automate a terminal UI or scrape an IDE.
Capabilities
The server exposes these MCP tools:
| Tool | Purpose |
|---|---|
codex_start |
Start a new Codex thread and turn in an allowed repository. |
codex_send |
Send a new instruction after the active turn is idle. |
codex_steer |
Append guidance to the active turn. |
codex_status |
Read thread state, recent events, the latest agent message, diff, and pending requests. |
codex_wait |
Long-poll until completion, failure, interruption, or an approval request. |
codex_interrupt |
Interrupt an active turn. |
codex_list_threads |
List persisted threads inside configured roots. |
codex_read_thread |
Read a persisted authorized thread. |
codex_list_approvals |
Inspect pending app-server requests. |
codex_resolve_approval |
Accept or reject command-execution and file-change approvals. |
Requirements
- Node.js 22 or newer.
- A current Codex CLI available as
codex. - Codex CLI authentication already configured.
- One or more explicit local repository roots.
This project has no npm runtime dependencies.
Verify the package
npm test
The test suite uses a protocol-compatible mock app-server. It does not make model requests or require Codex authentication.
Install with the Codex CLI
Use the MCP server name codex-supervisor. The name must match
CODEX_SUPERVISOR_MCP_NAME; the bridge uses it to prevent the child
app-server from loading this same MCP server recursively.
macOS or Linux
codex mcp add codex-supervisor \
--env CODEX_ALLOWED_ROOTS="/Users/you/code:/Users/you/work" \
--env CODEX_SUPERVISOR_MCP_NAME="codex-supervisor" \
-- node "/absolute/path/to/codex-supervisor-mcp/src/index.mjs"
Use the platform path-list delimiter between roots. On macOS and Linux it is
a colon (:).
Windows PowerShell
codex mcp add codex-supervisor `
--env CODEX_ALLOWED_ROOTS="C:\src;D:\work" `
--env CODEX_SUPERVISOR_MCP_NAME="codex-supervisor" `
-- node "C:\absolute\path\to\codex-supervisor-mcp\src\index.mjs"
On Windows the path-list delimiter is a semicolon (;).
Confirm the registration:
codex mcp list
In Codex, type /mcp to inspect the connected server.
Install with config.toml
Copy and adapt examples/config.toml, then place its contents in
~/.codex/config.toml or a trusted project's .codex/config.toml.
Use absolute paths. Keep the server id and
CODEX_SUPERVISOR_MCP_NAME identical.
ChatGPT desktop or the Codex IDE extension
- Open Settings → MCP servers → Add server.
- Set the name to
codex-supervisor. - Select STDIO.
- Set the command to
node. - Add the absolute path to
src/index.mjsas the only argument. - Add
CODEX_ALLOWED_ROOTSandCODEX_SUPERVISOR_MCP_NAME=codex-supervisor. - Save and restart the host.
- Type
/mcpto verify the tools.
Local STDIO MCP servers are not loaded by ordinary ChatGPT web chats. Using this bridge from the web requires a separately deployed, authenticated remote MCP service or hosted plugin.
Typical workflow
Ask the MCP host to:
Use codex_start in /absolute/path/to/repository to implement the requested
change. Use workspaceWrite, keep network access disabled, wait for progress,
show me every approval request before resolving it, and report the final diff
and test result.
The host should follow this sequence:
codex_start -> codex_wait
approval request -> inspect -> codex_resolve_approval -> codex_wait
active correction -> codex_steer -> codex_wait
completed -> codex_status
later follow-up -> codex_send -> codex_wait
Every start/send/steer/interrupt call returns an eventCursor. Pass it as
afterSequence to codex_wait or codex_status to avoid replaying older
events.
approvalPolicy accepts the current app-server wire values on-request
(default) and untrusted. The legacy values onRequest and unlessTrusted
are accepted by the bridge and normalized before the app-server request.
Configuration
| Variable | Default | Meaning |
|---|---|---|
CODEX_ALLOWED_ROOTS |
Required | Repository roots separated by the platform path-list delimiter. |
CODEX_BIN |
codex |
Codex executable path. |
CODEX_SUPERVISOR_MCP_NAME |
codex-supervisor |
MCP config id disabled in the nested app-server to prevent recursion. |
CODEX_ALLOW_NETWORK |
0 |
Set to 1 to allow callers to request network access. |
CODEX_EVENT_LIMIT |
1000 |
In-memory event count, clamped to 100–10,000. |
CODEX_SUPERVISOR_DEBUG |
0 |
Set to 1 to copy Codex app-server stderr to this server's stderr. |
CODEX_APP_SERVER_ARGS |
Internal safe default | Advanced JSON array replacing every argument passed to codex. |
The default app-server arguments are equivalent to:
-c mcp_servers.<CODEX_SUPERVISOR_MCP_NAME>.enabled=false app-server
Overriding CODEX_APP_SERVER_ARGS removes that recursion guard. Include an
equivalent disable override yourself.
Security model
CODEX_ALLOWED_ROOTSis mandatory.- Paths are canonicalized with
realpath; symlink escapes are rejected. - Codex receives restricted read access to the selected repository and platform defaults.
workspaceWritelimits writable roots to the selected repository.dangerFullAccessis not exposed.- Network access requires both
CODEX_ALLOW_NETWORK=1andnetworkAccess: trueon a task. - The bridge has no generic, unsandboxed shell tool.
- Command and file-change approvals must be resolved explicitly.
- Threads outside allowed roots are denied or filtered.
- Event payloads are size-bounded before storage.
The child app-server still inherits the MCP server process environment and your broader Codex configuration. Audit environment secrets, apps, skills, hooks, and other configured MCP servers before using it with untrusted code.
Supported approval requests
This release resolves:
item/commandExecution/requestApprovalitem/fileChange/requestApproval
Other app-server requests remain visible through codex_status and
codex_list_approvals, but the bridge refuses to answer them. This prevents
a generic response endpoint from silently granting permissions or supplying
sensitive user input.
Persistence and monitoring
Codex owns persisted thread history. The bridge keeps streamed event buffers,
latest deltas, and pending request state in memory. Restarting the MCP server
clears that transient state, but codex_list_threads and
codex_read_thread can recover authorized persisted threads.
Development
npm test
node --check src/index.mjs
Project layout:
src/app-server-client.mjs Codex app-server JSONL client
src/approval-policy.mjs Approval-policy validation and legacy normalization
src/event-store.mjs Bounded event, turn, and approval state
src/security.mjs Repository-root policy
src/supervisor-service.mjs Codex lifecycle orchestration
src/tool-registry.mjs MCP tool schemas and validation
src/mcp-server.mjs Dual-era MCP STDIO transport
src/index.mjs Entrypoint
test/ Unit and integration tests
License
MIT
Codex App Server compatibility
Version 1.0.3 removes the deprecated readOnly.access and
workspaceWrite.readOnlyAccess fields from turn/start. Current Codex App
Server releases use permission profiles when a client needs custom restricted
read scopes. The supervisor continues to restrict writable roots to the selected
repository and validates every task directory against CODEX_ALLOWED_ROOTS.
Hostinger remote relay
Version 1.2.0 adds a Hostinger-compatible relay for ChatGPT remote MCP access:
ChatGPT -> OAuth bearer JWT -> Hostinger /mcp -> queued job -> outbound Windows local-agent -> Codex app-server
The public /mcp endpoint validates RS256 OAuth access tokens from an external
identity provider. The Windows local-agent uses separate HMAC credentials only
for outbound polling, status, lease acquisition, and result submission. The
Hostinger relay never starts Codex and never reads local repositories.
See docs/REMOTE_DEPLOYMENT.md for Hostinger hPanel
steps, DNS for mcp.biotele.mx, Auth0 setup, Microsoft Entra ID setup,
environment variables, local-agent installation, and the threat model.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。