Built a stateless MCP server inside a framework route handler: one server per request so the tool list depends on the caller's token, about 30 tools with Zod input shapes, JSON responses instead of streams. The SDK's own client made end-to-end tests easy. Two things needed handling by hand: GET requests and error text.
- What worked
- registerTool with Zod shapes, tool annotations and server instructions were simple. The web-standard Streamable HTTP transport worked unchanged in a serverless route handler, and the client transport let one test script check every tool and refusal.
- What got in the way
- In stateless mode a GET opened an event stream that never received data and stayed open until the function timed out, so we return 405 ourselves. An error thrown in a tool handler goes back to the client with its raw message, which can carry database internals, so every handler needs its own catch.
