AI Skill Hub 推荐使用:开源MCP工具 是一款优质的MCP工具。AI 综合评分 7.5 分,在同类工具中表现稳健。如果你正在寻找可靠的MCP工具解决方案,这是一个值得深入了解的选择。
使用One命令使Claude Code安全运行,防止rm -rf等危险操作,提高AI安全性
开源MCP工具 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
使用One命令使Claude Code安全运行,防止rm -rf等危险操作,提高AI安全性
开源MCP工具 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
# 方式一:通过 Claude Code CLI 一键安装
claude skill install https://github.com/yurukusa/cc-safe-setup
# 方式二:手动配置 claude_desktop_config.json
{
"mcpServers": {
"--mcp--": {
"command": "npx",
"args": ["-y", "cc-safe-setup"]
}
}
}
# 配置文件位置
# macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
# Windows: %APPDATA%/Claude/claude_desktop_config.json
# 安装后在 Claude 对话中直接使用 # 示例: 用户: 请帮我用 开源MCP工具 执行以下任务... Claude: [自动调用 开源MCP工具 MCP 工具处理请求] # 查看可用工具列表 # 在 Claude 中输入:"列出所有可用的 MCP 工具"
// claude_desktop_config.json 配置示例
{
"mcpServers": {
"__mcp__": {
"command": "npx",
"args": ["-y", "cc-safe-setup"],
"env": {
// "API_KEY": "your-api-key-here"
}
}
}
}
// 保存后重启 Claude Desktop 生效
Listed on Product Hunt since April 21, 2026.
One command to make Claude Code safe for autonomous operation. 746 example hooks · 73+ Anthropic Issues addressed by hook · 9,250+ tests · 30K+ total installs · 日本語
npx cc-safe-setup
Installs 8 safety hooks in ~10 seconds. Blocks rm -rf /, prevents pushes to main, catches secret leaks, validates syntax after every edit. Zero npm dependencies. Hooks use jq at runtime (brew install jq / apt install jq).
What's a hook? A checkpoint that runs before Claude executes a command. Like airport security, it inspects what's about to happen and blocks anything dangerous before it reaches the gate.
▶ Live Demo (see hooks block rm -rf in your browser) · Incident Tracker (90 real incidents) · Token Checkup (what type are you?) · All 8 Tools · Defense Kit (11 incidents → 11 hooks, narrative-per-incident) · Drift Matrix (14 May 2026 cases × 10 hooks, "if I saw X install Y")
cc-safe-setup
Make Claude Code safe for autonomous operation
Prevents real incidents (from GitHub Issues):
✗ rm -rf permanently destroyed ~50 GB / 1,500 files (#49129) ← April 2026
✗ Auto mode approved ~/.ssh deletion, all SSH keys gone (#49554)
✗ ~/.git-credentials PATs deleted without confirmation (#49539)
✗ rm -rf deleted 3,467 files (~7 GB) without confirmation (#46058)
✗ rm -rf deleted entire user directory via NTFS junction (#36339)
✗ Remove-Item -Recurse -Force destroyed unpushed source (#37331)
✗ Entire Mac filesystem deleted during cleanup (#36233)
✗ Untested code pushed to main at 3am
✗ Force-push rewrote shared branch history
✗ API keys committed to public repos via git add .
✗ Syntax errors cascading through 30+ files
✗ Sessions losing all context with no warning
✗ CLAUDE.md rules silently ignored after context compaction
✗ Claude ran destructive DDL on production database (#46684)
✗ AI executed delete/kill operations on production environment (#46650)
✗ Subagents ignoring all CLAUDE.md rules since v2.1.84 (#40459)
Hooks to install:
● Destructive Command Blocker
● Branch Push Protector
● Post-Edit Syntax Validator
● Context Window Monitor
● Bash Comment Stripper
● cd+git Auto-Approver
● Secret Leak Prevention
Install all 8 safety hooks? [Y/n] Y
✓ Done. 8 safety hooks installed.
| Hook | Prevents | Related Issues |
|---|---|---|
| **Destructive Guard** | rm -rf /, git reset --hard, git clean -fd, git checkout --force, sudo + destructive, PowerShell Remove-Item -Recurse -Force, rd /s /q, NFS mount detection | [#46058](https://github.com/anthropics/claude-code/issues/46058) [#36339](https://github.com/anthropics/claude-code/issues/36339) [#36640](https://github.com/anthropics/claude-code/issues/36640) [#37331](https://github.com/anthropics/claude-code/issues/37331) |
| **Branch Guard** | Pushes to main/master + force-push (--force) on all branches | |
| **Secret Guard** | git add .env, credential files, git add . with .env present | [#6527](https://github.com/anthropics/claude-code/issues/6527) |
| **Syntax Check** | Python, Shell, JSON, YAML, JS errors after edits | |
| **Context Monitor** | Session state loss from context window overflow (40%→25%→20%→15% warnings) | |
| **Comment Stripper** | Bash comments breaking permission allowlists | [#29582](https://github.com/anthropics/claude-code/issues/29582) |
| **cd+git Auto-Approver** | Permission prompt spam for cd /path && git log | [#32985](https://github.com/anthropics/claude-code/issues/32985) [#16561](https://github.com/anthropics/claude-code/issues/16561) |
| **API Error Alert** | Silent session death from rate limits or API errors, desktop notification + log |
Each hook exists because a real incident happened without it.
Verify your setup:
npx cc-health-check
| Guide | What it covers |
|---|---|
| **[6-hook fortification for the 2026-04 regression cluster](https://gist.github.com/yurukusa/79eeabd11dbfa29d99e7f2a058391286)** | The April 2026 postmortem recap + which 6 cc-safe-setup hooks would have caught each issue. No signup. |
| **[Find which CC versions ran your cache regression sessions](https://gist.github.com/yurukusa/60b21cc133769e0bedab0b828bca4f90)** | One-line grep + jq diagnostic over ~/.claude/ logs. Shows per-day per-version count of sessions affected by [#46829](https://github.com/anthropics/claude-code/issues/46829)/[#46917](https://github.com/anthropics/claude-code/issues/46917). |
**[/usage --json: 5 fields, one ratio that decides whether you migrate](https://yurukusa.hashnode.dev/how-to-read-usage-json-5-fields-one-ratio-that-decides-whether-you-migrate)** | cache_creation_ratio cheat sheet for the v2.1.118 /usage --json output. Five fields and one ratio with HEALTHY / WATCH / TRIGGER bands so you can decide migration timing from your own logs, no third-party dashboard. |
| **[PocketOS 9-second wipe, 3-prevention audit script](https://gist.github.com/yurukusa/f4e9104ff5bb331b21c9446bffb57d91)** | Read-only audit script (Railway / AWS / GCP / GitHub examples) for the three preventions surfaced by the [2026-04-25 PocketOS production-database wipe](https://yurukusa.hashnode.dev/9-seconds-no-backups-what-the-pocketos-wipe-tells-you-to-harden-before-friday) ([HN 817pt](https://news.ycombinator.com/item?id=47911524)). No destructive commands; prints questions and read-only checks you run yourself. |
| **[Postmortems incident #1 free preview, cache TTL regression Signal + Diagnosis](https://gist.github.com/yurukusa/9f597e27d4a44de85d4c8815a84b4f5d)** | Verbatim chapter excerpt from the Postmortems book (live on Gumroad since 2026-05-05). Three read-only checks (one minute total) to tell whether the [March 2026 cache TTL regression](https://github.com/anthropics/claude-code/issues/46829) hit your sessions, no purchase required. |
| **[Copilot 2026-06-01 transition pre-flight checklist](https://gist.github.com/yurukusa/abf63634d1e0b5856bdbdcb378915bd8)** | Five read-only audit steps to run today before GitHub's "Preview my bill" tool launches in early May. Identifies your tier, inventories your past 30-day usage by surface, and stages the stay/switch/hybridize decision tree against your own numbers. No purchase required. |
| **[Five primary-source-verified Claude Code signals (2026-04-26 to 2026-04-28)](https://gist.github.com/yurukusa/751f4c229b2499ba9e005e25c07d002d)** | 48-hour roundup with audit one-liners. [#52921](https://github.com/anthropics/claude-code/issues/52921) (Max 20× weekly limits resetting on a ~24-hour cycle, Anthropic in-app support acknowledged), [#53489](https://github.com/anthropics/claude-code/issues/53489) (Web MCP connectors lost + v2.1.120 force-rolled-back within 24h), [#53262](https://github.com/anthropics/claude-code/issues/53262) (HERMES.md substring routing), plugin hook path drift cluster, and the 2026-04-25 Anthropic Rate Limits API release. Two issues independently primary-source-verified. |
**[claim-verify-audit.sh — 8 diagnostic checks for the May 2026 failure-mode cluster](scripts/claim-verify-audit.sh)** | One-shot read-only audit (single bash file, MIT). Eight checks against documented patterns: 8.3 short-name allow-rule bypass ([#58614](https://github.com/anthropics/claude-code/issues/58614)), skill bloat token tax ([Reddit 1tbbove](https://www.reddit.com/r/ClaudeAI/comments/1tbbove/)), session backup absence ([#58608](https://github.com/anthropics/claude-code/issues/58608)), .env subagent inheritance ([#57068](https://github.com/anthropics/claude-code/issues/57068)), auto-compact drift ([#57490](https://github.com/anthropics/claude-code/issues/57490) + [#58373](https://github.com/anthropics/claude-code/issues/58373)), bypassPermissions remote override ([#57810](https://github.com/anthropics/claude-code/issues/57810)), settings.json JSON validity ([#57491](https://github.com/anthropics/claude-code/issues/57491)), cache-trail forensic ([#58608](https://github.com/anthropics/claude-code/issues/58608)). Each finding cites the source issue + the prevention chapter. Run with bash scripts/claim-verify-audit.sh from any working directory. Also published as a [standalone Gist](https://gist.github.com/yurukusa/e2fb2b2dadab456c5396704a485b789c). |
| I want to... | Command |
|---|---|
| Make Claude Code safe right now | npx cc-safe-setup --shield |
| Stop permission prompt spam | npx cc-safe-setup --install-example auto-approve-readonly |
| Enforce a rule instantly | npx cc-safe-setup --guard "never delete production data" |
| See what risks my project has | npx cc-safe-setup --suggest |
| Convert CLAUDE.md rules to hooks | npx cc-safe-setup --from-claudemd |
| Share hooks with my team | npx cc-safe-setup --team && git add .claude/ |
| Choose a safety level | npx cc-safe-setup --profile strict |
| See what Claude blocked today | npx cc-safe-setup --replay |
| Know why a hook exists | npx cc-safe-setup --why destructive-guard |
| Block silent memory file edits | npx cc-safe-setup --install-example memory-write-guard |
| Stop built-in skills editing opaquely | npx cc-safe-setup --install-example skill-gate |
| Diagnose why hooks aren't working | npx cc-safe-setup --doctor |
| Preview how hooks react to a command | npx cc-safe-setup --simulate "git push origin main" |
| Protect a specific file from edits | npx cc-safe-setup --protect .env |
| Stop .git/ write prompts | npx cc-safe-setup --install-example allow-git-hooks-dir |
| Auto-approve compound git commands | npx cc-safe-setup --install-example auto-approve-compound-git |
| Detect prompt injection patterns | npx cc-safe-setup --install-example prompt-injection-detector |
| Define rules in YAML, compile to hooks | npx cc-safe-setup --rules rules.yaml |
| Validate all hook scripts are correct | npx cc-safe-setup --validate |
| Maximum protection mode | npx cc-safe-setup --safe-mode |
| Migrate from Cursor/Windsurf | [Migration Guide](https://yurukusa.github.io/cc-safe-setup/migration-guide.html) |
Need custom hooks beyond the 8 built-in ones? Install any example with one command:
npx cc-safe-setup --install-example block-database-wipe
Or browse all available examples in examples/:
claude update when a new release exists or the registry is unreachable.git status, git log, even with -C flagsuptime, whoami, etc.)migrate:fresh, Django flush, Rails db:drop, raw DROP DATABASE (#46684 #46650 #37405 #37439)psql -c invocations missing an explicit transaction. Strict mode via CC_SQL_BULK_DELETE_BLOCK=1 (#56738)~/.bashrc, ~/.aws/, ~/.ssh/ and chezmoi without diff (#37478)git config --global modifications without consent (#37201)git push when tests haven't been run (#36970)../../ path traversal and system directoriescd && git log, cd && npm test) that the permission system can't match (#30519 #16561)/tmp/claude-*-cwd files on session end (#8856)~/.claude/hook-debug.logRead that detects when the model is about to re-read a file already read in the same session (with the same mtime). Operationalizes #60283 ("excessive token consumption — task halted mid-execution with zero output") and the broader quota-leakage cluster (analysis, audit tool). Default mode warns; strict mode refuses the call.~/.claude/session-handoff.md on session endpython3 stub on Windows Git Bash — which python3 succeeds but subprocess exits 49 with no output, silently no-op-ing every Python-based hook. Matches four failure modes (exit 49 / Store-redirect stderr / exit 127 / silent stub) and warns via hookSpecificOutput (#57946)MIGRATION.md: Step-by-step guide for moving from permissions-only to permissions + hooks. Keep your existing config, add safety layers on top.
| Variable | Hook | Default |
|---|---|---|
CC_ALLOW_DESTRUCTIVE=1 | destructive-guard | 0 (protection on) |
CC_SAFE_DELETE_DIRS | destructive-guard | node_modules:dist:build:.cache:__pycache__:coverage |
CC_PROTECT_BRANCHES | branch-guard | main:master |
CC_ALLOW_FORCE_PUSH=1 | branch-guard | 0 (protection on) |
CC_SECRET_PATTERNS | secret-guard | .env:.env.local:credentials:*.pem:*.key |
CC_CONTEXT_MISSION_FILE | context-monitor | $HOME/mission.md |
SETTINGS_REFERENCE.md: Complete reference for permissions, hooks, modes, and common configurations. Includes known limitations and workarounds.
Install safety hooks as Claude Code plugins, no npm required:
/plugin marketplace add yurukusa/cc-safe-setup
/plugin install safety-essentials@cc-safe-setup
| Plugin | What it blocks |
|---|---|
safety-essentials | rm -rf, force-push, hard-reset, .env overwrite, npm publish |
git-protection | Force-push, main/master push, git clean, branch -D |
credential-guard | .env write/edit, API keys in commands, service account files |
Also listed on claudemarketplaces.com.
```yaml
- uses: yurukusa/cc-safe-setup@main with: threshold: 70 # CI fails if score drops below this ```
TROUBLESHOOTING.md: "Hook doesn't work" → step-by-step diagnosis. Covers every common failure pattern.
Q: I installed hooks but Claude says "Unknown skill: claude-code-hooks:setup"
cc-safe-setup installs hooks, not skills or plugins. Hooks run automatically in the background, you don't invoke them manually. After install + restart, try running a dangerous command; the hook will block it silently.
Q: cc-health-check says to run cc-safe-setup but I already did
cc-safe-setup covers Safety Guards (75-100%) and Monitoring (context-monitor). The other health check dimensions (Code Quality, Recovery, Coordination) require additional CLAUDE.md configuration or manual hook installation from claude-code-hooks.
Q: Will hooks slow down Claude Code?
No. Each hook runs in ~10ms. They only fire on specific events (before tool use, after edits, on stop). No polling, no background processes.
**Q: My permission p
该工具提供了一种简单的方式来提高AI安全性,适用于Claude Code等AI系统,但需要进一步测试和优化
该工具未明确声明开源协议,商业使用前请联系原作者确认授权范围,避免侵权风险。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
总体来看,开源MCP工具 是一款质量良好的MCP工具,在同类工具中具备一定竞争力。AI Skill Hub 将持续追踪其更新动态,建议收藏备用,结合自身场景选择合适时机引入使用。
| 原始名称 | cc-safe-setup |
| Topics | mcpagentic-codingai-safetyanthropicautomationautonomousshell |
| GitHub | https://github.com/yurukusa/cc-safe-setup |
| 语言 | Shell |
收录时间:2026-05-23 · 更新时间:2026-05-23 · License:未公布 · AI Skill Hub 不对第三方内容的准确性作法律背书。
选择 Agent 类型,复制安装指令后粘贴到对应客户端