I’m exploring the idea of building a server for the Model Context Protocol, and I’ve been researching various hosting strategies. In a recent discussion, the debate between long-lived and short-lived connections was highlighted, which has significant implications for server architecture.
Given that Vercel offers fluid serverless compute, I’m curious about whether it can effectively support a Model Context Protocol server. Specifically, I’m wondering:
Connection Handling: Can Vercel’s serverless platform manage the specific connection patterns (long-lived vs. short-lived) required by the protocol?
Performance & Scalability: Are there any performance or scalability concerns when running such a server on Vercel compared to using a traditional server environment?
Best Practices: Have others experimented with similar setups, and what insights can you share regarding potential pitfalls or optimizations?
Any insights, experiences, or recommendations would be greatly appreciated. Thanks in advance for your help!
Hi @alexbjorlig, I tried building a simple MCP server. It was my first time and had much fun learnings. It worked fine locally but didn’t work as expected once hosted on Vercel.
Hi @jacobparis, yes. It is a good starting point. I made something similar for BMI calculation. But this still uses SSE. I’m waiting for the docs update about serverless hosting so it works just with POST HTTP requests without keeping the connections open.
I see. I think the package provides abstraction for creating a serverless function route handler for your MCP server so you should be able to use it in any serverless function (TS/JS) hosted on Vercel.
I can try making an example app when I get a chance.
Edit: Currently this package has out of the box support for Next.js. Other frameworks to follow.