Searching for mcp sampling vs elicitation usually means you already expose tools/resources and now need a client-capability decision: should the server ask the host for another model completion, or ask the user for missing structured input? Short answer—use elicitation when only a human can supply or confirm a value; treat sampling as a legacy host-mediated completion path that newer protocol revisions deprecate in favor of calling your LLM provider directly from the server. This page deepens the MCP server tutorial and best practices—not a second intro, not an official spec mirror.
01
Independence note
02
Definitions: sampling vs elicitation
- Elicitation lets a server request additional information from the user through the client—commonly form mode (structured fields / schema) or URL mode (out-of-band flows for sensitive credentials). The human stays in the loop; secrets must not be harvested via casual form elicitation.
- Sampling (historically) let a server request an LLM completion via the client, so the host kept model access, permissions, and billing while the server stayed keyless. Newer protocol revisions deprecate this path for new implementations.
Both are client features servers may request mid-flight (often nested inside a tool call). Neither replaces resources / tools / prompts as the primary server surface.
03
Side-by-side comparison
| Dimension | Elicitation | Sampling (legacy / deprecated path) |
|---|---|---|
| Who answers | User (via client UI) | Model (via client’s LLM access) |
| Primary job | Collect missing facts, choices, confirmations | Ask the host to run a completion for the server |
| Typical modes | Form (structured) / URL (sensitive out-of-band) | Host-mediated messages → completion |
| Security focus | Clear requester identity; no secrets in form mode | Client controls model, permissions, data egress |
| New designs (2026+) | Still the right tool for human-in-the-loop input | Prefer direct provider API calls from the server |
04
When to use which
- Missing user-only facts. Seat preference, which environment to target, “approve this destructive action”—use elicitation (form mode for non-sensitive structured fields).
- Credentials and payments. Use URL-mode elicitation (or entirely out-of-band auth). Do not ask for API keys or card data through a casual in-chat form.
- Server needs another model judgment. For new work, call your LLM provider from the server with your own key and policy—do not design greenfield features around sampling.
- Existing sampling clients. Keep them working until hosts migrate; plan a direct-provider path and feature-detect client capabilities. See also transport and host wiring in stdio vs Streamable HTTP and mcp.json example.
05
Sampling deprecation — practical migration
Protocol revisions around mid-2026 mark sampling as deprecated for new implementations (exact revision ids and sunset windows live in upstream registries—re-check). Migration pattern:
- Keep tool handler shapes; replace “request sampling from client” with a direct provider SDK call.
- Move model selection, temperature, and spend controls into server config—not silent client defaults.
- Preserve elicitation for human confirmations; do not fake user consent with another model sample.
- Document capability negotiation so older hosts fail closed with a clear message.
07
FAQ
What is the difference between MCP sampling and elicitation?
Elicitation asks the user (via the client) for structured or URL-based input. Sampling historically asked the client to run an LLM completion for the server. Use elicitation for human-in-the-loop data; do not use sampling for greenfield designs—prefer a direct provider call.
Is MCP sampling deprecated?
Newer protocol revisions deprecate sampling for new implementations and recommend integrating LLM provider APIs on the server. Existing deployments may keep working during a transition window—confirm against your pinned revision and host support matrix.
When should I use elicitation form mode vs URL mode?
Form mode fits non-sensitive structured fields the user can review before send. URL mode fits credentials, OAuth, and payment-like flows that must not pass secrets through the MCP client.
Is this official MCP documentation?
No. Unofficial engineering notes from 墨码 / codemo.fun. Spec text, SEPs, and SDK guides remain authoritative—re-check after upgrades.