MCP Deployment: The Real Cost of Hosting
Most tutorials show you how to build an MCP server locally. They teach you endpoints and authentication. They do not teach you how to keep your server running 24/7.
I spent three months building an MCP server for my personal knowledge base. I learned the hard way that deployment is where the real pain starts.
If you want your AI assistants to work from mobile, web, or cloud clients, you cannot rely on localhost. You must deploy to a public host.
Here is my breakdown of hosting options based on real production testing:
Heroku Pros: Easy deployment and automatic HTTPS. Cons: Free tier sleeps after 30 minutes. This causes 10 to 30 second delays. MCP clients often timeout and fail during this period. Verdict: 3/10. Good for testing, bad for daily use.
Fly.io Pros: Fast deployment and global network. Supports persistent volumes for your files. Cons: Free tier apps stop after one week of inactivity. You need a cron job to keep them awake. Verdict: 6/10. A solid choice for most users.
Serverless (e.g., Tencent Cloud SCF) Pros: Extremely cheap for low traffic. Very low latency if you are in specific regions like China. Cons: Cold starts take a few seconds. You must design for a stateless architecture. Verdict: 7.5/10. Perfect for personal side projects with low usage.
VPS (Virtual Private Server) Pros: Total control and no sleeping servers. Predictable monthly costs. Cons: You must manage security, updates, and SSL yourself. Verdict: Best for multiple users or high traffic.
Three lessons to save you hours of debugging:
Set timeouts: MCP clients are impatient. If your search takes longer than 10 seconds, the client hangs up. Set a strict connection timeout in your server config.
Add a health check: Cloud providers need a way to know your app is alive. Create a simple /health endpoint.
Fix CORS: Authentication often breaks CORS preflight requests. Ensure your configuration allows OPTIONS requests without authentication.
My workflow:
- Build locally.
- Use ngrok to test with remote clients.
- Deploy to Fly.io or a VPS once stable.
Deployment is not glamorous, but it is necessary. A perfect server is useless if your AI client cannot connect to it.
What are you using to host your MCP servers? Let me know in the comments.
Optional learning community: https://t.me/GyaanSetuAi
