MCP Sampling
Based on the official MCP spec and the 2026-07-28 release candidate
Most of the time, your app asks a server for things, and the server answers. MCP has a weird exception called sampling, where the server turns around and asks your app to go talk to the AI model for it. It sounds like a small trick. It's actually a whole design decision about who holds the API key, who approves what the AI says, and who pays the bill.
Here's the twist: no company has published a case study proving sampling paid off — because in the 2026-07-28 spec release, MCP itself deprecated sampling, about 13 months after introducing it, in favor of just calling the AI provider directly. This chapter walks through why the idea existed, how it actually works, and why the protocol changed its mind.
WHO ASKS WHOM
Normally your app (the "client") is the one that starts things — it asks the server for a file, a search result, a calculation. The server just answers. Sampling flips that around: the server is the one that starts things. It sends your app a request that says "go ask the AI model this, and bring me back the answer." That's what makes sampling unusual — the arrow points the other way.
THE SAMPLING HANDSHAKE
"There SHOULD always be a human in the loop with the ability to deny sampling requests." — MCP spec
Think of it like this: the server writes a note asking a question. It hands the note to your app. Your app shows you the note before sending it anywhere — you can approve it or change it. Only then does your app forward it to the AI. When the AI answers, your app shows you that answer too, before handing it back to the server. Two separate "are you sure?" moments, on purpose, so nothing gets sent or returned without a human seeing it first.
WHY SERVERS DON'T HOLD API KEYS
"With no server API keys necessary." — MCP spec
The simplest way to give an MCP server AI powers is to just paste your API key into it and let it call the model directly. That works fine on your laptop. It falls apart the moment other people start using your server — now your key is paying for every stranger's request, nobody reviewed what got sent, and there's no record of any of it. Sampling exists so the server never has to hold a key at all — it just asks whoever is running it to make the call, using their own account.
TRANSPORT BREAKS THE PATTERN
For the server to ask the client something, there has to be an open line between them the server can talk into whenever it wants — like a phone that's always picked up, not one you only answer when you happen to call. Running the server as a local program on the same computer (called "stdio") gives you that automatically. Hosting the server remotely over the web works too, but only if the connection is kept open and tied to one specific client. Turn on the "stateless" setting some teams use to handle more traffic, and that open line disappears — so does sampling.
ROOTS AND LOGGING — THE SIBLINGS
Sampling wasn't deprecated alone. Two other features that also depend on the server being able to reach the client at any moment got deprecated in the same release: "roots" (the server checking which folders it's allowed to look at) and "logging" (the server telling the client what it's doing while it works). All three share the same weak spot — they all need that always-open line between server and client.
THE DEPRECATION TIMELINE
"Server-initiated requests may now only be issued while the server is actively processing a client request." — MCP spec blog, 2026-07-28
MCP wants to let anyone run a server behind a normal load balancer, spreading traffic across many copies of the same server at random. That only works if any copy can handle any request — which means no copy is allowed to keep a private, dedicated line open to one specific client. Sampling needs exactly that private line. When those two goals collided, the spec picked the load-balancer-friendly option and walked sampling back.
SO SHOULD YOU USE IT?
No company has published numbers on sampling paying off — this isn't that kind of feature. What we do have is a clear, sourced chain of cause and effect, and a real practitioner (running an actual production MCP server) who chose not to use sampling at all. Use that instead of a made-up ROI number.