Agent Guard Mcp

io.github.Kavachh由 GitHub 账号 Kavachh 发布v0.2.0更新于 Oct 24, 2026

Git-aware safe file ops for AI agents: delete anything except git-tracked source code.

已验证STDIO仅桌面文件与存储开发者工具

概览

AI 生成的概览

一个本地 MCP 服务器,让助手删除文件和目录,但拒绝删除任何被 git 跟踪的内容。

可以做什么
提供具备 git 感知能力的文件删除工具:safe_delete 可删除文件或目录,但会阻止删除被 git 跟踪的文件或包含此类文件的目录,并支持 dry_run 模式。check_protection 报告指定路径是否受保护及原因,guard_status 汇总某个目录中被跟踪(受保护)与未跟踪(可删除)条目的数量。其策略是:只要未被 git 仓库跟踪,任何内容都可删除。
适用场景
适合希望让 AI 编程代理清理构建产物、临时文件和生成文件,同时避免误删版本控制下源代码的场景。也适用于授予代理较宽删除权限的工作流。
运行要求
以本地 stdio 进程运行,使用单个静态二进制文件;PATH 中需要有 git。从源码构建需要 Go 1.24 或更高版本,编译后的二进制文件没有运行时依赖。未声明任何账户、API 密钥或环境变量。
安装前请注意
该服务器会在本机删除文件和目录,删除是真实且无法通过该工具恢复的。保护依赖 git 跟踪,因此未跟踪或被忽略的文件(包括尚未提交的工作)可能被删除。README 建议在客户端权限设置中自动批准其工具,这会取消删除前的确认步骤。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Agent Guard Mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

agent-guard-mcp

MCP server (written in Go, single static binary) for git-aware safe file operations. Give your AI agents (Claude Code, GitHub Copilot CLI, Cursor, …) free rein to delete what they build — while making it impossible for them to delete your git-tracked source code.

Policy: anything is deletable until it's tracked by a git repository.

Tools

ToolPurpose
safe_deleteDelete files/dirs; refuses git-tracked files or dirs containing them. Supports dry_run.
check_protectionReport whether paths are protected and why.
guard_statusSummarize a directory: tracked (protected) vs untracked (deletable) counts.

Install

Build the single static binary (no runtime dependencies):

bash
go build -o agent-guard-mcp .

Or install directly:

bash
go install github.com/kavachh/agent-guard-mcp@latest

Claude Code

bash
claude mcp add agent-guard -- /path/to/agent-guard-mcp

GitHub Copilot CLI

In ~/.copilot/mcp-config.json:

json
{  "mcpServers": {    "agent-guard": { "command": "/path/to/agent-guard-mcp", "args": [] }  }}

Any MCP client (generic stdio config)

json
{ "command": "/path/to/agent-guard-mcp", "args": [] }

Recommended agent instructions

Add to your CLAUDE.md / AGENTS.md / .github/copilot-instructions.md:

Never use rm in the shell. Always delete files with the safe_delete MCP tool, which protects git-tracked source code.

Since safe_delete can never destroy tracked source, it is safe to auto-approve this server's tools in your client's permission settings.

Example

safe_delete { "paths": ["build/", "scratch.txt"] }→ deleted (untracked)
safe_delete { "paths": ["src/main/java/App.java"] }→ BLOCKED: git-tracked source file — use `git rm` deliberately if intended

Requirements

  • git on PATH
  • Go ≥ 1.24 (build only — the binary itself has zero dependencies)

Testing

24-case edge suite (tracked/staged/ignored files, nested repos, symlinks, dry-run, …):

bash
go build -o agent-guard-mcp . && npm test

来源:README.md,提交 f19ee77

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.2.0最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分