Cloudflare updates Agents SDK: Streamable HTTP and Python MCP servers

Cloudflare is extending its support for the Model Context Protocol (MCP) with two updates to its developer platform. The Agents SDK now supports the Streamable HTTP transport spec, and developers can deploy MCP servers written entirely in Python on Workers. Both capabilities are available now, with one-click deployment options for a remote MCP server and a Python MCP server.

Deploy to Cloudflare

One endpoint for MCP traffic

The March 26 update to the MCP specification introduced Streamable HTTP, a new transport mechanism for remote MCP communication. Instead of requiring clients to manage separate endpoints — one for establishing a persistent Server-Sent Events (SSE) connection and another for sending requests — all traffic now flows through a single HTTP endpoint. This simplifies the client-server interaction model and eliminates the need for long-lived connections that can be dropped during long-running operations.

The Cloudflare Agents SDK has been updated so a single MCP server can serve both the existing SSE transport and the new Streamable HTTP transport. This means existing clients continue to work without changes, while newer clients can take advantage of the streamlined protocol.

To enable both transports, the key configuration changes are:

  • Use MyMcpAgent.serveSSE('/sse') for SSE, replacing the previous MyMcpAgent.mount('/sse') (which remains as an alias).
  • Use MyMcpAgent.serve('/mcp') for the new Streamable HTTP transport.

export default {
  fetch(request: Request, env: Env, ctx: ExecutionContext) {
    const { pathname }  = new URL(request.url);
    if (pathname.startsWith('/sse')) {
      return MyMcpAgent.serveSSE('/sse').fetch(request, env, ctx);
    }
    if (pathname.startsWith('/mcp')) {
      return MyMcpAgent.serve('/mcp').fetch(request, env, ctx);
    }
  },
};

const app = new Hono()
app.mount('/sse', MyMCP.serveSSE('/sse').fetch, { replaceRequest: false })
app.mount('/mcp', MyMCP.serve('/mcp').fetch, { replaceRequest: false )
export default app

For MCP servers that use the Workers OAuth Provider Library for authentication and authorization:

export default new OAuthProvider({
 apiHandlers: {
   '/sse': MyMCP.serveSSE('/sse'),
   '/mcp': MyMCP.serve('/mcp'),
 },
 // ...
})

The new transport comes with notable improvements over its predecessor:

  • Single endpoint: All MCP interactions—requests and responses—flow through one path, reducing operational complexity.
  • Bi-directional communication: Servers can send requests and notifications back to the client over the same connection, enabling real-time updates and interactive flows.
  • Automatic upgrades: Connections start as standard HTTP requests and can dynamically upgrade to SSE when a server needs to stream responses during long-running tasks.

For example, a tool call from an agent can be made with a single POST request to /mcp. The server either responds immediately or upgrades the connection to stream results over SSE—all within the same request lifecycle.

Clients that don't yet support Streamable HTTP natively—including many desktop MCP clients—can still connect to the new transport through mcp-remote, an adapter that bridges local-only MCP clients to remote servers via either SSE or Streamable HTTP.

The current implementation provides feature parity between the two transport methods. Cloudflare says it is actively working on additional specification capabilities, including resumability, cancellability, and session management, which are designed to support more complex agent-to-agent interactions.

Python Workers for MCP

With first-class Python support already available in Workers, developers can now build and deploy remote MCP servers using the Python MCP SDK. This library lets you define tools and resources with regular Python functions:

class FastMCPServer(DurableObject):
    def __init__(self, ctx, env):
        self.ctx = ctx
        self.env = env
        from mcp.server.fastmcp import FastMCP
        self.mcp = FastMCP("Demo")

        @mcp.tool()
        def calculate_bmi(weight_kg: float, height_m: float) -> float:
            """Calculate BMI given weight in kg and height in meters"""
            return weight_kg / (height_m**2)

        @mcp.resource("greeting://{name}")
        def get_greeting(name: str) -> str:
            """Get a personalized greeting"""
            return f"Hello, {name}!"

        self.app = mcp.sse_app()

    async def call(self, request):
        import asgi
        return await asgi.fetch(self.app, request, self.env, self.ctx)

async def on_fetch(request, env):
    id = env.ns.idFromName("example")
    obj = env.ns.get(id)
    return await obj.call(request)

For teams already using FastAPI, the FastAPI-MCP package can expose existing API endpoints as MCP tools without writing protocol boilerplate. Recent Worker updates also add Durable Objects and Cron Triggers to Python Workers, making it easier to run stateful logic and scheduled tasks inside an MCP server.

Deploy to Cloudflare

BLOG-2811 4