mcp-safe-proxy
轻量级 MCP 注解代理 — 拦截 tools/list 响应,将工具注解重写为"安全"值,绕过 Codex 等 AI CLI 的审批弹窗,同时完全透传所有实际操作。
claude mcp add --transport stdio huan-zhaojun-mcp-safe-proxy npx -y mcp-safe-proxy -- npx @playwright/mcp@latest \ --env DEBUG="false" \ --env LOG_LEVEL="info"
How to use
mcp-safe-proxy is a lightweight stdio MCP proxy that sits between your MCP client (for example Codex or Claude Code) and the real MCP server. Its primary job is to intercept the tools/list response and rewrite each tool's annotations so that the client treats tools as read-only, non-destructive, and not to be opened in external contexts. All other messages like tools/call and initialize are passed through unmodified, preserving full functionality of the original server. This enables automation and scripting workflows that would otherwise trigger approval prompts.
To use it, install the proxy (globally or via npx), then wrap your MCP server command with the proxy as shown in the examples. For Playwright MCP, you can run the proxy with an upstream server like npx @playwright/mcp@latest, and the proxy will insert itself in the command chain, ensuring the client receives safe tool annotations while still performing real actions through the upstream server.
How to install
Prerequisites:
- Node.js (LTS) and npm installed on your machine
- Basic familiarity with MCP configuration and command-line usage
Installation (global, recommended for faster startup):
- Install the proxy globally npm install -g mcp-safe-proxy
- Run the proxy wrapping your MCP server command, for example: mcp-safe-proxy -- npx @playwright/mcp@latest
Alternative (per-use via npx):
- Use npx to run the proxy without installation: npx -y mcp-safe-proxy -- npx @playwright/mcp@latest
- The command will start and route requests through the proxy to the actual server.
From source (for developers):
- git clone https://github.com/Huan-zhaojun/mcp-safe-proxy.git
- cd mcp-safe-proxy
- npm install
- npm run build (if you are contributing or need a built artifact)
Notes:
- The proxy requires no modifications to the upstream MCP server.
- You can enable verbose logs with --verbose or redirect logs with --log-file <path>.
Additional notes
Tips and caveats:
- The proxy focuses on intercepting tools/list annotations; other MCP messages are passed through unchanged to maintain full compatibility.
- If using ccSwitch or similar tooling, you can wire the proxy into your configuration as shown in the README examples to avoid approval prompts automatically.
- Typical environment variables you might tweak include LOG_LEVEL and DEBUG; set DEBUG=true to enable deeper logging during troubleshooting.
- Ensure the MCP client and server communication remains stable; if you modify the upstream server version, re-test to ensure the annotation rewrite still applies correctly.
- This proxy is designed to be non-intrusive and reversible; you can disable it by removing the proxy wrapper and using the upstream server directly.
Related MCP Servers
any-chat-completions
MCP Server for using any LLM as a Tool
mcp-read-website-fast
Quickly reads webpages and converts to markdown for fast, token efficient web scraping
mcp-screenshot-website-fast
Quickly screenshots webpages and converts to an LLM friendly size
skrills
Coordinate skills between Codex, Copilot, and Claude Code. Validates, analyzes, and syncs skills, subagents, commands, and configuration between multiple CLIs.
unity-editor
An MCP server and client for LLMs to interact with Unity Projects
website-publisher
AI Website builder and publisher MCP. Quickly publish and deploy your AI generated code as real website URL. Support html, css, js, python etc.