dont-leak-mcp
Provides safe reading of [.env](/mcp/integrations/dotenv) files: the read_sanitized_file tool returns variable names and non-sensitive values (like PORT or public app names) while replacing credentials with placeholders such as <HIGH_ENTROPY_SECRET_001>, and the installed agent hooks block direct cat .env / read_file('.env') style access and redirect the agent to the sanitizing tool.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Your Data. Your Control.
npx -y dont-leak-mcp setup
Guide · Before & After · Install · 10-Agent Hooks · Detectors · Deploy · FAQ
Don't Leak is a local-first privacy filter for AI coding agents. It detects, redacts, masks, or blocks personal data (PII), credentials, custom RE2 regex patterns, and restricted words before prompts or local files reach a cloud model. One shared @dont-leak/core engine powers the MCP Server, automatic hooks for 10 AI agents, a local LLM HTTP proxy, a bilingual (ID / EN) Web Dashboard, and the CLI. Raw sensitive values never leave your machine and are never stored in SQLite audit logs.
Before and after
One developer prompt containing customer PII and production credentials, before and after passing through Don't Leak:
Before: raw input sent to the AI | After: filtered locally by Don't Leak |
Debug failed webhook for budi.santoso@klien.co.id Applicant NIK: 3171014507900003 Phone: +6281298765432 DATABASE_URL=postgresql://app:Sup3rS3cret99@db.internal:5432/prod WEBHOOK_SECRET=whsec_9fK3mPq8Rw2Lx7Nz4Vb6Cd1Fg5Hj0Kl3 | Debug failed webhook for <EMAIL_001> Applicant NIK: <NIK_001> Phone: <PHONE_001> DATABASE_URL=<DB_CREDENTIAL_001> WEBHOOK_SECRET=<HIGH_ENTROPY_SECRET_001> |
Customer identity, database password, and signing secret enter the model context permanently. | Context stays readable and deterministic ( |
1. Partial masking (action: mask)
Useful in development presets when you still want visual confirmation of which record was matched:
Input | Masked output |
|
|
2. Hard block on internal codenames (action: block)
When any finding resolves to block (or when failMode: closed catches a validation error), Don't Leak withholds the entire payload before the model is called:
Input: "Summarize the Q4 acquisition memo for Project Garuda"
Verdict: BLOCKED (status: "blocked", summary: { BLOCKED_WORD: 1 })
Output: Withheld. Nothing is sent upstream.3. Reading .env safely via MCP (read_sanitized_file)
Agent hooks block direct cat .env or read_file(".env") calls and instruct the agent to call read_sanitized_file instead, so the agent sees variable names without raw credentials:
| Returned to AI agent |
|
|
4. Human-only reversible Token Vault (<LABEL_VXXXXXX>)
When the encrypted vault is enabled, headless hooks and MCP seal values with an RSA-OAEP-256 public key. Only a human with the admin password can restore them afterward:
# AI receives and replies using sealed tokens:
"Send the invoice confirmation to <EMAIL_V4F9A2C>."
# You restore original values locally when needed:
npx -y dont-leak-mcp detokenize ./ai-reply.txt
# -> "Send the invoice confirmation to finance@klien.co.id."Related MCP server: classifinder-mcp
Install
Pick the setup that matches how you run your AI tools. Every route shares the same config.yaml and SQLite metadata store. Full step-by-step instructions, including updates and removal, live in GUIDE.md.
Route | What it does | Best for |
Configures detectors, country profiles, policy preset, Dashboard password, and project hooks | First-time setup on any machine | |
Intercepts prompts and | OpenCode, OMP/Pi, Antigravity, Claude Code, Cursor, Gemini CLI, Windsurf, Cline, Copilot, Codex | |
Gives the AI client 9 local sanitization, inspection, and safe-file tools over | Claude Desktop, Cursor, Antigravity, OpenCode, Windsurf, Cline | |
Sanitizes OpenAI, Anthropic, and Gemini JSON request bodies in transit | Custom scripts, SDKs, or chat apps without hook support |
The setup wizard (recommended)
Requirements: Node.js >= 22.13. Run one command and answer the prompts:
npx -y dont-leak-mcp setupVerify your environment or open the local Web Dashboard (http://127.0.0.1:3000 by default) anytime:
npx -y dont-leak-mcp doctor
npx -y dont-leak-mcp dashboardMCP Server
Add dont-leak to your client's mcpServers configuration:
{
"mcpServers": {
"dont-leak": {
"command": "npx",
"args": ["-y", "dont-leak-mcp"]
}
}
}By default, MCP runs in read/sanitize-only mode (5 tools). Append "--allow-admin" to args only if you want the AI client to add or remove custom regex rules, blocked words, and allowlist entries.
Client | Config file location |
Claude Desktop | Windows: |
Claude Code |
|
Cursor |
|
Antigravity |
|
OpenCode |
|
Windsurf |
|
Cline | VS Code Cline panel -> MCP Servers -> Configure MCP Servers |
Automatic interception
Standard MCP servers are passive: an AI model only filters text through MCP when it chooses to call a tool. To filter prompts and block direct .env or private-key reads automatically on every new session, install lifecycle hooks for your coding agent:
# Auto-detect agent folders in the current project:
npx -y dont-leak-mcp setup-hooks
# Or install globally across your machine for specific / all 10 agents:
npx -y dont-leak-mcp setup-hooks --target opencode,omp,antigravity,claude,cursor --global
npx -y dont-leak-mcp setup-hooks --target all --globalAdd --strict-prompt if you want prompts containing redactable PII/secrets to be hard-blocked on agents whose hook protocol cannot rewrite prompt text in-place.
npx -y dont-leak-mcp setup-hooks --target opencode --globalWrites ~/.opencode/plugins/dont-leak.js (or .opencode/plugins/dont-leak.js for a single repo) using OpenCode v2's { id, setup(ctx) } plugin contract. Hooks ctx.session.hook("prompt") to rewrite PII/secrets into placeholders before persistence and ctx.tool.hook("execute.before") to block .env or secret shell reads. If OpenCode is already open, run opencode reload or opencode service restart.
npx -y dont-leak-mcp setup-hooks --target omp --global
# Alias also supported: --target piWrites native ExtensionAPI module dont-leak.js (pi.on("input") prompt transform + error toast on blocked phrases, and pi.on("tool_call") guard) alongside settings.json command hooks.
Install one or several by name (--global for machine-wide, omit --global for current workspace):
npx -y dont-leak-mcp setup-hooks --target antigravity,claude,cursor,gemini,windsurf,cline,copilot,codexAgent | Project path | Global path | Interception behavior |
Antigravity |
|
|
|
Claude Code |
|
|
|
Cursor |
|
|
|
Gemini CLI |
|
|
|
Windsurf |
|
|
|
Cline |
|
| POSIX |
GitHub Copilot |
|
|
|
OpenAI Codex |
|
|
|
Local LLM HTTP proxy
For SDKs, scripts, or desktop chat clients without hook support, route requests through the local sanitizing reverse proxy:
npx -y dont-leak-mcp proxy --port 8787Point your client base URLs to the local proxy (127.0.0.1 only):
export OPENAI_BASE_URL="http://127.0.0.1:8787/openai/v1"
export ANTHROPIC_BASE_URL="http://127.0.0.1:8787/anthropic"
# Gemini route prefix: http://127.0.0.1:8787/geminiMulti-turn messages[] within one request share a consistent token table, and payloads matching a block rule stop locally with HTTP 422 before reaching the provider.
Detectors
Module | What it catches | Validation & safety |
PII ( | Email, phone ( | Checksum and structure checks (Kemendagri province/date for NIK, Luhn for cards, ISO 13616 MOD-97 for IBAN) |
Secrets ( | AWS, GitHub, GitLab, Slack, Stripe, OpenAI/Anthropic, Google API keys, JWTs, PEM/SSH private keys, Bearer tokens, DB URLs, and high-entropy credentials | Contextual Shannon entropy skips UUIDs, SHA/Git hashes, file paths, and |
Custom Regex ( | User-defined patterns such as | Compiled through |
Blocked Words ( | Confidential codenames, client names, or restricted phrases ( | NFKC Unicode normalization; rules with |
Country profiles (id, us, eu, intl) can be toggled independently in config.yaml or the Web Dashboard.
MCP tools and Web Dashboard
The local Web Dashboard (npx -y dont-leak-mcp dashboard) binds to 127.0.0.1, supports Bahasa Indonesia (ID) and English (EN), and protects state-changing endpoints with scrypt password hashing, HttpOnly session cookies, and CSRF tokens.
MCP Tool | Access | Purpose |
| Default | Redacts, masks, or blocks sensitive spans according to active policy |
| Default | Returns structured finding metadata (labels, offsets, severity) without modifying input |
| Default | Reads |
| Default | Tests a custom RE2 pattern against sample text safely |
| Default | Reports active policy, enabled detectors, country profiles, and scan counts |
|
| Adds or updates a validated RE2 custom rule (creates automatic config backup) |
|
| Removes a custom regex rule by ID |
|
| Adds a blocked word or phrase |
|
| Removes a blocked word or phrase |
Encrypted Token Vault (optional)
Need to restore redacted values in an AI response? Initialize the local hybrid RSA-OAEP-256 + AES-256-GCM vault:
npx -y dont-leak-mcp vault init
npx -y dont-leak-mcp detokenize ./ai-output.mdMCP, hooks, and the HTTP proxy only ever read the public key to seal <LABEL_VXXXXXX> tokens. The private key stays wrapped with your scrypt admin password and is never exposed as an MCP tool.
Update
When a new release ships updated detectors or agent plugin schemas, one command upgrades your global install (if present), cleans stale _npx cache slots so hooks do not run an older cached version, regenerates every installed hook/plugin across your project and home folder, and reloads OpenCode's background service:
npx -y dont-leak-mcp@latest updateTo inspect your current version and list detected hooks without changing any files:
npx -y dont-leak-mcp update --checkSelf-hosted deployment
git clone https://github.com/ItsAxware/DontLeak.git
cd DontLeak
docker compose up -d --buildPrebuilt image: ghcr.io/itsaxware/dontleak:latest.
Web Dashboard listens on
http://127.0.0.1:3000.Persistent
config.yaml, snapshots, and SQLite WAL files live in theprivacy-datavolume (/data).Connect a host MCP client to the running container:
{ "mcpServers": { "dont-leak": { "command": "docker", "args": ["exec", "-i", "dont-leak", "node", "/app/apps/mcp-server/dist/server.js"] } } }
git clone https://github.com/ItsAxware/DontLeak.git
cd DontLeak
pnpm install --frozen-lockfile
pnpm -r build
sudo ./deployment/scripts/install.sh --from-dir .Runs under a dedicated
dont-leaksystem user withNoNewPrivileges=true,PrivateTmp=true,ProtectSystem=strict, andProtectHome=true.Stores config in
/etc/dont-leak/config.yamland SQLite/backups in/var/lib/dont-leak.Upgrade with automatic snapshot:
sudo ./deployment/scripts/update.sh --from-dir .Uninstall while keeping config and audit data:
sudo ./deployment/scripts/uninstall.sh
policy:
name: default
failMode: closed
maxInputBytes: 1000000
entropyDetection: true
reversibleTokenization: false
countryProfiles: [id, us, eu, intl]
enabled:
pii: true
secret: true
custom_regex: true
blocked_words: true
actions:
pii: redact
secret: redact
custom_regex: redact
blocked_words: block
rules:
- id: employee-id
label: EMPLOYEE_ID
pattern: \bEMP-[0-9]{6}\b
case_insensitive: false
severity: medium
action: redact
replacement: "[EMPLOYEE_ID]"
enabled: true
blocked_words:
- value: project phoenix
group: internal_project
match: phrase
action: block
allowlist:
- value: "@example.com"
kind: literal
description: Synthetic test domainAllowlist entries (literal, @domain suffix, or RE2 regex) skip warn, mask, and redact findings. Rules or words with action: block always override the allowlist.
Measured performance
Benchmarked on Node.js >= 22.13 (x64) across 46 structured positive and hard-negative lookalike cases (including contextual Shannon entropy) plus a 1.00 MB mixed sanitization and output-validation payload:
Metric | Measured value |
Precision |
|
Recall |
|
False-positive rate (lookalike negatives) |
|
|
|
Heap delta during |
|
FAQ
Why did my agent still see a secret when I only configured MCP?
MCP tools are passive: the model only calls sanitize_text when it decides to. Install automatic hooks (npx -y dont-leak-mcp setup-hooks) or use the local HTTP proxy so prompts and .env reads are intercepted before the model runs.
How is this different from an agent's built-in secret redaction? Built-in agent filters usually only mask a few known API key prefixes in terminal output and vary across vendors. Don't Leak gives you one consistent policy across all 10 agents, adds country-specific PII checksums (NIK, NPWP, SSN, IBAN, Luhn cards), linear-time RE2 custom rules, company blocked words, a human-only reversible vault, and local metadata-only audit stats.
Can an AI agent decrypt <LABEL_VXXXXXX> vault tokens?
No. No MCP tool accepts a detokenization request, and the private key is encrypted at rest with your scrypt admin password. Only you can run dont-leak-mcp detokenize or enter your admin password in the Web Dashboard Vault tab.
What does Don't Leak intentionally not claim to catch?
Unstructured free-text person names and street addresses have no deterministic format; Don't Leak does not claim regex-only coverage for them to avoid a false sense of security. For specific client or project names, add them to blocked_words or rules.
Star History
Contributors
Thanks to everyone reporting detector edge cases, agent hook changes, and fixes. See the contributors graph or open an issue if a pattern slipped through or flagged a false positive. Full setup, update, and troubleshooting documentation lives in GUIDE.md.
Disclaimer
Get Don't Leak only from ItsAxware/DontLeak, the dont-leak-mcp npm package, or ghcr.io/itsaxware/dontleak. For LAN or remote Dashboard deployments, place Don't Leak behind a TLS reverse proxy and set DASHBOARD_ALLOWED_HOSTS.
License
MIT: LICENSE
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
AI Privacy Firewall: PII/secret leak scanner, hybrid cost estimator & reversible agent redaction.
Find and redact leaked secrets, wallet keys and PII before an AI agent sends text.
Checks AI-written code for leaked keys and made-up packages, on your machine. Never uploads code.
Finds and tokenizes personal data and secrets before they reach an AI model.
Related MCP Servers
- FlicenseAqualityBmaintenancePII sanitization layer for autonomous AI agent pipelines. Detects and redacts emails, phone numbers, national IDs, private keys, and financial data before text reaches LLMs. Supports EN, ES (LATAM), PT (BR/PT), DE, JA.12-

classifinder-mcpofficial
AlicenseAqualityBmaintenanceEnables AI agents to scan text for leaked secrets and prompt injection markers, and redact them before reaching an LLM.21MIT- AlicenseNot gradedqualityCmaintenanceProvides cascading content protection for AI coding assistants by detecting and redacting PII, secrets, prompt injection, and system prompt leakage before they reach LLMs.MIT
- AlicenseNot gradedqualityDmaintenancePrivacy firewall for AI agents that scans files, commits, and push URLs to prevent sensitive data leaks.1MIT