tmcproxy
Bridges OpenAI's Secure MCP Tunnel to legacy stdio MCP servers by answering server/discover requests that older servers don't support.
README
tmcproxy
Minimal MCP stdio compatibility proxy that bridges OpenAI Secure MCP Tunnel / ChatGPT connectors to legacy stdio MCP servers.
The problem this solves
ChatGPT connectors (via OpenAI Secure MCP Tunnel) probe stdio MCP servers with server/discover — a method introduced in MCP 2026-07-28. Legacy servers like codex mcp-server and local-mcp mcp only speak 2025-06-18 and return method not found for server/discover, causing connector creation to fail.
tmcproxy sits in between, answers server/discover on the downstream's behalf, and forwards every other request verbatim.
ChatGPT → tunnel-client → tmcproxy → codex mcp-server (or local-mcp mcp)
↑
answers server/discover here,
forwards everything else straight through
Requirements
- Node.js >= 23.6.0 (for native TypeScript strip-mode execution — no build step needed)
Usage
Standalone
node src/tmcproxy.ts -- codex mcp-server
node src/tmcproxy.ts -- local-mcp mcp
Or via environment variable:
TMCPROXY_DOWNSTREAM="codex mcp-server" node src/tmcproxy.ts
With tunnel-client
Edit your tunnel-client profile YAML (e.g. ~/.config/tunnel-client/<profile>.yaml):
mcp:
commands:
- channel: main
command: "node /path/to/tmcproxy/src/tmcproxy.ts -- codex mcp-server"
Then:
tunnel-client run --profile <profile>
Switching downstreams is just changing the command after --:
command: "node /path/to/tmcproxy/src/tmcproxy.ts -- local-mcp mcp"
How it works
| Request | Behavior |
|---|---|
server/discover |
Proxy answers with a spec-shaped DiscoverResult. Capabilities are probed from the downstream via tools/list (not guessed). |
initialize |
Forwarded verbatim to downstream. The proxy never calls initialize itself — codex mcp-server allows it exactly once, so the client's handshake must be the one that reaches it. |
tools/list, tools/call, ping, etc. |
Forwarded verbatim with JSON-RPC id preserved. |
| Notifications (no id) | Forwarded; no response expected. |
| Malformed JSON | -32700 Parse error returned to upstream, not forwarded. |
| Unknown method | Forwarded; downstream error flows back. |
Why supportedVersions includes 2026-07-28
ChatGPT probes with 2026-07-28. If the response only lists 2025-06-18, ChatGPT treats it as "requested version not supported" and retries indefinitely — never reaching initialize or tools/list. By listing 2026-07-28, ChatGPT enters modern mode and sends stateless requests (tools/list, tools/call) directly. The legacy downstream answers these without a prior initialize (confirmed for both codex mcp-server and local-mcp mcp), so transparent forwarding works.
Debugging
Debug log
Set TMCPROXY_DEBUG=1 to log server/discover requests and responses to stderr:
TMCPROXY_DEBUG=1 tunnel-client run --profile local-codex
Output on stderr (stdout stays clean — it's the MCP channel):
[tmcproxy] downstream: ["codex","mcp-server"]
[tmcproxy] discover request: {"jsonrpc":"2.0","id":"openai-mcp-discover",...}
[tmcproxy] discover response: {"resultType":"complete","supportedVersions":["2026-07-28","2025-06-18"],...}
Local end-to-end test (no API key needed)
tunnel-client dev proxy runs a local in-memory control plane that reproduces the same MCP probe flow ChatGPT uses:
tunnel-client dev proxy \
--mcp-command "command=node /path/to/tmcproxy/src/tmcproxy.ts -- codex mcp-server,channel=main" \
--url-file /tmp/url.json \
--duration 30s
MCP_URL=$(node -e "console.log(JSON.parse(require('fs').readFileSync('/tmp/url.json','utf8')).mcp_url)")
curl -sS -X POST "$MCP_URL" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-H 'MCP-Protocol-Version: 2026-07-28' \
-H 'Mcp-Method: server/discover' \
-d '{"jsonrpc":"2.0","id":1,"method":"server/discover","params":{"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28"}}}'
Baseline comparison
To confirm the proxy is needed, run the downstream directly through dev proxy and observe the server/discover failure:
tunnel-client dev proxy \
--mcp-command "command=codex mcp-server,channel=main" \
--url-file /tmp/url.json --duration 30s
# server/discover → -32601 method not found
Tests
pnpm install
pnpm test # unit + integration
pnpm test:unit # mock downstream only
pnpm test:integration # real codex / local-mcp (auto-skipped if not installed)
pnpm typecheck
Unit tests use a mock downstream (test/fixtures/mock-downstream.js) and cover: discover response shape, capability probing, initialize forwarding, tools/list, tools/call id preservation, ping, unknown methods, malformed JSON, notifications, stderr mirroring, downstream exit handling, and stdout leak detection.
Integration tests spawn the real codex mcp-server and local-mcp mcp binaries if available on PATH.
Security
- Diagnostics go to stderr only; stdout is reserved for MCP traffic.
- No credentials, API keys, or secrets are logged.
- Downstream is spawned via argv (no shell).
- Only
server/discoveris handled by the proxy; all other requests pass through unchanged. - The proxy does not expand the downstream's permissions.
License
Apache-2.0
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。