The latest MCP spec (https://modelcontextprotocol.io/specification/2025-06-18/bas...) requires MCP Servers implement OAuth for authenticating users and authorizing access to tools and resources. I spent way too long wiring up OAuth to build a ChatGPT connector and decided to wrap the pain into a library: @mcpauth/auth.
What it is:
- Self-hosted OAuth server, built for Model-Context-Protocol
- Single authenticateUser() hook, so you plug in whatever session logic you already have (NextAuth, Auth.js, plain cookies, JWT, you name it)
- Adapters: Next.js and Express; stores: Drizzle or Prisma
- ISC licensed, no calls home
Quick start is ~5 min: npm i @mcpauth/auth, add two route handlers, set three env vars.
Live demo: https://mcpauth-nextjs.vercel.app/
If you’re building an MCP server or any internal AI tool that needs proper OAuth, I’d love feedback — especially on edge cases or new functionality.