An offline, LLM-free safety & conformance auditor for the stateless MCP lifecycle (SEP-2575, MCP 2026-07-28 release candidate).
On 2026-07-28 the Model Context Protocol shipped its largest revision since launch: SEP-2575 removed the
initialize/initializedhandshake and made MCP stateless. The handshake's three jobs — negotiate the protocol version, exchange server capabilities +instructions, exchange client capabilities — were unbundled into a per-request_metacredential set and a newserver/discoverRPC.passportpassively replays a captured stateless session and grades whether the server honoured the new contract, and whether it weaponised the newly per-request credential surface.
passport is experiment #20 in a series of channel-by-channel MCP auditors. Experiments 001–019 each audited a capability the handshake used to set up (tools, prompts, resources, roots, sampling, elicitation, authorization, tasks, MRT, completion). This entry audits the dissolution of the handshake itself — and the attack classes that only became possible once version and capability negotiation were smeared across every request.
Making a protocol stateless is not free. When the initialize handshake was the single place a client proved its version, identity, and capabilities, those facts were negotiated once and trusted for the connection's life. SEP-2575 moves them into _meta on every request and forbids the server from remembering anything between requests. That unlocks three defect classes that could not exist in the stateful model:
- Per-request protocol-version downgrade. Because each request carries its own version, an attacker (or a buggy client) can present a newer version to pass a capability check and then quietly drop to an older version on the request that matters — dodging a
MUSTthat the newer version introduced. There is no longer a negotiated version to pin. - Capability inference across requests. The spec now says a server MUST NOT infer capabilities from prior requests and MUST return
-32021when a request needs a capability it didn't declare. A server that "remembers" the client declaredsamplingtwo calls ago and borrows its LLM anyway is both non-conformant and a confused-deputy risk. - Per-request authentication bypass. "Without a session handshake, every request must be independently authenticated" (SEP-2575 §Security). A server that lets an unauthenticated request through because an earlier request on the wire was authenticated has turned statelessness into an auth-inheritance hole.
Add to that the relocation of the server-authored instructions string (which clients may fold into the LLM system prompt) from the initialize result into server/discover — the same tool-poisoning surface, now on a new channel — and you have a channel worth auditing the day the spec lands.
passport is the smallest artifact that proves the idea: a 34-rule catalog over a captured session, a severity-weighted score, and a CI exit-code gate, shipping a conformant reference capture that scores 100/A and a trojaned capture with 26 ground-truth findings across all six families including 3 CRITICALs.
| Family | What it audits | Rules |
|---|---|---|
| DISC | server/discover conformance — must-implement, DiscoverResult schema (supportedVersions/capabilities/serverInfo/instructions), unknown capability keys |
DISC01–06 |
| INJ | The instructions / serverInfo injection surface — prompt-injection signatures (CRITICAL), invisible/bidi/tag Unicode, homoglyph server names, embedded credentials, metadata-endpoint/SSRF URLs, token bombs |
INJ01–06 |
| VER | Per-request version negotiation — required protocolVersion _meta, mandatory MCP-Protocol-Version header, header/_meta mismatch, per-request downgrade, -32022 error shape, accepting an unsupported version |
VER01–06 |
| CAP | Per-request capability coherence — required clientCapabilities, reliance on an undeclared capability (CRITICAL), inference from a prior request, -32021 error shape, clientInfo legality |
CAP01–05 |
| STATE | Statelessness invariants — use of a removed RPC (initialize/ping/logging/setLevel/roots/list/resources/subscribe…), Mcp-Session-Id reliance, per-request auth bypass (CRITICAL), Last-Event-ID resumption, removed HTTP GET endpoint, session/init-state enforcement |
STATE01–06 |
| STREAM | Per-request logging opt-in (logLevel MUST precede any log notification) and subscriptions/listen (acknowledgment-first, opt-in-only notification types, subscriptionId correlation, notifications-only stream) |
LOG01–02, SUB01–03 |
Run python -m passport rules for the full annotated catalog with spec references.
Requires Python 3.11+. No third-party runtime dependencies (pure standard library).
# audit the two bundled captures end to end
python main.py
# audit a single capture with the CLI
python -m passport audit captures/trojan.json
# machine-readable report for CI
python -m passport audit captures/trojan.json --json
# tune the CI gate
python -m passport audit path/to/capture.json --min-score 90 --fail-at HIGH
# list the rule catalog
python -m passport rulesExit codes: 0 = gate passed · 1 = gate failed (score below --min-score or a finding at/above --fail-at) · 2 = usage / capture-load error. Drop it into CI to block a regression the moment a stateless MCP server starts leaking state.
make venv # optional: isolated .venv with pytest
make test # or: python -m pytest91 tests, ~0.13s, pure offline.
python -m passport audit captures/trojan.json (abridged):
========================================================================
passport — stateless MCP (SEP-2575) audit
capture: captures/trojan.json
========================================================================
score: 0/100 grade: F gate: FAIL
findings: 26 total CRITICAL=3 HIGH=12 MEDIUM=10 LOW=1
families: DISC=1 INJ=5 VER=5 CAP=2 STATE=6 STREAM=7
------------------------------------------------------------------------
[CRITICAL] INJ01 prompt-injection in server-authored text @ex[0]:discover
instructions contains prompt-injection signature(s) that flow into the
model's system context: 'Ignore all previous instructions'.
[CRITICAL] CAP02 server relied on an undeclared client capability @ex[4]:sampling-undeclared
Response embeds a 'sampling/createMessage' input request requiring the
'sampling' capability, which this request never declared; the server
MUST return -32021 instead.
[CRITICAL] STATE03 per-request authentication bypass @ex[9]:auth-bypass
Request to protected method 'tools/call' succeeded with no Authorization
header, while other calls to it were authenticated — auth was inherited
across requests, which statelessness forbids.
[ HIGH] VER04 per-request protocol-version downgrade @ex[3]:downgrade
Request declares protocol version '2025-06-18', older than '2026-07-28'
seen earlier; a per-request downgrade can bypass a requirement introduced
in the newer version.
... 22 more findings across DISC / INJ / VER / CAP / STATE / STREAM ...
========================================================================
The conformant reference (captures/conformant.json) reports 0 findings, score 100/100, grade A, gate PASS.
capture.json ─▶ models.load_capture ─▶ Capture{ Exchange[] }
│
spec.py (SEP-2575 literals: _meta keys, error codes,
removed RPCs, DiscoverResult fields)
│
auditor.audit ──▶ for each of 34 rules in RULES:
checks.py (perception.py for INJ scanning)
│
Finding[] ──▶ report.score_findings
│ │
cli.py ◀────────────┘ (text / JSON / exit code)
spec.py— every SEP-2575 literal in one place (theio.modelcontextprotocol/*_metakeys, error codes-32022/-32021, the removed-RPC table,DiscoverResultfields). Rules read constants from here so the audit is itself auditable.models.py— strict capture loader. A malformed capture raisesCaptureErrorwith a precise message rather than degrading silently — a broken capture is an operator error, not a finding.checks.py— the 34 rules, each acheck(cap, mk) -> Iterable[Finding]. Every check is wrapped so an adversarial field can never make it raise; a rule that somehow throws becomes a traceable meta-finding instead of a silent gap.perception.py— deterministic, model-free scanners for the INJ family: invisible/bidi/tag Unicode, prompt-injection lexical signatures, credential regexes, dangerous-URL classification, and confusable-skeleton homoglyph folding.report.py— severity-weighted scoring (LOW 3 / MEDIUM 8 / HIGH 20 / CRITICAL 40), letter grade, and the CI gate.
A. Live proxy (dynamic). Sit in the middle of a real client↔server connection, mutate requests, and observe reactions (the approach of experiments #002 and #011). Rejected for this run: it needs a live server + network, it is non-deterministic, and it can't be dropped into CI as a fast gate. The value here is catching the defect in a recorded artifact.
B. Passive replay of a captured session (chosen). Consume a recorded JSON capture and reason about it statically. Trade-offs: near-zero CPU/memory, fully deterministic and reproducible, no network, no secrets, trivially CI-embeddable, and diffable output. The cost is that it only sees what the capture recorded — it cannot probe behaviour the trace didn't exercise (see limitations). For a conformance/safety gate that runs on every PR, determinism and zero-dependency portability win decisively. This also keeps the whole series methodologically consistent.
A capture is a JSON object with transport ("http" | "stdio") and an ordered exchanges list. Each exchange has an optional http block (method/path/status/headers), a JSON-RPC request (whose params._meta carries the stateless credentials), a response (result or error), and an optional stream of SSE notifications. See captures/conformant.json for a fully-annotated reference and captures/trojan.json for the adversarial counterpart. A recorder/proxy tap emits this shape; passport never talks to a live server.
- Passive, not active.
passportaudits what a capture recorded. It will not discover a defect on a code path the trace never exercised. Pair it with a fuzzer (see experiment #011) for dynamic coverage. - Draft-spec target. SEP-2575 is
Finalbut the 2026-07-28 protocol revision is a release candidate; field names (io.modelcontextprotocol/*,server/discover'sDiscoverResult, error codes-32022/-32021) are transcribed from the SEP text inpassport/spec.pyand may shift before GA. Updatespec.pyif they do — the rules read from it. - Version ordering assumes ISO-date identifiers. MCP versions are
YYYY-MM-DDstrings, so lexicographic comparison is a correct total order for downgrade detection. A non-date version scheme would need a different comparator. - Heuristic INJ signatures. The injection/secret/homoglyph scanners are deterministic and tuned for precision (the conformant capture stays clean), so they favour few false positives over exhaustive recall. They flag candidates; a human confirms intent.
- Auth model is coarse. STATE03 treats any method ever seen with an
Authorizationheader as "protected"; it flags an unauthenticated success on that method. It does not model scopes, token audiences, or per-resource policy (that layer is experiment #016'sdeputy). - HTTP-specific rules skip stdio. Header-based checks (VER02/03, STATE02/03/04/05) only apply to
transport: "http";server/discover,_meta, removed-RPC, and stream rules apply to both.
MIT — see LICENSE.