IntentShield for MCP
IntentShield checks what your AI coding agent does with MCP (Model Context Protocol) tools, on your machine, before anything runs. It reads each tool call, tool description and tool result with deterministic rules and then allows the call, holds it for you to confirm (an "ask"), or blocks it (a "deny"); the core needs no API key. Hooks say allow, ask and deny; the gateway and proxy log the same three outcomes as ALLOW, REVIEW and BLOCK.
It works with Claude Code, Codex CLI, Cursor and Gemini CLI (through their hooks: commands the harness runs before each tool call) and with any MCP client that launches stdio servers (through a proxy). One author; how the work was produced is in Authorship and process.
Threat model.
- Attacker: whoever controls text the model reads (an MCP server's tool descriptions and results, a fetched page, a file) and wants the agent to make a call you did not ask for.
- Trusted: you, your prompts, your machine, the harness and IntentShield's own rules. The model's output and everything an MCP server sends are untrusted: scanned, never obeyed. Only the deterministic rules can allow a call; detectors and the judge add evidence.
- Not covered: an attacker who already has your shell or controls the harness; the MCP servers' own code; the harness's shell, file
and web tools unless installed with
--builtin-tools(best effort); plain-language injections the rules do not read. - Full text: Security boundary and what is in and out of scope.
Install
Python 3.11 or later and uv (brew install uv, or pip install uv); pipx works too.
uv tool install intentshield-mcp # or: pipx install intentshield-mcp
intentshield install claude # or codex, cursor, gemini; --scope project for this directory only (not Codex)
intentshield demo # sample calls through the real hook: an allow, an ask and a deny; nothing runs
intentshield doctor # run it after you start the harness and send it any prompt
intentshield-mcp-verify --demo --stdio --summary # the proxy's own check against a bundled demo server
What you should see:
installprintsinstalled claude hooks in <the settings file>, then aNext:line.demoprints one line per sample call (allow,ask,deny) with the rule's reason, then a seconddenyfor an MCP call, and exits 0.doctorright afterinstallprints awarnthat no hook has run yet and exits 0 (since 0.4.4; 0.4.3 printedFAILand exited 1). Start the harness (Codex CLI first asks you to trust the hooks), send any prompt and run it again. A line that staysFAILis in Troubleshooting.intentshield-mcp-verifyends withPASS 13/13 checks. It checks the bundled demo server, not the proxywrapinstalls;doctor --connectstarts each wrapped server through its proxy.
What the default install guards. MCP calls. Shell, file and web tools are guarded only with --builtin-tools
(intentshield install claude --builtin-tools; opt-in, best effort); demo runs its shell calls with that flag on.
The optional LLM judge (--judge, off by default; a hosted one sends prompts, arguments and tool text to its provider) is in
docs/layers.md; the glossary defines the terms.
On a system Python that pip will not change ("externally-managed-environment") use uv tool or pipx; if intentshield is then
not found, run uv tool update-shell or pipx ensurepath. Do not install through uvx, which leaves a temporary path behind.
The PyPI name is intentshield-mcp; intentshield there is a different project.
The package ships no trained model and has no ml extra: the optional learned classifiers (docs/detectors.md) are trained from a clone. Platforms: tested on macOS and Linux (CI, Python 3.11 to 3.14); Windows is untested.
Put the proxy in front of MCP servers
intentshield wrap .mcp.json # or ~/.claude.json (servers added with `claude mcp add`), Cursor mcp.json, Gemini settings.json,
# ~/.codex/config.toml, VS Code mcp.json; restart the client afterwards
intentshield unwrap .mcp.json # undo; add --dry-run to either command to preview
intentshield scan # check the servers you already use; it starts each one to list its tools
wrap rewrites each stdio server to start through intentshield-mcp --transparent, which hides poisoned or changed tool
descriptions and flags injected results. HTTP servers ("url") are left alone. doctor prints the exact wrap command for each
config file it finds. install and wrap write absolute paths of this machine, so do not commit a wrapped project file or a
--scope project hook file. Formats, the reduced environment a wrapped server sees and what scan starts are in the
guide.
What it stops and does not stop
| Stops | Does not stop |
|---|---|
| Instructions injected into a tool call's arguments or a tool result | Plain-language injections with no instruction marker (the optional judge reads these) |
| A value a tool result supplied that the user never gave: an address, URL, path or credential | Most non-English injections: the rules read two phrases in 11 languages |
| Poisoned tool descriptions, and descriptions that change after you accepted them (a "rug pull"), through the proxy | The harness's own shell and file tools, unless installed with --builtin-tools (opt-in, best effort). An MCP filesystem or shell server is read only by its path and command arguments |
| Tools that ask for the model's name or system prompt: the guard removes them from the schema | HTTP MCP servers under wrap |
A hook that cannot start or crashes: install adds a launcher that turns it into a refusal (POSIX shells) |
A Codex hook you have not trusted yet: Codex skips it silently |
The left column lists the categories the rules were written for. The measured catch rate on injection text they were not written for is low: see Results. What each layer sees, per harness: docs/layers.md. All limits: docs/benchmarks.md.
What is stored locally
In ~/.intentshield:
hooks.db(mode 0600): per-session state. It holds your prompts, with any credential the guard recognises replaced by a short hash, and the values (addresses, URLs, paths) taken from tool calls and results. A clean session is forgotten after 7 days without activity, one that holds a flag or taint after 30.threats.db: learned threat memory (30 days unless confirmed).gateway.dbandproxies/<server>-<hash>.dbfor each wrapped server: an audit database with call arguments and results, with no expiry.backups/: each settings or MCP file as it was beforeinstallorwrapfirst changed it; it can hold tokens that were already in it..env: a judge key, if you set one.
SECURITY.md lists every file and the commands for a single one.
Upgrading and removing
uv tool upgrade intentshield-mcp && intentshield install claude # then again for each harness, with your earlier options
intentshield uninstall claude; intentshield unwrap .mcp.json # undo your files first: they may need the backups
uv tool uninstall intentshield-mcp; rm -r ~/.intentshield # last
Coming from 0.4.3: Upgrading from 0.4.3 lists what changes for you, including that a call with MCP arguments over 1,000,000 characters now asks. Full steps: Upgrading and removing.
Results
The weak numbers come first. Protocols, intervals, tables and every caveat are in docs/benchmarks.md. The hook study is below.
- Injection text the rules were not written for: the rules catch 28 of 1,427 (2.0%); with exemplars (a nearest-neighbour check) 252 (17.7%), mostly generated outputs in the exemplar index's own styles. The rules catch 50.8% of all 2,959 injections, but were tuned on 1,505 of them.
- MCP Security Bench (MSB): no guarded arm let a harmful call run, but a trivial baseline did equally well, so the metric cannot rank guards. The gateway cost 8 to 14 points of task completion against that baseline. A call held for a human counts as not executed.
- MCPTox replay (a tuning set): 0.4% attack success, 3.5% of benign calls blocked and 46.3% sent to review.
- Limits: single runs of small models on templates the rules were tuned on. Overhead is about 70 ms per hook event and 140 ms per guarded MCP call.
The hook study
What coding-agent tools do with the verdict a hook returns: the report is about 2,800 words and has every count and caveat.
- Setup. Claude Code (27 scored builds), Codex CLI (14) and Gemini CLI (28), run headless on macOS against a scripted stub model. Cursor was not measured.
- Deny and ask. A
denythe harness parsed was enforced on every build where the hook ran. Anaskwith nobody to answer it was refused by Claude Code from 2.1.85 (the sweep pre-approved Bash; without that, one build, 2.1.316, was tested), ignored by Codex CLI, and run or left hanging by Gemini CLI. - Timeouts. With a 3 s hook timeout the call ran on 22 of 22 Claude Code, 12 of 12 Codex CLI and 1 of 1 Gemini CLI builds. Claude Code's
onFailure: "block", whichinstallwrites, blocked it on one build (2.1.316). Other failures were tested on one or two builds. - Other guards. Mixed. Before its dangerous-command rules IntentShield let through 137 of 166 harmful calls, against 31 of 130 for safety-net and 67 of 117 for knox on their own scopes.
Denies alone, with the opt-in rules as they were when scored, IntentShield denied 24 of 85 harmful calls and safety-net 41 of 85 (p = 0.0033; descriptive only). With the rules now,
benchmarks/hook_fidelity/fresh_report.py --current-rulesgives 29 of 85 (p = 0.043), and one item moved would put it above 0.05. Its gain elsewhere fits its own rule categories and is post hoc. On benign calls it ties safety-net and trails knox. - Limits. One author, one operating system, a stub model, author-written fixtures, no second coder. A measurement note and an artifact, not a paper; nothing was sent to a vendor.
Documentation
- docs/README.md: which files are the product documentation, a reading path with word counts, and where the working notes are. The research verdict: docs/contribution.md.
- docs/guide.md: hooks, the proxy, scan, troubleshooting, the built-in tool rules and wrapping a third-party hook.
- docs/gateway.md: the gateway, dashboard and REST API. docs/layers.md: what each layer sees and stops.
- docs/benchmarks.md: every protocol, table and limit, and the commands that regenerate them. docs/hook-fidelity-report.md: the hook study.
- SECURITY.md, CONTRIBUTING.md, CHANGELOG.md, CITATION.cff. Licence: Apache-2.0, LICENSE.
Metadata
Release files for intentshield-mcp 0.4.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| intentshield_mcp-0.4.4.tar.gz | 457.7 kB | With provenance | Details for intentshield_mcp-0.4.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| intentshield_mcp-0.4.4-py3-none-any.whl | Python 3 | none | any | Details for intentshield_mcp-0.4.4-py3-none-any.whl |
Total release size: 950.2 kB
Release files / intentshield_mcp-0.4.4.tar.gz
| Download URL | intentshield_mcp-0.4.4.tar.gz |
|---|---|
| Size | 457.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
16a32c221f0ff7410fd2e1fccdba3016dead948a672a35993f7b7aa496fcb270
|
|
BLAKE2b-256 checksum How to use checksums |
5eed19d1463f43d503a1d401a268130aa4fe122e69ec1cca5597d88819f25b10
|
| 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 Nov 12, 2026.
Transparency logRelease files / intentshield_mcp-0.4.4-py3-none-any.whl
| Download URL | intentshield_mcp-0.4.4-py3-none-any.whl |
|---|---|
| Size | 492.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4310590bf054ae802893bcf7e5e4b590825825cfe6a2805475a6f240d2bbf858
|
|
BLAKE2b-256 checksum How to use checksums |
fcdfe555df05a5b9f3540699ed78d5df1ab98ab9a62437b7786bb94f51364c7e
|
| 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 Nov 12, 2026.
Transparency logSecurity for intentshield-mcp 0.4.4
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
Both files in this release have been uploaded with provenance metadata.
Attestation for intentshield_mcp-0.4.4.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 12, 2026.
Transparency logA 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.