Next.js MCP Server
Model Context Protocol server built with Next.js and mcp-handler
Overview
This is a Next.js application that implements an MCP (Model Context Protocol) server using the Vercel MCP Adapter. It provides endpoints for AI assistants to interact with custom tools and resources.
Quick Start
- Install dependencies:
- Set up environment variables in
.env.local
:
- Run the development server:
- The server will display the port it's running on (e.g.,
http://localhost:3005
)
Available Tools
The server currently provides two example tools:
- echo: Echoes a message back to the user
- add: Adds two numbers together
To add more tools, edit app/api/mcp/[transport]/route.ts
following the MCP TypeScript SDK documentation.
Testing the MCP Server
Using curl
Using the test client
Note: The MCP endpoints are now organized under /api/mcp/
for better structure when integrating into existing Next.js applications.
Deployment 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, adjust
maxDuration
inapp/[transport]/route.ts
to 800 if using a Vercel Pro or Enterprise account - Deploy the Next.js MCP template
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
A Model Context Protocol server built with Next.js that provides AI assistants with access to custom tools and resources. Includes example tools for echoing messages and performing mathematical operations, with support for both SSE and HTTP transports.
Related MCP Servers
- -securityFlicense-qualityA comprehensive Model Context Protocol server implementation that enables AI assistants to interact with file systems, databases, GitHub repositories, web resources, and system tools while maintaining security and control.Last updated -61
- -securityFlicense-qualityEnables real-time communication between applications and AI models using the Model Context Protocol, supporting features like custom tools and multiple transport options for Next.js applications.Last updated -30,445
- -securityAlicense-qualityA sample implementation of a Model Context Protocol server using Next.js and the Vercel MCP Adapter, allowing developers to create AI assistants with custom tools and resources.Last updated -MIT License
- -securityAlicense-qualityA Model Context Protocol server that enables AI assistants to interact with ERPNext data and functionality, providing access to documents, reports, and CRUD operations via structured API calls.Last updated -2MIT License