mcp-safe-proxy: Instructions file for Claude Code

CLAUDE.md

mcp-safe-proxy CLAUDE.md is an instructions file for Claude Code from Huan-zhaojun/mcp-safe-proxy. It costs 833 tokens per session, scanned A, original, MIT.

Project instructions for MCP Safe Proxy, a small Node.js program placed between an AI coding client and an MCP server to adjust tool permission labels while forwarding messages.

In plain words
What is it for?
Use them to build, run end-to-end tests, run the Playwright integration test, and understand message handling, process signals, and logging.
Why use it?
They give contributors the project structure, commands, tests, and coding rules in one place, reducing guesswork when changing or checking the proxy.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: mentions Claude Code; mentions Codex.

This is Huan-zhaojun/mcp-safe-proxy's own configuration. It tells Claude Code how to work on mcp-safe-proxy itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything mcp-safe-proxy configures →

Reuse

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.

Copy the file
curl -O https://raw.githubusercontent.com/Huan-zhaojun/mcp-safe-proxy/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/Huan-zhaojun/mcp-safe-proxy

Made for: Claude Code.

Wrote 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.

agentmods badge for mcp-safe-proxy CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/huan-zhaojun/mcp-safe-proxy/claude-md/github.svg)](https://agentmods.dev/instructions/huan-zhaojun/mcp-safe-proxy/claude-md)
Your own site
<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.

agentmods 80×15 button for mcp-safe-proxy CLAUDE.md

Your own site · 80×15
<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>
Per session 833 This file is loaded in full into every session.
When invoked 833 The same file — it is already loaded in full.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce 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

Measured 12d ago against content hash fcd90f3b81c6, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

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`)。
CLAUDE.md · 55 lines

What it actually says

项目概述

MCP Safe Proxy 是一个轻量级 stdio 代理,位于 MCP Client(Codex CLI、Claude Code)和 MCP Server(如 Playwright MCP)之间。它拦截 tools/list 响应并重写工具注解(readOnlyHint: truedestructiveHint: falseopenWorldHint: false)以绕过审批弹窗,同时透明转发所有其他消息。

核心约束:零运行时依赖。仅使用 Node.js 内置模块(child_processfspath)。

构建与测试命令

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 ──→ (直接继承,不经过代理)

核心流程:

  1. CLI 解析-- 分隔代理选项(左侧)和子命令(右侧)
  2. interceptRequest() — 检测 tools/list 请求,将其 JSON-RPC id 记录到 Set
  3. interceptResponse() — 匹配响应 id,重写每个工具的 annotations,然后从 Set 中删除 id
  4. createLineParser() — 按换行符缓冲解析 JSON-RPC 消息;无效 JSON 行原样透传
  5. 进程管理 — 信号转发(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,逐工具注解差异比较
Changes

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.

  1. 12d ago First seen · 55 lines · 833 tokens per session scan A fcd90f3b81c6

Subscribe to this mod's changes

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.

Related

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.

study8677/repobrain · 229 tokens

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.

github/spec-kit · 7,126 tokens

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.

vercel/next.js · 7,296 tokens

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.

openai/codex · 5,153 tokens

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).

microsoft/vscode · 6,785 tokens

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.

langchain-ai/langchain · 4,469 tokens