Skip to content
Dashboard

Building efficient MCP servers

Chief of Software, Vercel

Link to headingWhat's changed in MCP

Link to headingA new MCP server transport: Streamable HTTP

app/[transport]/route.ts
import { createMcpHandler } from '@vercel/mcp-adapter';
const handler = createMcpHandler(server => {
server.tool(
'roll_dice',
'Rolls an N-sided die',
{ sides: z.number().int().min(2) },
async ({ sides }) => {
const value = 1 + Math.floor(Math.random() * sides);
return { content: [{ type: 'text', text: `🎲 You rolled a ${value}!` }] };
}
);
});
export { handler as GET, handler as POST, handler as DELETE };

An example MCP server with a single tool call.

Link to headingOptimizing MCP servers for efficiency

Migrating to Streamable HTTP reduced CPU consumption by over 50%Migrating to Streamable HTTP reduced CPU consumption by over 50%
Migrating to Streamable HTTP reduced CPU consumption by over 50%

Link to headingBuilding for the future

MCP Server with Next.js

Get started building your first MCP server on Vercel.

Deploy now

Ready to deploy?