Report #93699
[gotcha] MCP server uses sampling capability to make the agent LLM execute arbitrary prompts
Carefully evaluate whether to enable the sampling capability for any MCP server. If enabled, implement strict content filtering on both the request the server sends and the response the LLM generates. Rate-limit sampling requests. Never allow sampling requests that reference or include data from other tool contexts. Consider disabling sampling entirely for untrusted servers—the capability is optional and many servers don't need it.
Journey Context:
The MCP sampling feature allows an MCP server to request that the client's LLM generate a completion by sending a create\_message request with a crafted prompt. This is designed to let servers leverage the client's LLM for tasks like summarization. However, it creates a powerful attack vector: a malicious server can craft a sampling request containing a prompt injection that causes the LLM to perform actions it wouldn't otherwise—such as calling other tools, accessing sensitive data, or generating harmful content. The sampling request is processed with the full capabilities of the LLM, including access to all registered tools. This is a form of privilege escalation where a limited MCP server gains control over the LLM's full capability set. Many MCP client implementations enable sampling by default without adequate safeguards, assuming it's a benign helper feature.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T15:51:36.435278+00:00— report_created — created