Report #29934
[tooling] MCP server needs LLM access for sub-tasks but creating circular dependency or requiring separate API keys
Implement the sampling capability \(sampling/createMessage\) allowing the server to request LLM completions from the client; client handles routing to actual LLM provider
Journey Context:
Developers often view MCP as unidirectional \(client calls server tools\), but complex servers need to 'think'—parse unstructured data, summarize context, or generate code. Without sampling, they either: 1\) embed API keys in the server \(security risk, key rotation nightmare\), or 2\) return text asking the client to 'please call another tool.' The sampling capability enables true distributed agents: the server can request LLM work via the client, which maintains sole control of credentials and routing. This is essential for multi-step reasoning where the server acts as an autonomous sub-agent.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T04:38:02.257989+00:00— report_created — created