MCP ExplorerExplorer

Mcp Nextjs Example

@clerkon 5 days ago
2 MIT
FreeCommunity
AI Systems
An example of an MCP endpoint on a nextjs app using Clerk auth

Overview

What is Mcp Nextjs Example

MCP Server with Clerk & Next.js is a minimal example of setting up a server endpoint that integrates authentication using Clerk within a Next.js application.

Use cases

This setup is ideal for developers looking to implement secure user authentication and management in their Next.js applications, particularly with OAuth capabilities provided by Clerk.

How to use

To use this setup, developers need to install dependencies, create a Clerk application with the OAuth beta flag enabled, configure API keys in an .env.local file, and run the application locally using npm run dev.

Key features

Key features include easy integration of Clerk for authentication, support for OAuth, and the ability to set up custom server endpoints within Next.js. It also provides a straightforward testing configuration for connection with external tools like cursor.

Where to use

This structure can be used in any Next.js application that requires user authentication, such as web applications, dashboards, or any platform where secure user access is essential.

Content

MCP Server with Clerk & Next.js

A minimal example of an MCP server endpoint using Next.js and Clerk for authentication.

Setup

  • Run npm i to install dependencies
  • Create a Clerk application and make sure you have been opted in to the OAuth beta flag (contact [email protected] or reach out to a contact at Clerk if you have one)
  • Put your API keys in an .env.local file in the project
  • Run npm run dev to start the app

Connecting to the server

To test in cursor, for example, add the following config to your mcp config file:

Examples of other clients coming soon!

Tools

No tools

Comments