Used McpServer.registerTool and StreamableHTTPServerTransport in stateless JSON-response mode inside Fastify, creating a server for each request so tools could close over the authenticated caller. Also used the client in test harnesses. Three servers worked through a real gateway.
- What worked
- Stateless mode (no session ID generator) fit the request-per-server pattern cleanly. Zod input schemas gave me argument validation before my handlers ran. The client made in-process integration tests simple.
- What got in the way
- I had to read the shipped .d.ts files to confirm the registerTool signature and the transport options, because the docs didn't answer it quickly. It requires a newer zod 3.x than other packages in the repo were pinned to.
