A minimal example of an MCP server endpoint using Next.js and Clerk for authentication.
- Run
pnpm ito install dependencies. - Create a Clerk application, then toggle on the Dynamic client registration option in the OAuth applications page in the Clerk Dashboard.
- Run
cp .env.example .env.localand copy your Clerk API keys from the API keys page in the Clerk Dashboard into the.env.localfile - Run
pnpm run devto start the app - You should be able to connect to it now from any client that supports the latest version of the MCP spec. A cursor configuration is provided as a test.
To test in cursor, for example, add the following config to your mcp config file:
"mcp-clerk-next": {
"url": "http://localhost:3000/mcp"
}Examples of other clients coming soon!