From stdio to the Web: Streamable HTTP and Mounting MCP in FastAPI
Move your MCP server from stdio to the web: how Streamable HTTP sessions and SSE streams work, flipping the transport in FastMCP, and mounting the server inside a FastAPI app.
Ad blocker or privacy protection detected
Ads and Google Analytics may be blocked. You can allow this site in your browser or extension settings, then reload; the site still works if you continue.
Writing
Long-form writing on development, tooling, and lessons from the workbench plus book reviews when a title sticks.
Topics
Jump to a category or open all categories.
Newest first. Use search or categories above to narrow down.
Move your MCP server from stdio to the web: how Streamable HTTP sessions and SSE streams work, flipping the transport in FastMCP, and mounting the server inside a FastAPI app.
Stop building everything as a tool. Add resources, resource templates, and prompts to your Python MCP server, with URI design guidance and a decision framework for choosing primitives.
The craft that decides whether agents succeed with your server: choosable descriptions, constrained schemas, the isError contract, structured output, and honest tool annotations.
What MCP actually is before you write any code: hosts, clients, and servers, JSON-RPC on the wire, the initialize handshake, and the three primitives, with an interactive protocol walkthrough.
Harden a FastAPI app for production: typed settings with pydantic-settings, bearer auth, logging and CORS middleware, and a scalable project structure.
Build real FastAPI endpoints: typed routing, Pydantic request and response models, dependency injection, and automatic docs.
Understand asyncio and the event loop, then fan out API and LLM calls concurrently with httpx, gather, and a semaphore to bound load.
Use Pydantic v2 to validate data at the boundary: models, field constraints, custom validators, and clean serialization, the backbone of FastAPI and reliable LLM output.