Skip to main content

Install and CLI

Install zn-gate for Node.js or Python, and the commands it provides.

View .md

zn-gate is open source (MIT): a local rules engine with secret redaction, an MCP server, a proxy for other MCP servers, a local audit log and SDKs. It has zero runtime dependencies, needs no account and sends nothing anywhere by default. It works on macOS, Windows and Linux.

Install

Node.js 18 or later:

# Run without installing
npx -y zn-gate --version

# Or add it to a project
npm install zn-gate

To add it to your coding agent, see the quickstart.

After updating from a version older than 1.8.0, run zn unlock once. A vault still running from an older version keeps secrets as markers and tokens in the agent hooks until it is restarted, and zn unlock restarts it. zn vault status shows the zn-gate version of the running vault and flags an old one.

The Python SDK, for agents you build yourself; it does not protect coding agents such as Claude Code, Codex or Cursor. Python 3.10 or later, standard library only. Install it in a virtual environment:

python3 -m venv .venv
.venv/bin/pip install zn-gate      # Windows: .venv\Scripts\pip install zn-gate

On Windows, in PowerShell run .venv\Scripts\Activate.ps1 (if scripts are blocked, run Set-ExecutionPolicy -Scope Process RemoteSigned first, or call .venv\Scripts\zn-gate directly); in cmd run .venv\Scripts\activate.

Commands

Command What it does
mcp Runs zn-gate as a local MCP server (clients and tools)
init Guided setup for Claude Code, Codex CLI, Cursor and OpenCode (Install). init --wrap-mcp finds the MCP servers in your agent configs and wraps each local one with shield, after writing a backup (details)
check (also doctor) Shows that zn stops your agent from reading a test .env file (details)
reach Read-only report of what your coding agents can reach on this machine: secret names in .env files, credential files, environment variables, MCP servers and agent settings. Each finding has its fix (details)
audit Reads the agent configuration files of a repository without running anything and reports what would run, where requests would go and which instructions an agent would follow. Text, JSON or SARIF (details)
connect Optional: turns on the cloud check for analyze_prompt with an analysis-only API key kept in your system keychain (details)
disconnect Removes the saved key and can also revoke it on usezn.com, after asking (details)
report Local summary of what zn-gate did on this computer in the last days (--since, --json). Reads only local files (details)
uninstall Removes zn-gate from this computer: the Claude Code plugin, the hooks and the MCP servers wrapped by init --wrap-mcp. Lists first and asks before removing; your vault stays unless you say yes to a separate question (--dry-run only lists). Run it yourself in your own terminal (details)
shield -- <command> Wraps one MCP server command (uvx, npx, node, python) with zn-gate
analyze <text> Checks one prompt and prints the verdict and rule. Local; cloud only with ZN_CLOUD=1 and a key
scan <path> Audits prompt templates, Markdown, skills and configs for injection traps and leaked secrets. Exit code 1 on findings. A leaked secret is reported as Secret found, with the next step (details)
evidence (alias logs) Verifies, shows, serves and exports the local audit log (details)
test Runs the local self-test (51 curated vectors: 26 attacks, 25 benign) with latency. Never uses the network
status Shows the detection engine, the rules version, whether the optional cloud check is on and whether a key was saved by connect (never the key). Sharing of usage statistics has its own status: zn-gate stats share status

Run npx -y zn-gate --help for every option. Environment variables, flags and custom rules: Configuration.

The Python package installs a zn-gate command too, with scan, analyze, test, evidence and status (its test checks a single text you pass it).