clerk/mcp-nextjs-example ? reverse-engineered prompt

Reverse engineered prompt

Build me a small Next.js app that shows how to expose an MCP endpoint and protect it with Clerk login.

I want it to be a simple working example, not a full product. Include the basic app pages, the auth flow, and a server endpoint that MCP clients can connect to once they are signed in. Set it up so it follows Clerk’s current setup for a new app, including the option needed for dynamic client registration. Add a clear local setup path with an example env file so I can copy in my Clerk keys and run it right away.

Please make sure it works well with a client like Cursor, and include a sample config I can use to point a local MCP client at the endpoint. Keep the code clean and easy to understand, since I’m mainly using this as a reference project. If you need to confirm anything from the latest docs, look it up online first.