- wire spec: lifecycle, stdio + Streamable HTTP transports, tools, utilities, legacy SSE, versioning, changelog (14 Tier 1) - client ecosystem: Claude Code/VS Code/Cursor/Codex configs, mcp-remote, Smithery, registries, Glama (12 Tier 1) - security/ops: authorization draft, trust model, poisoning, rug pulls, production hardening (12 Tier 1) + 68 Tier 2 cards - conclusions: minimal stdlib client on 2025-11-25, normalizer + resolver agent for pasted configs/GitHub URLs, untrusted-until- consent trust model; nothing built yet - audit PASS (14 subjects, 797 sources, 32 conclusions)
54 lines
3.4 KiB
Markdown
54 lines
3.4 KiB
Markdown
# Sampling (client feature, 2025-11-25)
|
|
|
|
## Metadata
|
|
|
|
| Field | Value |
|
|
|---|---|
|
|
| Institute | Molodetz Institute - Research & Retrieval Division |
|
|
| Subject | mcp-client-support |
|
|
| Document type | Source Dossier |
|
|
| Tier | 1 |
|
|
| Source title | Sampling (MCP Specification v2025-11-25) |
|
|
| Source URL | https://modelcontextprotocol.io/specification/2025-11-25/client/sampling |
|
|
| Source publisher / author | Model Context Protocol authors (Anthropic-donated open project; site docs) |
|
|
| Source type | standard |
|
|
| Source date (published) | 2025-11-25 (version stamp; no other publish date stated) |
|
|
| Date researched | 2026-10-18 |
|
|
| Researched by | tai (agent), model: Claude Sonnet 5, on behalf of retoor |
|
|
| Research method | gather-subagent direct page fetch, parent synthesis from evidence pack |
|
|
| Confidence | High (partial read; findings cover retrieved sections only, see Cons) |
|
|
| Status | Active |
|
|
|
|
## Summary
|
|
|
|
Sampling lets servers request LLM completions through the client ("with no server API keys necessary") via the server-to-client `sampling/createMessage` request carrying messages, model preferences, system prompt, and max tokens. Clients must declare the `sampling` capability (plus `sampling.tools` for tool-using requests, which servers must not send otherwise). The `includeContext` values `thisServer`/`allServers` are soft-deprecated and servers should avoid them.
|
|
|
|
## Key findings
|
|
|
|
- Sampling is servers requesting "LLM sampling ('completions' or 'generations')… via clients… with no server API keys necessary."
|
|
- "Clients that support sampling MUST declare the `sampling` capability"; tool use in sampling needs `sampling.tools`, and "Servers MUST NOT send tool-enabled sampling requests to Clients that have not declared" it.
|
|
- Server-to-client request `sampling/createMessage` with `messages[]`, `modelPreferences`, `systemPrompt`, `maxTokens`; the client responds with `role`/`content`/`model`/`stopReason`.
|
|
- `includeContext` values `"thisServer"`/`"allServers"` are "soft-deprecated"; "Servers SHOULD avoid using these values."
|
|
|
|
## Pros / strengths
|
|
|
|
- Sensible trust design: the client holds the keys and the model policy, and the `sampling.tools` sub-capability gates the riskiest (tool-using) requests so servers cannot escalate unilaterally.
|
|
- Request/response shapes are explicit (messages, preferences, system prompt, max tokens in; role, content, model, stop reason out).
|
|
- Soft-deprecation of the broad `includeContext` values shows the spec actively narrowing context leakage.
|
|
|
|
## Cons / limitations / caveats
|
|
|
|
- Per the pack's Uncertainty notes this page was only partially read; the sampling-with-tools flow and deeper subsections were not read, so findings cover the retrieved sections only.
|
|
- No explicit author names or publish dates appear on the page; the date above is the version stamp in the URL.
|
|
- Deprecated in the 2026-07-28 revision along with roots and logging, and server-initiated requests are replaced by MRTR there; also, sampling needs a real LLM backend, which is far outside a minimal stdlib client's scope.
|
|
|
|
## Relevance to tai
|
|
|
|
Optional and LLM-backed, so safely omitted by a minimal client (no declared capability, `-32601` if asked). Notable for tai only as a future direction: a client with model access could one day offer sampling, but the deprecation in 2026-07-28 argues against investing here.
|
|
|
|
## Changelog
|
|
|
|
| Date | Change |
|
|
|---|---|
|
|
| 2026-10-18 | Initial dossier created. |
|