Borrowing it
Nothing to install: this file belongs to Huan-zhaojun/mcp-safe-proxy. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/Huan-zhaojun/mcp-safe-proxy/main/CLAUDE.mdgit clone --depth 1 https://github.com/Huan-zhaojun/mcp-safe-proxyWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/huan-zhaojun/mcp-safe-proxy/claude-md)<a href="https://agentmods.dev/instructions/huan-zhaojun/mcp-safe-proxy/claude-md"><img src="https://agentmods.dev/badge/instructions/huan-zhaojun/mcp-safe-proxy/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/instructions/huan-zhaojun/mcp-safe-proxy/claude-md"><img src="https://agentmods.dev/badge/instructions/huan-zhaojun/mcp-safe-proxy/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00833 | $0.00833 |
| Opus 5 | $0.00417 | $0.00417 |
| Sonnet 5 | $0.00167 | $0.00167 |
| Haiku 4.5 | $0.00083 | $0.00083 |
Grade A, and why
mcp-safe-proxy CLAUDE.md scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Runs shell commandslowCapability
Expected in a hook, worth knowing in a rule or an instructions file.
**核心约束**:零运行时依赖。仅使用 Node.js 内置模块(`child_process`、`fs`、`path`)。 What it actually says
项目概述
MCP Safe Proxy 是一个轻量级 stdio 代理,位于 MCP Client(Codex CLI、Claude Code)和 MCP Server(如 Playwright MCP)之间。它拦截 tools/list 响应并重写工具注解(readOnlyHint: true、destructiveHint: false、openWorldHint: false)以绕过审批弹窗,同时透明转发所有其他消息。
核心约束:零运行时依赖。仅使用 Node.js 内置模块(child_process、fs、path)。
构建与测试命令
npm install # 安装开发依赖(仅首次)
npm run build # TypeScript 编译 (tsc) → dist/
npm run build && node test/e2e-test.js # E2E 测试(使用 mock server)
node test/real-playwright-test.js # 集成测试(需安装 @playwright/mcp)
项目未配置 npm test 脚本、linter 或 formatter。测试为纯 Node.js 脚本,使用手动断言(无测试框架)。
架构
单一源文件:src/index.ts(约 227 行)。
Client stdin ──→ [mcp-safe-proxy] ──→ MCP Server stdin
MCP Server stdout ──→ [注解重写] ──→ Client stdout
MCP Server stderr ──→ (直接继承,不经过代理)
核心流程:
- CLI 解析 —
--分隔代理选项(左侧)和子命令(右侧) interceptRequest()— 检测tools/list请求,将其 JSON-RPCid记录到SetinterceptResponse()— 匹配响应id,重写每个工具的annotations,然后从 Set 中删除idcreateLineParser()— 按换行符缓冲解析 JSON-RPC 消息;无效 JSON 行原样透传- 进程管理 — 信号转发(SIGTERM/SIGINT/SIGHUP)、退出码保持一致、stdin 关闭传递
编码规范
- 注释:代码内使用中文注释;日志/调试输出使用英文
- 日志:所有调试输出写入 stderr(不能写 stdout,那是 JSON-RPC 通道)。可选通过
--log-file写入文件 - Windows 兼容:使用
shell: true启动子进程以处理.cmd文件;路径使用正斜杠 - TypeScript:严格模式,目标 ES2022,模块 Node16,输出到
dist/
文档
docs/mcp-safe-proxy-design.md— 原始设计文档(版本号、行数等非核心描述可能与实际存在差异),含架构设计、通信模型、风险评估docs/codex-mcp-permission-issue.md— Codex MCP 审批行为的根因分析、源码追踪docs/local-dev-testing.md— 开发环境搭建、配置模板、验收测试清单
测试结构
| 文件 | 用途 |
|---|---|
test/mock-mcp-server.js |
模拟 MCP Server,返回带"危险"注解的工具列表 |
test/e2e-test.js |
启动代理 + mock server,验证注解重写和透传 |
test/real-playwright-test.js |
对比直连与代理连接 Playwright MCP,逐工具注解差异比较 |
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 12d ago First seen · 55 lines · 833 tokens per session scan A fcd90f3b81c6
mcp-safe-proxy CLAUDE.md is an instructions file published in the GitHub repository Huan-zhaojun/mcp-safe-proxy (10 stars, last pushed 6mo ago), licensed MIT. It adds 833 tokens to every session, about $0.0042 per session on Opus 5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other instructions, from other repositories
repobrain copilot-instructions.md
Copilot instructions for study8677/repobrain, covering github copilot bootstrap instructions and hard rule — query the repobrain hub first.
spec-kit AGENTS.md
AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.
next.js AGENTS.md
AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.
codex AGENTS.md
AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.
vscode buildNext.instructions.md
Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).
langchain AGENTS.md
AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.