Zero to Production: Deploy Your MCP Server to Vercel in 5 Minutes
Here's the deployment story you're probably living:
Your MCP server works locally. It handles tools, resources, prompts—maybe even agents. Now you need it in production.
Traditional deployment means:
- Provisioning servers
- Setting up load balancers
- Configuring Redis for sessions
- Managing SSL certificates
- Worrying about scaling
- Paying for idle capacity
What if deployment was just... vercel deploy?
FrontMCP has first-class Vercel support. One command generates the right build artifacts. Your server runs on Vercel's edge network, scales automatically, and costs nothing when idle.
Let's ship it.
What You'll Deploy
By the end of this guide, you'll have:
Your MCP server running on Vercel's worldwide network—low latency everywhere.
Zero to thousands of requests with no configuration. Pay only for what you use.
Edge-compatible session storage that works with serverless architecture.
Push to git, deployment happens automatically. Or run vercel deploy.
Prerequisites
Before you start:
FrontMCP Project
You need a working FrontMCP server. If you don't have one yet:
npx frontmcp create my-mcp-server cd my-mcp-serverVercel Account
Sign up at vercel.com if you haven't already. The Hobby tier is free.
Vercel CLI
Install the Vercel CLI:
npm i -g vercel vercel login
One-Command Build
FrontMCP's CLI handles all the Vercel-specific configuration:
frontmcp build --adapter vercelThat's it. This command:
- Compiles your TypeScript to ESM
- Bundles everything into a single
handler.cjsfile - Generates Vercel's Build Output API structure
- Detects your package manager (npm/yarn/pnpm/bun)
- Creates
vercel.jsonwith correct configuration
What Gets Generated
After running frontmcp build --adapter vercel, your project contains:
.vercel/
└── output/
├── config.json # Routing configuration
└── functions/
└── index.func/
├── .vc-config.json # Runtime config
└── handler.cjs # Your bundled server
vercel.json # Build commands
The .vc-config.json configures:
- Runtime: Node.js 22.x
- Handler:
handler.cjs - Launcher: Nodejs type
Routes in config.json point all traffic to your function.
Deployment Steps
Build for Vercel
Run the build command:
frontmcp build --adapter vercelAdd Environment Variables
Your MCP server likely needs API keys. Add them to
.env.local:OPENAI_API_KEY=sk-... DATABASE_URL=postgresql://...For production, set them in Vercel Dashboard or via CLI:
vercel env add OPENAI_API_KEY productionDeploy
Run the deploy command:
vercel deployFor production:
vercel deploy --prodVerify
Test your deployment:
curl https://my-mcp-server.vercel.app/health # Expected: {"status":"ok","serverless":true}Or test the MCP endpoint:
curl -X POST https://my-mcp-server.vercel.app/mcp \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}'
Adding Vercel KV for Sessions
Standard Redis requires a persistent TCP connection—which serverless doesn't have. Vercel KV is a REST-based key-value store that works perfectly with serverless.
Enable Vercel KV
Add KV to Your Project
In Vercel Dashboard:
- Go to your project → Storage
- Click "Create Database"
- Select "KV"
- Name it (e.g.,
my-mcp-sessions)
Vercel automatically adds
KV_REST_API_URLandKV_REST_API_TOKENto your environment.Configure FrontMCP
Update your server configuration:
@FrontMcp({ info: { name: 'My MCP Server', version: '1.0.0' }, redis: { provider: 'vercel-kv', // Environment variables are auto-detected // url: process.env.KV_REST_API_URL, // token: process.env.KV_REST_API_TOKEN, keyPrefix: 'mcp:', defaultTtlMs: 7200000, // 2 hours }, }) export default class MyServer {}Redeploy
frontmcp build --adapter vercel vercel deploy --prod
Vercel KV vs Standard Redis
| Feature | Vercel KV | Standard Redis |
|---|---|---|
| Transport | REST (edge-compatible) | TCP (requires connection) |
| Latency | ~5-15ms | ~1-5ms |
| Pub/Sub | Not supported | Supported |
| Resource Subscriptions | Requires hybrid setup | Fully supported |
| Setup | One-click in dashboard | Provision + configure |
| Cost | Pay-per-request | Fixed instance cost |
Serverless Considerations
Function Timeout
Vercel serverless functions have timeout limits:
| Tier | Max Duration |
|---|---|
| Hobby | 60 seconds |
| Pro | 300 seconds |
| Enterprise | 900 seconds |
FrontMCP uses Vercel's Build Output API, so max duration is configured in the function's .vc-config.json. You can customize this via the CLI:
frontmcp build --adapter vercel --max-duration 300This generates .vercel/output/functions/index.func/.vc-config.json:
{
"runtime": "nodejs22.x",
"handler": "handler.cjs",
"launcherType": "Nodejs",
"maxDuration": 300
}
Cold Starts
The first request after idle may take 1-3 seconds while Vercel spins up your function. Subsequent requests (warm starts) are much faster.
FrontMCP tracks this for you:
// Available in your tools/resources
const info = ctx.scope.serverlessInfo;
console.log(info.isColdStart); // true on first request
console.log(info.invocationCount); // number of requests since cold start
Session Persistence Across Cold Starts
Here's where FrontMCP shines: clients don't need to re-initialize MCP when functions wake up from idle.
Traditional MCP servers lose all state when they restart. Clients must detect the disconnect, re-send initialize, and rebuild their session. This creates a terrible user experience in serverless environments where functions spin down after ~15 minutes of inactivity.
FrontMCP handles this automatically:
This means:
- No client-side reconnection logic needed for cold starts
- Session state persists across function invocations
- Seamless experience even with aggressive function recycling
Resource Subscriptions (Hybrid Setup)
Vercel KV doesn't support Pub/Sub, which means real-time resource subscriptions won't work out of the box. If you need subscriptions:
@FrontMcp({
info: { name: 'My Server', version: '1.0.0' },
// Sessions via Vercel KV (edge-compatible)
redis: {
provider: 'vercel-kv',
},
// Pub/Sub via external Redis (for subscriptions)
pubsub: {
host: process.env.REDIS_HOST,
port: 6379,
password: process.env.REDIS_PASSWORD,
},
})
Recommended Redis Services for Pub/Sub
- Upstash - Serverless Redis, pay-per-request, integrates with Vercel
- Redis Cloud - Managed Redis with free tier
- AWS ElastiCache - If you're already on AWS
Project Structure
A typical Vercel-ready FrontMCP project:
my-mcp-server/
├── src/
│ ├── main.ts # Server entry point
│ ├── apps/
│ │ └── my-app/
│ │ ├── index.ts # App definition
│ │ └── tools/ # Tool implementations
│ └── providers/ # Shared providers
├── .env.local # Local environment
├── package.json
├── tsconfig.json
└── vercel.json # Generated by build
Your vercel.json (auto-generated):
{
"version": 2,
"buildCommand": "npm run build",
"installCommand": "npm install"
}
Monitoring & Debugging
Vercel Dashboard
The Vercel dashboard shows:
- Function invocations and duration
- Error rates and logs
- Request/response details
Navigate to Project → Functions to see real-time data.
Logging
FrontMCP logs are captured by Vercel:
@Tool({ name: 'my-tool' })
class MyTool extends ToolContext {
async execute(input: any) {
console.log('Processing:', input); // Visible in Vercel logs
this.notify('Starting processing...', 'info');
// ...
}
}
View logs with:
vercel logs https://my-mcp-server.vercel.appError Tracking
For production, connect Vercel to your error tracking service:
// In your server configuration
@FrontMcp({
// ...
logging: {
level: 'info',
format: 'json', // Structured logs for parsing
},
})
CI/CD Setup
Connect your git repository for automatic deployments:
Connect Repository
In Vercel Dashboard:
- Import your GitHub/GitLab/Bitbucket repo
- Vercel auto-detects the build settings
Configure Build
Set the build command in project settings:
- Build Command:
frontmcp build --adapter vercel - Output Directory:
.vercel/output - Install Command:
npm install(or yarn/pnpm)
- Build Command:
Push to Deploy
Every push to
maintriggers a production deployment. Pull requests get preview deployments.
Cost Optimization
Vercel's serverless pricing is usage-based:
| Resource | Hobby (Free) | Pro ($20/mo) |
|---|---|---|
| Function Invocations | 100K/mo | 1M/mo |
| Function Duration | 100 GB-hrs | 1000 GB-hrs |
| Bandwidth | 100 GB | 1 TB |
| KV Operations | 30K/day | 150K/day |
Troubleshooting
Function Timeout Error
Symptom: 504 Gateway Timeout
Solution:
- Increase max duration in
vercel.json - Upgrade to Pro tier for longer limits
- Break long operations into smaller chunks
Missing Environment Variables
Symptom: OPENAI_API_KEY is not defined
Solution:
vercel env add OPENAI_API_KEY production
vercel deploy --prodCold Start Latency
Symptom: First request takes 2-3 seconds
Solution: This is expected for serverless. For lower latency:
- Keep functions small (faster cold starts)
- Use edge functions for ultra-low latency
- Consider Pro tier with more resources
KV Connection Errors
Symptom: Could not connect to Vercel KV
Solution:
- Ensure KV database is linked to project
- Check that
KV_REST_API_URLandKV_REST_API_TOKENare set - Redeploy after linking KV
What's Next
Build a FrontMCP server step by step, in your browser.
The fetch handler behind serverless and edge deployments, and how to call a server in-process.
FrontMCP supports multiple deployment targets: Vercel, AWS Lambda, Cloudflare Workers, and traditional Node.js servers. Choose what fits your infrastructure.
Star us on GitHub to follow development.
Code in this post targets the FrontMCP version current when it was written; see Versions for what changed since.