Skip to main content

Veilgate

A local-first zero-trust Model Context Protocol (MCP) privacy firewall & context-diet gateway.

PyPI Version Python Versions License Build Status


Overview

Veilgate is a local-first zero-trust security gateway and proxy that sits transparently between AI client hosts (Claude Desktop, Cursor, Antigravity, Windsurf, LangGraph) and upstream Model Context Protocol (MCP) tool servers.

As AI agents connect to databases, filesystems, and external APIs via MCP, they introduce four major risks:

  1. Unchecked Data Exfiltration: Upstream tools can leak PII, credentials, and financial records directly into LLM context windows.
  2. Cross-MCP Confused Deputy Attacks: Sensitive outputs from an internal MCP server can be forwarded by an agent into an external MCP sink (email, Slack, HTTP, webhooks).
  3. Rug-Pull Tool Mutation: Compromised MCP servers can silently alter tool schemas or inject hidden prompt instructions after initial approval.
  4. Context Window Token Bloat: Large MCP tool catalogs can consume 40–70% of the prompt context window before reasoning begins.

Key Capabilities

  • Cryptographic Data Minimization (protect & drop): Intercepts sensitive fields and inline PII/secrets, encrypts raw values locally in an AES-256-GCM vault, and replaces them with format-preserving synthetic tokens (<vg:SALARY:101YJQ>, <vg:SSN:F36N37>) while stripping unnecessary bloat fields.
  • Cross-MCP Taint Tracking & Egress Guard: Tracks token provenance across MCP servers and blocks unauthorized attempts to pass vaulted tokens into external or untrusted sinks (TAINT_ARG_GUARD_BLOCKED), while transparently rehydrating authorized tokens for trusted internal tools.
  • Native Human-in-the-Loop (HITL) Approval Modal & Web Dashboard: Pauses guarded or high-risk tool calls and prompts the human reviewer via an always-on-top native GUI popup modal (or the local web dashboard) with [1] Allow Once, [2] Allow Always, or [3] Deny.
  • Lossless Context Diet: Compacts verbose JSON schemas and uses BM25 adaptive search (veilgate_search_tools) to keep agent context windows lean.
  • Rug-Pull & Prompt Injection Defense: Pins SHA-256 tool schema fingerprints and scans descriptions for hidden instructions or Unicode tag smuggling.
  • Tamper-Evident Audit Ledger: Records every discovery, tool call, token transformation, and approval decision in an append-only, HMAC/SHA-256 hash-chained SQLite WAL ledger.

Installation

Requires Python 3.11+.

# Standard installation
pip install veilgate

# Or install with uv
uv pip install veilgate

# Or run directly without installing
uvx veilgate --help

Quickstart

1. Initialize a Starter Policy

Generate a policy.yaml file in your workspace:

veilgate init --output policy.yaml

(Optional) Provision a dedicated 32-byte AES-256-GCM master key in your OS keyring:

veilgate keygen

2. Configure Upstream MCP Servers & Rules (policy.yaml)

Define the upstream MCP servers Veilgate should proxy, which tools require human approval, and which fields to tokenize (protect) or strip (drop):

version: '1'
extends: recommended
default_tool_allow: true

upstreams:
  - id: fs
    transport: stdio
    command: npx
    args:
      - -y
      - "@modelcontextprotocol/server-filesystem"
      - "/path/to/workspace"
  - id: db
    transport: stdio
    command: uvx
    args:
      - mcp-server-motherduck
      - --db-path
      - ":memory:"

tools:
  - match: "fs.write_file"
    allow: true
    require_approval: true
  - match: "db.query"
    allow: true
    require_approval: true

protect:
  - margin
  - salary
  - ssn
  - secret
  - password
  - token

drop:
  - debug_trace
  - internal_id

Validate your policy at any time:

veilgate validate --config policy.yaml

3. Connect Your AI Client (mcp.json / mcp_config.json)

Point your MCP client host (Claude Desktop, Cursor, Antigravity, etc.) to veilgate run:

{
  "mcpServers": {
    "veilgate": {
      "command": "veilgate",
      "args": [
        "run",
        "--config",
        "/absolute/path/to/policy.yaml"
      ]
    }
  }
}

Or automatically import and rewire an existing Cursor or Claude Desktop config:

veilgate adopt --client cursor --output policy.yaml

Interactive Human-in-the-Loop (HITL) Approvals

When an AI agent invokes a tool marked with require_approval: true (or an external egress tool), Veilgate pauses the call and displays a native authorization modal (and queues the request in the local dashboard):

Option Decision State Behavior
[1] Allow Once APPROVED Authorizes this single tool invocation (bound to the exact SHA-256 hash of its arguments). Future calls will prompt again.
[2] Allow Always APPROVED_AND_SAVED Authorizes the call and updates policy.yaml (require_approval: false) with live hot-reload so future calls to that tool execute without prompting.
[3] Deny DENIED Immediately blocks the tool call (APPROVAL_DENIED) before any upstream execution occurs and logs the event.

All approval requests are fail-closed: if the timeout expires (default: 120s) without human confirmation, Veilgate automatically denies the call (APPROVAL_TIMEOUT).


CLI Reference

# Start the Veilgate MCP Gateway proxy (stdio or streamable HTTP)
veilgate run --config policy.yaml

# Wrap a single MCP command on the fly without writing a config file
veilgate run --wrap "npx -y @modelcontextprotocol/server-filesystem ."

# Validate and inspect a compiled policy
veilgate validate --config policy.yaml

# Inspect upstream tool catalog, capabilities, risk ratings, and token counts
veilgate catalog list --config policy.yaml

# Test how Veilgate will classify a tool or sanitize a sample JSON payload
veilgate explain db.query --config policy.yaml
veilgate explain '{"customer": "Alice", "salary": "$145,000", "debug_trace": " verbose "}' --config policy.yaml

# Launch the local web observability and review dashboard (http://127.0.0.1:8765)
veilgate dashboard --config policy.yaml --port 8765

# Verify the cryptographic integrity of the SHA-256 audit hash chain
veilgate audit verify --db veilgate.db

# Tail or export audit logs (JSONL or CSV)
veilgate audit tail --db veilgate.db
veilgate audit export --db veilgate.db --output audit.jsonl --format jsonl

License

Released under the MIT License.

Metadata

Release files for veilgate 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for veilgate 0.1.3
File Size Uploaded Provenance
veilgate-0.1.3.tar.gz 701.7 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for veilgate 0.1.3
File Interpreter ABI Platform
veilgate-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 809.9 kB

Release files / veilgate-0.1.3.tar.gz

Download URL veilgate-0.1.3.tar.gz
Size 701.7 kB
Tags Source
SHA-256 checksum
How to use checksums
bd934cedd599180ce3ca89bd20bfda9beeb883fadd80c19164a41bf2382db81b
BLAKE2b-256 checksum
How to use checksums
6423dd04eb70c9d810ab4b67feb884deafaaa9a07f2d33601354df59e40830bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

Release files / veilgate-0.1.3-py3-none-any.whl

Download URL veilgate-0.1.3-py3-none-any.whl
Size 108.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
25a55bb2219429884acaaa554faf3d403125a90eb9cf34657b646240793b6842
BLAKE2b-256 checksum
How to use checksums
903aac3b7f5b44888beb7d99df54e1d2977fec074de85c4e9b4d45083789fc27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

Security for veilgate 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for veilgate-0.1.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page