TemplatesNext.js Starter
Next.js Starter
A full-stack MCP server built with Next.js and xmcp
A full-stack MCP server built with Next.js, exposing tools via the /mcp route.
Features
- Next.js app with MCP endpoint at
/mcp - File-based tool discovery from
src/tools/ - Concurrent dev server (xmcp + Next.js)
- Example tools:
greet(sync) andweather(async with external API) - Ready for authentication via
withAuth
Getting Started
1. Create the project
2. Install & run
This starts both the xmcp dev server and Next.js dev server concurrently. Open http://localhost:3000 to see your app, and the MCP endpoint will be available at /mcp.
Project Structure
MCP Endpoint
The MCP server is exposed at /mcp via the Next.js adapter in app/mcp/route.ts:
Adding Tools
Create a new .ts file in src/tools/. The tool is automatically discovered:
Authentication
Add authentication to your MCP server using the withAuth function. See the xmcp Next.js documentation for details.
Deploy
Deploy to Vercel or any Node.js hosting platform.

