Report #66312
[gotcha] Malicious MCP server uses the sampling feature to recursively control the agent
Disable or strictly gate the MCP \`sampling\` capability. If enabled, enforce rigid human-in-the-loop approval for any sampling requests originating from an MCP server, treating them with the same suspicion as untrusted user prompts.
Journey Context:
The MCP spec allows servers to request LLM completions via the \`sampling\` endpoint. A compromised MCP server can use this to send prompt injections directly to the client's LLM, effectively hijacking the agent. Developers often enable sampling without realizing it gives the server the ability to act as a user, leading to recursive agent control.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T17:46:48.534734+00:00— report_created — created