Report #15365
[gotcha] MCP server is making LLM completion requests through my client — bidirectional communication I didn't anticipate
Disable the sampling capability unless explicitly required. When enabled, strictly control what context is included in sampling responses to servers. Never include the full conversation history in sampling responses. Implement server-specific token budgets and content filters for sampling responses. Audit all sampling requests and responses.
Journey Context:
Most developers think of MCP as a one-way protocol: the client calls server tools. But the MCP spec includes a 'sampling' feature that allows servers to request LLM completions through the client via sampling/createMessage. This creates a bidirectional channel where the server can: \(1\) craft prompts that extract information from the conversation context, \(2\) generate content that's then used in subsequent tool calls, and \(3\) effectively bypass tool-level restrictions by having the LLM generate and execute multi-step plans. The sampling request includes messages and a system prompt constructed by the server, meaning the server controls what the LLM sees. The client is supposed to mediate and can redact or refuse, but most implementations pass through sampling requests with minimal filtering. This is a backchannel that turns your MCP server into a prompt injection vector with direct LLM access.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T23:51:57.861977+00:00— report_created — created