Open-source runtime firewall for AI agents. Stops poisoned tools, rug-pulls, data leaks, AI worms and memory poisoning in MCP traffic.
The open-source runtime firewall for AI agents. Stops poisoned tools, rug-pulls, data theft, AI worms and memory poisoning in the live traffic between your agent and its MCP servers.
Get started · Explained simply · Benchmark · MCP server scan · Test any guard · Architecture · Contribute
AI agents do whatever the text they read tells them, including a note an attacker hid in an email, a web page or a GitHub issue. And they hold the keys to your email, files, code and money. Naka sits between the agent (Claude, Cursor, VS Code, any MCP client) and its tools, and checks every message both ways:
AI agent ⇄ naka ⇄ MCP servers (Claude, checks (GitHub, Slack, files, mail, Cursor...) every message or a remote https:// server) 🔒 Follows your secrets. A key read through one tool can't leave through another, even base64-encoded, reversed or split up. 🪱 Stops AI worms. An injected note can't be copied into emails, comments or chats where the next AI will read it. We haven't found another MCP guard that does this. 🧠 Protects the AI's memory. Attacker text can't be written into CLAUDE.md, AGENTS.md, Cursor rules, skills or a memory server, where it would come back every session. 📌 Pins every tool. A tool that changes after you approved it is quarantined. 🙋 Asks you, in the app. Payments, unlocks and messages to addresses the agent just read pop up a question instead of a guess. It fails closed, has zero dependencies, and sets up with one command.
Naka (नाका) is Hindi for a checkpoint: the post on the road where every vehicle stops and gets checked before it goes on.
pip install naka naka install --dry-run # see which servers in Claude/Cursor/VS Code/... would be protected naka install # protect them (backs up each config; `naka uninstall` restores) Restart the apps. Every MCP server now runs through Naka.
Using Claude Code? Its own tools (Bash, file edits, web fetch) don't go through MCP. Protect them too with the plugin:
/plugin marketplace add lakshyab20/naka /plugin install naka@naka To see it work first:
naka demo --unprotected # a hijacked agent, two servers: 7 attacks succeed naka demo # the same agent through Naka: every one is stopped The MCP server scan We started the 100 most downloaded MCP servers and read what they tell the AI. None hid instructions, but 12 of the 75 that started (including the official GitHub, Slack and Notion servers) let one injected message read your private data and send it out on its own. Full results, rerun every week. Check any server yourself with naka audit -- (it starts the server, so run unknown ones somewhere disposable).
New to AI agent security? Naka explained simply, in six pictures →
Same 40 attacks and 22 everyday tasks, through each guard, scored by what actually reached the tools (details and caveats):
These come from the Agent Firewall Bench, an open test any MCP guard can run, now with an agentjacking suite too (Naka: 4 / 4). The suites are ours and include attack families other guards don't claim to cover, so read the per-kind breakdown. Pipelock does plenty this test doesn't measure (an HTTP egress proxy, signed receipts). Run it yourself, or add your guard:
naka eval --guard naka --guard "yourguard=yourguard proxy -- {cmd}" -v What it stops Attack What happens Naka's rule Tool poisoning A tool's description hides instructions for the model, often in invisible Unicode poisoned-tool: hidden from the agent, calls refused Rug-pull A tool is harmless when you approve it, then changes later rug-pull: every definition is pinned by SHA-256; a change is quarantined Indirect prompt injection Tool output (a page, an issue, an email) tells the model what to do injected-response: withheld, or labelled as untrusted in warn mode Injected destinations The output says "email this to attacker@…" or "transfer to account …" and the agent does it untrusted-destination: an address, URL, account or ID that came from tool output can't decide where data goes without your OK Data theft A secret read through one server leaves through another tainted-flow: tracked across every server in the app, even base64-encoded, reversed, reformatted or split up High-impact actions After reading untrusted content, the agent pays, unlocks, grants access or deletes after-untrusted: asks you first AI worms A hijacked agent copies an injected note into an email reply, a forward, an issue comment, a code comment or team chat, where the next AI reads it and spreads it further spread: Naka remembers the wording of everything untrusted tools return; a copied note that asks to be passed on can't leave, in several languages, even edited or buried in padding Memory poisoning The note is written into CLAUDE.md, AGENTS.md, Cursor/Cline/Windsurf rules, skills, a memory server, an MCP config, a git hook or a CI workflow, so it comes back every session memory-poisoning / memory-write: copied text with a link, command or AI-directed request is blocked; other outside text asks first. Text from your own project files is fine Credential leaks API keys, tokens or private keys in tool-call arguments secret-in-args Look-alike tools A new tool named send_emaіl (Cyrillic і) shadows send_email shadow-tool Agentjacking (new) An error report, issue, doc page or ticket tells a coding agent to npx a package or curl … | bash a script, the 2026 attack on Claude Code, Cursor and Codex install-after-untrusted asks first; untrusted-install blocks a script link that came from that content; lookalike-package flags reqeusts-style typo-squats Hijacked agents (new) Whatever trick got in, the agent starts sending your secrets somewhere canary: naka canary plant leaves decoy keys; if one is ever sent, in any encoding, the call is blocked and the session locked Phishing pop-ups (new) A server uses MCP's in-app forms to ask for your password, one-time code, API key or card, or fakes a Naka prompt elicitation-phishing: the form is declined before you see it Detection covers hidden Unicode, base64, look-alike letters, English plus Hindi/Hinglish, Spanish, French, German and Portuguese phrasings, common credentials, and India-aware PII (PAN, Aadhaar, Luhn-checked card numbers).
naka eval runs attack scenarios and everyday tasks through any MCP guard over real stdio, and scores what actually reached the tools (how it works). It includes the first open test set for AI worms and memory poisoning, with everyday look-alikes (quoting, forwarding, saving notes) that a guard must let through.
¹ Saving text from an email into the AI's long-term memory asks first. ² A reply to an address read from an email and paying a bill from a list ask first; copying .env into another file is blocked. ³ Every one is a high-impact action (payment, unlock, access grant…) right after reading outside content: a confirmation click, not a block. On 924 real emails, documents and code snippets copied into outgoing messages, the spread rule fired on 0 (block) and 0.3% (ask).
Replaying 1,054 InjecAgent attacks end to end (a fully hijacked agent tries to complete each attack):
The lesson behind the design: detection can't be the main defence. Attackers can always reword, and InjecAgent's polite "Please unlock my front door" doesn't look like an attack. What stops attacks is structure: pinning, data flow, and asking a person before risky actions. Detection is a cheap first filter. naka bench reproduces these numbers and scores detection alone on BIPIA and NotInject.
Some calls aren't clearly wrong, only risky: replying to an address the agent just read, a payment after browsing, a tool's first use. If your app supports MCP elicitation, Naka asks you in the app:
Naka: allow 'send_email' on inbox? - The email amy.watson@gmail.com came from the output of 'inbox/read_page', not from you. Arguments: {"to": "amy.watson@gmail.com", "body": "..."} Apps without prompts get confirm_fallback (block by default, with a message explaining how to adjust).
# Local server claude mcp add github -- naka wrap --name github -- npx -y @modelcontextprotocol/server-github # Remote server (Streamable HTTP); $VARS in headers are read from the environment naka wrap --name linear --url https://mcp.linear.app/mcp --header "Authorization: Bearer $LINEAR_TOKEN" # Untrusted server: hide your home folder from it naka wrap --name sketchy --sandbox auto --allow-path ~/projects/app --env SKETCHY_TOKEN -- npx -y some-server naka pins list # what is pinned, what is waiting for review naka pins approve --name github add # accept a changed definition after reading it naka log # recent decisions naka scan suspicious.txt # scan any text; exit code 1 if flagged (CI-friendly) naka audit -- npx -y some-mcp-server # check a server's definitions (it starts the server: use a spare machine for unknown ones) naka canary plant .env.backup # leave decoy keys that catch a hijacked agent naka eval -v # run the attack suites through Naka Defaults are safe; override them with --config naka.toml:
[policy] on_first_use = "confirm" # ask before each tool's first call, instead of trust-on-first-use confirm_after_untrusted = true # strict mode classifier = "builtin" # second-opinion ML classifier (warn mode by default) trusted_tools = ["get_contact"] # outputs that may decide destinations deny_tools = ["delete_repo"] See naka.example.toml for every option.
Naka relays MCP's JSON-RPC between the app and each server, local (stdio) or remote (Streamable HTTP). A pure decision engine (firewall.py) inspects every message, and a shared data-flow store (flow.py) remembers where secrets, destinations and untrusted wording came from, across all the servers one app runs. It fails closed: a message that can't be fully inspected is stopped, never passed through. More in ARCHITECTURE.md.
Zero runtime dependencies. Python 3.11+. Tested on Linux and macOS against the official MCP Python SDK (stdio and Streamable HTTP, protocol 2025-11-25, elicitation). 200+ tests, including attacks on Naka itself from five rounds of security review.
See SECURITY.md for the threat model, review history and how to report a vulnerability.
Naka gets better with every attack someone finds. The most useful contributions:
Start with CONTRIBUTING.md. Everyone taking part follows the Code of Conduct.
All 2 files in this release have provenance metadata.
mcp model-context-protocol ai-security prompt-injection llm agents firewall ai-worm memory-poisoning
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
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 verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
All 2 files in this release have been uploaded with provenance metadata.
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.




