Multi-tenant MCP server with OAuth: full tutorial and repo using Clerk and Arcade Cloud
manveerc · reddit · 2026-10-17
A developer shares a complete walkthrough for exposing a multi-tenant SaaS API to agents like Claude and ChatGPT via a custom MCP server deployed on Arcade Cloud, with OAuth handled by Clerk so customers sign in with existing credentials.
The key design: the model never handles an access token and can't choose which user it acts as — the API verifies the OAuth token and enforces workspace membership and plan-tier permissions on every call.
The trickiest insight is that "signing in" involves three separate concerns — gateway authentication, API authorization, and browser session verification — each with its own token flow; conflating them causes confusion. Full working code is on GitHub and the tutorial is on Substack. The author discloses their company provides services to Arcade, but says the choice to use it was independent.
More from coding & agent
- Zach Lloyd on the 'software factory': engineering is becoming factory engineering — vikvang1 · 2026-10-17
- "A Great Model with a Bad Harness Loses": Complete Guide to Harness Engineering — aakashgupta · 2026-10-17
- Ex-Chrome lead Addy Osmani: a decent model with a great harness beats a great model — aakashgupta · 2026-10-17
- Dev uses Claude to ban millions of IPs by ASN, stopping a 0.5Tbps-scale attack — basedjensen · 2026-10-17
- GLM 5.3 Prompt for API Security Testing Sparks Debate — MicahBerkley · 2026-10-17
- RUC open-sources EvoOntology: self-evolving ontology layer lifts data agents by up to 26.7 points — udmrzn · 2026-10-17