Agent Guard MCP logo

Agent Guard MCP

Protects Git-tracked files from AI-agent deletion while allowing removal of untracked files and directories.

Install Agent Guard MCP

Run the project’s own setup commands, in order.

Setup steps from the project

agent-guard-mcp installs with its own steps rather than a config we can generate, so these are copied as-is. Follow them in order and run the commands in a terminal. Source: github.com

  1. 1. Install
    go build -o agent-guard-mcp .
    
  2. 2. Install
    go install github.com/kavachh/agent-guard-mcp@latest
    
  3. 3. Add to Claude Code
    claude mcp add agent-guard -- /path/to/agent-guard-mcp
    

Overview

Git-aware deletion protection is the core of the agent-guard-mcp MCP server: it lets agents remove untracked files while refusing operations that would affect Git-tracked source. The Go server runs as a static stdio binary and provides deletion, protection-check, and directory-status tools. Reach for it when agents need to clean up generated files without being able to delete tracked code accidentally.

Use cases

  • Delete generated build output without touching tracked source
  • Preview agent cleanup operations with dry-run mode
  • Check whether temporary paths are protected before removal
  • Summarize tracked and untracked content in a workspace

Key features

  • Git-aware deletion protection
  • Safe file and directory removal
  • Dry-run support
  • Protection explanations
  • Tracked and untracked directory counts
  • Static Go binary

Tools3

What Agent Guard MCP lets your agent do. Expand a tool for its parameters.

Self-reported~62 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

14/18 checks healthy over the last 112d

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

Last commit4mo agoMost recent push to the default branch.
Tools exposed3Callable tools this server registers over MCP.
Directory activity1 viewsConfig copies, upvotes, and views on AllMCPs.

How Agent Guard MCP works

What agent-guard-mcp MCP server does

The agent-guard-mcp MCP server exposes file-deletion safeguards based on Git tracking state. Its policy is simple: paths remain deletable until Git considers them tracked. A tracked file is protected, and a directory is protected when it contains tracked files.

This is intended for AI agents that create build output, scratch files, generated artifacts, or temporary directories during development. Agents can remove those untracked paths through MCP, while deliberate changes to tracked source still require an explicit Git operation such as git rm.

How it works

The server inspects the target paths against the Git repository and applies the protection rule before deletion. safe_delete can receive files or directories. It removes untracked targets, but refuses tracked files and directories that contain tracked content. The tool also accepts a dry_run option so an agent can preview the result without performing the deletion.

check_protection answers whether supplied paths are protected and reports the reason. guard_status provides a directory-level summary with counts for tracked, protected content and untracked, deletable content.

The agent-guard-mcp MCP server is a single Go binary. Git must be available on PATH; the compiled binary has no runtime dependencies. The repository describes testing for tracked, staged, ignored, nested-repository, symlink, and dry-run cases.

Setup and configuration

Build the binary with Go 1.24 or newer:

bash
go build -o agent-guard-mcp .

Alternatively, install it with:

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

MCP clients use a generic stdio configuration with the binary path as the command and no required arguments. Claude Code can register it with claude mcp add; GitHub Copilot CLI uses its mcp-config.json file. Cursor and other MCP clients can use the same stdio command configuration.

The project recommends instructing agents not to use shell rm and to call safe_delete instead. Client permission settings can then be configured around the MCP tools, while intentional deletion of tracked source remains outside this server's permitted operation.

Tools and capabilities

  • safe_delete: Deletes untracked files or directories, blocks tracked files and directories containing tracked files, and supports dry-run checks.
  • check_protection: Explains whether each requested path is protected.
  • guard_status: Counts tracked and untracked content within a directory.

The agent-guard-mcp MCP server focuses on deletion safety rather than general file editing. It does not replace deliberate Git commands for removing tracked files.

Limitations and notes

Protection depends on Git tracking state and therefore requires git on PATH. Building requires Go 1.24 or newer, although the resulting binary does not require Go at runtime. The documented interface is stdio-based, and the supplied setup examples do not specify environment variables or command-line arguments.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Agent Guard MCP

agent-guard-mcp is an MCP server that connects AI agents to Git-aware file operations. Its main tools are safe_delete for removing untracked files and directories, check_protection for explaining path protection, and guard_status for counting tracked versus untracked content. It blocks deletion of Git-tracked source code.

Build it with Go 1.24 or newer using `go build -o agent-guard-mcp .`, or install it with `go install github.com/kavachh/agent-guard-mcp@latest`. Git must be available on `PATH`; the resulting binary has no runtime dependencies.

Yes, agent-guard-mcp can be configured in Cursor as a generic MCP server using its stdio command configuration. Set the command to the path of the compiled binary and provide no required arguments.

No, safe_delete refuses Git-tracked files and directories containing tracked files. It can delete untracked paths, while intentional removal of tracked source must be performed separately with a deliberate Git operation.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewAgent Guard MCP AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/agent-guard-mcp?style=directory)](https://allmcps.com/mcp/agent-guard-mcp)
HTML Embed
<a href="https://allmcps.com/mcp/agent-guard-mcp"><img src="https://allmcps.com/api/badge/agent-guard-mcp?style=directory" alt="Agent Guard MCP on AllMCPs" /></a>