Uses @vercel/mcp-adapter
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.
- 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.ts
and adjustmaxDuration
to 800 if you using a Vercel Pro or Enterprise account - Deploy the Next.js MCP template
Copy env.example
to .env.local
and configure:
# Required for production
DATABASE_URL=your-neon-postgres-url
REDIS_URL=your-upstash-redis-url
MCP_API_KEY=your-secure-api-key
# For testing scripts
MCP_PRODUCTION_URL=https://your-vercel-app.vercel.app
- API Key Authentication: Production endpoints require
MCP_API_KEY
- Environment Variables: Never commit
.env*
files to version control - Cursor Configuration: Use
cursor-mcp-config.template.json
as a template
Test your MCP server with the included scripts:
# Test locally
node scripts/test-client.mjs
# Test with authentication
node scripts/test-authenticated-client.mjs
# Test production deployment
MCP_PRODUCTION_URL=https://your-app.vercel.app MCP_API_KEY=your-key node scripts/test-cursor-integration.mjs