Back to Blog
DeploymentMar 29, 202618 min read

How to Deploy MCP Servers: Vercel vs Railway vs Render vs Heroku vs Fly.io (2026 Guide)

MP

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
HobbyFree300s150k/mo (hard limit)
Pro$20/seat/mo800s (w/ Fluid)1M/mo + $0.60/M extra
EnterpriseCustom800sCustom

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/mo0.5 GB / 1 vCPU
Hobby$5$5/mo creditUp to 48 GB / 48 vCPU
Pro$20$20/mo creditUp 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 / CPU512 MB / 0.1512 MB / 0.52 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 hrs512 MBSleeps after 30 min
Basic$7/dyno/mo512 MBAlways-on
Standard-1X$25/dyno/mo512 MBAlways-on, production
One-off dyno$0.0008/sec512 MBPer 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-1x1 shared / 256 MB~$2.02Near-zero
shared-cpu-2x2 shared / 512 MB~$4.04Near-zero
performance-1x1 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~250msNone (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 forNext.js / OAuthStateful / SSESimple deployEnterprisestdio / 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)

  1. Always bind to process.env.PORT — every platform assigns a dynamic port; hardcoding 3000 or 8080 causes deployment failures.
  2. Export GET, POST, and DELETE — MCP clients use all three methods. Missing DELETE causes errors during session cleanup.
  3. Never use ts-node in production — compile TypeScript to JS and run with node dist/index.js.
  4. Pin the SDK version — use @modelcontextprotocol/sdk@1.26.0 or later. Earlier versions have known security vulnerabilities.
  5. Use Redis for session state at scale — stateless platforms can route requests to different instances. In-memory sessions break on the next request.
  6. Don't use Edge Runtime with full SDK transportStreamableHTTPServerTransport requires Node.js APIs. Use Node.js runtime explicitly on Vercel.

Frequently Asked Questions

Can I host an MCP server for free?+
Vercel's Hobby plan is the only genuinely free always-on option (150k function invocations/month). Render's free tier sleeps after 15 minutes — unusable for production. Railway's free tier gives $1/month credit (very limited). Heroku and Fly.io have no free tiers for new accounts. For low-traffic production use, Vercel Hobby is your best bet.
Which platform has the least cold start latency?+
Railway wins with zero cold starts (persistent process never sleeps on Hobby+). Fly.io's suspend mode is second (~100–500ms resume). Vercel with Fluid Compute is third (~250ms). Render and Heroku paid tiers have no cold starts, but their free/Eco tiers are painful (30–60 seconds) — long enough to time out most MCP clients.
Does my MCP server need Redis?+
Only if you need SSE session resumability (clients reconnecting after dropped connections), stateless infrastructure where different instances might handle sequential requests, or async tool results that need to be stored and retrieved later. For simple stateless Streamable HTTP servers where each POST request is fully independent, Redis is optional.
Can I use these platforms with Claude Desktop and Cursor?+
Yes — all 5 platforms produce a public HTTPS URL. Add it to your client config. For Claude Desktop: {"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?+
Streamable HTTP (the current MCP spec standard, introduced March 2025) uses a single POST endpoint. The client sends requests as POST bodies; the server responds inline (200 OK) or asynchronously (202 + SSE stream). It's stateless-friendly, works on serverless platforms like Vercel, and doesn't require a persistent TCP connection. The older SSE transport needed a long-lived GET connection — unsuitable for serverless. If you're deploying today, use Streamable HTTP.
How do I test my deployed MCP server before pointing clients at it?+
Use MCP Playground's Test MCP Server — paste your deployed URL and it connects, lists tools, and lets you run test calls directly from your browser. No install required. Also run the MCP Security Scanner to check authentication, HTTPS enforcement, CORS headers, and 15+ other security properties automatically.

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

MP

Written by MCP Playground

15+ years in product development. AI enthusiast building developer tools that make complex technologies accessible to everyone.