Deploying MCP Servers: Platform Selection Guide
Deploying MCP servers in production requires choosing the right approach for your use case. This guide covers the four main deployment patterns and helps you select between Cloudflare Workers, Vercel Functions, and MCP gateways based on your specific requirements.
Deployment Approaches
1. Next.js Integration (Vercel)
Add MCP endpoints directly to your existing Next.js application using the mcp-handler
package. This approach leverages your existing infrastructure:
- TypeScript types and validation
- Authentication middleware
- CI/CD pipeline
- Monitoring and alerting
Best for: Teams with existing Next.js apps who want to expose application functionality as MCP tools.
2. Standalone Functions
Deploy MCP servers as independent serverless functions on either platform:
Vercel Functions:
- Excellent Next.js ecosystem integration
- Superior developer experience and preview deployments
- Extended timeout capabilities (up to 800s on Pro/Enterprise)
Cloudflare Workers:
- Global edge distribution
- Indefinite connection duration (CPU-time based billing)
- Built-in DDoS protection and performance optimization
Best for: New MCP servers or when you need clean separation from your main application.
3. MCP Gateways (Enterprise)
Use a centralized gateway like MintMCP that manages multiple MCP servers:
- Virtual server organization by team or role
- Unified authentication and access control
- Managed execution environment (no platform deployment needed)
- Protocol translation for Custom GPTs and legacy systems
Best for: Organizations with multiple MCP servers across teams requiring centralized security and management.
4. Hybrid Deployments
Combine approaches based on workload characteristics:
- Next.js app on Vercel for main functionality
- Cloudflare Workers for streaming-heavy tools
- Gateway for internal team coordination
Best for: Large organizations with diverse MCP server requirements.
Platform Comparison
Cost Analysis
The cost difference between these platforms comes down to three factors: how long your connections stay open, how much CPU you actually use, and how much data you send back.
Long-lived connections
For SSE streams or WebSocket-like patterns, Cloudflare costs significantly less. Vercel charges for memory allocation throughout the entire connection lifetime, even when your function is idle. Cloudflare only charges for actual CPU time consumed.
If you need to use Vercel, minimize memory allocation and maximize connections per instance. For streaming workloads, Cloudflare is more cost-effective.
CPU-intensive workloads
Both platforms cost about the same for compute-heavy work like JSON parsing, data transformations, or complex API processing. Cloudflare bills CPU-milliseconds, Vercel bills active CPU time plus memory allocation.
Cloudflare defaults to a 30-second CPU limit that you can raise for longer operations. Vercel's Fluid compute handles traffic bursts better out of the box.
Platform choice depends on your operational preferences rather than cost differences.
Data transfer
Cloudflare doesn't charge egress fees for Worker responses. Vercel charges $0.15/GB after plan allowances. For MCP tools returning large datasets like database dumps or generated reports, this creates meaningful cost differences.
Most API responses are small enough that egress costs don't matter. Data-heavy applications should factor in transfer costs.
Technical Limits
Vercel Functions (Fluid Compute):
- Duration: Default 300s; up to 800s on Pro/Enterprise
- Wall-clock time limits - timer runs even during idle connections
- Set maxDuration per route only as needed to control costs
Cloudflare Workers:
- CPU time limits, not wall-clock time - connections can stay open indefinitely
- 30s CPU by default; up to 5 minutes configurable
- 128 MB memory per isolate
Making the Right Choice
Most teams start with the path of least resistance. If you already have a Next.js app on Vercel, adding MCP endpoints there makes sense for your first tools. You can always extract specific servers later if needed.
Organizations with multiple teams often hit complexity quickly. Managing separate deployments across different platforms, coordinating security policies, and organizing tools by team becomes operational overhead. This is where MCP gateways provide the most value - they handle the coordination so individual teams can focus on building tools.
For workload-specific decisions, connection patterns matter most. Streaming tools with many idle connections work better on Cloudflare due to its CPU-based billing model. CPU-heavy operations work well on either platform. Large data responses favor Cloudflare's zero egress pricing.
Security Essentials
Core Requirements
- OAuth 2.1 with PKCE for HTTP-based MCP auth
- Environment secrets for credentials (never in code)
- HTTPS enforcement and rate limiting
- User-scoped access control for external servers
Platform Security
Both platforms provide enterprise-grade security features including WAF protection, secrets management, and environment isolation. Choose based on your existing security infrastructure and team expertise.
For organizations with multiple MCP servers across teams, gateways provide:
- Virtual server organization by role (Development, Sales, Support)
- Centralized security and audit trails
- Managed execution environment (no platform deployment needed)
- Protocol translation for Custom GPTs and legacy systems
Gateways can either route to existing platform deployments or host MCP servers directly, eliminating deployment complexity entirely.
For a comprehensive overview, see Understanding MCP Gateways for AI Infrastructure.
Conclusion
Choose your deployment approach based on organizational complexity and technical requirements:
- Next.js Integration: Simple addition to existing applications
- Standalone Functions: Clean separation with platform-specific benefits
- MCP Gateways: Enterprise coordination with centralized management
- Hybrid Approaches: Mix platforms based on workload characteristics
Start with the simplest approach that meets your needs. All deployment methods support migration as requirements evolve.