repo-guard
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@repo-guardCheck if writing to .env with SECRET=123 is allowed"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
repo-guard
Firewall programático de políticas para agentes de código. AGENTS.md sugiere;
repo-guarddecide y bloquea.
Los agentes de código (Claude Code, opencode, Cursor) ejecutan acciones con tus privilegios: escribir archivos, borrar, correr comandos. Las guías en texto (AGENTS.md) son sugerencias que el agente puede ignorar. repo-guard es un motor de políticas ejecutable que evalúa cada acción contra reglas deterministas y devuelve allow / deny / confirm con razones.
Diferente de los proxies MCP que gatean por nombre de herramienta: repo-guard inspecciona qué toca tu repo — rutas (globs), contenido (patrones de secretos) y comandos (rm -rf, curl | sh, git push --force).
Instalación
npm install -g @darkm3tter/repo-guard # CLI + hook
# o local:
npm install --save-dev @darkm3tter/repo-guardRelated MCP server: gov-mcp
Uso rápido (CLI)
repo-guard check --write .env --content "X=1"
# repo-guard: BLOQUEADO
# - ruta protegida: **/.env*
repo-guard check --command "git push origin main --force"
# repo-guard: BLOQUEADO
# - git push --force (force-push)
repo-guard check --write src/app.ts --content "const x = 1"
# repo-guard: OKExit codes: 0 permitido · 1 bloqueado/aprobación · 2 uso · 3 config inválida.
Configuración
repo-guard.config.json en la raíz del proyecto (o REPO_GUARD_CONFIG):
{
"mode": "enforce",
"defaultAction": "allow",
"rules": [
{ "id": "no-touch-secrets", "kind": "protect", "path": "**/.env*", "message": "secretos" },
{ "id": "no-logs-prod", "kind": "block", "path": "src/**", "pattern": "console\\.log" },
{ "id": "confirm-migrations", "kind": "require-confirm", "path": "prisma/migrations/**" },
{ "id": "no-force-push", "kind": "block", "command": "git push.*--force" }
]
}
| Frontera | Efecto |
| glob de ruta (write/delete) |
|
| glob + regex de contenido (write) o regex de comando |
|
| glob o regex |
|
| glob o regex |
|
Precedencia: deny > confirm > allow > default. Soporta **/*/? en globs y el prefijo (?i) en regex.
Reglas built-in (overridables)
id | Qué protege |
|
|
|
|
|
|
|
|
|
|
|
|
| secretos hardcodeados en cualquier write ( |
|
|
Una regla del usuario con el mismo id sobreescribe la built-in.
Modos
enforce(default): bloquea de verdad.log-only: no bloquea — reporta qué habría bloqueado (--log-onlyen CLI, o"mode": "log-only"). Ideal para adopción gradual.
Como MCP server
repo-guard mcp arranca un servidor MCP (stdio) que expone:
guard_check— evalúa una acción (kind + path/content/command)guard_config— las reglas activas, para que el agente conozca los límitesguard_report— resumen de la sesión (checks, bloqueos, confirmaciones)guard_allow— permite temporalmente una regla para la sesión
Configuración en Claude Code (.mcp.json) / opencode (opencode.json):
{ "mcpServers": { "repo-guard": { "command": "repo-guard", "args": ["mcp"] } } }Como hook (bloqueo nativo)
El hook lee la llamada de herramienta del agente desde stdin y sale != 0 para bloquear. Ver examples/opencode.hook.json y examples/claude-code.settings.json.
echo '{"tool":"bash","toolInput":{"command":"rm -rf /"}}' | node node_modules/repo-guard/dist/hook.js
# [repo-guard] BLOQUEADO: command rm -rf /Desarrollo
bun install
bun test # 56+ tests
bun run typecheck # TS estricto
bun run build # dist/cli.js + dist/hook.jsLicencia
MIT
This server cannot be installed
Maintenance
Related MCP Servers
- Alicense-qualityAmaintenanceMCP server that intercepts and controls AI agent actions in your codebase by enforcing policies on file operations and commands, with logging, approval workflows, and rollback capabilities.Last updated1MIT
- Alicense-qualityCmaintenanceAn MCP server that enforces runtime governance on AI agent actions — file access, command execution, delegation chains, and permission escalation.Last updatedMIT
- Flicense-qualityCmaintenanceA local MCP server that provides controlled repository access with policy-based file filtering, secret redaction, and audit logging for AI coding agents.Last updated
- Alicense-qualityAmaintenanceMCP server that vets package installations and shell commands to block dangerous actions by AI coding agents.Last updated81MIT
Related MCP Connectors
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
Security firewall for AI agents — scans MCP calls for injection, secrets, and risks.
Security scanner for MCP servers. Detect vulnerabilities, prompt injection, and tool poisoning.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/darkm3tter/repo-guard'
If you have feedback or need assistance with the MCP directory API, please join our Discord server