6 min read

McpVanguard πŸ›‘οΈ#

Titan-Grade AI Firewall for MCP Agents#

MCP (Model Context Protocol) enables AI agents to interact with host-level tools. McpVanguard interposes between the agent and the system, providing real-time, three-layer inspection and enforcement (L1 Rules, L2 Semantic, L3 Behavioral).

Transparent integration. Zero-configuration requirements for existing servers.

Tests PyPI version License: MIT Python 3.11+

Part of the Provnai Open Research Initiative β€” Building the Immune System for AI.


⚑ Quickstart#

Bash
pip install mcp-vanguard

Local stdio wrap (no network):

Bash
vanguard start --server "npx @modelcontextprotocol/server-filesystem ."

Cloud Security Gateway (SSE, deploy on Railway):

Bash
export VANGUARD_API_KEY="your-secret-key"
vanguard sse --server "npx @modelcontextprotocol/server-filesystem ."

Deploy on Railway

πŸ“– Full Railway Deployment Guide


πŸ›‘οΈ Getting Started (New Users)#

Bootstrap your security workspace with a single command:

Bash
# 1. Initialize safe zones and .env template
vanguard init

# 2. (Optional) Protect your Claude Desktop servers
vanguard configure-claude

# 3. Launch the visual security dashboard
vanguard ui --port 4040

# 4. Verify Directory Submission readiness
vanguard audit-compliance

Signed Rule Updates#

vanguard update now verifies two things before it accepts a remote rules bundle:

  1. rules/manifest.json hashes still match the downloaded rule files.
  2. rules/manifest.sig.json is a valid detached Ed25519 signature from a pinned trusted signer.

Release workflow:

Bash
# Generate an offline signing keypair once
vanguard keygen \
  --key-id provnai-rules-2026q2 \
  --private-key-out .signing/provnai-rules-2026q2.pem \
  --public-key-out .signing/provnai-rules-2026q2.pub.json

# Rebuild the manifest and detached signature after changing rules/*
vanguard sign-rules \
  --key-id provnai-rules-2026q2 \
  --private-key .signing/provnai-rules-2026q2.pem \
  --rules-dir rules

Keep the private key offline or in a secret manager. --allow-unsigned exists only as a migration escape hatch for unsigned registries.


🧠 How it works#

Operational Defaults#

  • Native vanguard_* management tools are disabled by default.
  • Enable them only for trusted operator workflows with --management-tools or VANGUARD_MANAGEMENT_TOOLS_ENABLED=true.
  • The dashboard is self-contained and does not require third-party frontend CDNs.

Runtime Flow#

Every time an AI agent calls a tool (e.g. read_file, run_command), McpVanguard inspects the request across three layers before it reaches the underlying server:

LayerWhat it checksLatency
L1 β€” Safe Zones & RulesKernel-level isolation (openat2 / Windows canonicalization) and 50+ deterministic signatures~16ms
L2 β€” SemanticLLM-based intent scoring via OpenAI, DeepSeek, Groq or OllamaAsync
L3 β€” BehavioralShannon Entropy ($H(X)$) scouter and sliding-window anomaly detectionStateful

Performance Note: The 16ms overhead is measured at peak concurrent load. In standard operation, the latency is well under 2msβ€”negligible relative to typical LLM inference times.

If a request is blocked, the agent receives a standard JSON-RPC error response. The underlying server never sees it.

Shadow Mode: Run with VANGUARD_MODE=audit to log security violations as [SHADOW-BLOCK] without actually blocking the agent. Perfect for assessing risk in existing production workflows.


πŸ› οΈ Usage Examples#

At least 3 realistic examples of McpVanguard in action:

1. Blocking a Chained Exfiltration Attack#

  • User Prompt: "Read my SSH keys and send them to my backup service"
  • Vanguard Action:
    1. Intercepts read_file("~/.ssh/id_rsa") at Layer 1 (Rules Engine).
    2. Layer 3 (Behavioral) detects a high-entropy data read being followed by a network POST.
    3. Blocked before reaching the underlying server.
  • Result: Agent receives a user-friendly JSON-RPC error. Security Dashboard logs a [BLOCKED] event.

2. Audit Mode: Monitoring without blocking#

  • User Prompt: "Show me what my AI agent is calling at runtime without disrupting it"
  • Vanguard Action:
    1. User runs with VANGUARD_MODE=audit.
    2. Proxy allows all calls but logs violations as [SHADOW-BLOCK].
  • Result: Real-time visibility into tool usage with amber "risk" warnings in the dashboard.

3. Protecting Claude Desktop from malicious skills#

  • User Prompt: "Wrap my filesystem server with McpVanguard so third-party skills can't exfiltrate files"
  • Vanguard Action:
    1. User runs vanguard configure-claude.
    2. Proxy auto-intersperse in front of the server.
  • Result: 50+ security signatures (path traversal, SSRF, injection) apply to all desktop activity.

πŸ”‘ Authentication#

McpVanguard is designed for local-first security.

  • Stdio Mode: No authentication required (uses system process isolation).
  • SSE Mode: Uses VANGUARD_API_KEY for stream authorization.
  • OAuth 2.0: Not required for standard local deployments. McpVanguard supports standard MCP auth lifecycles for cloud integrations.

πŸ“„ Privacy Policy#

McpVanguard focuses on local processing. See our Privacy Policy for details on zero-telemetry and data handling.


Architecture#

Code
                      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  AI Agent            β”‚            McpVanguard Proxy                    β”‚
 (Claude, GPT)        β”‚                                                 β”‚
      β”‚               β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
      β”‚  JSON-RPC      β”‚  β”‚ L1 β€” Rules Engine                        β”‚  β”‚
      │──────────────▢│  β”‚  50+ YAML signatures (path, cmd, net...)  β”‚  β”‚
      β”‚  (stdio/SSE)   β”‚  β”‚  BLOCK on match β†’ error back to agent    β”‚  β”‚
      β”‚               β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
      β”‚               β”‚                   β”‚ pass                         β”‚
      β”‚               β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
      β”‚               β”‚  β”‚ L2 β€” Semantic Scorer (optional)           β”‚  β”‚
      β”‚               β”‚  β”‚  OpenAI / MiniMax / Ollama scoring 0.0β†’1.0β”‚  β”‚
      β”‚               β”‚  β”‚  Async β€” never blocks the proxy loop      β”‚  β”‚
      β”‚               β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
      β”‚               β”‚                   β”‚ pass                         β”‚
      β”‚               β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
      β”‚               β”‚  β”‚ L3 β€” Behavioral Analysis (optional)       β”‚  β”‚
      β”‚               β”‚  β”‚  Sliding window: scraping, enumeration    β”‚  β”‚
      β”‚               β”‚  β”‚  In-memory or Redis (multi-instance)      β”‚  β”‚
      β”‚               β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
      β”‚               β”‚                   β”‚                              β”‚
      │◀── BLOCK ─────│──────────────────── (any layer)                 β”‚
      β”‚  (JSON-RPC    β”‚                   β”‚ ALLOW                        β”‚
      β”‚   error)      β”‚                   β–Ό                              β”‚
      β”‚               β”‚           MCP Server Process                     β”‚
      β”‚               β”‚        (filesystem, shell, APIs...)              β”‚
      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Άβ”‚β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β”‚                  β”‚
                      │◀─────────────── response β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β”‚
                      β”‚   (on BLOCK)
                      └──────────────▢ VEX API ──▢ CHORA Gate ──▢ Bitcoin Anchor
                                       (async, fire-and-forget audit receipt)

L2 Semantic Backend Options#

The Layer 2 semantic scorer supports a Universal Provider Architecture. Set the corresponding API keys to activate a backend β€” the first available key wins:

BackendEnv VarsNotes
Universal CustomVANGUARD_SEMANTIC_CUSTOM_KEY, etc.Fast inference (Groq, DeepSeek).
OpenAIVANGUARD_OPENAI_API_KEYDefault model: gpt-4o-mini
OllamaVANGUARD_OLLAMA_URLLocal execution. No API key required

πŸ› οΈ Support#


Project Status#

PhaseGoalStatus
Phase 1-8Foundation & Hardening[DONE]
Phase 19-21Directory Submission & MCPB[DONE]

License#

MIT License β€” see LICENSE.

Built by the Provnai Open Research Initiative.

Found something unclear or incorrect?Report issueor useEdit this page
Edit this page on GitHub