Keep MCP Multi-Tenant Auth Out of Context

Street_Inevitable_77 · reddit · 2026-07-13

While building a multi-tenant MCP server with private user data, the author discovered that the hardest part isn't the tool itself, but keeping sensitive information completely out of the model's context.

The key lesson: Identity and authentication must never be passed to the model as tool arguments. Once user IDs, account IDs, or tokens enter tool parameters, they flow into the context window, risking being logged, reproduced in subsequent generations, or read/abused by prompt injections in other tools' outputs. The author argues that anything the model sees should not be considered a secret.

Their summarized approach:

Finally, the author treats the model as a "useful but untrusted client" and asks others how they handle per-call authentication and data isolation on the server side.

Related event: Pitfalls of Multi-Tenant Auth and Access Control in MCP(2 posts)→

Original post →

More from coding & agent

coding & agent channel →