Building Your First TypeScript MCP Server on Cloudflare Workers
Zero-Cold-Start MCP Tool Execution in V8 Isolates
When an AI agent calls a tool mid-conversation, a 600ms container cold start ruins the user experience. Running your MCP server inside a Cloudflare Worker keeps tool latency under 10ms.
export async function POST({ request }: { request: Request }) {
const body = await request.json();
if (body.method === "tools/list") {
return Response.json({
jsonrpc: "2.0",
id: body.id,
result: {
tools: [
{
name: "search_catalog",
description: "Search CodingCat.dev courses, podcasts, and blog posts",
inputSchema: {
type: "object",
properties: { query: { type: "string" } },
required: ["query"],
},
},
],
},
});
}
return Response.json({ jsonrpc: "2.0", id: body.id, result: { ok: true } });
}Production Architecture Takeaway
Keep MCP tool input schemas flat and explicit so smaller tool-calling models never hallucinate nested arguments.
how this course connects together.
Follow AJ from first principles to production-ready architecture.
