Skip to content

About

overreach — LLM-free static annotation-integrity auditor for MCP tool manifests (catches tools whose declared safety hints under-state what they do)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Development Experiment 007 — overreach

Static annotation-integrity auditor for MCP tool manifests.

overreach reads a Model Context Protocol tools/list manifest and checks whether each tool's declared safety annotations — readOnlyHint, destructiveHint, idempotentHint, openWorldHint — are consistent with the behavioral evidence in the tool's name, parameters, and description. When a declared hint under-states what a tool actually does, it flags the mismatch and emits a per-tool auto-approval policy, a manifest trust score, and a CI gate.

It is LLM-free, offline, deterministic, and dependency-free (Python stdlib only). It runs on the manifest JSON alone — no server source code, no network, no API keys.


Thesis

MCP tool annotations have become the risk vocabulary agent clients use to decide what to auto-approve: a tool marked readOnlyHint: true from a trusted server may run without a confirmation prompt, while destructiveHint: true gets a gate. But the spec is explicit that annotations are hints, not guarantees — "an untrusted server can claim readOnlyHint: true and delete your files anyway." The MCP maintainers' own guidance says that if a client uses annotations for auto-approval it needs "a trust model, a change detector, a policy engine, and trace evidence — otherwise the annotation is just a label."

Today's MCP security tooling (mcp-scan, Cisco MCP Scanner, MCPScan, Proximity, mcp-security-linter) hunts for injection and tool poisoning — hidden instructions in descriptions, or taint flows in server source. None of them check whether a tool's declared safety hints actually match its behavior. That consistency check is the missing "policy engine," and it is exactly the piece that can be done deterministically, offline, from the manifest alone.

overreach is the smallest thing that proves the idea: a verb-lexicon evidence engine plus a handful of contradiction rules that turn "the annotation is just a label" into an auditable, machine-readable approval policy.


What it catches

Rule Severity Fires when…
READONLY_SPOOF critical / medium readOnlyHint: true but name/params (critical) or description (medium) show mutation or deletion — the auto-approval spoofing case
DESTRUCTIVE_UNDERDECLARED high / low destructiveHint: false but destructive verbs are present
OPENWORLD_UNDERDECLARED medium / low openWorldHint: false but the tool clearly reaches the network / external systems
IDEMPOTENT_OVERCLAIM medium / low idempotentHint: true but the tool looks side-effectful per call (send / pay / charge / create) — a "safe retry" could double-charge
MISSING_ANNOTATIONS info strong behavioral evidence but the relevant hint is omitted (prevents auto-approval; conservative defaults still apply)
READONLY_OPPORTUNITY info a clearly read-only tool that hasn't declared readOnlyHint: true (reduce confirmation friction)

Severity scales with evidence strength: identifiers (tool name, parameter names) are authored to describe structure and are treated as strong evidence; free-text descriptions are weak (and negation-guarded, so "never deletes" is not read as destructive). Only dangerous mismatches fire — omitting a hint is handled per the MCP conservative defaults (destructiveHint/openWorldHint default to the safe value), so a server is never punished for omission the way it is for a false claim.


Install & run

Zero runtime dependencies. Python ≥ 3.11.

# from a clone of this repo
python -m overreach examples/sample_manifest.json          # audit, human report
python -m overreach manifest.json --format json            # machine-readable
python -m overreach manifest.json --policy-out policy.json  # emit approval policy
python -m overreach a.json b.json --fail-on critical        # CI gate

Or install it as a console script:

pip install -e .          # provides the `overreach` command
overreach manifest.json

make targets are provided (make test, make run, make demo, make lint) which use an isolated .venv.

Getting a manifest to audit

Any MCP client can dump a server's tools/list result to JSON. The expected shapes are a full result {"tools": [...]}, a JSON-RPC envelope {"result": {"tools": [...]}}, or a bare [...] array of tool objects.

CLI options

--format {text,json}     output format (default: text)
--fail-on SEVERITY       exit non-zero at/above this severity
                         (critical|high|medium|low|info|none; default: high)
--min-severity SEVERITY  hide findings below this in output (gate still uses all)
--policy-out FILE        write the machine-readable approval policy JSON
--custom-lexicon FILE    extend the built-in lexicons: {axis: [extra words]}
--no-color               disable ANSI colors

Exit codes: 0 clean · 1 findings at/above --fail-on · 2 usage/parse error. --min-severity only affects display; the gate always evaluates the full finding set, so hiding noise can never mask a failure.


Sample run

Auditing the bundled examples/sample_manifest.json (seven tools, each demonstrating one rule):

=== examples/sample_manifest.json ===
trust score: 41/100   tools: 7
  * list_files  [auto-approve]
      -> declared read-only with no contradicting evidence
  * delete_record  [always-confirm]
      -> a critical annotation-integrity finding; destructive behavioral evidence
      [CRITICAL] READONLY_SPOOF: declares readOnlyHint=true but evidence suggests it may
                 delete/overwrite (matched: delete). A client that auto-approves read-only
                 tools would run this without confirmation.
          evidence: delete@name
      [INFO] MISSING_ANNOTATIONS: has behavioral signals but omits relevant annotations
                 (destructiveHint). ...
  * sync_directory  [always-confirm]
      [LOW] DESTRUCTIVE_UNDERDECLARED: declares destructiveHint=false but evidence suggests
                 destructive behavior (matched: overwrite). ...
  * http_fetch  [confirm]
      [MEDIUM] OPENWORLD_UNDERDECLARED: declares openWorldHint=false but evidence suggests it
                 reaches external systems (matched: fetch, http, url). ...
  * charge_card  [confirm]
      [MEDIUM] IDEMPOTENT_OVERCLAIM: declares idempotentHint=true but evidence suggests each
                 call has an effect (matched: charge). A client that safely retries could
                 duplicate the action (e.g. double-charge or double-send).
  * update_profile  [confirm]
      [INFO] MISSING_ANNOTATIONS: ... (readOnlyHint) ...
  * get_weather  [confirm]
      [INFO] READONLY_OPPORTUNITY: looks read-only (matched: get) but does not declare
                 readOnlyHint=true; declaring it reduces confirmation friction.

summary: 7 finding(s) across 1 manifest(s)
  by severity: critical=1, medium=2, low=1, info=3

Exit code is 1 — the CRITICAL READONLY_SPOOF on delete_record (a tool named delete_record that claims to be read-only) trips the default --fail-on high gate. The generated approval-policy.json summarizes: 1 auto-approve, 4 confirm, 2 always-confirm.


Architecture

manifest JSON
   │
   ▼
loader.py      parse tools/list → Tool(name, description, params, annotations)
   │
   ▼
tokenizer.py   split identifiers (camel/snake/kebab) + text → normalized lemmas
   │
   ▼
analyzer.py    lexicon match → Evidence(axis, token, site, strength)
   │            + negation guard on description text
   │            → contradiction rules → Finding(rule, severity, evidence)
   │
   ▼
policy.py      Finding+Evidence → Recommendation (auto/confirm/always-confirm)
   │            + 0–100 trust score
   ▼
report.py      text (ASCII, CI-safe) or JSON + approval_policy
   │
   ▼
cli.py         thresholds, exit codes, artifact output

The five behavioral axes mirror the four MCP hints (plus an explicit read-only axis) and are treated as orthogonal: fetch reads state and reaches the network, so it is open-world evidence, never mutation evidence. This keeps each rule reasoning about exactly one hint.

Approaches considered

  • A — lexicon + structural heuristics on the manifest (chosen). Pros: zero dependencies, fast, fully deterministic (essential for a CI gate), works offline on just the tools/list JSON, language-agnostic. Cons: lexical recall is bounded by the curated word lists; ambiguous nouns/verbs can mislead. Mitigations: strong/weak evidence weighting, negation handling on free text, a --custom-lexicon escape hatch, and conservative severities for weak evidence.
  • B — LLM-as-judge classification of each tool's true behavior. Higher recall on novel phrasing, but needs a paid API/secret (excluded by design), is nondeterministic (a bad fit for gating merges), costs per run, is slow, and can be prompt-injected by the very tool descriptions it audits. Rejected.
  • C — source-code taint analysis (like mcp-security-linter). Precise, but requires the server's source, is language-specific, and is far heavier than a prototype needs. overreach deliberately audits the published manifest — the same surface a client actually consumes — so it works on any server regardless of implementation language. Rejected for this scope.

overreach is complementary to the injection/poisoning scanners, not a replacement: they check for hidden malice in content; overreach checks for honest-but-wrong safety metadata that drives auto-approval.


Assumptions & limitations

  • Heuristic, not sound. Detection recall equals the union of the built-in lexicons plus light morphological normalization. Domain-specific verbs it has never seen are missed until added via --custom-lexicon. It is a linter, not a proof system.
  • Metadata only. It reasons about declared names/descriptions/annotations. A tool can still lie in its implementation; catching that requires runtime monitoring or source analysis (out of scope, see approach C). overreach narrows the gap between what a manifest claims and what it reads like.
  • English lexicons. The word lists are English. Non-English manifests will under-report until extended.
  • Ambiguous tokens. Words that are both common nouns and mutation verbs (e.g. "link", "tag") were removed from the lexicons to avoid false positives on read-only tools; the trade-off is missing the rarer verb sense. Negation handling covers "never deletes"-style phrasing but not arbitrary grammar.
  • Annotations are hints by spec. overreach improves the integrity of the hints a manifest ships; it does not make them trustworthy from an untrusted server. Pair it with server allow-listing and description pinning.

Development

make test    # 49 tests, pytest
make lint    # mypy --strict, clean

The suite covers tokenization/lemmatization, every rule and severity tier, negation handling, policy/trust scoring, and full CLI behavior (formats, exit codes, policy artifact, error handling, custom lexicons, manifest shapes).

License

MIT — see LICENSE.

About

overreach — LLM-free static annotation-integrity auditor for MCP tool manifests (catches tools whose declared safety hints under-state what they do)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages