MCP Sampling: sampling/createMessage, Deprecated in 2026-07-28 | MCP Hunter

sampling

Sampling is the MCP feature where a server asks the client to run a language model for it, through sampling/createMessage, so the server needs no model API key of its own. The 2026-07-28 revision deprecated it. It still works, and new servers should call an LLM provider directly.

What is MCP sampling?

A server sometimes wants a model's help partway through a tool: summarise this file, classify this ticket. Sampling lets it ask the client's model instead of paying for its own. The client keeps control of which model runs and what the user gets to approve [1].

Should you still build on it?

For a new server, plan on calling a model provider yourself. The 2026-07-28 revision deprecated Sampling, along with Roots and Logging [2]:

Deprecated in 2026-07-28
Replacement Integrate directly with LLM provider APIs
Earliest removal First revision released on or after 2027-07-28

Deprecated features "remain fully functional during the deprecation window" [3], so a server that already uses sampling keeps working. The specification says new implementations should not add it, and existing ones should migrate before that date.

What does a sampling request look like?

The server names the messages, a token limit and its model preferences [1]:

{
  "method": "sampling/createMessage",
  "params": {
    "messages": [
      {
        "role": "user",
        "content": { "type": "text", "text": "What is the capital of France?" }
      }
    ],
    "modelPreferences": {
      "hints": [{ "name": "claude-3-sonnet" }],
      "intelligencePriority": 0.8,
      "speedPriority": 0.5
    },
    "systemPrompt": "You are a helpful assistant.",
    "maxTokens": 100
  }
}

The client answers with the generated message, the model it used and a stopReason. Only a client that declared the sampling capability can be asked. Letting the model call tools during sampling takes sampling.tools as well.

On 2026-07-28 the request travels inside an InputRequiredResult, and the client retries the original call with the answer, the same way elicitation now works [4].

How does a server choose the model?

It can't. It states preferences, and the client decides [1].

costPriority, speedPriority and intelligencePriority each run from 0 to 1. hints suggest model names as substrings, in order, and a client may map a hint to an equivalent model from another provider.

The specification also says there "SHOULD always be a human in the loop with the ability to deny sampling requests" [1]. A client that follows it lets the user review the prompt before it goes out and the response before the server gets it.

Example

Our MCP connection test declares no client capabilities and never calls a tool, so a server cannot ask it for a completion. If your server's tools depend on sampling, a clean result shows the server answers and lists its tools. Whether a given tool works depends on the client calling it having declared sampling, and after this deprecation that is a dependency worth removing.

Sources

  1. Sampling, MCP specification 2025-11-25
  2. Deprecated features, MCP specification 2026-07-28
  3. Key changes, MCP specification 2026-07-28
  4. Multi Round-Trip Requests, MCP specification 2026-07-28

Go deeper

Related terms