Been digging into per-user OAuth with MCP servers in Next.js lately, and it’s a neat way to fix a big pitfall: shared API keys. When your MCP server uses one token for everyone, users end up seeing or acting on each other’s data—definitely not ideal.
The trick is to capture each user’s OAuth token in their session (NextAuth helps here) and wire it directly into the MCP route handler, so every request runs with that specific token. No globals, no shared keys, just isolated sessions. This means your tools—like listing repos or creating GitHub issues—run as the actual user, respecting their permissions and rate limits.
If you’re building multi-tenant AI tools or integrations, this session-threading approach is worth exploring. Anyone else using OAuth this way with MCP? What providers do you prefer?
#nextjs #oauth #mcp #aiengineering #multitenant
(Link for setup details: https://github.com/vercel/mcp-adapter)
