Skip to main content
Glama
menaje

codex-mcp-bridge

by menaje

codex-mcp-bridge

在 ChatGPT 与官方本地 Codex MCP 服务器之间提供一个小型策略层。

ChatGPT
  -> OpenAI Secure MCP Tunnel
  -> codex-mcp-bridge (loopback HTTP)
  -> codex mcp-server (stdio)
  -> one explicitly allowed repository

官方 Codex MCP 服务器已经提供 codexcodex-reply。该桥接层刻意只增加 ChatGPT 日常更安全使用所需的控制项:

  • bridge_status:检查当前生效的策略。

  • codex_read:强制使用只读 Codex 会话。

  • codex_run:启动受策略限制的读取或写入会话。

  • codex_reply:仅继续通过此桥接层创建的线程。

  • codex_job_status:获取长时间运行任务的结果。

安全默认值

  • 绑定到 127.0.0.1

  • 除非显式配置根目录,否则只允许一个当前工作目录。

  • 使用 read-only Codex 沙盒。

  • 使用 on-request 审批策略。

  • 决不暴露 danger-full-access

  • 除非桥接层所有者启动写入配置,否则阻止工作区写入。

  • 拒绝配置的真实路径根目录之外的路径。

  • 拒绝包含常见机密文件名的仓库,除非所有者显式禁用预检查。

  • 限制提示长度和并发 Codex 任务数。

  • 抑制上游 Codex stderr,除非启用本地调试日志。

这些控制是策略层,不是 OS 级隔离。若需要强隔离,请使用暂存副本、容器、虚拟机或独立的 OS 用户。

Related MCP server: mcp-governance-proxy

先决条件

  • Node.js 20 或更高版本;推荐 Node.js 22。

  • 已安装并完成认证的 Codex CLI,且提供 codex mcp-server

  • ChatGPT 访问需要 tunnel-client 和 OpenAI Secure MCP Tunnel。

官方参考:

安装

npm ci
npm run check

本地冒烟测试

本地模式不会创建公共端点:

npm run bridge:local -- --root /absolute/path/to/repository

MCP 端点是 http://127.0.0.1:8876/mcp,健康检查端点是 http://127.0.0.1:8876/healthz

Secure MCP Tunnel

在 OpenAI Platform 中创建隧道,然后在本仓库之外提供其运行时凭据:

export CONTROL_PLANE_API_KEY="<runtime-key>"
export CONTROL_PLANE_TUNNEL_ID="tunnel_..."

npm run bridge:secure -- --root /absolute/path/to/repository

启动器会构建桥接层,在环回地址上启动它,初始化 tunnel 配置文件,运行 tunnel-client doctor,并保持 tunnel 客户端运行。

对于有意的写入会话:

npm run bridge:secure -- --root /absolute/path/to/repository --write

不需要写入配置时,不要让它一直运行。

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

仅在有意进行写入会话时使用 bridge:secure:write:keychain

配置

变量

默认值

用途

CODEX_MCP_BRIDGE_ROOTS

当前目录

允许的绝对根目录,以逗号分隔

CODEX_MCP_BRIDGE_DEFAULT_SANDBOX

read-only

read-onlyworkspace-write

CODEX_MCP_BRIDGE_ALLOW_WRITE

未设置

必须先设为 1,才接受写模式

CODEX_MCP_BRIDGE_APPROVAL_POLICY

on-request

on-requestuntrusted

CODEX_MCP_BRIDGE_MAX_CONCURRENT_JOBS

2

最大活跃 Codex 调用数

CODEX_MCP_BRIDGE_MAX_PROMPT_CHARS

50000

每次工具调用的最大提示长度

CODEX_MCP_BRIDGE_UPSTREAM_TIMEOUT_MS

180000

Codex MCP 调用超时时间

CODEX_MCP_BRIDGE_FAST_RETURN_MS

25000

返回任务 ID 前的等待时间

CODEX_MCP_BRIDGE_JOB_TTL_MS

21600000

已完成任务的保留时长

CODEX_MCP_BRIDGE_DISABLE_SECRET_SCAN

未设置

显式绕过机密文件名预检查

CODEX_MCP_BRIDGE_DEBUG

未设置

输出本地诊断错误和 Codex stderr

为兼容上游,暂时接受旧的 CODEX_GPT_BRIDGE_* 变量前缀。

ChatGPT 配置

参见 docs/chatgpt-setup.md

上游

本仓库在 MIT License 下衍生自 DeepCogNeural/codex-gpt-bridge。本 fork 的范围参见 UPSTREAM.md

A
license - permissive license
Not graded
quality - not tested
B
maintenance

Maintenance

Maintainers
<1hResponse time
Release cycle
Releases (12mo)
Commit activity

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

  • A
    license
    Not graded
    quality
    C
    maintenance
    An MCP server that acts as a governance proxy for AI agents, evaluating each tool call against policies before execution, enabling secure and controlled access to systems like Slack, GitHub, and AWS without exposing credentials to the agent.
    Apache 2.0
  • F
    license
    Not graded
    quality
    C
    maintenance
    A local MCP server that provides controlled repository access with policy-based file filtering, secret redaction, and audit logging for AI coding agents.
  • A
    license
    Not graded
    quality
    B
    maintenance
    A secure MCP server that connects ChatGPT/Codex to a local Obsidian Vault, enabling controlled knowledge retrieval, note maintenance, and daily ingest while enforcing path policies, concurrency checks, and audit.
    MIT

View all related MCP servers

Related MCP Connectors

  • A paid remote MCP for OpenAI Codex agent coordination MCP, built to return verdicts, receipts, usage

  • A paid remote MCP for OpenAI Codex memory MCP, built to return verdicts, receipts, usage logs, and a

  • Remote MCP for Copilot CLI switch gate MCP, structured receipts, audit logs, and reviewer-ready evid

View all MCP Connectors

Latest Blog Posts

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/menaje/codex-mcp-bridge'

If you have feedback or need assistance with the MCP directory API, please join our Discord server