feat(hooks): mcp-destructive-guard asks before irreversible MCP verbs (#52)
CI / Check / Test (push) Successful in 5s
CI / Tag release (push) Successful in 2s

PreToolUse hook on mcp__.*: asks for repo_delete, file_delete, branch_delete, pr_merge, tbd_ship, repo_update, repo_mirror_push, workflow_run_trigger, tag_create, release_create on any server name, and for file_write_branch unless it targets a plain non-main/master branch with non-empty content under exactly one exact-case branch/content key. Fails closed; never emits allow.

Refs mathias/infra#508. Reviewed in three rounds by pr-gatekeeper with execution against gitea-mcp and Gitea 1.27.1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Mathias <mthbqv@gmail.com>
This commit was merged in pull request #52.
This commit is contained in:
2026-10-01 20:21:52 +00:00
committed by mathias
co-authored by Claude Opus 5.5
parent 55b2e811d1
commit b0d58d5adf
4 changed files with 215 additions and 1 deletions
+10
View File
@@ -33,6 +33,16 @@
"timeout": 5
}
]
},
{
"matcher": "mcp__.*",
"hooks": [
{
"type": "command",
"command": "bash \"${CLAUDE_PLUGIN_ROOT}/hooks/mcp-destructive-guard.sh\"",
"timeout": 5
}
]
}
]
}