How to Deploy MCP Servers: Vercel vs Railway vs Render vs Heroku vs Fly.io (2026 Guide)
MCP Playground
MCP Playground
📖 TL;DR — Key Takeaways
- Vercel: best for Next.js MCP servers — zero-config, built-in OAuth, proven at scale (Zapier, Vapi). Cold starts ~250ms with Fluid Compute.
- Railway: best for stateful or SSE-based MCP — persistent always-on process, one-click Redis, $5/mo Hobby plan.
- Render: simplest deploy with predictable $7/mo billing — free tier sleeps after 15 min, Starter is production-ready.
- Heroku: best for enterprise and Salesforce Agentforce integration — official Node/Python/Go/Ruby templates, mature ecosystem.
- Fly.io: best for stdio MCP servers and cost optimization — one-command
fly mcp launch, per-second billing, near-zero idle cost via auto-suspend. - All 5 platforms support MCP Streamable HTTP transport (the current standard).
The MCP ecosystem took off in 2025 and has continued to accelerate into 2026: remote MCP servers now account for over 80% of the most-searched servers on directories like PulseMCP. Moving your MCP server off your laptop and into the cloud lets any AI client — Claude, Cursor, Windsurf, VS Code, or your own app — connect to it 24/7 without needing local software installed.
But which platform should you use? Vercel, Railway, Render, Heroku, and Fly.io each make different trade-offs around pricing, cold starts, session persistence, and deployment experience. This guide breaks down each one with real configuration examples, pricing comparisons, and a clear recommendation for each use case.
MCP Transport Quick Reference
Before picking a platform, understand the transport your server uses — it affects which platforms work best:
| Transport | Status | Best Platform Match | Notes |
|---|---|---|---|
| Streamable HTTP | ✅ Current standard | All 5 platforms | Single POST endpoint; stateless-friendly |
| SSE | ⚠️ Deprecated in spec | Railway, Render, Heroku, Fly.io | Needs persistent connections; avoid serverless |
| stdio | 🖥️ Local only | Fly.io (via fly mcp launch) | Fly wraps any stdio server as a remote HTTP endpoint |
1. Vercel — Best for Next.js MCP Servers
Vercel is the first-party platform for Next.js and ships the official mcp-handler package. If you're building a Next.js app with an MCP server endpoint, Vercel is the natural choice. Companies like Zapier (7,000+ app integrations), Vapi, and Composio host their production MCP servers on Vercel.
How to Deploy
Install the required packages:
npm install mcp-handler @modelcontextprotocol/sdk@1.26.0 zod
Create a dynamic route handler at app/api/[transport]/route.ts:
import { createMcpHandler } from 'mcp-handler';
import { z } from 'zod';
const handler = createMcpHandler(
(server) => {
server.tool(
'get_weather',
'Returns current weather for a city',
{ city: z.string().describe('City name') },
async ({ city }) => ({
content: [{ type: 'text', text: `Weather in ${city}: 72°F, sunny` }],
})
);
},
{},
{
basePath: '/api', // must match your app/api/ path
maxDuration: 60, // seconds; 800 with Fluid Compute on Pro
verboseLogs: false,
}
);
export { handler as GET, handler as POST, handler as DELETE };
The [transport] dynamic segment lets one route handler serve both Streamable HTTP (/api/mcp) and legacy SSE (/api/sse) clients. Your MCP client URL becomes https://your-app.vercel.app/api/mcp.
⚠️ Vercel Firewall Gotcha
Vercel's DDoS protection can rate-limit MCP client connections and return 429 errors. Add a WAF bypass rule for your /api/mcp path in the Vercel dashboard under Firewall → System Bypass Rules. Pro plans get 25 rule slots.
Pricing
| Plan | Cost | Max Duration | Invocations |
|---|---|---|---|
| Hobby | Free | 300s | 150k/mo (hard limit) |
| Pro | $20/seat/mo | 800s (w/ Fluid) | 1M/mo + $0.60/M extra |
| Enterprise | Custom | 800s | Custom |
Strengths: Fluid Compute eliminates ~99% of cold starts; built-in OAuth via withMcpAuth(); dual transport (SSE + Streamable HTTP); instant rollbacks; proven at scale. Weaknesses: Stateless by design (needs Redis for sessions); 4.5 MB body limit; no native Redis (use Upstash or Redis Labs); Edge Runtime incompatible with full SDK transport.
2. Railway — Best for Stateful and SSE-Based MCP Servers
Railway runs your MCP server as a persistent, always-on process — not a serverless function. This means no cold starts, native SSE connection persistence, and built-in database provisioning. If your MCP server needs long-running sessions or keeps state in memory, Railway is the right choice.
How to Deploy
Create a Dockerfile for predictable builds:
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
EXPOSE 8080
ENV PORT=8080
CMD ["node", "dist/index.js"]
Your server must bind to process.env.PORT. Then connect your GitHub repo at railway.com, Railway auto-detects Node.js and builds automatically, add a Redis service from Railway's template library (auto-injects REDIS_URL), set env vars using Railway's reference syntax: {Redis.REDIS_URL{"}"}, and your service is live at *.railway.app.
✅ Railway's Redis Advantage
Add a Redis service alongside your MCP server in the same Railway project. Railway automatically injects REDIS_URL, REDIS_HOST, REDIS_PASSWORD into your service — zero manual configuration. Private networking means no egress charges for Redis traffic.
Pricing
| Plan | Monthly Fee | Included Credits | RAM / CPU per service |
|---|---|---|---|
| Free | $0 | $1/mo | 0.5 GB / 1 vCPU |
| Hobby | $5 | $5/mo credit | Up to 48 GB / 48 vCPU |
| Pro | $20 | $20/mo credit | Up to 1 TB / 1,000 vCPU |
For a small MCP server (256 MB RAM, 0.1 vCPU), the Hobby plan's $5 credit covers it entirely. Usage beyond credits: $10/GB RAM/month, $20/vCPU/month. Strengths: Zero cold starts; native Redis; transparent billing; multi-service private networking. Weaknesses: Single-region; app can sleep if no outbound traffic for 10 min on Free plan.
3. Render — Simplest Deploy with Predictable Pricing
Render is the easiest path from GitHub to a running MCP server. Push your code, connect your repo, and Render builds and deploys automatically. The free tier sleeps — but for $7/month on the Starter plan you get an always-on service with managed Redis alongside it.
How to Deploy
Use render.yaml to declare your service and Redis together:
services:
- type: web
name: mcp-server
env: node
plan: starter # $7/mo — always-on, no sleeping
buildCommand: npm install && npm run build
startCommand: node dist/index.js
envVars:
- key: NODE_ENV
value: production
- key: REDIS_URL
fromService:
type: redis
name: mcp-redis
property: connectionString
- type: redis
name: mcp-redis
plan: starter # $10/mo — 100 MB storage
⚠️ Free Tier Warning
Render's free web services spin down after 15 minutes of inactivity. Cold boot takes 30–60 seconds — MCP clients will time out waiting. For any production MCP server, you need the Starter plan ($7/mo). The free tier is usable only for development.
Pricing
| Service | Free | Starter | Standard |
|---|---|---|---|
| Web Service | $0 (sleeps) | $7/mo | $25/mo |
| Redis | $0 (25 MB) | $10/mo (100 MB) | — |
| RAM / CPU | 512 MB / 0.1 | 512 MB / 0.5 | 2 GB / 1 |
Strengths: Easiest GitHub-to-deploy; no CLI required; managed Redis; predictable billing; render.yaml for infra-as-code. Weaknesses: Free tier sleeps (fatal for production); no multi-region; no custom MCP hosting guide; free Redis only 25 MB.
4. Heroku — Best for Enterprise and Salesforce Integration
Heroku provides official MCP server templates in Python, Node.js, Ruby, and Go, plus a managed heroku-inference add-on that handles tool routing, authentication, and scaling for AI agents automatically. For Salesforce Agentforce integration, Heroku is the only platform with native support.
Two Deployment Modes
Mode A — HTTP MCP Server (standard web dyno):
# Procfile
web: node dist/index.js
# Deploy
git push heroku main
heroku config:set NODE_ENV=production
# Live at: https://your-app.herokuapp.com/mcp
Mode B — STDIO server via Heroku Managed Inference add-on:
# Procfile — the mcp- prefix is mandatory for auto-discovery
web: npm start
mcp-mytools: node dist/mcp-server.js
# Attach the inference add-on
heroku addons:create heroku-inference:standard -a $APP_NAME
# Verify MCP server registration
curl "$INFERENCE_URL/v1/mcp/servers" \
-H "Authorization: Bearer $INFERENCE_KEY" | jq .
Pricing
| Dyno Type | Price | RAM | Notes |
|---|---|---|---|
| Eco | $5/1,000 hrs | 512 MB | Sleeps after 30 min |
| Basic | $7/dyno/mo | 512 MB | Always-on |
| Standard-1X | $25/dyno/mo | 512 MB | Always-on, production |
| One-off dyno | $0.0008/sec | 512 MB | Per STDIO tool call (inference add-on) |
Strengths: Enterprise Salesforce Agentforce integration; official multi-language templates; one-off dyno isolation per tool call; mature Redis/Postgres add-ons. Weaknesses: No free tier; most expensive at scale (Standard-1X is $25/mo); Private Spaces limitation (no inference add-on MCP); Eco dynos sleep after 30 min.
5. Fly.io — Best for stdio Servers and Cost Optimization
Fly.io has a unique proposition: it can wrap any stdio MCP server — whether it's an npx package, a Python uvx command, or a custom binary — and expose it as a remote HTTP endpoint with bearer token authentication. The fly mcp launch command does this in a single line.
How to Deploy
For any stdio MCP server — one command:
# Deploy npx-based server
fly mcp launch "npx -y @modelcontextprotocol/server-slack" \
--claude --server slack \
--secret SLACK_BOT_TOKEN=xoxb-your-token
# Deploy Python-based server
fly mcp launch "uvx mcp-server-time" \
--claude --server time
# --claude flag automatically updates your local Claude config
For a custom HTTP MCP server — use fly.toml:
app = "my-mcp-server"
primary_region = "iad"
[http_service]
internal_port = 8080
force_https = true
auto_stop_machines = "suspend" # resumes in ~100ms (use this, not "stop")
auto_start_machines = true
min_machines_running = 0 # set to 1 for always-on
[[vm]]
size = "shared-cpu-2x"
memory = "512mb"
✅ Fly.io: Suspend vs Stop
Always use auto_stop_machines = "suspend" (not "stop"). Suspend snapshots the VM's memory state; resume takes ~100–500ms. Stop requires a full boot from scratch: 1–3 seconds. The difference matters for MCP clients with strict connection timeouts.
Pricing
| Machine Size | vCPU / RAM | Always-on ~monthly | With auto-suspend |
|---|---|---|---|
| shared-cpu-1x | 1 shared / 256 MB | ~$2.02 | Near-zero |
| shared-cpu-2x | 2 shared / 512 MB | ~$4.04 | Near-zero |
| performance-1x | 1 dedicated / 2 GB | ~$32.19 | ~$5-10 |
Strengths: fly mcp launch one-liner for any stdio server; per-second billing; Firecracker VM isolation; 30+ regions; suspend for ~100ms resume; Wireguard private networking. Weaknesses: No free tier (post-Oct 2024); stateful MCP requires single-machine deployment; no managed Redis (use Upstash externally); fly mcp tooling is beta.
Platform Comparison at a Glance
| Feature | Vercel | Railway | Render | Heroku | Fly.io |
|---|---|---|---|---|---|
| Free tier | ✅ Hobby | ⚠️ $1/mo | ⚠️ Sleeps | ❌ | ❌ |
| Min paid tier | $20/mo | $5/mo | $7/mo | $7/mo | ~$2/mo |
| Cold start | ~250ms | None (Hobby+) | 30–60s (free) | 10–30s (Eco) | ~100ms |
| Native Redis | ❌ Upstash | ✅ 1-click | ✅ Managed | ✅ Add-on | ❌ Upstash |
| Stateful MCP | ⚠️ Needs Redis | ✅ Native | ✅ Native | ✅ Native | ✅ Single-machine |
| MCP docs quality | ✅ Excellent | ⚠️ Minimal | ⚠️ Platform-only | ✅ Good | ✅ Good (beta) |
| stdio support | ❌ | ⚠️ Via proxy | ❌ | ✅ Via add-on | ✅ fly mcp launch |
| Multi-region | ✅ Edge | ❌ | ❌ | ❌ | ✅ 30+ regions |
| Best for | Next.js / OAuth | Stateful / SSE | Simple deploy | Enterprise | stdio / cost opt. |
Which Platform Should You Choose?
🟦 Choose Vercel if…
- Building a Next.js app with an embedded MCP server
- You need OAuth 2.1 support out of the box
- Scale and reliability are critical (Vapi, Zapier-level traffic)
🟩 Choose Railway if…
- Your server needs persistent SSE connections
- You want Redis co-located with zero configuration
- Always-on on a budget ($5/mo Hobby plan)
🟪 Choose Render if…
- You want the simplest possible deploy experience
- Predictable monthly billing ($7 Starter)
- Small team or solo project, no complex scaling needs
🟧 Choose Heroku if…
- You need Salesforce Agentforce integration
- You want official templates in your language (Python, Ruby, Go)
- Enterprise compliance and isolation per tool call matter
🟥 Choose Fly.io if…
- You want to host any npx/uvx stdio MCP server remotely in one command
- Cost optimization is critical (pay only for active seconds)
- You need multi-region or Firecracker VM isolation
Common Deployment Gotchas (All Platforms)
- Always bind to
process.env.PORT— every platform assigns a dynamic port; hardcoding 3000 or 8080 causes deployment failures. - Export GET, POST, and DELETE — MCP clients use all three methods. Missing DELETE causes errors during session cleanup.
- Never use
ts-nodein production — compile TypeScript to JS and run withnode dist/index.js. - Pin the SDK version — use
@modelcontextprotocol/sdk@1.26.0or later. Earlier versions have known security vulnerabilities. - Use Redis for session state at scale — stateless platforms can route requests to different instances. In-memory sessions break on the next request.
- Don't use Edge Runtime with full SDK transport —
StreamableHTTPServerTransportrequires Node.js APIs. Use Node.js runtime explicitly on Vercel.
Frequently Asked Questions
Can I host an MCP server for free?+
Which platform has the least cold start latency?+
Does my MCP server need Redis?+
Can I use these platforms with Claude Desktop and Cursor?+
{"mcpServers": {"myserver": {"url": "https://your-server.vercel.app/api/mcp"}}}. For Cursor: same format in .cursor/mcp.json. If your server requires auth, add a headers field with the Bearer token.What is Streamable HTTP and why does it matter for deployment?+
How do I test my deployed MCP server before pointing clients at it?+
Test Your Deployed MCP Server — Free
Connect to any remote MCP server, explore its tools, and execute calls from your browser. No sign-up required.
Related Resources
- Build a Custom MCP Server with Node.js — step-by-step guide to write your server before deploying it
- What Is the Model Context Protocol? — MCP fundamentals if you're just getting started
- Complete Guide to MCP Config Files — configure Claude Desktop, Cursor, Windsurf after deploying
- MCP Config Generator — generate client config JSON from your deployed server URL
- MCP Servers Directory — browse 10,000+ servers to see what others have built and deployed
Written by MCP Playground
15+ years in product development. AI enthusiast building developer tools that make complex technologies accessible to everyone.
Related Resources