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.
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 ."
๐ง 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_PRELOADinjection, 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20800774e1c0e8937fab928240efcd719324824ace2a998c4e655449f78d20b7
|
|
| MD5 |
46eaec4c02f07b9d24b9528632d1aa72
|
|
| BLAKE2b-256 |
9b52cdded2e3513688fc36ea7dd97bbe60c40217a86fe7dc2250ebacd2358d77
|
Provenance
The following attestation bundles were made for mcp_vanguard-1.1.4.tar.gz:
Publisher:
publish.yml on provnai/McpVanguard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_vanguard-1.1.4.tar.gz -
Subject digest:
20800774e1c0e8937fab928240efcd719324824ace2a998c4e655449f78d20b7 - Sigstore transparency entry: 1072226965
- Sigstore integration time:
-
Permalink:
provnai/McpVanguard@133c60b30e0dabc4205914329a0f259247c1cae7 -
Branch / Tag:
refs/tags/v1.1.4 - Owner: https://github.com/provnai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@133c60b30e0dabc4205914329a0f259247c1cae7 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d851bcdfe5edec327ed647e077b29456025482799230873c502ee609fee26d0
|
|
| MD5 |
713e138bc8ac8dbb39cb4486bd4cdc6e
|
|
| BLAKE2b-256 |
4c2313e780cf86c135e12a9982a0d66868d7219f116ebd9027fe21e748e11e6c
|
Provenance
The following attestation bundles were made for mcp_vanguard-1.1.4-py3-none-any.whl:
Publisher:
publish.yml on provnai/McpVanguard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_vanguard-1.1.4-py3-none-any.whl -
Subject digest:
1d851bcdfe5edec327ed647e077b29456025482799230873c502ee609fee26d0 - Sigstore transparency entry: 1072227016
- Sigstore integration time:
-
Permalink:
provnai/McpVanguard@133c60b30e0dabc4205914329a0f259247c1cae7 -
Branch / Tag:
refs/tags/v1.1.4 - Owner: https://github.com/provnai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@133c60b30e0dabc4205914329a0f259247c1cae7 -
Trigger Event:
push
-
Statement type: