agents-mcp-gateway
Secure localhost MCP gateway that exposes project-scoped file/Git/search tools and controlled CLI agent adapters (Codex, Claude) with fixed argv for safe Windows-native agent work.
README
agents-mcp-gateway
Secure localhost MCP gateway for Windows-native local agent work.
Only one MCP server is exposed externally: agents-mcp-gateway at http://127.0.0.1:3333/mcp. Codex and Claude are no longer used as child MCP servers. Agent work runs through ordinary non-interactive CLI subprocesses with fixed argv from local config.
Architecture
ChatGPT
-> OpenAI Secure MCP Tunnel
-> http://127.0.0.1:3333/mcp
-> native bounded file/Git/search/check tools
-> codex CLI subprocess adapter
-> claude CLI subprocess adapter
Configuration
config/projects.yaml has two registries:
projects:
agents-mcp-gateway:
description: Gateway source tree
path: D:\Projects\agents-mcp-gateway
agents:
codex-readonly:
description: Codex CLI non-interactive read-only agent
adapter: codex
args: ["exec", "--json", "-s", "read-only", "-c", "approval_policy='never'"]
claude-readonly:
description: Claude Code non-interactive JSON agent
adapter: claude
args: ["-p", "--output-format", "json", "--permission-mode", "dontAsk"]
Remote MCP callers cannot pass command, args, env, model, cwd, or arbitrary filesystem paths for an agent. They can only choose a configured agent, provide a configured project_id, and send a prompt.
Public Agent Tools
list_projects()list_agents()create_task(project_id, agent, prompt) -> task_id, thread_idresume_thread(thread_id, prompt) -> task_idget_task(task_id)await_task(task_id, timeout_ms?)— wait up to 60 seconds for a terminal task state, defaulting to 30 seconds; if the timeout elapses, returns the latest task withwait_timed_out: truecancel_task(task_id)list_tasks(status?, limit?)get_thread(thread_id)list_threads(status?, limit?)close_thread(thread_id)
A task is one CLI subprocess execution. A thread stores the gateway thread ID, provider session ID, adapter, agent, and canonical cwd so later tasks can resume the provider conversation without accepting project_id or agent again.
Native Tools
Native file/Git/search tools remain project-scoped:
list_files(project_id, relative_path, depth)read_file(project_id, relative_path, start_line, end_line)search_code(project_id, query, glob, max_results)git_status(project_id)git_diff(project_id, base, max_chars)git_log(project_id, limit)run_check(project_id, check_id)
run_check does not accept arbitrary commands. It only runs detected package scripts named test, lint, typecheck/check, or build.
CLI Probe Findings
Codex 0.146.0-alpha.3.1:
- new session:
codex exec --json -C <cwd> ... <prompt> - JSONL event
thread.started.thread_idis the provider session ID - resume:
codex exec resume --json <thread_id> <prompt> - resume command must run with process cwd set to the original cwd;
resumehas no-C - fixture probe confirmed new session, remembered context, and cwd continuity
Claude Code 2.1.220:
- new session:
claude -p --output-format json ...with prompt on stdin - JSON result has
session_id - resume help exposes
--resume <session_id> - current provider probe returned a quota
429, so command shape andsession_idparsing are implemented, while semantic resume could not be completed in this run
Run
cd D:\Projects\agents-mcp-gateway
pnpm install
pnpm build
pnpm start
Doctor:
pnpm doctor
Tests:
pnpm test
Automatic Start
powershell -ExecutionPolicy Bypass -File scripts\install-task-scheduler.ps1
Remove:
powershell -ExecutionPolicy Bypass -File scripts\uninstall-task-scheduler.ps1
Security Notes
- Server binds only to
127.0.0.1. - No router port forwarding,
0.0.0.0, or public tunnel URL is used. - External access should go through OpenAI Secure MCP Tunnel only.
- Agent argv is fixed in local config.
- Environment is allowlisted.
- Sensitive files, credential folders,
.git,node_modules, browser session stores, symlink/junction escapes, UNC paths, URL paths, and project traversal are blocked.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。