This is a clean architecture pattern for building MCP servers in Next.js that keeps your route handlers thin and your logic reusable. The core idea is smart: define your tools once with Zod schemas in lib files, then share that exact code between your MCP endpoints and Next.js server actions. That means your web UI for testing and your actual MCP tools stay in sync automatically. It uses mcp-handler for HTTP transport, works with mcp-remote for Claude Desktop, and the folder structure is straightforward App Router stuff. If you're shipping MCP tools on Vercel or want a proper web interface alongside your AI integrations, this gives you a solid starting point without the usual duplication headaches.
npx skills add https://github.com/gocallum/nextjs16-agent-skills --skill mcp-server-skills