MCP OAuth Sample
About
A sample MCP OAuth server implementation using Next.js, providing OAuth 2.1 authentication with Google and PostgreSQL.
Details
- Author
- raxitai
- Categories
- Developer Tools, Other
Jump to
Setup
Install MCP OAuth Sample in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/raxitai/mcp-oauth-sample
Follow the installation instructions in the repository README, then restart your MCP client.
MCP OAuth Sample on Vercel and Analytics
A production-ready MCP (Model Context Protocol) OAuth 2.1 server implementation built with Next.js 15, providing secure authentication and analytics for MCP clients.
This project was built usingrun-llama/mcp-nextjsas a reference implementation and significantly enhanced to be fully compliant with theMCP Authorization Specificationorhere.
✅OAuth 2.1 Compliance- Full implementation of MCP authorization specification
✅OAuth Refresh Tokens- Automatic token refresh for seamless user experience
✅DIY Analytics Dashboard- Real-time analytics with security monitoring
✅Enhanced Security- Comprehensive threat detection and monitoring
# Install dependencies pnpm install # Setup environment variables (see docs/setup.md) cp .env.example .env # Setup database pnpm prisma generate pnpm prisma db push # Start development server pnpm dev
- Complete OAuth 2.1 Serverwith PKCE and refresh token support
- MCP Authorization Flowcompliant with latest MCP specification
- Analytics Dashboardwith real-time security monitoring
- Google Authenticationintegration via NextAuth.js
- Dynamic Client Registrationfor seamless MCP client onboarding
- Security Monitoringwith threat detection and alerting
- PostgreSQL Databasewith automated cleanup and TTL management
📚View Full Documentation- Interactive Material for MkDocs site
# Serve documentation locally with hot reload ./docs-serve.sh # Or on Windows docs-serve.bat # Manual setup pip install -r requirements.txt mkdocs serve
We have attempted to implement all the mandatory requirements specified in the MCP Authorization Specification.
- Discovery Endpoints- Proper RFC 8414 and RFC 9728 implementation
- Resource Parameter Support- RFC 8707 Resource Indicators implementation
- Token Audience Validation- Strict security boundary enforcement
- Refresh Token Flow- OAuth 2.1 compliant token refresh
- WWW-Authenticate Headers- Proper 401 response handling
- Dynamic Client Registration- RFC 7591 support for MCP clients
- SSE:/mcp/sse
- HTTP:/mcp/mcp
{ "mcpServers": { "raxIT-oauth": { "url": "https://your-domain.com/mcp/sse", "transport": "sse" } } }
{ "mcpServers": { "raxIT-oauth": { "url": "https://your-domain.com/mcp/mcp", "transport": "http-stream" } } }
We warmly welcome contributions from the community! This project is open source and we encourage developers to help make it even better.
🐛Report Bugs- Found an issue?Open a bug report
✨Request Features- Have an idea?Submit a feature request
📝Improve Documentation- Help make our docs clearer and more comprehensive
🔧Submit Code- Fix bugs, add features, or improve performance
🧪Add Tests- Help us increase test coverage and reliability
🎨Enhance UI/UX- Make the analytics dashboard even better
- Forkthe repository to your GitHub account
- Cloneyour fork:git clone https://github.com/your-username/mcp-oauth-sample.git
- Install dependencies:pnpm install
- Set up environment: Follow ourSetup Guide
- Create a branch:git checkout -b feature/your-feature-name
- Make your changesand test thoroughly
- Commit: UseConventional Commitsformat
- Pushand create a Pull Request
- Code Style: Follow existing patterns and use ESLint/Prettier
- Testing: Add tests for new features and ensure existing tests pass
- Documentation: Update relevant docs for any changes
- Security: Follow security best practices, especially for OAuth flows
- Performance: Consider analytics and monitoring impact
- 💬Discussions: Join conversations inGitHub Discussions
- 💼LinkedIn: Follow us onLinkedIn
- 🐦X (Twitter): Follow@raxit_aifor updates
- 🦋Bluesky: Connect onBluesky
All contributors are welcome!Whether you're fixing typos, adding major features, or helping with docs - every contribution matters. 🙏
This project is licensed under the Apache License 2.0 - see theLICENSEfile for details.
- Issues:GitHub Issues
- Documentation:docs/
Based onrun-llama/mcp-nextjswith enhancements to learn MCP authz.
This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.
A FastAPI microservice for health-related operations, featuring JWT authentication and a PostgreSQL database with Alembic migrations.
An example of a remote, authentication-free MCP server deployable on Cloudflare Workers.
MCPg - Production-grade PostgreSQL MCP Server
Safe-by-default PostgreSQL Model Context Protocol server for AI agents.
A framework for building MCP servers on Cloudflare Workers with OAuth, PostgreSQL, and Stripe.
A Next.js template for building MCP servers with OAuth 2.1 authentication, supporting PostgreSQL and Redis.
Create crafted UI components inspired by the best 21st.dev design engineers.
Bring agent evaluations, observability, and synthetic test set generation directly into your IDE for free with Galileo's new MCP server
An MCP server to help AI assistants to answer questions and generate AccelByte Extend SDK code more effectively .
MCP server for AI Diagram Maker — generate beautiful software engineering diagrams directly inside Cursor, Claude Desktop, Claude Code, or any MCP-compatible AI agent
ALAPI MCP Tools,Call hundreds of API interfaces via MCP
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





