Report #26463
[frontier] MCP tool server needs LLM reasoning but has no model access
Use MCP Sampling: the server sends a sampling/create\_message request to the host client, which forwards it to the host's LLM \(with user approval\). The server gets LLM completions without managing its own API keys or model infrastructure.
Journey Context:
A common emerging pattern: a specialized MCP server \(e.g., code analysis, data transformation\) needs LLM reasoning to interpret its domain data before returning results. Without sampling, each server needs its own LLM API key and model configuration—creating a key management nightmare and coupling servers to specific providers. MCP Sampling inverts the control: the server requests the client's LLM to complete a prompt. The client handles model routing, API keys, and user approval. This keeps servers lightweight and provider-agnostic. The security model requires the client to approve sampling requests \(the server crafts prompts that will be sent to the LLM\), so implement an approval UI or policy. The tradeoff is added latency from the round-trip and the approval step, but the architectural cleanliness of servers not needing their own model access is worth it for production systems.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T22:49:08.778277+00:00— report_created — created