AID-H-028.008: Server-Requested Sampling Compatibility Isolation (Deprecated MCP Capability)
Pillars: app
Lifecycle: building, operation
Scope boundary
Owns client-side admission and isolation of deprecated sampling/createMessage as a signed, expiring, server-bound exception with visible purpose and strict model, context, token, tool, iteration, and cost limits. It is not a general agent-action authorization mechanism.
AID-H-018.002: AID-H-028.008 decides whether a deprecated server-requested sampling exception is enabled and bounded at the client; AID-H-018.002 authorizes ordinary runtime capabilities and actions under policy. The deprecated exception must remain narrower than the agent's general capability policy.
AID-H-034: AID-H-028.008 owns the client's deprecated sampling exception; AID-H-034 owns the MCP server boundary and must not assume that a client permits removed server-initiated capabilities. New server designs should use direct provider integration rather than depend on this exception.
Implementation guidance
- AID-H-028.008-G001: Permit deprecated sampling/createMessage only as an approved MCP 2026-07-28 deprecated-capability exception with isolated context, user visibility, and policy-derived rate, token, iteration, and tool budgets.
- AID-H-028.008-G002: Audit every sampling exception and invocation with exact server, user, model route, context, budget, policy, and outcome bindings.
AID-H-028.008-G001
Concept
Roots, sampling, and logging remain present but deprecated in MCP 2026-07-28. An approved use is a narrow exception governed by that exact version's per-request metadata and security policy. For server-to-client sampling, require the current request's client capabilities, a signed exception, explicit user visibility, isolated context, and bounded model/tool use.
MCP v2 exception gate
// File: src/deprecated/samplingException.js
const VERSION = "2026-07-28";
const SAMPLING = "sampling/createMessage";
export function authorizeDeprecatedSampling(input) {
const meta = input.requestParams?._meta;
const capabilities = meta?.["io.modelcontextprotocol/clientCapabilities"];
if (meta?.["io.modelcontextprotocol/protocolVersion"] !== VERSION ||
!capabilities?.sampling || input.method !== SAMPLING) {
throw new Error("deprecated_sampling_not_declared_on_current_request");
}
const rule = input.signedPolicy?.exceptions?.find(item =>
item.protocolVersion === VERSION && item.method === SAMPLING &&
item.serverOrigin === input.serverOrigin && item.clientId === input.clientId
);
if (!rule || Date.parse(rule.expiresAt) <= Date.now() || !rule.approvalId ||
!Number.isSafeInteger(rule.maxTokens) || rule.maxTokens <= 0 ||
!Number.isSafeInteger(rule.maxIterations) || rule.maxIterations <= 0 ||
!Number.isSafeInteger(rule.maxRequestsPerMinute) ||
rule.maxRequestsPerMinute <= 0) {
throw new Error("approved_deprecated_capability_exception_required");
}
if (input.requestedMaxTokens > rule.maxTokens ||
input.requestedTools?.some(tool => !rule.allowedTools.includes(tool.name))) {
throw new Error("deprecated_sampling_budget_or_tool_denied");
}
return Object.freeze({
protocolVersion: VERSION,
exceptionId: rule.approvalId,
maxTokens: rule.maxTokens,
maxIterations: rule.maxIterations,
allowedTools: Object.freeze([...rule.allowedTools])
});
}Action: deny by default. When approved, meter separately, prevent ambient secrets or privileged tools from entering sampling context, show which server requested model use, and preserve request, policy, approval, budget, tool, and outcome digests. Apply the same signed-exception pattern to deprecated roots and logging surfaces that remain enabled.
Independent verification
Exercise absent per-request capability, expired or wrong-server exception, token/iteration/rate overflow, unapproved tool, hidden invocation, context crossover, and revocation. Confirm that every accepted request is bound to protocol version 2026-07-28.
AID-H-028.008-G002
Sampling exception audit
Emit requested, allowed, and rejected events bound to the originating request, server identity, user and tenant digests, exact capability metadata, exception ID and expiry, model route, context digest, visibility receipt, budget reservations, policy version, and terminal status. Never log complete prompts, hidden reasoning, credentials, or reusable authorization. Test expired or wrong-server exceptions, hidden UI, context injection, privileged tools, nested sampling, concurrent exhaustion, cancellation, unknown outcomes, and sink failure.
Open-source tools
- Pydantic
- limits (Python rate limiting with multiple backend strategies)
- Microsoft Presidio
- Model Context Protocol TypeScript SDK v2 (@modelcontextprotocol/server and @modelcontextprotocol/client)
- Model Context Protocol Python SDK (mcp)
Commercial / hosted tools
- Azure AI Content Safety - Prompt Shields (prompt injection detection in server-originated sampling content)
- Check Point AI Guardrails
- Amazon Bedrock Guardrails
- Palo Alto Networks Prisma AIRS
Threat mappings
MITRE ATLAS
- AML.T0051 LLM Prompt Injection (server-originated prompt injection via sampling/createMessage)
- AML.T0053 AI Agent Tool Invocation (covert tool calls triggered through crafted sampling prompts)
- AML.T0054 LLM Jailbreak (sampling request used to bypass client-side safety alignment)
MAESTRO
- Integration Risks (L7) (sampling blurs trust boundary between server-originated and user-originated prompts)
- Denial of Service (DoS) Attacks (L1) (token and complexity limits prevent hidden sampling resource exhaustion)
OWASP LLM Top 10 2026
- LLM01:2026 Prompt Injection (isolated context, denied tools, and hard budgets bound the blast radius of injected sampling content but do not detect the injection)
- LLM03:2026 Excessive Agency
- LLM06:2026 Unbounded Consumption
OWASP ML Top 10 2023
- N/A
OWASP Top 10 for Agentic Applications 2026
- ASI01:2026 Agent Goal Hijack (sampling request hijacks client LLM conversation direction and decision pathway)
- ASI02:2026 Tool Misuse and Exploitation (covert tool invocation via sampling-triggered completions)
- ASI03:2026 Identity and Privilege Abuse (server assumes user-level authority through sampling channel)
- ASI06:2026 Memory & Context Poisoning
NIST Adversarial Machine Learning 2025
- NISTAML.039 Compromising connected resources (sampling-mediated compromise of client LLM and connected tools)
Cisco Integrated AI Security and Safety Framework
- AISubtech-13.1.1 Compute Exhaustion
- AISubtech-13.1.2 Memory Flooding
- AISubtech-13.1.3 Model Denial of Service
- AISubtech-13.1.4 Application Denial of Service
- AISubtech-13.2.1 Service Misuse for Cost Inflation
- AISubtech-2.1.2 Capability and Permission Overreach
- AITech-1.2 Indirect Prompt Injection (isolates deprecated sampling requests from privileged client context)
- AITech-12.1 Tool Exploitation
- AITech-13.1 Disruption of Availability
- AITech-13.2 Cost Harvesting / Repurposing
- AITech-2.1 Excessive Agency
- AITech-4.2 Context Boundary Attacks (isolates deprecated sampling requests from privileged client context)
Google Secure AI Framework 2.0 - Risks
- PIJ: Prompt Injection (server-originated sampling prompts are an injection vector into the client LLM)
- RA: Rogue Actions (sampling-triggered tool invocations can produce rogue actions without user awareness)
- DMS: Denial of ML Service (unbounded sampling requests consume client LLM resources)
Databricks AI Security Framework 3.0
- Agents - Tools MCP Server 13.16: Prompt Injection (server-originated prompt injection via sampling)
- Agents - Core 13.2: Tool Misuse (covert tool invocation via sampling-triggered completions)
- Agents - Tools MCP Server 13.24: Context Spoofing and Manipulation
- Model Serving - Inference requests 9.7: Denial of Service (DoS) (resource theft through hidden token consumption)
- Agents - Core 13.1: Memory Poisoning
- Agents - Core 13.6: Intent Breaking & Goal Manipulation (sampling request redirects client LLM intent and planning)