MCP Detect
MCP-DETECT captures Model Context Protocol tool traffic, applies a bounded set of structural and stateful detections, publishes adversarial evasions, and binds every measurement to exact reproducible evidence.
Research software, not autonomous enforcement or complete MCP protection. Every corpus and worked example is synthetic and self-authored.
At a glance
Claim
Makes selected MCP behaviors observable and produces reproducible evidence for five implemented abuse techniques.
Evidence
Ten rules plus two parent anchors, a 4,727-record benign corpus, five compiler gates, and a 12-class evasion corpus.
Boundary
All data is self-authored, 5 of roughly 85 SAF-MCP techniques are implemented, and there is no semantic detection backend.
On this page
MCP tool calls need inspectable evidence
MCP connects agents to filesystems, ticketing, memory stores, and internal services. A configuration review can list declared permissions, but it cannot show which tools were actually advertised, what arguments moved through them, whether metadata changed mid-session, or whether an undeclared server appeared in live traffic.
So the project asks a narrower set of questions. What evidence can be extracted from MCP traffic, which abuse techniques are detectable from that evidence, and which classes need controls outside telemetry?
Capture once, analyze through bounded paths
- Observe Transparent proxy Forwards MCP JSON-RPC bytes untouched and emits one JSONL event per message.
- Structure Telemetry schema Normalizes sessions, server commands, tools, arguments, and direction.
- Detect Rules and baseline Wazuh handles structural patterns. Python tracks stateful metadata drift.
- Measure Framework gates Runs fixtures, joins alerts to sessions, measures coverage, and records gaps.
- Reproduce Frozen evidence Checksums, rule hashes, golden matches, and source-level retests keep each claim inspectable.
Five techniques, each with a named evasion
Covered Structurally undetectable blind spot
Tool poisoning
Flags hidden instructions embedded in advertised tool descriptions. It does not catch every semantic manipulation, and meaning-preserving rewrites can evade it.
Credential exfiltration
Correlates a sensitive-file read with secret-shaped content leaving in a later tool argument. Encoded or transformed secrets can evade plaintext matching.
Sensitive absolute paths
Matches a bounded list of high-risk absolute paths used with content-exposing file tools. Renamed tools, new paths, or indirection can evade.
Path traversal
Detects relative escape patterns in file-tool arguments. It complements, and does not replace, server-side path confinement.
Rug pull
Tracks hash-visible tool and server metadata drift across a stateful baseline. A legitimate upgrade looks identical to a malicious swap at this layer, and behavior-only changes are invisible.
Gates tied to real historical bugs
Each detection declares its backends, rules, session join, fixtures, status, and known gaps in a detection.yaml. The framework compiler checks schema, rule references, fixture references, session-key correctness, and false positives against a frozen benign corpus. Its tests reconstruct earlier failures so a new detection cannot silently reintroduce the same class of mistake.
The five techniques are behaviors the rules implement. The 12 evasion classes are separate ways those detections can be bypassed. Nine leave a signal this sensor can test, and three are structurally invisible at this layer.
The corpora and worked examples are self-authored. Results are reproducible, but they are not evidence of performance against independent adversary traffic.
An AI Bill of Materials from observed traffic
The framework inventories observed MCP servers, tool names, version hashes, session counts, filesystem access, and network egress, then compares a declared known-good inventory against observations to surface shadow-server candidates. An unrecognized server is reported as unknown and routed to manual review, not assigned a guessed trust level.
What this cannot show
- Coverage breadth. Five of roughly 85 SAF-MCP techniques are implemented.
- No semantic backend. Prompt manipulation and meaning-preserving obfuscation are out of scope for the current detections.
- Behavior-only compromise. A tool can return manipulated results without changing any visible metadata.
- Encoded content. Base64 and similar transforms bypass plaintext secret matching.
- Self-authored data. Independent or held-out traffic is the highest-value next validation step.
- Offline analysis. The proxy captures traffic, but the workflow is not positioned as inline production enforcement.
Inside MCP Detect, from baseline to denied retest
I documented the project in three first-person articles. The series starts with model-selected benign traffic, pressure-tests the five detections, and ends at the authorization decision that telemetry could not prove.
-
Part 1
Start by watching the agent behave
541 sessions, 1,011 model-selected calls, and the accepted zero-call
git_showgap. - Part 2 Build the detections, then break them Canonical results, benign regression, ten successful evasions, and the compiler gates those failures created.
- Part 3 Follow identity into the handler A synthetic cross-tenant defect, exact source fix, and denied authorization retest.
Inspect it yourself
The proxy, schema, complete synthetic corpora, rules, drift detector, compiler gates, coverage reports, and authorization reference are public under MIT.
Ten rules I wrote. Twelve attacks I built to break them.
Ten of the twelve still get through. E5, E8 and E11 have no fix I can write, and each says why in its own words on the bench below. E12 is closed by a deployed rule and E10 is a false-positive probe the rules correctly ignore.
- E1 Got in
- E2 Got in
- E3 Got in
- E4 Got in
- E5 No fix
- E6 Got in
- E7 Got in
- E8 No fix
- E9 Got in
- E10 Held
- E11 No fix
- E12 Held
Ten rules deployed on a byte-transparent MCP proxy, quiet across a 4,727-record benign corpus of 541 sessions.
- 100100
- 100101
- 100102
- 100103
- 100104
- 100105
- 100106
- 100107
- 100108
- 100109
Pick one and watch it get through
Every rule below is the one deployed in MCP Detect, ported to run in this page. Pick an attack from the corpus, or edit the record and run something of your own against it.
Baseline
- Unmodified credential read
Tool poisoning
- E1 keyword avoiding
- E2 no HTML comment
- E3a zero-width insertion
- E3b homoglyph
- E4 distance bound
Credential exfiltration
- E5 tool-name spoof
- E6 untested key
- E7 secret shape
- E8 encoded payload
- E9 read-path variant
Rug pull
- E10 legitimate upgrade
- E11 behavior only
- E12 session-conditional
- 100100 session_id, server_command matched, level 0, no alert
- 100101 tool_arguments.path MATCH, level 12, T1552.001
- 100102 raw.result.tools no match
- 100103 tool_arguments.data no match
- 100104 tool_arguments.payload no match
- 100105 tool_arguments.content no match
- 100106 tool_arguments.body no match
- 100107 tool_arguments.message no match
- 100108 tool_arguments.path no match
- 100109 tool_arguments.path no match
Caught by 100101
rule 100101 level 12 T1552.001
No evasion applied. The attack as originally written.
This is the shape every class below is trying to get past.
Verdicts and mechanisms come from the project’s own Phase 5 red-team report. The reasoning behind them is in Catching Your Own Attack Only Proves the Plumbing Works, and the rules themselves are on the MCP Detect repository (opens in a new tab).