Skip to main content

Security proxy and verification layer for the Model Context Protocol (MCP)

Project description

๐Ÿ›ก๏ธ McpVanguard

A security proxy for AI agents that use MCP

MCP (Model Context Protocol) lets AI agents like Claude or GPT call tools on your computer โ€” reading files, running commands, browsing the web. McpVanguard sits in between, inspecting every tool call before it reaches your system and blocking anything that looks malicious.

No changes to your agent. No changes to your server. Just wrap it.

Tests PyPI version License: Apache 2.0 Python 3.11+

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


โšก Quickstart

pip install mcp-vanguard

Local stdio wrap (no network):

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

Cloud Security Gateway (SSE, deploy on Railway):

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

Deploy on Railway

๐Ÿ“– Full Railway Deployment Guide


๐Ÿง  How it works

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:

Layer What it checks Latency
L1 โ€” Rules 50+ static signatures: path traversal, reverse shells, SSRF, prompt injection ~16ms
L2 โ€” Semantic LLM-based intent scoring for ambiguous requests Async
L3 โ€” Behavioral Sliding-window anomaly detection (e.g. reading 500 files in 60 seconds) Stateful

On latency: 16ms is the overhead at peak concurrent load. In practice it's well under the 1โ€“2 second LLM response time โ€” imperceptible to the agent.

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


๐Ÿ›ก๏ธ What gets blocked

  • Filesystem attacks: Path traversal (../../etc/passwd), null bytes, restricted paths (~/.ssh), Unicode homograph evasion
  • Command injection: Pipe-to-shell, reverse shells, command chaining via ; && \n, expansion bypasses
  • Network abuse: SSRF, cloud metadata endpoints (AWS/GCP/Azure), hex/octal encoded IPs
  • Prompt injection: Jailbreak patterns, instruction-ignore sequences, hidden unicode characters
  • Privilege escalation: SUID binary creation, LD_PRELOAD injection, crontab manipulation

๐Ÿ“Š VEX Protocol โ€” Immutable Audit Log

When McpVanguard blocks an attack, it can send a cryptographically-signed report to the VEX Protocol. VEX anchors that report to the Bitcoin blockchain via the CHORA Gate.

This means an auditor can independently verify exactly what was blocked and why โ€” without relying on your local logs.

export VANGUARD_VEX_URL="https://api.vexprotocol.com"
export VANGUARD_VEX_KEY="your-agent-jwt"
vanguard sse --server "..." --behavioral

๐Ÿ—๏ธ Architecture

                      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  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)           โ”‚  โ”‚
      โ”‚               โ”‚  โ”‚  Ollama / OpenAI intent 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)

๐Ÿ—บ๏ธ Project Status

Phase Goal Status
Phase 1 Foundation (Proxy, CLI, Defensive Rules) โœ… Done
Phase 2 Intelligence (L2 Semantic, L3 Behavioral) โœ… Done
Phase 3 Flight Recorder (VEX & CHORA Integration) โœ… Done
Phase 4 Distribution (stable PyPI release) โœ… Done
Phase 5 Production Hardening (v1.1.3 stability) โœ… Done
Phase 6 Security Audit Remediation (v1.1.4 hardening) โœ… Done
Phase 7 Agent Identity & VEX v0.2 Spec ๐Ÿ”„ In Progress

๐Ÿ“š Resources


๐Ÿ“„ License

Apache License 2.0 โ€” see LICENSE.

Built by the Provnai Open Research Initiative. "Verifying the thoughts and actions of autonomous agents."

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_vanguard-1.1.4.tar.gz (1.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_vanguard-1.1.4-py3-none-any.whl (44.1 kB view details)

Uploaded Python 3

File details

Details for the file mcp_vanguard-1.1.4.tar.gz.

File metadata

  • Download URL: mcp_vanguard-1.1.4.tar.gz
  • Upload date:
  • Size: 1.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mcp_vanguard-1.1.4.tar.gz
Algorithm Hash digest
SHA256 20800774e1c0e8937fab928240efcd719324824ace2a998c4e655449f78d20b7
MD5 46eaec4c02f07b9d24b9528632d1aa72
BLAKE2b-256 9b52cdded2e3513688fc36ea7dd97bbe60c40217a86fe7dc2250ebacd2358d77

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_vanguard-1.1.4.tar.gz:

Publisher: publish.yml on provnai/McpVanguard

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcp_vanguard-1.1.4-py3-none-any.whl.

File metadata

  • Download URL: mcp_vanguard-1.1.4-py3-none-any.whl
  • Upload date:
  • Size: 44.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mcp_vanguard-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1d851bcdfe5edec327ed647e077b29456025482799230873c502ee609fee26d0
MD5 713e138bc8ac8dbb39cb4486bd4cdc6e
BLAKE2b-256 4c2313e780cf86c135e12a9982a0d66868d7219f116ebd9027fe21e748e11e6c

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_vanguard-1.1.4-py3-none-any.whl:

Publisher: publish.yml on provnai/McpVanguard

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page