codex-mcp
Provides a local coding MCP server for ChatGPT (OpenAI), offering tools for reading/writing/editing files, executing commands, searching code, and fetching web pages within a bound project directory.
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-mcpSearch for 'FIXME' in the project and list matches"
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-mcp
精简的本机 Coding MCP 服务:通过 Streamable HTTP 把本地项目目录暴露给 ChatGPT(Developer Mode),无需 OAuth / 密码页。
适合个人开发:在终端运行 codex-mcp,选择项目目录后即可在 ChatGPT 里读改代码、跑命令、搜文件。可选集成 Cloudflare Tunnel,一条命令同时起本机服务与公网入口。
功能
单项目绑定:启动前选择 project root(回车 = 当前目录)
Cloudflare Tunnel(可选):首次交互配置域名与
cloudflared;之后自动tunnel run(日志写入~/.codex-mcp/logs/,默认不刷屏)文件与搜索:
read/write/edit,以及grep/glob/ls命令执行:短命令用
bash;长任务用exec_command+write_stdin/process_kill(Codex 风格进程会话)网页拉取:
webfetch(http/https → text / markdown / html)下游 MCP 网关(可选):在
~/.codex-mcp/mcp.json配置其它 MCP;instructions 只平铺各 server 简介,具体工具通过mcp_tools/mcp_call按需列出与调用MCP Apps 摘要卡片:工具结果挂
ui://codex-mcp/tool-card.html,只展示状态 / 路径 / 计数 / 最多 120 字预览,不渲染完整文件或命令输出
工具 | 说明 |
| 读写与精确替换(路径相对 project root) |
| 短命令前台执行(Windows: |
| 长时间命令可返回 |
| 向 |
| 按 |
| 搜索与列目录 |
| 拉取 http(s) 页面 |
| 列出某个下游 MCP 的 tools(含描述 / schema) |
| 调用某个下游 MCP 的某个 tool |
返回格式遵循 OpenAI MCP server 文档:content 为短摘要,structuredContent 为结构化数据(并声明 outputSchema)。
Related MCP server: codex-web-bridge
要求
Node.js
>= 22使用隧道时需要 cloudflared(Windows 可放到仓库
bin/cloudflared.exe,该路径已在.gitignore)建议安装 ripgrep(
grep更快;未安装时自动 Node 回退)
安装(本机全局命令)
本项目不发布到 npm。在仓库内构建后把 codex-mcp 放到 PATH:
Windows (PowerShell):
cd D:\path\to\codex-mcp
npm install
pwsh -File scripts\install.ps1
# 新开一个终端后:
codex-mcp --helpmacOS / Linux:
cd /path/to/codex-mcp
npm install
npm run build
npm link日常使用
cd D:\work\my-app
codex-mcp未配置时会进入向导;已配置后启动时确认 project root 即可(回车使用当前目录)。
在 ChatGPT 中添加 MCP URL:https://<你的域名>/mcp
常用命令
命令 | 说明 |
| 默认 serve(交互选 root;按配置决定是否起隧道) |
| 重新跑域名 / cloudflared 配置向导 |
| 不起 cloudflared(仍可用已配置的域名做 Host 校验) |
仓库内开发:
npm run dev # tsx src/cli.ts(可交互;首次配置请用这个)
npm run dev:watch # tsx watch(会干扰 stdin,勿用于首次向导)
npm start # node dist/cli.js(需先 npm run build)本地调试可用 MCP Inspector 连接 http://127.0.0.1:3920/mcp。
用户配置
机器级配置:~/.codex-mcp/config.json(Windows:%USERPROFILE%\.codex-mcp\config.json)。
{
"host": "127.0.0.1",
"port": 3920,
"domain": "mcp.example.com",
"useCloudflared": true,
"cloudflaredBin": "D:\\path\\to\\codex-mcp\\bin\\cloudflared.exe",
"tunnelName": "codex-mcp",
"tunnelId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}字段 | 说明 |
| 公网 Host(可由向导写入) |
|
|
| cloudflared 可执行文件路径。Windows 常不在 PATH,建议填写;macOS/Linux 可省略走 PATH |
| 由向导写入;用于 |
| 本机监听地址(默认 |
相关文件:
隧道日志:
~/.codex-mcp/logs/tunnel.logcloudflared 配置:
~/.cloudflared/config.yml(向导生成/更新;ingress 指向本机host:port)下游 MCP:
~/.codex-mcp/mcp.json(可选;见下)
DNS 路由:向导会先尝试创建记录;若域名已存在但未指向当前 tunnel,会自动 --overwrite-dns,避免重建 tunnel 后出现公网 502/530。
下游 MCP(mcp.json)
可选。不写此文件时行为与原来一致。写法对齐常见 MCP 客户端:
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_xxx"
}
},
"remote-demo": {
"url": "https://example.com/mcp",
"headers": {
"Authorization": "Bearer xxx"
}
}
}
}字段 | 说明 |
| stdio 启动(与 Cursor 类似) |
| Streamable HTTP 远程 MCP(与 |
|
|
启动时会对每个下游 MCP 做 initialize,用其 instructions(首行)或 server title/name 作为顶层简介写入 ChatGPT instructions——不必在 mcp.json 里手写 description。
ChatGPT 侧不会看到下游每个 tool;只会看到 server 名 + 上述简介。按需 mcp_tools(同一对话可复用)再 mcp_call。改 mcp.json 后重启 codex-mcp,并刷新 ChatGPT connector。
接入 ChatGPT
跑通
codex-mcp(含隧道)后,复制 banner 上的https://<domain>/mcpChatGPT → Settings → Apps / Developer Mode → 添加 MCP server URL
无需 Owner 密码;工具声明为
noauth连接后走 MCP
initialize,读取instructions(含 project root)与tools/list。改工具后请刷新 connector 或开新对话
安全
无认证。 知道 URL 的人即可读写你的 project root、执行命令。
仅用于个人受控隧道;不要把端口直接暴露到公网。
路径访问限制在绑定的 project root 内;写操作带进程内锁。这不能替代网络层访问控制。
开发
npm run typecheck
npm test
npm run buildnpm test 在进程内启动 MCP HTTP 服务,用官方 SDK 的 MCP Client + StreamableHTTPClientTransport 做端到端校验。
架构
cli → (tunnel wizard / cloudflared sidecar)
→ DownstreamMcpHub (optional ~/.codex-mcp/mcp.json)
→ http-server (Streamable HTTP /mcp)
→ mcp-server (instructions = project root + workflow + MCP blurbs)
→ tools/* + ProjectContext (path guard + write lock)
→ mcp_tools / mcp_call → DownstreamMcpHubLicense
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
- Alicense-qualityBmaintenanceA lightweight, stdio-based MCP server enabling AI assistants to perform local file system operations like reading, writing, searching, and executing commands.Last updated5,748MIT
- Alicense-qualityCmaintenanceLocal MCP server bridging ChatGPT Web to local tools for file, shell, git, test, and process management with secure policy controls.Last updatedMIT
- Alicense-qualityCmaintenanceA lightweight MCP server for file manipulation, code searching, and shell command execution, with optional semantic search using local embeddings.Last updated1MIT
- Flicense-qualityBmaintenanceZero-dependency MCP server that provides AI models with secure read/write/exec access to local files and directories over HTTP and SSE, designed to be tunneled via ngrok for integration with Claude Web.Last updated
Related MCP Connectors
Agent-native MCP server over the public saagarpatel.dev corpus. Read-only, stateless.
Search your AI chat history (ChatGPT, Claude, Codex) from any MCP client. Remote, private, read-only
An MCP server that gives your AI access to the source code and docs of all public github repos
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/meesii/codex-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server