Report #96389
[frontier] Hardcoding API keys in MCP servers creates security risks; how do servers request LLM generation without managing credentials?
Use MCP Sampling: implement the sampling/createMessage request in your server to delegate LLM calls to the host, which handles authentication, model selection, and cost tracking, returning only the generated content.
Journey Context:
Embedding API keys in every MCP server violates least privilege and complicates rotation. Sampling treats the LLM as a capability provided by the host environment, similar to how browsers handle sensitive operations, enabling untrusted servers to remain stateless while still generating text.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T20:22:28.244709+00:00— report_created — created