MCP Sampling is deprecated: choosing who owns inference
MCP 2026-07-28 deprecates Sampling. Inventory model selection, credentials, context, and tool loops before moving inference to direct provider API calls.

New MCP integrations should call model provider APIs directly instead of building around Sampling. The 2026-07-28 specification deprecates Sampling and gives existing implementations the same migration direction: integrate directly with LLM provider APIs.
There is a transition window. Sampling remains in the specification and becomes eligible for removal in the first revision released on or after July 28, 2027. Maintainers decide the actual removal. The useful action now is to inventory responsibilities and plan the move, rather than treating existing services as already shut down.
What did Sampling do for an MCP server?
Sampling let a server ask its client to perform inference. The client controlled model access, selection, and permission, so the server did not need its own provider API key for that path.
The Sampling specification describes model preferences and task content supplied by the server, with the actual model and review policy controlled by the client. modelPreferences.hints were advisory, not a guarantee that a named model would run.
That differs from an ordinary tool returning data or an action result to an agent. Sampling requested another generation while processing a tool or related operation. Migrating it does not require removing the tool interface. The MCP roles guide helps separate those paths.
Should inference move to the application or the server?
Assign inference to the component that owns its context, permissions, and runtime lifecycle.
| Design | Suitable task | Responsibilities transferred |
|---|---|---|
| Application calls the model and MCP tools | Reasoning belongs to the current user conversation | Model selection, history, tool loop, cancellation, presentation |
| Server calls the model within a bounded business step | Reasoning belongs to the service’s own operation | Service credentials, input scope, validation, timeout, failure handling |
Choosing which document to retrieve from a conversation fits application orchestration. Classifying an explicitly supplied public product description can fit a bounded service operation. The latter should declare its inputs rather than implicitly depend on the user’s entire conversation.
These are architecture choices. The specification’s migration target is direct provider API integration; it does not prescribe a universal location for credentials. An LLM gateway can supply model access while the application or business service retains ownership of task context and execution permission.
How do you inventory Sampling dependencies?
Inspect source, SDK wrappers, and real task paths. A capability declaration alone is not the migration unit; identify the request producer, input handling, and result consumer.
With ripgrep installed, run this read-only search from the project root:
rg -n --hidden \
--glob '!.git/**' --glob '!node_modules/**' --glob '!.env*' \
'sampling/createMessage|createMessage|modelPreferences|includeContext' .
createMessage can belong to unrelated SDKs, so review each match. Dependencies, remote servers, and generated requests require SDK documentation and runtime records as well.
Record the following for each actual path:
Origin: [tool, resource, or prompt operation]
Input: [explicit content and any extra context dependency]
Model: [selector and required capabilities]
Runtime: [credential owner, timeout, cancellation, concurrency]
Output: [validation, further tool turns, failure result]
Destination: [application or server calling a provider directly]
Do not turn an old hint string into a provider model ID without checking it. Nbility users should verify IDs in the model documentation and confirm endpoints and protocols with the connection guide.
What behavior must move with the HTTP call?
Move context selection, tool-loop handling, and terminal outcomes along with inference. A replacement POST alone does not take over everything the client previously did.
Start with input scope. The deprecation registry gives includeContext: thisServer and allServers a migration path of omitting the field or using none. New code should choose explicit data instead of requesting every connected context.
Next, preserve tool associations. If Sampling returned several tool_use items, the new API path must associate each call with its result and stop on missing results. MCP toolUseId, Claude blocks, and OpenAI tool messages have distinct structures; convert them according to the chosen API. Native API formats provides the starting comparison.
Finally, assign outcomes for deadlines, user cancellation, model refusal, and invalid output. Human review or presentation previously handled by the client needs a new owner. A tool operation must not report completed business work when its internal inference failed or produced an unusable result.
Must existing SDK integrations remove Sampling immediately?
Maintain the currently supported service while scheduling migration. The deprecation window does not require an immediate outage, and new designs should avoid expanding the dependency.
The deprecation registry, checked on December 2, 2026, distinguishes eligibility for removal from an actual removal decision. Its minimum twelve-month window is not a support promise for every SDK or hosted product.
An existing implementation moving to 2026-07-28 must also adopt that version’s multi round-trip pattern. Message migration for the retained feature and its eventual retirement are separate work. Elicitation remains available for requesting human input; see the current Elicitation flow.
Use the same public tasks to verify complete inputs, required model capabilities, tool associations, refusals, and cancellation. This article checks the specification and architecture; it does not deploy a replacement or compare model quality. Move one clearly bounded task first, then retire the remaining client-mediated inference paths.


