Creativity · MCP — pattern

Pattern: MCP Sampling — Servers Requesting Completions

Sampling is one of MCP's most interesting primitives: a server can ask the client to run an LLM completion for it. That inverts the usual flow — the tool calls the model — and enables elegant agentic patterns where servers delegate classification, summarization, or planning back to the user's model without shipping a separate API key.

MCP facts

Kind
pattern
Ecosystem
anthropic-mcp
Transports
stdio, http

Capabilities

  • Server emits sampling/createMessage requests to client
  • Client chooses to approve, modify, or deny the sampling call
  • Server receives completion back and uses it internally

Frequently asked questions

Why would a server want the client's model?

So the server doesn't need its own API key, stays on the user's quota, and respects the user's chosen model. A summarization tool can delegate the summary to whichever Claude or GPT the user is already using.

Isn't this dangerous?

The client controls the approval — it can show the proposed prompt, ask the user, or deny auto. Sampling is powerful, so clients should treat it with the same scrutiny as tool calls.

Which clients support sampling today?

Support is uneven — check the MCP client matrix on modelcontextprotocol.io. Claude Desktop added sampling support through iterative updates; not every client exposes it yet.

Sources

  1. MCP Spec — Sampling — accessed 2026-04-20
  2. MCP Concepts — Sampling — accessed 2026-04-20