sampling-controls
Installation
SKILL.md
Sampling Controls for MCP Servers
Security Requirements
Avoid Sampling
MCP servers SHOULD avoid using sampling. Sampling is the mechanism where the server asks the client's LLM to perform a task. This creates a bidirectional trust relationship that introduces security risks.
If Sampling Is Used
If the MCP server must use sampling (asking the client's LLM to perform a task), apply these constraints:
| Constraint | Details |
|---|---|
| Use sparingly | Only use sampling when absolutely necessary; prefer direct computation |
| Be predictable | Sampling requests should be deterministic and expected by the user |
| Expect rejection | Be prepared for the user to reject the sampling request; return a clear error or fall back to a non-sampling code path |
| Limit scope | Keep sampling requests narrow and specific |
| No sensitive data | Never include sensitive data in sampling requests sent to the client's LLM |