{"slug": "tutorial", "title": "Tutorial", "summary": "The Model Context Protocol (MCP) spec's 2026-07-28 update removed the initialize handshake and session ID header, making MCP servers stateless and deployable on serverless platforms like Cloudflare Workers. The update introduces Multi Round-Trip Requests (MRTR) for interactive tools without stateful connections, header-based routing, cacheable tool lists, and an extensions framework, while deprecating Roots, Sampling, and Logging. The author ported a personal MCP server to the new TypeScript SDK v2 and deployed it on Cloudflare Workers' free tier with zero configuration changes.", "body_md": "# Tutorial\n\n[MCP](/en/tags/mcp/)spec just removed every long-standing architectural constraint that made stateless deployment painful. The handshake is gone. Sessions are gone. Three features are deprecated. And what's left is the cleanest prompt engineering workflow I've seen for building LLM agent tooling at scale.\n\nI spent the last few days porting a personal MCP server to the new TypeScript SDK v2 and shipping it on Cloudflare Workers. Here's the breakdown of what changed, how the build actually works, and the deployment path I used.\n\n## Why This Spec Change Matters for Deployment\n\nBefore the 2026-07-28 update, MCP servers required a sticky `initialize`\n\n/ `initialized`\n\nexchange and a session ID header. That killed round-robin load balancing, made autoscaling a nightmare, and prevented any kind of caching layer from sitting in front of your server. Every request had to hit the same instance.\n\nNow? Every request is self-describing. It carries its own protocol version, client identity, and capabilities inside `_meta`\n\n. A bare POST to any server instance is a complete conversation. No shared session state. No stream to hold open.\n\nThis is the stateless core that makes the whole deployment story simple: your MCP server is just a regular HTTP service now.\n\n## The Feature That Changed My Mind: MRTR\n\nMulti Round-Trip Requests (MRTR) solve a problem I ran into constantly with the old spec. When a tool needed user confirmation or a missing parameter mid-call, the server had to push an `elicitation/create`\n\nrequest over a held-open stream. That meant stateful connections, which is the opposite of what you want on production infrastructure.\n\nWith MRTR, the server returns `resultType: \"input_required\"`\n\nwith the questions it needs, then closes the connection cleanly. The client collects answers and retries the original call with them attached, plus an opaque `requestState`\n\ntoken so the server knows exactly where it left off. No open streams, no sessions, no sticky routing. Interactive tools on fully stateless infra — that's a real win for prompt engineering workflows.\n\nThere's a graceful fallback path too: if a client doesn't speak MRTR yet, the server can detect that and fall back to the old elicitation behavior. Given how many clients are still on pre-spec versions, this compatibility layer is essential and the SDK v2 handles it out of the box.\n\n## Other Notable Additions\n\n**Header-based routing**—`Mcp-Method`\n\nand`Mcp-Name`\n\nHTTP headers let your gateway, rate limiter, or WAF route and meter requests without parsing JSON bodies. Huge for production monitoring.**Cacheable tool lists**—`tools/list`\n\n,`prompts/list`\n\n,`resources/list`\n\n, and`resources/read`\n\nnow carry`ttlMs`\n\nand`cacheScope`\n\nfields, modeled on HTTP Cache-Control. Clients cache your catalog instead of re-fetching on every connection.**Extensions framework**— Tasks moved into an official extension (`io.modelcontextprotocol/tasks`\n\n), and you can build your own. MCP Apps and Enterprise Managed Authorization live there too.**Deprecations**— Roots, Sampling, and Logging are deprecated but keep working for at least 12 months. Plan your migration accordingly.\n\n## The Build and Deploy Pipeline\n\nI used the new TypeScript SDK v2 (the old `@modelcontextprotocol/sdk`\n\npackage is now v1) to scaffold the server in minutes. The stateless design meant I could test locally with raw curl and a lightweight client, then deploy to Cloudflare Workers on the free tier with zero configuration changes. The same code ran locally and in production without any environment-specific hacks — that's the kind of consistency that makes prompt engineering iteration fast.\n\nThe entire deployment took less time than my previous attempts with session-based architectures, and the cost was literally zero on Cloudflare's free plan. For anyone building LLM agent tooling who's been held back by MCP's old stateful constraints, this spec update removes the blocker entirely.\n\n[Next popover hell →](/en/threads/5012/)\n\n[these AI tool field notes](https://tanyan888.com/), with plenty of directly applicable cases.\n\n## All Replies （0）\n\nNo replies yet — be the first!", "url": "https://wpnews.pro/news/tutorial", "canonical_source": "https://promptcube3.com/en/threads/5134/", "published_at": "2026-08-05 16:01:02+00:00", "updated_at": "2026-08-05 16:04:23.541796+00:00", "lang": "en", "topics": ["developer-tools", "ai-agents", "ai-infrastructure"], "entities": ["Model Context Protocol", "Cloudflare Workers", "TypeScript SDK v2"], "alternates": {"html": "https://wpnews.pro/news/tutorial", "markdown": "https://wpnews.pro/news/tutorial.md", "text": "https://wpnews.pro/news/tutorial.txt", "jsonld": "https://wpnews.pro/news/tutorial.jsonld"}}