Skip to main content
Back to all articles
AI Engineering 14 min readUpdated November 3, 2026

When MCP Sampling Goes Away, Who Owns the Model Decision?

Migrate deprecated MCP sampling without silently changing inference authority. Design a host-to-service contract for consent, tenant isolation, budgets, model quality, and safe fallback.

By Salman Butt · Senior Full-Stack & Generative AI Engineer
#MCP#Model Context Protocol#Sampling Deprecation#AI Infrastructure#TypeScript#Python#Multi-Tenancy#Security#Model Routing
On this page

A small MCP tool can look deceptively self-contained. It accepts arguments, consults some records, and returns a result. But if it uses MCP sampling, part of its computation runs on a model selected and operated by the client rather than by the server.

Moving that model call into the tool's own infrastructure changes more than a function signature. The application must now decide which customer data may leave for which inference provider, which identity can invoke that provider, and whether the new model is an acceptable substitute for the old behavior.

I would treat this migration as an inference ownership change. The main artifact is not a provider SDK wrapper. It is a versioned service contract that prevents a previously host-mediated operation from silently acquiring a new processing destination, billing path, or release dependency.

This is a proposed architecture for a hypothetical multi-tenant warehouse application. No numbers or operational incidents in the example are claimed as observed results.

Deprecation is not removal

The MCP sampling specification marks Sampling Deprecated starting with the July 28, 2026 protocol revision (SEP-2577). The official deprecated-features registry states that it remains eligible for removal only in a revision released on or after July 28, 2027. That is the earliest possible ordinary removal point, not a promised shutdown date; an SDK's support policy is also a separate question.

The recommended direction for *new* implementations is direct integration with an LLM provider API. Existing sampling workflows have a migration window, and it is worth using to establish parity rather than rushing to replace a protocol call.

The transport model also changed. The 2026-07-28 specification announcement documents the shift from server-initiated requests to Multi Round-Trip Requests (MRTR): a handler can return input_required, the client supplies requested input, and the original operation is retried. SDK migration documentation describes how older request styles are adapted. These mechanics do not reverse the deprecation: using MRTR to obtain client sampling can preserve compatibility for a time, but it still depends on a deprecated feature and a client that supports it.

One distinction matters for implementation planning: sampling capability is not guaranteed for every client or protocol profile. Older, modern, and library-specific flows should be tested as explicit combinations. Never assume that a protocol version alone means a particular host will perform model inference for a server.

A different product example: warehouse exception explanations

Consider a warehouse operations tool called explain_pick_exception. The application records an immutable event for an order that could not be picked because a bin inventory check failed. The operator asks for a brief explanation and suggested next investigation steps.

The tool receives a trusted order identifier, reads a constrained set of non-sensitive operational facts, and previously sent an abbreviated description to the client's model through MCP sampling. It then returned a human-readable explanation.

There are at least three realistic target designs:

TargetWho selects and operates inference?Suitable when
Application-managed inference serviceThe SaaS's inference platform, separated from the MCP processMultiple internal tools share a documented security and billing boundary
Tenant-managed inference connectionA customer-approved provider connection or enterprise inference serviceCustomers require control of provider or data-processing region
Deterministic explanationNo LLM at all for standardized codesCommon exception states have enough structured information for reliable templates

A fourth path—continued sampling for an existing compatible client—may serve as a migration bridge during the deprecation period, but is not the new architecture to build around.

Do not substitute an unrestricted provider call for a missing host capability. An organization that approved a tool under the assumption of client-mediated inference has not necessarily approved sending the same data to a new external provider.

Architecture: keep the MCP server out of credential custody

I would put the inference service behind an application-controlled authorization boundary and keep the MCP server's role narrow:

~~~text MCP host / authenticated user | tools/call: explain exception | [MCP tool implementation] scoped read only | [Fact projection + policy] tenant, purpose, data class | [Inference admission service] approval • budget • location / \ template path inference path | | fixed rules [service-owned model route] | restricted provider adapter | validate response \ / [MCP tool result] | host/user display

Separate: policy store, identity, audit, and revocation. ~~~

The model-call service does not accept the MCP server's arbitrary tenantId as proof of identity. It authenticates the calling workload and checks a server-minted, short-lived work intent linked to a verified user and the specific operation. The MCP tool can request inference; it cannot choose an arbitrary provider destination or read provider secrets.

This design differs from putting a provider key directly in the MCP process. A separate service can narrow secrets and outbound paths, but does not eliminate misuse: a compromised tool process could attempt unauthorized requests through that service. Admission controls, replay defense, rate limits, and validation belong on the inference service as well.

See my related article on the compromise budget of an LLM gateway for why credential custody and request authorization should not collapse into one proxy.

Make ownership an explicit tenant policy

A migration should create a policy record identifying the accepted inference route, not just the preferred model name.

I would attach these fields to the tool contract:

  • Operation identity: versioned tool name, feature, and client integration profile.
  • Authorized scope: tenant, actor, task purpose, allowed records, and maximum retrieved data class.
  • Route approval: permitted inference service/provider, region, retention class, and disclosure or consent state where required.
  • Execution limit: max input/output tokens, deadline, concurrency, and spend reservation policy.
  • Model release: tested model revision, prompt version, response schema, and regression-evaluation set.
  • Evidence: verified policy decision, actual provider usage if reported, result validation, and uncertainty state.

The record must come from a protected tenant configuration and authenticated operator context, not from model-generated tool arguments. Do not infer customer authorization merely because the host sent a valid MCP call.

If a product allows customers to provide their own provider credentials, those credentials should be stored behind a scoped integration service. This is not equivalent to copying the customer's key into a model prompt, logging it, or returning it to the MCP client. Some providers support temporary or project-scoped identities; others have a different API-key model. Enforce only capabilities that the actual provider and application gateway support.

The delegated agent identity pattern provides another useful separation: the identity asking for work and the workload performing it both matter.

TypeScript: an explicit inference-admission decision

The following code is an application-policy function, not an SDK example. Its caller is responsible for authenticating the principal and retrieving a protected route record. By returning a narrow plan instead of a key, the model-routing layer need not acquire provider credentials.

~~~typescript type RouteKind = "template" | "managed-model" | "tenant-model"; type DataClass = "operational" | "restricted";

type Principal = Readonly<{ tenantId: string; actorId: string; canReadException: boolean; }>;

type Policy = Readonly<{ tenantId: string; feature: "pick-exception"; route: RouteKind; allowedDataClass: DataClass; modelProfile?: string; approvalVersion: string; approved: boolean; maxOutputTokens: number; }>;

type Work = Readonly<{ exceptionId: string; dataClass: DataClass; outputTokens: number; }>;

type Plan = Readonly<{ tenantId: string; exceptionId: string; route: RouteKind; modelProfile?: string; approvalVersion: string; outputTokens: number; }>;

export function admitInference( principal: Principal, policy: Policy, work: Work, ): Plan { if ( !principal.tenantId || !principal.actorId || !principal.canReadException || !work.exceptionId || policy.tenantId !== principal.tenantId || policy.feature !== "pick-exception" || !policy.approved || !policy.approvalVersion || !Number.isSafeInteger(work.outputTokens) || work.outputTokens < 1 || work.outputTokens > policy.maxOutputTokens ) { throw new Error("inference-not-authorized"); }

const classificationRank: Record<DataClass, number> = { operational: 0, restricted: 1, }; if (classificationRank[work.dataClass] > classificationRank[policy.allowedDataClass]) { throw new Error("data-class-not-permitted"); }

if (policy.route !== "template" && !policy.modelProfile) { throw new Error("model-route-not-configured"); } return { tenantId: principal.tenantId, exceptionId: work.exceptionId, route: policy.route, ...(policy.modelProfile ? { modelProfile: policy.modelProfile } : {}), approvalVersion: policy.approvalVersion, outputTokens: work.outputTokens, }; } ~~~

The returned Plan is not a bearer credential and is not sufficient to authorize a network request. A production service must bind the plan to a server-generated request identity, trusted asset revision, expiration, and replay policy, then verify those properties at the executor. The exception ID still needs a resource-level ownership check at the data service; canReadException is only a coarse-grained gate.

The classification comparison above is an illustrative two-level policy. Real data categories, residency constraints, and restrictions need a documented matrix and proper data-flow enforcement. A generic redact() helper is not proof that confidential details have been removed.

Make model quality a release condition

MCP sampling gave the client discretion over model selection, so a server may not even know exactly which model handled historical requests. That limits how reliably a team can construct an old-versus-new quality comparison. Do not manufacture a baseline from an unknown host model.

I would assemble a golden set of warehouse exception cases from authorized, safely handled fixtures. Each case includes immutable warehouse facts, the correct exception category, allowable suggestions, forbidden assertions, and evidence requirements. Compare three methods—existing sampling where a test host supports it, the proposed inference route, and a deterministic template—without pretending all runs are on equivalent models.

Measurements should include:

DimensionExample acceptance condition
Factual groundingEvery suggested explanation cites or corresponds to a supplied operational fact
Unauthorized inferenceThe result does not invent a cause beyond available evidence
Tenant isolationNo cross-tenant fact can be retrieved or shown
Contract complianceOutput passes runtime schema and domain checks
CostReservation and actual settlement are both recorded
LatencyA deadline ends the workflow with an explicit outcome
DegradationUnavailable model returns a truthful fallback or no-answer state

As with any model rollout, calibrate thresholds using real representative evaluation cases. This table describes what to test, not a claim that the proposed system achieved any particular accuracy or latency.

For a release framework, see model upgrades as evaluation gates. Version the prompt, model, retrieval snapshot assumptions, and output validator together.

Python: test that missing permission does not silently choose a new route

A useful migration invariant is that absence of an approved route must never turn into provider fallback. This pure state-policy example makes that decision visible.

~~~python from dataclasses import dataclass from typing import Literal

Route = Literal["template", "managed-model", "tenant-model"] State = Literal["ready", "blocked", "legacy-compatible"]

@dataclass(frozen=True) class MigrationCase: feature: str approved_route: Route | None client_sampling_supported: bool legacy_allowed: bool provider_connection_ready: bool

def decide(case: MigrationCase) -> tuple[State, Route | None]: if case.feature != "pick-exception": return "blocked", None

route = case.approved_route if route == "template": return "ready", "template" if route in ("managed-model", "tenant-model"): if case.provider_connection_ready: return "ready", route return "blocked", None

# Legacy compatibility is explicit, never an implicit fallback. if case.legacy_allowed and case.client_sampling_supported: return "legacy-compatible", None

return "blocked", None

assert decide(MigrationCase( "pick-exception", None, False, False, True )) == ("blocked", None)

assert decide(MigrationCase( "pick-exception", "tenant-model", False, False, False )) == ("blocked", None)

assert decide(MigrationCase( "pick-exception", None, True, True, False )) == ("legacy-compatible", None) ~~~

This sketch does not implement an MCP client, sampling handler, or provider integration. Its legacy-compatible result only means the application may attempt an explicitly configured legacy path. The adapter still must verify protocol-era behavior, client sampling capability, user-control policy, and a valid transport mechanism. In a modern MCP request, the appropriate MRTR behavior differs from the old server-initiated call.

An unavailable tenant-approved model should not silently switch to an application-managed model. Such a change might violate provider approval, region, or retention expectations. A failover policy can select only from independently approved routes and versions.

Data handling changes belong in a migration notice

Direct inference introduces a processor and possible external data path that may not have existed in the same form when the host mediated sampling.

I would document the categories of fact sent, provider route, region, retention assumptions, model use policy, and who can disable the feature. The host may still control which MCP tools a user invokes, but it does not automatically see every downstream provider call the server makes. Operational authorization and product disclosures must reflect that shift.

The application should construct a minimal, typed fact projection before inference. For the warehouse example, transmit an exception code, permitted counts, and a bounded timestamp window where possible—not full order histories, customer addresses, or raw staff notes. A model output egress check remains necessary because the generated explanation can also expose sensitive information.

A restricted inference service can enforce a route-bound policy, but the model provider's actual data-handling terms and regional availability must still be reviewed. Do not claim that a new cloud route has exactly the same privacy properties as a host-selected model without evidence.

See security at the agent's output boundary and limiting AI telemetry content for adjacent protections.

Cost ownership is also a correctness boundary

When the inference service pays the provider, its budget policy becomes part of the tool's availability contract.

Reserve a bounded cost estimate before dispatch; settle against actual provider-reported usage; reconcile uncertain requests whose network response is lost. A retry after a timeout may have incurred cost even if the application did not receive the completion. Do not treat missing usage as zero or permit unbounded repeated reservations for the same user operation.

Track cost per completed warehouse explanation rather than only per model invocation. Track the reservation error rate, ambiguous provider responses, recoveries, and user-visible incomplete answers. For concurrency-safe reservations and delayed settlement, see multi-tenant AI budgets.

If the deterministic template path covers a large proportion of cases with satisfactory quality, it can lower costs and make the workflow more reliable. But it should be selected for the right class of input, not deployed as an untested universal replacement for inference.

Reliability: the tool has more failure boundaries now

A migration should separate failures that legacy client sampling might have hidden inside one MCP tool result:

  • Policy failure: no permitted provider, stale approval, or incompatible data class. Deny without contacting a model.
  • Credential failure: service identity or provider key unavailable. Stop the route; do not request a new secret from the model.
  • Provider failure: timeout, throttling, outage, or unsupported model revision. Apply a bounded retry/degradation policy.
  • Quality failure: response is syntactically valid but contradicts source evidence. Withhold or route to review.
  • Execution ambiguity: provider may have processed the request, but usage or result confirmation is unavailable. Reconcile separately from user-visible success.
  • Compatibility failure: a legacy host does not support sampling, or modern MRTR behavior is not implemented for the intended route.

The exception tool itself should expose the difference between a completed explanation, a deterministic result, an incomplete operation, and an unsupported processing mode. Do not return an empty success to conceal any of these states.

A useful test suite injects each failure, verifies no unauthorized provider call occurs, and checks that sensitive facts never appear in unrestricted logs. Test a rollout across at least one legacy MCP client and one modern-compatible client if both are supported. For modern profiles, ensure the tool does not rely on server-initiated JSON-RPC requests. The TypeScript SDK migration guidance is a good first-party reference for this transition.

Operations: observe the new owner, not just the old tool

A dashboard with only MCP tools/call success rate will miss model-routing failures.

I would monitor four dimensions independently: admission (route approved or denied), inference (provider response and usage), result (validated explanation and grounding), and compatibility (legacy or modern MCP mode and fallback reason).

Metrics should include eligible requests, denied provider routes, provider failures by class, budget reservations and reconciliations, result-validation failures, response latency, and legacy sampling traffic remaining. Segment by approved processing route and low-cardinality workflow versions; keep tenant identity and tool payload details in access-controlled records. A high sampling-traffic share is a migration-planning signal, not proof of user harm.

For release rollout, begin with a protected test tenant and shadow quality evaluations that do not duplicate consequential external actions. Move one explicitly approved tenant cohort at a time; use feature flags to disable the new inference path. If the new route fails, a valid fallback is the approved deterministic mode or an explicit unavailable result—not automatic processing by an unapproved provider.

Document the rollback limit: a new provider call already sent cannot be undone by reverting code, and cost already incurred does not disappear. Rollback controls future traffic; a separate incident process handles exposure or unexpected spend.

What should remain in MCP

MCP remains an excellent interface for discovering and invoking the warehouse tool. The tool's request/response schema, resource identity, and application authorization continue to belong there. The internal choice of inference provider, credential vault, and accounting system need not become public MCP protocol features.

The 2026 deprecation does not make every MCP server an AI-hosting product. Many tools should remain deterministic. Others can call an application-managed inference service behind a versioned authorization contract, with explicit tenant approval when the processing route changes.

The migration principle I would keep is this:

Replacing borrowed inference is a change of operational authority. Treat consent, data destination, model behavior, and budget as deployment requirements—not implementation details hidden behind a new SDK.

Primary technical references

Topic provenance: Viral Ruparel's October 30, 2026 discussion of MCP sampling deprecation provided the topic for further independent research. The warehouse scenario, inference-ownership contract, route admission policy, compatibility tests, diagram, and recommendations here are original.

KEEP READING

Related engineering notes