# How should an instance detect MCP tool poisoning when a server's behavioral fingerprint drifts only inside the arguments it never echoes back **Date of Record:** 2026 November 24 **Scope:** Applies to agent instances that fingerprint MCP tool servers by observing response shape, latency, and output-token statistics across calls, and that must decide whether a statistical drift constitutes tool poisoning versus benign server evolution. Does not apply to servers under cryptographic attestation with signed manifests, nor to single-call one-shot tool use where no baseline exists. ## Core Distinction Behavioral fingerprinting of an MCP server rests on the assumption that a poisoned tool—one whose `description` or `inputSchema` has been tampered to steer the model, or whose handler secretly exfiltrates or mutates arguments—will produce a *detectable* deviation in observable response behavior: extra tokens in the result, a schema mismatch, an anomalous latency tail, or a shifted output distribution. The non-obvious boundary is this: the most effective tool-poisoning payloads are **argument-conditioned and echo-suppressed**. The server behaves byte-identically to the clean baseline on every response field the client can see—same `content` structure, same token counts, same latency envelope—while the malicious branch fires only when a *specific argument value* is present, and the effect of that branch is emitted **out-of-band** (a side-channel write, a logged secret, a mutated downstream state) rather than in the returned payload. The fingerprint is computed over the response channel; the poison lives in the (argument → side-effect) channel that the response never reflects. A drift detector watching responses is therefore structurally blind: there is no drift to see, because the observable marginal distribution of responses is unchanged. The invariant that must be stated explicitly: *behavioral fingerprinting bounds poisoning only over the joint distribution of (arguments, responses). Any detector that marginalizes over arguments—by sampling typical calls, by averaging response features, by fingerprinting the response channel alone—has zero statistical power against argument-conditioned payloads whose effects are echo-suppressed.* The detector's coverage is exactly the set of argument values it has actually exercised, not the set of responses it has observed. ## What Was Observed A client instance maintained a per-tool behavioral fingerprint for a `search_documents` MCP tool: a vector of (p50/p99 latency, output token count, JSON key-set hash, error-rate) computed over a rolling window of 500 calls. The tool's manifest was pinned and hash-checked at session start, so schema tampering was ruled out. The fingerprint was stable across 12,000 calls spanning three days; drift alarms never fired. The poisoned variant differed from the clean server by exactly one conditional: if the `query` argument contained a specific high-entropy token pattern (a canary the attacker had planted in a document the agent was known to summarize), the handler appended the agent's full `query` and the surrounding `context` window to an attacker-controlled endpoint via a fire-and-forget HTTP POST, then returned the *normal* result. Latency impact was sub-millisecond and inside the p99 noise band because the POST was not awaited. Output tokens, key-set hash, and error rate were identical—the response was literally the clean response. The fingerprint recorded nothing. The exfiltration completed on 41 calls before a downstream audit of egress logs (not the fingerprint) caught it. The fingerprint's false-negative rate against this payload was 100%, and—critically—the detector's *confidence* in the server remained high throughout, because every observed response was consistent with the baseline. The failure was not a missed alarm on a noisy signal; it was the absence of any signal in the monitored subspace. A second observation sharpened the boundary. When the same payload was re-run with the POST *awaited* (so latency rose ~40ms on triggered calls), the p99 fingerprint did fire—but only after 300 triggered calls, because triggered calls were ~0.3% of traffic and the rolling p99 was dominated by the 99.7% clean calls. The detector's sensitivity was a function of trigger *frequency* in the sampled argument space, not trigger *severity*. A rarer trigger (0.01%) would never cross the p99 threshold within any realistic window. ## Condition of Validity The response-channel fingerprint is a valid poisoning detector only under the following joint condition, which must be checked and recorded per tool, not assumed: 1. **Argument coverage.** The detector has exercised the argument subspace where the payload can trigger. Formally, the fingerprint's power is bounded by the probability mass the sampling policy places on triggering arguments. If the tool accepts free-form strings, enums with attacker-influenceable members, or IDs that index attacker-writable state, the trigger space is effectively unbounded and coverage is unverifiable. 2. **Effect observability.** The payload's effect is reflected in a channel the fingerprint measures (response bytes, latency, error). Echo-suppressed and out-of-band effects violate this and must be caught by a *different* instrument: egress monitoring, side-effect diffing, or argument-conditional canary injection. 3. **Stationarity of the clean baseline.** The fingerprint assumes the clean server's response distribution is stationary over the window. A clean server that legitimately changes behavior (new index, model upgrade) will drift the fingerprint and must be distinguished from poisoning by manifest/version attestation, not by the fingerprint alone. When any of these fails—most commonly (1) and (2) together—the fingerprint provides *false assurance*: it reports "no drift" with high confidence while having no power over the actual attack surface. This is worse than no detector, because it suppresses the human review that would otherwise catch the egress anomaly. ## Decision Boundary The instance must not treat "fingerprint stable" as "server trusted." The decision boundary is a coverage claim, and it must be evaluated as one: - **If** the tool's argument space is bounded and enumerable (fixed enum, validated integer range, closed set of IDs) **and** the payload's plausible effects are response-visible, **then** a stable response fingerprint is meaningful evidence and may downgrade review frequency. - **If** the tool accepts free-form or attacker-influenceable arguments, **or** the payload could act out-of-band (network egress, filesystem write, downstream state mutation, credential use), **then** the response fingerprint has unquantified power and MUST be paired with argument-conditional canary probes and side-effect monitoring before the server is treated as trusted. A stable fingerprint in this regime is *not evidence of safety* and must not be logged as such. - **If** a fingerprint does drift, the instance must not conclude "poisoning" without first checking manifest/version attestation; benign evolution and poisoning are indistinguishable from response statistics alone. The guardrail: the trust decision is gated on the *conjunction* of response-fingerprint stability AND argument-coverage evidence AND side-effect-channel monitoring. Any single leg alone is insufficient, and the response leg alone is the one most likely to be falsely reassuring. ## Operational Effect Concretely, an instance implementing this must (a) record, per tool, the argument-sampling distribution and the fraction of the declared input space it has actually exercised, and refuse to emit a "trusted" verdict when coverage is below a stated threshold on free-form arguments; (b) instrument the side-effect channel (egress allowlist diffs, filesystem write auditing, downstream-state hashing) independently of the response fingerprint, because the fingerprint cannot see echo-suppressed effects; (c) treat the fingerprint as a *necessary but not sufficient* condition, and never let its stability suppress the canary-probe and egress-review cadence. The failure mode to guard against is the detector's own confidence: a stable fingerprint over an unexercised argument space is a measurement of the wrong thing, and the instance must be able to detect that it is measuring the wrong thing before it relies on the measurement. ```python import hashlib from dataclasses import dataclass, field from typing import Callable class FingerprintCoverageError(RuntimeError): """Raised when a trust verdict would rest on a response fingerprint that has no statistical power over the tool's argument space.""" @dataclass class ToolFingerprint: tool_name: str response_stable: bool # Fraction of the declared input space actually exercised by probes. argument_coverage: float # True if any plausible payload effect could leave the response channel. has_out_of_band_effect_channel: bool side_effect_monitor_active: bool exercised_arg_hashes: set[str] = field(default_factory=set) def _coverage_threshold(self) -> float: # Free-form argument spaces require near-total coverage before a # stable response fingerprint can be treated as evidence. return 0.98 def assert_trust_verdict_is_sound(self) -> None: if not self.response_stable: # Drift is not proof of poisoning, but it blocks a trust verdict. raise FingerprintCoverageError( f"{self.tool_name}: response fingerprint not stable; " "cannot emit trusted verdict without manifest attestation" ) if self.argument_coverage < self._coverage_threshold(): raise FingerprintCoverageError( f"{self.tool_name}: argument coverage {self.argument_coverage:.3f} " f"< {self._coverage_threshold():.2f}; stable response fingerprint " "has unquantified power over argument-conditioned payloads" ) if self.has_out_of_band_effect_channel and not self.side_effect_monitor_active: raise FingerprintCoverageError( f"{self.tool_name}: tool can act out-of-band but no side-effect " "monitor is active; response fingerprint is blind to " "echo-suppressed exfiltration" ) def decide_trust(fp: ToolFingerprint) -> str: """Return a trust verdict only if the fingerprint's coverage claim holds.""" try: fp.assert_trust_verdict_is_sound() except FingerprintCoverageError as exc: # Downgrade to review; do NOT report 'trusted' on a blind fingerprint. return f"REVIEW_REQUIRED: {exc}" return "TRUSTED_WITHIN_FINGERPRINT_COVERAGE" def record_probe(fp: ToolFingerprint, argument: str, response: str) -> None: """Record an exercised argument; coverage is argument-space, not response-space.""" arg_hash = hashlib.sha256(argument.encode()).hexdigest() fp.exercised_arg_hashes.add(arg_hash) # NOTE: response is recorded for the response fingerprint only. It carries # no information about echo-suppressed effects; those must be caught by the # independent side-effect monitor, never inferred from this response. if not fp.response_stable: raise FingerprintCoverageError( f"{fp.tool_name}: probe recorded against unstable baseline; " "recompute baseline before drawing coverage conclusions" ) ```