@haram

MCP v2.0 Release — Building Serverless Agent Tools with Hono and Cloudflare
There is a technology that is a must-mention when building AI agents these days: the Model Context Protocol (MCP), which seamlessly connects AI with various external tools.
This MCP has been completely revamped with the recent v2.0 specification. The core change is moving to a stateless structure that exchanges requests and responses lightly, boldly eliminating the complex connection maintenance steps.
Thanks to this, there is no longer a need to manage heavy servers that maintain persistent connections like WebSockets. You can now deploy your own agent tools to Cloudflare Workers, the lightest and fastest serverless environment, in just 5 minutes. Let's look at the charm of the clearer new MCP and how to deploy it most cleanly to an edge server.
Connection sessions are gone! Why MCP v2.0 is lightweight
Existing MCP servers required complex initial handshakes like a greeting when a client connected, and had to maintain connection states by creating session IDs. This meant either paying for an always-on server or using complex workarounds to force it into a serverless environment.
However, with the recently announced MCP v2.0 spec, this cumbersome connection process has been completely removed. It has changed to a stateless model where every request autonomously carries the client metadata and version.
Thanks to this, there is no need to hold onto connections anymore. It is a perfect match for serverless environments like Cloudflare Workers, which wake up only to respond when a request comes in. The stage is set to deploy your own light and fast AI agent tools without the burden of monthly server maintenance costs.
Ultra-simple edge server code completed with the Hono adapter
The news that developers welcomed most in this MCP v2.0 update is that the official packages have been split into lightweight modules by role. Among them, the @modelcontextprotocol/hono adapter provides tremendous convenience when building lightweight edge servers. It is because you can complete a secure server with just a few lines of code on top of Hono, an ultra-lightweight framework based on web standards.
Instead of an all-in-one package, you only install the core modules you need, so the speed at which the server starts up and responds to requests is overwhelmingly fast. You can also handle the validation of input values for your tools cleanly and safely using Zod, making it safe for beginners to develop.
Let's take a look at how simple the actual code is with a minimal skeleton that can be deployed directly to Cloudflare Workers.
import { McpServer } from "@modelcontextprotocol/server";
import { createMcpHonoApp } from "@modelcontextprotocol/hono";
import { z } from "zod";
// 1. MCP 서버 인스턴스 생성
const server = new McpServer({
name: "shipping-agent-server",
version: "1.0.0",
});
// 2. 에이전트가 사용할 도구 등록
server.tool(
"calculate-shipping",
"배송비를 계산합니다.",
{ weight: z.number().describe("무게 (kg)") },
async ({ weight }) => {
const fee = weight * 5000;
return {
content: [{ type: "text", text: `예상 배송비는 ${fee}원입니다.` }]
};
}
);
// 3. Hono 앱 생성 및 연동
const app = createMcpHonoApp(server);
export default app;Like this, you just need to pass our created server instance to createMcpHonoApp and Hono handles the integration automatically. Internally, it is equipped by default with data parsing as well as filtering functions that automatically block security threats targeting localhost. Thanks to this, developers can focus entirely on developing the business logic for the tools the agent will actually perform.
Squeezing out 100% edge performance: preloadSchemas optimization
In edge environments like Cloudflare Workers, where costs are calculated based on CPU processing time per request, even tiny latency affects performance and costs. This MCP SDK v2 uses a lazy evaluation method that builds schemas for internal communication in real-time when the first request arrives. This is not an issue in standard server environments, but in serverless environments where instances turn on and off rapidly, it can cause unnecessary computation bottlenecks on the first request.
A perfect solution to compensate for this is the preloadSchemas function. If you call this function synchronously at the top of your code, it finishes schema generation during the server's startup preparation time. Thanks to this, you can cleanly bypass the cold start latency and bottlenecks that occur when the first agent request comes in.
import { preloadSchemas } from "@modelcontextprotocol/server";
// 코드 최상단 모듈 범위에서 동기식으로 호출해 줍니다.
preloadSchemas();In particular, this SDK v2 is built to handle this automatically when it detects a Cloudflare Workers build environment. You only need to specify the code above if you are manually tuning build settings or porting to a different edge platform. Deployment is also done with a single command thanks to the Wrangler tool.
# 완성된 코드를 전 세계 엣지에 배포합니다
npx wrangler deployBuilding agent tools without infrastructure worries
The meeting of the stateless MCP v2.0 and Cloudflare Workers is a very welcome change for individual developers and creators. You can launch your own lightweight agent tools without the cost burden, without complex server VMs or Docker configurations. If you have been burdened by the cost or infrastructure management of always-on servers, why not try deploying your own small, useful tool this weekend using the Hono adapter?