FastMCP 2.3 was just released, including the most-requested feature by a mile: Streamable HTTP for both FastMCP servers and clients.
Give us a star on GitHub or dive into the updated docs at gofastmcp.com.
Until now, if you wanted to run your FastMCP server over the web, Server-Sent Events (SSE) was the primary option. While SSE works, it has drawbacks including the need for long-lived, stateful connections and a complex interchange across multiple routes. In addition, not all hosting infrastructure is compatible with SSE. Streamable HTTP is a more modern, efficient approach that way to handle the back-and-forth of an MCP session, all neatly wrapped in familiar HTTP.
In fact, Streamable HTTP is so important for the MCP ecosystem that it’s now the default http transport for FastMCP.
To get started, just tell mcp.run()
to use the new "streamable-http"
transport in your server script. You can optionally customize the host
, port
, or mount path
, as needed:
from fastmcp import FastMCP
mcp = FastMCP(name="MyStreamingServer")
@mcp.tool()def echo(message: str) -> str: return f"Server echoes: {message}"
if __name__ == "__main__": mcp.run( transport="streamable-http", host="127.0.0.1", # Optional: defaults to 127.0.0.1 port=8000, # Optional: defaults to 8000 path="/mcp" # Optional: defaults to /mcp )
Run this file with python my_server.py
, and your server will start listening for Streamable HTTP connections at http://127.0.0.1:8000/mcp
.
You can see more about configuring the server in the deployment docs.
Connecting your FastMCP client is even simpler. If your server is running on Streamable HTTP, just provide the URL to the client and FastMCP will automatically attempt to connect with the appropriate transport:
import asynciofrom fastmcp import Client
async def main(): # FastMCP 2.3 will automatically infer Streamable HTTP for this URL client = Client("http://127.0.0.1:8000/mcp")
async with client: await client.ping() print("Ping successful!")
result = await client.call_tool("echo", {"message": "Hello Stream!"}) print(result[0].text)
if __name__ == "__main__": asyncio.run(main())
More details can be found in the client transports documentation.
The Model Context Protocol (MCP) is all about standardizing how AI models interact with tools and data, and with Streamable HTTP, FastMCP makes it even easier to build and deploy those crucial interaction points on the web. I’m excited to see what you build with these new capabilities. As always, your feedback, issues, and contributions are welcome!
Give FastMCP 2.3 a try:
- Upgrade:
uv add fastmcp
orpip install fastmcp --upgrade
- Explore the documentation on deploying Streamable HTTP
- Check out the code and examples on GitHub
Happy Streaming! 🌊