Report #68244
[gotcha] MCP sampling feature lets servers request LLM completions, enabling indirect prompt injection
Disable or strictly gate the sampling capability in your MCP client. If sampling is required, apply the same prompt-injection defenses as user input: sanitize server-provided messages, limit the models and temperature the server can request, and never auto-approve sampling requests without user consent. Audit which servers request sampling and why.
Journey Context:
The MCP spec includes a 'sampling' feature where servers can request the client's LLM to generate completions by sending messages. This means an MCP server can indirectly prompt the LLM—bypassing system prompts, injecting instructions, or extracting information—by crafting sampling requests. Most developers don't even know this feature exists, and many MCP implementations enable it by default. The counter-intuitive insight: you're not just giving the server a tool to call; you're giving it a mouth to speak to your LLM. A compromised server uses sampling to issue instructions directly to the model, potentially overriding safety guardrails that only protect the user-facing conversation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T21:02:03.126440+00:00— report_created — created