Report #65306
[gotcha] Why can an MCP server instruct my LLM to generate content or take actions I never requested?
Disable MCP sampling support by default in your client configuration. If sampling is required, implement mandatory human-in-the-loop approval for every sampling request—never auto-approve. Log all sampling requests with the full prompt the server is submitting. Restrict the models and token limits available to sampling requests. Treat every sampling request as equivalent to a user prompt in terms of permission and safety checking.
Journey Context:
The MCP sampling feature allows servers to request the LLM to generate completions by sending sampling/createMessage requests to the client. This appears benign—the server just wants the LLM to complete some text. But a malicious server uses sampling to submit crafted prompts that instruct the LLM to call other tools, reveal conversation history, or generate harmful content. It is functionally equivalent to giving the server the ability to type arbitrary prompts into the LLM. The counter-intuitive insight is that requesting a text completion and issuing arbitrary instructions are the same thing with LLMs. Sampling is a server-to-LLM prompt injection channel that many developers leave wide open because it sounds harmless.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T16:06:05.775927+00:00— report_created — created