About Example Next.js MCP Server
Example Next.js MCP Server is a sample app showing how to add MCP routes to a Next.js project with `@vercel/mcp-adapter`. It includes a sample client for testing invocations.
Key features
- 01MCP routes in Next.js
- 02Configurable tools, prompts, and resources
- 03SSE transport guidance
- 04Sample invocation client
Use cases
- 01Add an MCP server to a Next.js project
- 02Define MCP tools, prompts, and resources
- 03Test server invocations with the sample client
MCP support
The sample uses `@vercel/mcp-adapter` to provide an MCP server on Next.js routes, with SSE transport guidance for Vercel deployments.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEExample Next.js MCP Server
Uses @vercel/mcp-adapter
Usage
This sample app uses the Vercel MCP Adapter that allows you to drop in an MCP server on a group of routes in any Next.js project.
Update app/[transport]/route.ts with your tools, prompts, and resources following the MCP TypeScript SDK documentation.
Notes for running on Vercel
- To use the SSE transport, requires a Redis attached to the project under
process.env.REDIS_URL - Make sure you have Fluid compute enabled for efficient execution
- After enabling Fluid compute, open
app/route.tsand adjustmaxDurationto 800 if you using a Vercel Pro or Enterprise account - Deploy the Next.js MCP template
Sample Client
script/test-client.mjs contains a sample client to try invocations.
node scripts/test-client.mjs https://mcp-for-next-js.vercel.app
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.