Zero-Code Wire & Native-Hook Security Firewall for Claude Code, Cursor, Codex, Gemini CLI & MCP (Gitleaks + Little Snitch for AI Coding Agents)
pip install mcp-cage==0.4.3.post16
Zero-Code Wire & Native-Hook Security Firewall for Claude Code, Cursor, Codex, Gemini CLI & MCP ("Gitleaks + Little Snitch for AI Coding Agents" — 100% Python 3.10+ Standard Library, Zero External Dependencies)
🚀 Try the Live Interactive Web Sandbox in Your Browser: Explore the 5 Integration Modes ( wrap , hook , shell , Python SDK, mcp-sploit ), inspect the 8-Plane Security Feature Matrix , replay V1 Failure vs. v0.4.0 Blocked Exploits on the live $(P \times U \Rightarrow S)$ graph, and generate copy-paste configs for Claude Code, Cursor, Gemini CLI, Antigravity ( agy ), Codex, Claude Desktop, and LangGraph .
🚀 Try the Live Interactive Web Sandbox in Your Browser: Explore the 5 Integration Modes ( wrap , hook , shell , Python SDK, mcp-sploit ), inspect the 8-Plane Security Feature Matrix , replay V1 Failure vs. v0.4.0 Blocked Exploits on the live $(P \times U \Rightarrow S)$ graph, and generate copy-paste configs for Claude Code, Cursor, Gemini CLI, Antigravity ( agy ), Codex, Claude Desktop, and LangGraph .
Modern AI coding agents ( Claude Code , Cursor , OpenAI Codex CLI , Google Gemini CLI , Google Antigravity agy , and Claude Desktop ) combine three capabilities in a single context window:
Private Data Access ( [P] ) — reading .env , SSH keys, source code, and production databases.
Untrusted Content Ingestion ( [U] ) — reading external GitHub issues/PRs, web pages, and third-party documentation.
External Egress & State Mutation ( [S] / [M] ) — executing shell commands ( curl , git push ), posting Slack/GitHub , or mutating configuration files.
When all three meet in a single session—Simon Willison's Lethal Trifecta —a single indirect prompt injection ( XPIA ) or poisoned MCP tool definition ( MCPTox / CurXecute CVE-2025-54135) can silently exfiltrate credentials or execute arbitrary commands.
mcp-cage is a deterministic, OS-process-isolated security reference monitor that sits across both planes of an AI coding agent:
Plane A (MCP JSON-RPC 2.0 Wire Gateway): Wraps any stdio MCP server ( mcp-cage wrap ) to scrub secrets on the wire, pin tools/list schemas ( mcp-lock.json ), block sampling/createMessage hijacks, and spotlight untrusted outputs.
Plane B (Native Agent Lifecycle Hooks): Plugs directly into PreToolUse / PostToolUse / BeforeTool / beforeShellExecution hooks across Claude Code, Cursor, Gemini CLI, Antigravity ( agy ), and Codex CLI—sharing a single cross-process SQLite WAL taint & secret vault.
Core Security Capabilities
1. Zero-Leak Bidirectional Secret Scrubbing ( BidirectionalSecretScrubber )
Intercepts 11+ credential classes ( OPENAI_KEY , ANTHROPIC_KEY , AWS_ACCESS_KEY , GITHUB_PAT , STRIPE_KEY , SLACK_TOKEN , PRIVATE_KEY_PEM , JWT_TOKEN , DB_CONN_URI , JSON/YAML secrets, and .env assignments) before they enter the LLM context window.
Replaces raw secrets on the wire with deterministic placeholders ( ) backed by an atomic cross-process SQLite WAL vault .
Even if Process 1 ( filesystem MCP or native Read ) mints a token, Process 2 ( slack MCP or native Bash ) immediately blocks any attempt to exfiltrate that placeholder to an unauthorized sink.
2. Destructive Command, SSRF ( 169.254.169.254 ) & High-Entropy DNS Exfiltration Firewall
Path & Dotfile Confinement ( CVE-2025-53110 / CVE-2025-53773 / CVE-2025-54135 ): Resolves canonical paths ( Path.resolve() ) to block symlink escapes and hard-denies agent writes to .env , .git/hooks/ , .vscode/settings.json , .cursor/mcp.json , CLAUDE.md , and ~/.ssh/ .
Cloud Metadata & Private Network SSRF Guard ( validate_outbound_network_target ): Deterministically blocks requests to AWS/ECS/GCP/Alibaba/IPv6 cloud metadata ( 169.254.169.254 , 169.254.170.2 , fd00:ec2::254 , metadata.google.internal , 100.100.100.200 ), loopback ( 127.0.0.0/8 , localhost , [::1] ), RFC 1918 private networks, and dangerous non-HTTP schemes ( file:// , gopher:// , dict:// , ftp:// , ldap:// ).
High-Entropy DNS Exfiltration Blocker: Computes per-label Shannon entropy ($H > 3.9$ bits/char for labels $>28$ chars) and regex signatures to block hex/base64 secret exfiltration over DNS ( .attacker.com ).
3. Lethal-Trifecta Circuit Breaker + MELON Provenance Attribution
Tracks monotonic session Integrity ( TRUSTED $\rightarrow$ ENDORSED $\rightarrow$ UNTRUSTED ) and Confidentiality ( PUBLIC $\rightarrow$ INTERNAL $\rightarrow$ CONFIDENTIAL $\rightarrow$ SECRET ) across concurrent tool calls using BEGIN IMMEDIATE SQLite transactions.
MELON Provenance Attribution: Extracts URLs, domains, and email addresses from untrusted external inputs ( UNTRUSTED_SOURCE ) and hard-denies any subsequent sink or shell call targeting those untrusted entities ( [PROVENANCE HIJACK BLOCKED] ).
Zero-Fatigue UX: Distinguishes benign reads ( README.md + teammate issues stay ENDORSED / PUBLIC ), allows safe workspace-local code edits, and supports 5-minute scoped workspace edit leases ( LEASE_MUTATOR_5M ) while keeping external egress locked.
4. CurXecute Config Linter ( audit-config ), 7-Vector Skill/Rule AST Scanner ( audit-skills ) & MCPTox Schema Lockfile Verification
On-the-Wire Tool Sanitization & Rug-Pull Detection ( SchemaLockVerifier ): Strips , , HTML , and cross-server shadowing directives from tools/list descriptions prior to SHA-256 pinning in mcp-lock.json .
Workspace Config Auditor ( mcp-cage audit-config ): Scans .mcp.json , .cursor/mcp.json , .vscode/mcp.json , and claude_desktop_config.json for CurXecute relative-path RCE ( ./ , ../ , /tmp/ , bash -c , command chaining), hardcoded plaintext API keys in env blocks, and unwrapped MCP servers.
7-Vector Agent Skill & Rule Static + AST Auditor ( mcp-cage audit-skills / WorkspaceSkillAndRuleAuditor ): Scans SKILL.md , CLAUDE.md , AGENTS.md , .cursorrules , .cursor/rules/*.mdc , .github/copilot-instructions.md , .claude/skills/** , and companion scripts/*.py (via Python ast.parse() ) for: RULE_UNICODE_SMUGGLING (Invisible Unicode Tag U+E0000..U+E007F , zero-width, and BiDi overrides — "Rules File Backdoor" / CVE-2021-42574 ) RULE_MARKDOWN_IMAGE_BEACON (Zero-click Markdown image exfiltration beacons  RULE_SECURITY_BYPASS_DIRECTIVE ( , --no-verify , chat.tools.autoApprove , dangerouslyDisableSandbox ) SKILL_OBFUSCATED_OR_PIPE_EXEC ( curl ... | sh and Python AST eval(base64.b64decode(...)) / exec(...) ) SKILL_AST_CAPABILITY_DRIFT (Declarative-to-Executable Capability Drift: SKILL.md frontmatter claims read-only/formatting while companion scripts/*.py invoke subprocess / socket / urllib ) SKILL_PERSISTENCE_BACKDOOR (Self-propagating writes to ~/.bashrc , ~/.zshrc , or .git/hooks/ ) SKILL_UNTRUSTED_PACKAGE_SOURCE (Malicious --index-url or unpinned git+https:// package installs)
RULE_UNICODE_SMUGGLING (Invisible Unicode Tag U+E0000..U+E007F , zero-width, and BiDi overrides — "Rules File Backdoor" / CVE-2021-42574 )
RULE_MARKDOWN_IMAGE_BEACON (Zero-click Markdown image exfiltration beacons 
RULE_SECURITY_BYPASS_DIRECTIVE ( , --no-verify , chat.tools.autoApprove , dangerouslyDisableSandbox )
SKILL_OBFUSCATED_OR_PIPE_EXEC ( curl ... | sh and Python AST eval(base64.b64decode(...)) / exec(...) )
SKILL_AST_CAPABILITY_DRIFT (Declarative-to-Executable Capability Drift: SKILL.md frontmatter claims read-only/formatting while companion scripts/*.py invoke subprocess / socket / urllib )
SKILL_PERSISTENCE_BACKDOOR (Self-propagating writes to ~/.bashrc , ~/.zshrc , or .git/hooks/ )
SKILL_UNTRUSTED_PACKAGE_SOURCE (Malicious --index-url or unpinned git+https:// package installs)
5. Zero-Config Empirical Wire-Level Parameter Guards ( v0.3.0 )
Automatically enforced out of the box by MCPCageEngine ( MCPWireGateway ), DynamicProfileAwareProxy , and Plane B hooks:
Runtime Endpoint & Session Re-pointing Guard ( endpoint_repoint_guard ): Blocks runtime connection-mutation tools ( connect_to_* , switch_server , set_endpoint , configure_connection ) unless explicitly opted in, and blocks mid-session *_url + *_token / *_key repointing to local , localhost , 127.0.0.1 , 169.254.169.254 , RFC1918, or untrusted hosts as well as raw bearer tokens in LLM context ( GHSA-rvjm-7hvp-f868 ).
Embedded POSIX Command Substitution Guard ( path_command_substitution_guard + make_workspace_path_guard ): Inspects folderPath , filePath , source_dir , app_dir , working_directory , download_directory , destination , and path for $(...) , `...` , and ${...} even when disguised inside a valid relative workspace path segment ( CWE-78 ).
REST URL Path-Segment Traversal Guard ( url_path_segment_guard ): Blocks .. , %2e%2e , / , %2f , \ , ? , and # (including URL-decoded/double-encoded forms) across *_id , *Id , *Name , scriptName , job_id , session_id , rag_id , bucket , and repo before REST URL interpolation ( CWE-22 ).
CLI Positional-Argument Flag Injection Guard ( cli_flag_injection_guard ): Blocks leading - / -- flags ( --upload-pack= , --template= , --kubeconfig= , --token= , --output= ) injected into positional resource, directory, or target arguments ( CWE-88 ).
Multi-Statement & Clause-Level SQL AST Guard ( sql_safety_guard ): Strips -- and /* ... */ (both space-joined and compact to defeat token splitting), detects stacked ; queries, and enforces SQLi checks across where_clause , order_by , filter , having , sort_by , and group_by ( A4.3 / A8.1 ).
6. Wire-DIFC 4-Slot Canonicalizer, Line-Span WAL Provenance & Kernel Sandbox Compiler ( v0.4.0 – v0.4.3 )
Unconditional 4-Slot Wire Canonicalizer ( WireDIFCCanonicalizer ): Neutralizes Day-0 tool-provider misbinding and comparative authority inflation ( S_poison >= 0.45 ) on tools/list .
Content-Addressed Line-Span & Persistent Memory/RAG Provenance ( PersistentLineSpanProvenance ): Tracks SHA-256 line-span taint (both untrusted URL/email entities and imperative directives) in SQLite WAL across CLAUDE.md , .cursorrules , MEMORY.md , and @modelcontextprotocol/server-memory entities ( mcp-memory:// ) to defeat cross-session stored prompt injection and second-order RAG poisoning across both Plane A and Plane B without freezing clean lines.
Destination-Bound Format-Preserving Secret Vault ( DestinationBoundFPEVault ), Covert Identifier Guard ( is_covert_exfil_identifier ), Cross-Turn Salami-Slice Circuit Breaker & Rolling Shingle Multi-Encoding DLP ( check_outbound_encoded_confidential_exfil ): Prevents confused-deputy secret oracle forwarding, detects natural-language EFF Diceware identifier exfiltration, accumulates short cross-turn egress fragments in domain_egress_ledger , and blocks Base64, Base32, Hex, URL-decoded, reversed, and ROT13 exfiltration of CONFIDENTIAL / SECRET document excerpts.
Zero-Leak Child Environment Jail ( SubprocessEnvJail ) & Offline Damerau-Levenshtein Supply-Chain Slopsquatting Guard: mcp-cage wrap scrubs ambient shell credentials ( AWS_* , OPENAI_* , ANTHROPIC_* , GITHUB_* , *_KEY , *_TOKEN , *_SECRET ) from child MCP server os.environ by default ( --allow-env opt-in), while mcp-cage audit-config detects typosquatted/slopsquatted packages ( MCP_SUPPLY_CHAIN_TYPOSQUAT ) and unpinned dynamic runners ( UNPINNED_DYNAMIC_PACKAGE_EXEC ).
Inbound Response, Reverse-Channel, Scalar Return Trojan & Cross-Server Spoofing Firewall ( WirePayloadSanitizer + MCPHttpTransportFirewall ): Strips zero-click Markdown image beacons ( , active HTML / / tags, spoofed ChatML/XML turn-closing role delimiters, cross-server impersonation errors, and scalar return-value trojans ( timestamp , id , status ), while blocking server-initiated roots/list reconnaissance, elicitation/create credential phishing, sampling/createMessage includeContext: "allServers" hijacks, HTTP/SSE DNS Rebinding ( CVE-2025-66416 ), OAuth 2.1 metadata injection ( CVE-2025-6514 ), and cross-origin auth-header redirects.
7-Vector MCP Server Source-to-Sink 0-Day Scanner ( mcp-cage audit-server [--format json|sarif] [--auto-patch policy.json] ) & Live Differential Boundary Prober ( mcp-cage probe-live -- ): Hunts CWE-78 , CWE-22 , CWE-89 , CWE-918 , CWE-94/502 , CWE-346 ( 0.0.0.0 DNS-rebinding), and CWE-863 (OAuth Confused Deputy) directly inside Python ( FastMCP / mcp.server ) and TypeScript ( @modelcontextprotocol/sdk ) MCP server repositories and automatically compiles discovered 0-days into live wire virtual patches ( --auto-patch ) .
Declarative Temporal Call-Graph Invariants, Policy Learner ( mcp-cage learn-policy ), Active Honeytoken Tripwires ( mcp-cage plant-canaries ), Transactional Workspace Rollback ( mcp-cage rollback ), Zero-LLM Intent Alignment & Forensic Causal Trace Inspector ( mcp-cage inspect-audit ): Enforces require_prior / forbid_after / max_calls rules, synthesizes least-privilege policies from shadow logs, plants HMAC-tagged canary credentials, journals compressed file pre-images for instant taint rollback, enforces ).
If you use mcp-cage , WIRE-DIFC , or the WIRE-EVAL benchmark in your research or security engineering workflows, please cite our paper:
Preprint (Zenodo DOI): ( )
Preprint (Elsevier SSRN):
Released under the MIT License . Copyright (c) 2026 Nagarajulu Aerakoni .
Release files for mcp-cage 0.4.3.post16
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation .
Source distribution (sdist)
Built distribution (wheel)
Total release size: 279.3 kB
Release files / mcp_cage-0.4.3.post16.tar.gz
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 Nov 30, 2026.
Release files / mcp_cage-0.4.3.post16-py3-none-any.whl
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 Nov 30, 2026.
Security for mcp-cage 0.4.3.post16
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.
Both files in this release have been uploaded with provenance metadata.
Attestation for mcp_cage-0.4.3.post16.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 Nov 30, 2026.
Attestation for mcp_cage-0.4.3.post16-py3-none-any.whl
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 Nov 30, 2026.
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.
Release history Release notifications | RSS feed
0.4.3.post16 This release
Nov 30, 2026 2 release files Full provenance
Nov 29, 2026 2 release files Full provenance
Nov 27, 2026 2 release files Full provenance
Nov 27, 2026 2 release files Full provenance
Nov 23, 2026 2 release files Full provenance
Nov 22, 2026 2 release files Full provenance
Nov 22, 2026 2 release files Full provenance
Nov 22, 2026 2 release files Full provenance
Nov 21, 2026 2 release files Full provenance
Nov 21, 2026 2 release files Full provenance
Nov 20, 2026 2 release files Full provenance
Nov 20, 2026 2 release files Full provenance
Nov 20, 2026 2 release files Full provenance
Nov 20, 2026 2 release files Full provenance
The full story
This article is one source in a clustered incident — the cluster page carries the summary, timeline and every other outlet covering it.
