IntentShield for MCP
IntentShield checks what your AI coding agent does with MCP (Model Context Protocol) tools, on your machine, before anything runs: each call is allowed, held for you to confirm (an "ask"), or blocked (a "deny"). It is for developers who use Claude Code, Codex CLI, Cursor or Gemini CLI, or any MCP client that starts stdio servers, and who want a poisoned tool or an injected instruction stopped before it acts. It uses deterministic rules and needs no API key.
Only some harnesses show an ask as a prompt: Claude Code 2.1.85 or later in an interactive session, Cursor for shell commands (with --builtin-tools)
and Gemini CLI for shell commands (with install gemini --gemini-ask). Everywhere else an ask is a refusal that carries the reason:
Codex CLI, MCP calls on Cursor and Gemini CLI, and any headless run (what each harness shows).
"Intent" is what you asked for: the hook and the gateway check each call against your prompt or the request the model states. The default hook install runs rules and a memory of attacks the rules confirmed; it loads no trained model and calls no LLM judge. One author; how the work was produced is in Authorship and process.
What the harnesses do with a hook's verdict is in the hook study below.
Quick start
uv tool install intentshield-mcp # or: pipx install intentshield-mcp
intentshield demo # sample calls through the real hook: an allow, an ask, a deny; no settings change, nothing runs
intentshield install claude # or codex, cursor, gemini; guards MCP calls only: add --builtin-tools for shell, file and web tools (best effort)
# --scope project: this directory only (not Codex)
intentshield-mcp-verify --demo --stdio --summary # the proxy's own check against a bundled demo server
What you should see:
demoprints one line per sample call (allow,ask,deny) with the rule's reason, then a seconddenyfor an MCP call, and exits 0.installruns<harness> --versiononce to record the build, printsinstalled claude hooks in <the settings file>, then aNext:line.- Start the harness (Codex CLI first asks you to trust the hooks), send any prompt and run
intentshield doctor. Right afterinstallit prints awarnthat no hook has run yet and exits 0; a line that staysFAILis in Troubleshooting. - If
installsays it could not read the version of the harness, put the harness onPATHand runintentshield doctor. Until then Claude Code, and Gemini CLI with--gemini-ask, refuse a call that would normally ask you. On the other harnesses no verdict depends on the version.
What the default install guards. MCP calls. Shell, file and web tools are guarded only with --builtin-tools (opt-in, best effort;
the rules); demo runs its shell calls with that flag on.
Four words recur. The harness is the agent program you run (Claude Code, Codex CLI, Cursor or Gemini CLI). A hook is a command the
harness runs before each tool call and asks what to do; install registers IntentShield as that command. The proxy sits between the
harness and one MCP server; wrap puts it there. The gateway is an MCP server of IntentShield's own that the agent calls other
tools through. The glossary has the rest.
Install notes
- Needs Python 3.11 or later and uv (
brew install uv, orpip install uv);pipxworks too. - On a system Python that pip will not change ("externally-managed-environment") use
uv toolorpipx; ifintentshieldis then not found, runuv tool update-shellorpipx ensurepath. Do not install throughuvx, which leaves a temporary path behind. - Verdict handling was measured on Claude Code 2.0.41 to 2.1.316, Codex CLI 0.131.0 to 0.166.0 and Gemini CLI 0.24.5 to 0.66.0; Cursor was not measured. On a build older than these an ask is a refusal, not a prompt.
- The PyPI name is
intentshield-mcp;intentshieldthere is a different project. - The package ships no trained model and has no
mlextra: the optional learned classifiers (docs/detectors.md) are trained from a clone. 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 verify command above ends with
PASS 13/13 checks. It does not check the proxywrapinstalls;doctor --connectstarts each wrapped server through its proxy. - Platforms: tested on macOS and Linux (CI, Python 3.11 to 3.14); Windows is untested. The glossary defines the terms used here.
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.
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 # lists the tools of your user-level configs' servers (stdio ones are started, HTTP ones connected to)
intentshield scan .mcp.json # a project .mcp.json is started only when you name it
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.
scan and doctor --connect do not start servers named by a config in the current directory unless you name the file
(intentshield scan .mcp.json) or pass --connect-project. With no config at all, scan says so and exits 0; with only a project
config it starts nothing and exits 2. 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 catch rate on injection text they were not written for is low (Results). Per harness: what each layer sees. All limits: docs/benchmarks.md.
Documentation
- docs/README.md: how it works in 60 seconds, which files are the product documentation, a reading path and where the working notes are. The research verdict: docs/contribution.md.
- docs/guide.md: hooks, the proxy, scan, troubleshooting and wrapping a third-party hook.
docs/rules.md: what
--builtin-toolsdenies and asks. - 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.
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.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.threats.db: learned threat memory (30 days unless confirmed)..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
Give install the options you used before: running it again without --builtin-tools turns those rules off.
Coming from 0.4.5: Upgrading from 0.4.5 matters only if you set CLAUDE_CONFIG_DIR or CODEX_HOME. Coming from
0.4.4: Upgrading from 0.4.4 lists what changes for you, including the verdicts that are weaker than in 0.4.4.
Coming from 0.4.3: Upgrading from 0.4.3. Full steps: Upgrading and removing.
Results
The weak numbers come first. Protocols, intervals 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 texts in the 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 (an attack benchmark for agents that use MCP tools): no guarded arm let a harmful call run (0.0% executed; a call held for a human counts as not executed), but a trivial baseline did equally well, so it cannot rank guards. The gateway held 0.69 to 2.00 benign calls per case for review (the baseline 0.57 to 0.95) and cost 8 to 14 points of task completion against it. 19 of the 22 trace files carry no provenance record.
- Overhead: about 70 ms per hook event and 140 ms per guarded MCP call. Limits: single runs of small models on templates the rules were tuned on.
The hook study
What coding-agent tools do with the verdict a hook returns, measured on Claude Code, Codex CLI and Gemini CLI with a scripted stub model on macOS. The report has every count and caveat.
- A
denythe harness parsed was enforced on every build where the hook ran. Anaskwith nobody to answer it is handled three ways. - 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.
- Against two other published guards the result is mixed: in unattended runs IntentShield's hook trails safety-net on denies alone.
- Limits: one author, one operating system, a stub model, author-written fixtures, no second coder; Cursor was not measured; nothing was sent to a vendor. A measurement note and an artifact, not a paper.
Metadata
Release files for intentshield-mcp 0.4.6
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.6.tar.gz | 497.4 kB | With provenance | Details for intentshield_mcp-0.4.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| intentshield_mcp-0.4.6-py3-none-any.whl | Python 3 | none | any | Details for intentshield_mcp-0.4.6-py3-none-any.whl |
Total release size: 1.0 MB
Release files / intentshield_mcp-0.4.6.tar.gz
| Download URL | intentshield_mcp-0.4.6.tar.gz |
|---|---|
| Size | 497.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
58314079257439dc093d809047f3648f8758f953427f03a15bb6eaf25da96232
|
|
BLAKE2b-256 checksum How to use checksums |
d360649678f8b549396465d18afdb72506bbb644048a75c336ce52eadec678c8
|
| 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 19, 2026.
Transparency logRelease files / intentshield_mcp-0.4.6-py3-none-any.whl
| Download URL | intentshield_mcp-0.4.6-py3-none-any.whl |
|---|---|
| Size | 535.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e8fb4d6f23b7f394c181ec92232c8bec7b8f4de6176eb6da25f7d75cfde30259
|
|
BLAKE2b-256 checksum How to use checksums |
bc5d6131cdc5e2dcb8d1297ab0e1b6c4135c426802f88e9293f42b843fb29eab
|
| 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 19, 2026.
Transparency logSecurity for intentshield-mcp 0.4.6
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.6.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 19, 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.