
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
    <channel>
        <title><![CDATA[ The Cloudflare Blog ]]></title>
        <description><![CDATA[ Get the latest news on how products at Cloudflare are built, technologies used, and join the teams helping to build a better Internet. ]]></description>
        <link>https://blog.cloudflare.com</link>
        <atom:link href="https://blog.cloudflare.com/" rel="self" type="application/rss+xml"/>
        <language>en-us</language>
        <image>
            <url>https://blog.cloudflare.com/favicon.png</url>
            <title>The Cloudflare Blog</title>
            <link>https://blog.cloudflare.com</link>
        </image>
        <lastBuildDate>Thu, 21 May 2026 22:35:19 GMT</lastBuildDate>
        <item>
            <title><![CDATA[Introducing Dynamic Workflows: durable execution that follows the tenant]]></title>
            <link>https://blog.cloudflare.com/dynamic-workflows/</link>
            <pubDate>Fri, 01 May 2026 13:00:00 GMT</pubDate>
            <description><![CDATA[ Dynamic Workflows is a library that lets you route durable execution to tenant-provided code on the fly. Built on Dynamic Workers, it enables platforms to serve millions of unique workflows at near-zero idle cost. ]]></description>
            <content:encoded><![CDATA[ <p>When we first launched Workers eight years ago, it was a direct-to-developers platform. Over the years, we have expanded and scaled the ecosystem so that platforms could not only build on Workers directly, but they could also enable <i>their</i> customers to ship code to <i>us </i>through many multi-tenant applications. We now see on Workers: Applications where users describe what they want, and the AI writes the implementation. Multi-tenant SaaS where every customer's business logic is, at runtime, some TypeScript the platform has never seen before. Agents that write and run their own tools. CI/CD products where every repo defines its own pipeline.</p><p>Last month, when we shipped the <a href="https://blog.cloudflare.com/dynamic-workers/"><u>Dynamic Workers open beta</u></a>, we gave those platforms a clean primitive for the <i>compute</i> side: hand the Workers runtime some code at runtime, get back an isolated, sandboxed Worker, on the same machine, in single-digit milliseconds. <a href="https://blog.cloudflare.com/durable-object-facets-dynamic-workers/"><u>Durable Object Facets</u></a> extended the same idea to <i>storage</i> — each dynamically-loaded app can have its own SQLite database, spun up on demand, with the platform sitting in front, as a supervisor. <a href="https://blog.cloudflare.com/artifacts-git-for-agents-beta/"><u>Artifacts</u></a> did the same for <i>source control</i>: a Git-native, versioned filesystem you can create by the tens of millions, one per agent, one per session, one per tenant. So, we have dynamic deployment for storage and source control. What’s next?</p><p>Today, we are bridging durable execution and dynamic deployment with <a href="https://github.com/cloudflare/dynamic-workflows"><b><u>Dynamic Workflows</u></b></a>.</p>
    <div>
      <h2>The gap between durable and dynamic execution</h2>
      <a href="#the-gap-between-durable-and-dynamic-execution">
        
      </a>
    </div>
    <p><a href="https://developers.cloudflare.com/workflows/"><u>Cloudflare Workflows</u></a> is our durable execution engine. It turns a <code>run(event, step)</code> function into a program where every step survives failures, can sleep for hours or days, can wait for external events, and resumes exactly where it left off when the isolate is recycled. It's the right primitive for anything that has to "keep going" past a single request: onboarding flows, video transcoding pipelines, multi-stage billing, long-running agent loops, and — as of <a href="https://blog.cloudflare.com/workflows-v2/"><u>Workflows V2</u></a> — up to 50,000 concurrent instances and 300 new instances per second per account, redesigned for the agentic era.</p><p>But Workflows has always had one assumption baked in: the workflow code is part of your deployment. Your <code>wrangler.jsonc</code> has a block that says <i>"when the engine calls into </i><code><i>WORKFLOWS</i></code><i>, run the class called </i><code><i>MyWorkflow</i></code><i>."</i> One binding, one class. Per deploy.</p><p>That works fine if you own all the code. It's fine if you're running a traditional application.</p><p>It stops working the moment you want to let your customer ship <i>their</i> workflow.</p><p>Say you're building an app platform where the AI writes TypeScript for every tenant. Say you're running a CI/CD product where each repository has its own pipeline. Say you're using an agents SDK where each agent writes its own durable plan. In every one of these cases, the workflow is different for every tenant, every agent, every request. There is no single class to bind.</p><p>This is the same shape of problem that Dynamic Workers solved for compute and that Durable Object Facets solved for storage. We just hadn't solved it for durable execution yet.</p>
    <div>
      <h2>Dynamic Workflows</h2>
      <a href="#dynamic-workflows">
        
      </a>
    </div>
    <p><code>@cloudflare/dynamic-workflows</code> is a small library. Roughly 300 lines of TypeScript. It lets a single Worker — the <b>Worker Loader</b> — route every <code>create()</code> call to a different tenant's code, and, critically, have the Workflows engine dispatch <code>run(event, step)</code> back to that same code when the workflow actually executes, seconds or hours or days later.</p><p>Here's the whole pattern. A Worker Loader:</p>
            <pre><code>import {
  createDynamicWorkflowEntrypoint,
  DynamicWorkflowBinding,
  wrapWorkflowBinding,
} from '@cloudflare/dynamic-workflows';

// The library looks this class up on cloudflare:workers exports.
export { DynamicWorkflowBinding };

function loadTenant(env, tenantId) {
  return env.LOADER.get(tenantId, async () =&gt; ({
    compatibilityDate: '2026-01-01',
    mainModule: 'index.js',
    modules: { 'index.js': await fetchTenantCode(tenantId) },
    // The tenant sees this as a normal Workflow binding.
    env: { WORKFLOWS: wrapWorkflowBinding({ tenantId }) },
  }));
}

// Register this as class_name in wrangler.jsonc.
export const DynamicWorkflow = createDynamicWorkflowEntrypoint&lt;Env&gt;(
  async ({ env, metadata }) =&gt; {
    const stub = loadTenant(env, metadata.tenantId);
    return stub.getEntrypoint('TenantWorkflow');
  }
);

export default {
  fetch(request, env) {
    const tenantId = request.headers.get('x-tenant-id');
    return loadTenant(env, tenantId).getEntrypoint().fetch(request);
  },
};</code></pre>
            <p>Add to your <code>wrangler.jsonc</code>:</p>
            <pre><code>"workflows": [
		{
			"name": "dynamic-workflow",
			"binding": "WORKFLOW",
			"class_name": "DynamicWorkflow"
		}
	]</code></pre>
            <p>The tenant writes plain, idiomatic Workflows code. They have no idea they're being dispatched:</p>
            <pre><code>import { WorkflowEntrypoint } from 'cloudflare:workers';

export class TenantWorkflow extends WorkflowEntrypoint {
  async run(event, step) {
    return step.do('greet', async () =&gt; `Hello, ${event.payload.name}!`);
  }
}

export default {
  async fetch(request, env) {
    const instance = await env.WORKFLOWS.create({ params: await request.json() });
    return Response.json({ id: await instance.id });
  },
};</code></pre>
            <p>That's it. The tenant calls <code>env.WORKFLOWS.create(...)</code> against what looks like a perfectly normal Workflow binding. Workflow IDs, <code>.status()</code>, <code>.pause()</code>, retries, hibernation, durable steps, <code>step.sleep('24 hours')</code>, <code>step.waitForEvent()</code> — everything works the way it always has.</p><p>The library handles one thing: making sure that when the Workflows engine eventually wakes up and calls <code>run(event, step)</code>, it ends up inside the <i>right tenant's</i> code.</p>
    <div>
      <h2>How it works</h2>
      <a href="#how-it-works">
        
      </a>
    </div>
    <p>Three layers: the Workflows engine (platform) on top, your Worker Loader in the middle, your tenant's code (a Dynamic Worker) on the bottom. </p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3D8fGfZalW4N4h7QngR8tN/59ef281c194cfcba12ea6cfb6ec240d7/image2.png" />
          </figure><p>When a request reaches the Worker Loader, it routes the execution to the correct dynamic code on the fly. The rest of the execution is a handoff between these three layers, left-to-right in time: the request enters, bounces up to the engine, is persisted, and later bounces back down again.</p><p>Walking the flow:</p><p><b>① → ② Entering the tenant's code.</b> The Worker Loader receives an HTTP request, figures out which tenant it's for, loads that tenant's code via the Worker Loader, and forwards the request to its <code>default.fetch</code>. The <code>env</code> it hands the tenant contains <code>WORKFLOWS: wrapWorkflowBinding({ tenantId })</code>. As far as the tenant is concerned, that looks and acts like a real Workflow binding.</p><p><b>③ Up to the Worker Loader.</b> When the tenant calls <code>env.WORKFLOWS.create({ params })</code>, it's actually making a Remote Procedure Call (RPC) into the Worker Loader — the wrapped binding is a <code>WorkerEntrypoint</code> subclass (<code>DynamicWorkflowBinding</code>) that the runtime specialized with the tenant's metadata at load time. That's why you have to <code>export { DynamicWorkflowBinding }</code> from your Worker Loader: the runtime builds per-tenant stubs by looking the class up in <code>cloudflare:workers</code> exports. Bindings that cross the Dynamic Worker boundary <i>have</i> to be RPC stubs — a plain <code>{ create, get }</code> object can't be structured-cloned, and the raw <code>Workflow</code> binding isn't serializable either.</p><p>Inside the Worker Loader, the wrapped binding transparently rewrites the payload:</p>
            <pre><code>tenant calls:  create({ params: { name: 'Alice' } })
                            │
                            ▼
engine sees:   create({ params: {
                  __workerLoaderMetadata: { tenantId: 't-42' },
                  params: { name: 'Alice' }
               }})
</code></pre>
            <p><b>④ Up to the engine.</b> The Worker Loader then calls <code>.create()</code> on the <i>real</i> <code>WORKFLOWS</code> binding with the envelope as the params. From here the Workflows engine takes over. It persists <code>event.payload</code> — which now includes the envelope — and schedules the run. Every time the engine later wakes up the workflow (whether that’s after a 24-hour sleep, a crash, or a deploy), the metadata rides along with the payload, waiting to route the run.</p><p>One implication: treat the metadata as a routing hint, not as authorization. The tenant can read it back via <code>instance.status()</code>. Don't put secrets in there.</p><p><b>⑤ → ⑥ The engine comes back down.</b> When the engine is ready to run a step, it calls <code>.run(event, step)</code> on the class you registered in <code>wrangler.jsonc</code> — the one <code>createDynamicWorkflowEntrypoint</code> gave you. That class unwraps the envelope, hands the metadata to the <code>loadRunner</code> callback <i>you</i> wrote, and forwards the unwrapped event through to whatever runner the callback returns.</p><p>The callback is where everything interesting happens, and it's entirely yours. Fetch the tenant's latest source from R2. Check their plan tier and pick a region. Attach a tail Worker for per-tenant logging. Bundle TypeScript on the fly with <a href="https://www.npmjs.com/package/@cloudflare/worker-bundler"><code><u>@cloudflare/worker-bundler</u></code></a>. In the common case, you just hand off to the Worker Loader:</p>
            <pre><code>const stub = env.LOADER.get(tenantId, () =&gt; loadTenantCode(tenantId));
return stub.getEntrypoint('TenantWorkflow');</code></pre>
            <p>
The Worker Loader caches by ID, so a workflow that runs many steps over many hours reuses the same dynamic Worker across them. When the isolate eventually gets evicted, the next <code>step.do()</code> pulls the code again and keeps going — the tenant's workflow has no idea anything happened. A Dynamic Worker boots in single-digit milliseconds using a few megabytes of memory, so the dispatch overhead is essentially free. You can have a million tenants, each with their own distinct workflow code, each spun up lazily on the step boundary where it's needed, and none of them cost anything while idle.</p>
    <div>
      <h3>The escape hatch</h3>
      <a href="#the-escape-hatch">
        
      </a>
    </div>
    <p>If you want to subclass <code>WorkflowEntrypoint</code> yourself — to add logging around <code>run()</code>, wire up per-tenant observability, or thread custom state through — the library exposes the lower-level <code>dispatchWorkflow</code> primitive that <code>createDynamicWorkflowEntrypoint</code> is built on:</p>
            <pre><code>import { dispatchWorkflow } from '@cloudflare/dynamic-workflows';

export class MyDynamicWorkflow extends WorkflowEntrypoint {
  async run(event, step) {
    return dispatchWorkflow(
      { env: this.env, ctx: this.ctx },
      event,
      step,
      ({ metadata, env }) =&gt; loadRunnerForTenant(env, metadata),
    );
  }
}
</code></pre>
            <p>Everything else — IDs, pause/resume, <code>sendEvent</code>, retries — falls through to the real Workflows engine untouched.</p>
    <div>
      <h2>Dynamic Workers are the primitive</h2>
      <a href="#dynamic-workers-are-the-primitive">
        
      </a>
    </div>
    <p>Step back from the specifics for a second. Every interesting line of this library is either a wrapper around <code>.create()</code> on the outbound side or a wrapper around <code>WorkflowEntrypoint</code> on the inbound side. The actual work — spinning up the tenant's code, sandboxing it, routing RPC across the boundary, caching the isolate, hibernating between steps — is all done by Dynamic Workers underneath.</p><p>That's the real story, and it's a lot bigger than Workflows</p><p>Dynamic Workers is the primitive that swallows everything. <a href="https://blog.cloudflare.com/durable-object-facets-dynamic-workers/"><u>Durable Object Facets</u></a> is the same pattern applied to Durable Objects. Dynamic Workflows is that same pattern applied to <code>WorkflowEntrypoint</code>. Each one is the same small amount of envelope-and-unwrap glue between the static binding you've always had and the dynamic version you can now hand to your customers.</p><p>And we're not stopping at Workflows. Every binding that Workers currently exposes is heading for a dynamic counterpart — queues where each producer ships its own handler, caches, databases, object stores, AI bindings, and MCP servers where every tenant brings their own tools. Whatever you bind to a Worker today, you will soon be able to bind dynamically: dispatched per tenant, per agent, per request, at zero idle cost.</p><p>The unit economics of running a platform like this are, frankly, absurd. Shipping a multi-tenant product used to mean giving every customer their own container, their own database, their own disk, their own scheduler, and stitching it together with orchestration glue, service meshes, and hair-pulling billing math. Many of these applications have to support thousands of customers at the very least; millions, at the most. On Dynamic Workers and everything composing on top of them, idle tenants cost approximately nothing and active tenants share the same hardware through isolate-level multi-tenancy. The floor drops several orders of magnitude. A platform that used to cap out at thousands of paying customers can now reasonably serve tens of millions.</p>
    <div>
      <h2>What this unlocks</h2>
      <a href="#what-this-unlocks">
        
      </a>
    </div>
    
    <div>
      <h3>Agent platforms that plan like engineers</h3>
      <a href="#agent-platforms-that-plan-like-engineers">
        
      </a>
    </div>
    <p>Coding agents — <a href="https://opencode.ai"><u>OpenCode</u></a>, <a href="https://code.claude.com/docs/en/overview"><u>Claude Code</u></a>, Codex, Pi — have been proving for the past year that LLMs are far better at <i>writing code</i> than at making sequential tool calls. The <a href="https://developers.cloudflare.com/agents/"><u>Cloudflare Agents SDK</u></a> and <a href="https://blog.cloudflare.com/project-think"><u>Project Think</u></a> extend that insight into durable execution: with primitives like fibers and sub-agents, an agent's long-running plan can survive crashes, hibernation, and redeploys without the user noticing.</p><p>Dynamic Workflows is the piece that lets that plan be a <i>first-class Cloudflare Workflow</i> — something the agent literally writes and the platform literally runs, with the full durability machinery behind it. A <code>run(event, step)</code> function the model wrote a minute ago, where every <code>step.do(...)</code> is independently retryable, every <code>step.sleep('24 hours')</code> hibernates for free, and every <code>step.waitForEvent(...)</code> waits indefinitely for the human to approve the next action. The agent writes the workflow; the platform runs it; neither has to know ahead of time what the plan looks like.</p>
    <div>
      <h3>SDKs and frameworks where the user brings the logic</h3>
      <a href="#sdks-and-frameworks-where-the-user-brings-the-logic">
        
      </a>
    </div>
    <p>If you're shipping a framework where your customer writes the <code>run(event, step)</code> function — a workflow builder UI, a visual automation tool, a per-tenant extension system, a low-code tool for non-developers — Dynamic Workflows is now the primitive that makes it work without compromise. You call <code>wrapWorkflowBinding({ tenantId })</code> once, hand the result to their code as <code>WORKFLOWS</code>, and every workflow instance they create is automatically tagged, routed back, and executed in their sandbox. The framework owns the Worker Loader; the user owns the workflow; neither has to care about the other.</p>
    <div>
      <h3>CI/CD at primitive speed</h3>
      <a href="#ci-cd-at-primitive-speed">
        
      </a>
    </div>
    <p>Here's the use case that's been getting us most excited.</p><p>Every CI/CD platform in existence is, underneath, a dispatcher of per-repo configuration files: <i>"run these steps, in this order, with these secrets, cache these directories, upload these artifacts."</i> Each repo has its own pipeline. Each branch might have its own variant. Each pull request spawns an instance of that pipeline that has to run to completion, survive a machine crash, retry a flaky step, stream logs, pause for approvals, and persist results.</p><p>That's <i>exactly</i> the shape of a durable workflow. The reason CI hasn't been built that way until now is that nobody had a cloud primitive where <b>the workflow itself is different for every repo, dispatched at runtime, at zero provisioning cost.</b> Now you do.</p><p>Here's what a CI pipeline looks like when it's just code your customer ships with their repo — say, in <code>.cloudflare/ci.ts</code>. The workflow itself is real; the <code>runInSandbox() / summarise()</code> / GitHub binding helpers below are platform-provided glue, the kind of thing you'd ship once in your dispatcher:</p>
            <pre><code>import { WorkflowEntrypoint } from 'cloudflare:workers';

export class CIPipeline extends WorkflowEntrypoint {
  async run(event, step) {
    const { repo, sha, branch, pr } = event.payload;

    // Fork an isolated copy of the repo at this commit. Seconds, not minutes.
    const workspace = await step.do('checkout', () =&gt;
      this.env.ARTIFACTS.fork(repo, { sha })
    );

    await step.do('install', () =&gt; runInSandbox(workspace, ['pnpm', 'install']));

    // Each parallel step is independently retryable.
    const [lint, test, build] = await Promise.all([
      step.do('lint',  () =&gt; runInSandbox(workspace, ['pnpm', 'lint'])),
      step.do('test',  () =&gt; runInSandbox(workspace, ['pnpm', 'test'])),
      step.do('build', () =&gt; runInSandbox(workspace, ['pnpm', 'build'])),
    ]);

    if (pr) {
      await step.do('comment', () =&gt;
        this.env.GITHUB.commentOnPR(repo, pr, summarise({ lint, test, build }))
      );
    }

    // Workflow hibernates until approval arrives. No VM held open.
    if (branch === 'main') {
      await step.waitForEvent('approval', { type: 'deploy-approval', timeout: '24 hours' });
      await step.do('deploy', () =&gt; runInSandbox(workspace, ['pnpm', 'deploy']));
    }
  }
}</code></pre>
            <p>The platform owns the dispatcher. It ingests a webhook, figures out which repo it came from, loads <i>that repo's</i> <code>CIPipeline</code> class as a Dynamic Worker, and hands the run-off to Dynamic Workflows. The platform doesn't know what's in the pipeline. It doesn't need to. It's running a durable function that happens to live in the customer's repo.</p><p>Now line up what each step actually does:</p><ul><li><p><a href="https://blog.cloudflare.com/artifacts-git-for-agents-beta/"><b><u>Artifacts</u></b></a> gives every repo a Git-native, versioned filesystem that lives on Cloudflare's globally distributed network. <a href="https://github.com/cloudflare/artifact-fs"><u>ArtifactFS</u></a> hydrates the tree lazily, so even a multi-GB repo is ready to work within single-digit seconds — and <code>fork()</code> gives each CI run its own isolated copy, with no <code>git clone</code> tax.</p></li><li><p><a href="https://blog.cloudflare.com/dynamic-workers/"><b><u>Dynamic Workers</u></b></a> run each lightweight step (lint, format, typecheck, bundle) in a sandboxed isolate that boots in milliseconds, on the same machine as the repo's data. No VM provisioning, no image pull, no cold start.</p></li><li><p><a href="https://developers.cloudflare.com/dynamic-workers/usage/dynamic-workflows/"><b><u>Dynamic Workflows</u></b></a> holds the whole run together. Steps are retryable and durable. The run hibernates for free while waiting on approvals. State and progress survive deploys, evictions, and crashes.</p></li><li><p><a href="https://blog.cloudflare.com/sandbox-ga/"><b><u>Sandboxes</u></b></a> handle the heavy corners — the step that needs <code>docker build</code>, the integration suite that needs Postgres running, the Rust compile that needs 8 cores. Snapshots to R2 mean even those warm-start in a couple of seconds.</p></li></ul><p>A traditional CI run for a mid-sized JS repo looks something like: <i>allocate VM (15-30s) → pull base image (10s) → </i><code><i>git clone</i></code><i> (10s) → </i><code><i>npm ci</i></code><i> (30-60s) → run tests (actual work) → tear down</i>. Several minutes of ceremony before the first test runs, and you pay for the whole VM the whole time.</p><p>The same pipeline on this stack looks like: <i>edge fork of the repo (seconds) → each step boots a fresh isolate or snapshot-restored sandbox in milliseconds → runs the actual work → hibernates.</i> Nothing has to cold-start. Nothing has to be provisioned ahead of time. Nothing has to be kept warm. The repo doesn't move — the compute comes to it.</p><p>CI has never been this fast, and the reason it hasn't is that none of these primitives have existed together in one place. Now they do.</p>
    <div>
      <h2>Try it</h2>
      <a href="#try-it">
        
      </a>
    </div>
    <p><code>@cloudflare/dynamic-workflows</code> is MIT-licensed and on npm today:</p>
            <pre><code>npm install @cloudflare/dynamic-workflows</code></pre>
            <p>It runs on top of Dynamic Workers, which is in open beta on the Workers Paid plan. The <a href="https://github.com/cloudflare/dynamic-workflows"><u>repo</u></a> includes a working example — an interactive browser playground where you write a <code>TenantWorkflow</code> class, hit <b>Run</b>, and watch the steps execute with live-streaming logs and a per-step checklist that lights up as each <code>step.do()</code> commits. Clone it, deploy it, show it to a coworker.</p><p>If you're a platform, an SDK, a framework, or a CI/CD product, and you want to give your customers their own workflows without running their code in your own process: this is the primitive we built for you. If you're building agents that write durable plans, this is the primitive that makes those plans <i>real</i> Workflows. If you're just watching all of this, and it looks fun to build on top of: we'd love to see what you make.</p><p>Find us in the <a href="https://discord.cloudflare.com/"><u>Cloudflare Developers Discord</u></a>.</p> ]]></content:encoded>
            <category><![CDATA[Workflows]]></category>
            <category><![CDATA[Cloudflare Workers]]></category>
            <category><![CDATA[Durable Execution]]></category>
            <category><![CDATA[Developer Platform]]></category>
            <category><![CDATA[Developers]]></category>
            <guid isPermaLink="false">4JZIrwtIvEd4qwAd4JAThB</guid>
            <dc:creator>Dan Lapid</dc:creator>
            <dc:creator>Luís Duarte</dc:creator>
        </item>
        <item>
            <title><![CDATA[Bringing streamable HTTP transport and Python language support to MCP servers]]></title>
            <link>https://blog.cloudflare.com/streamable-http-mcp-servers-python/</link>
            <pubDate>Wed, 30 Apr 2025 14:00:00 GMT</pubDate>
            <description><![CDATA[ We're continuing to make it easier for developers to bring their services into the AI ecosystem with the Model Context Protocol (MCP) with two new updates. ]]></description>
            <content:encoded><![CDATA[ <p>We’re <a href="https://blog.cloudflare.com/building-ai-agents-with-mcp-authn-authz-and-durable-objects/"><u>continuing</u></a> to make it easier for developers to <a href="https://blog.cloudflare.com/remote-model-context-protocol-servers-mcp/"><u>bring their services into the AI ecosystem</u></a> with the <a href="https://www.cloudflare.com/learning/ai/what-is-model-context-protocol-mcp/">Model Context Protocol</a> (MCP). Today, we’re announcing two new capabilities:</p><ul><li><p><b>Streamable HTTP Transport</b>: The <a href="https://agents.cloudflare.com/"><u>Agents SDK</u></a> now supports the <a href="https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http"><u>new Streamable HTTP transport</u></a>, allowing you to future-proof your MCP server. <a href="https://developers.cloudflare.com/agents/model-context-protocol/transport/"><u>Our implementation</u></a> allows your MCP server to simultaneously handle both the new Streamable HTTP transport and the existing SSE transport, maintaining backward compatibility with all remote MCP clients.</p></li><li><p><b>Deploy MCP servers written in Python</b>: In 2024, we <a href="https://blog.cloudflare.com/python-workers/"><u>introduced first-class Python language support</u></a> in <a href="https://www.cloudflare.com/developer-platform/products/workers/">Cloudflare Workers</a>, and now you can build MCP servers on Cloudflare that are entirely written in Python.</p></li></ul><p>Click “Deploy to Cloudflare” to <a href="https://developers.cloudflare.com/agents/guides/remote-mcp-server/"><u>get started</u></a> with a <a href="https://github.com/cloudflare/ai/tree/main/demos/remote-mcp-authless"><u>remote MCP server</u></a> that supports the new Streamable HTTP transport method, with backwards compatibility with the SSE transport. </p><a href="https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/ai/tree/main/demos/remote-mcp-authless"><img src="https://deploy.workers.cloudflare.com/button" /></a>
<p></p>
    <div>
      <h3>Streamable HTTP: A simpler way for AI agents to communicate with services via MCP</h3>
      <a href="#streamable-http-a-simpler-way-for-ai-agents-to-communicate-with-services-via-mcp">
        
      </a>
    </div>
    <p><a href="https://spec.modelcontextprotocol.io/specification/2025-03-26/"><u>The MCP spec</u></a> was <a href="https://spec.modelcontextprotocol.io/specification/2025-03-26/basic/transports/"><u>updated</u></a> on March 26 to introduce a new transport mechanism for remote MCP, called <a href="https://spec.modelcontextprotocol.io/specification/2025-03-26/basic/transports/#streamable-http"><u>Streamable HTTP</u></a>. The new transport simplifies how <a href="https://www.cloudflare.com/learning/ai/what-is-agentic-ai/">AI agents</a> can interact with services by using a single HTTP endpoint for sending and receiving responses between the client and the server, replacing the need to implement separate endpoints for initializing the connection and for sending messages. </p>
    <div>
      <h4>Upgrading your MCP server to use the new transport method</h4>
      <a href="#upgrading-your-mcp-server-to-use-the-new-transport-method">
        
      </a>
    </div>
    <p>If you've already built a remote MCP server on Cloudflare using the Cloudflare Agents SDK, then <a href="https://developers.cloudflare.com/agents/model-context-protocol/transport/"><u>adding support for Streamable HTTP</u></a> is straightforward. The SDK has been updated to support both the existing Server-Sent Events (SSE) transport and the new Streamable HTTP transport concurrently. </p><p>Here's how you can configure your server to handle both transports:​</p>
            <pre><code>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);
    }
  },
};</code></pre>
            <p>Or, if you’re using Hono:</p>
            <pre><code>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</code></pre>
            <p>Or if your MCP server implements <a href="https://developers.cloudflare.com/agents/model-context-protocol/authorization/"><u>authentication &amp; authorization</u></a> using the Workers <a href="https://github.com/cloudflare/workers-oauth-provider"><u>OAuth Provider Library</u></a>: </p>
            <pre><code>export default new OAuthProvider({
 apiHandlers: {
   '/sse': MyMCP.serveSSE('/sse'),
   '/mcp': MyMCP.serve('/mcp'),
 },
 // ...
})</code></pre>
            <p>The key changes are: </p><ul><li><p>Use <code>MyMcpAgent.serveSSE('/sse')</code> for the existing SSE transport. Previously, this would have been <code>MyMcpAgent.mount('/sse')</code>, which has been kept as an alias.</p></li><li><p>Add a new path with <code>MyMcpAgent.serve('/mcp')</code> to support the new Streamable HTTP transport</p></li></ul><p>That's it! With these few lines of code, your MCP server will support both transport methods, making it compatible with both existing and new clients.</p>
    <div>
      <h4>Using Streamable HTTP from an MCP client</h4>
      <a href="#using-streamable-http-from-an-mcp-client">
        
      </a>
    </div>
    <p>While most MCP clients haven’t yet adopted the new Streamable HTTP transport, you can start testing it today using<a href="https://www.npmjs.com/package/mcp-remote"> mcp-remote</a>, an adapter that lets MCP clients like Claude Desktop that otherwise only support local connections work with remote MCP servers. This tool allows any MCP client to connect to remote MCP servers via either SSE or Streamable HTTP, even if the client doesn't natively support remote connections or the new transport method. </p>
    <div>
      <h4>So, what’s new with Streamable HTTP? </h4>
      <a href="#so-whats-new-with-streamable-http">
        
      </a>
    </div>
    <p>Initially, remote MCP communication between AI agents and services used a single connection but required interactions with two different endpoints: one endpoint (<code>/sse</code>) to establish a persistent Server-Sent Events (SSE) connection that the client keeps open for receiving responses and updates from the server, and another endpoint (<code>/sse/messages</code>) where the client sends requests for tool calls. </p><p>While this works, it's like having a conversation with two phones, one for listening and one for speaking. This adds complexity to the setup, makes it harder to scale, and requires connections to be kept open for long periods of time. This is because SSE operates as a persistent one-way channel where servers push updates to clients. If this connection closes prematurely, clients will miss responses or updates sent from the MCP server during long-running operations. </p><p>The new Streamable HTTP transport addresses these challenges by enabling: </p><ul><li><p><b>Communication through a single endpoint: </b>All MCP interactions now flow through one endpoint, eliminating the need to manage separate endpoints for requests and responses, reducing complexity.</p></li><li><p><b>Bi-directional communication: </b>Servers can send notifications and requests back to clients on the same connection, enabling the server to prompt for additional information or provide real-time updates. </p></li><li><p><b>Automatic connection upgrades: </b>Connections start as standard HTTP requests, but can dynamically upgrade to SSE (Server-Sent Events) to stream responses during long-running tasks.</p></li></ul><p>Now, when an AI agent wants to call a tool on a remote MCP server, it can do so with a single <code>POST</code> request to one endpoint (<code>/mcp</code>). Depending on the tool call, the server will either respond immediately or decide to upgrade the connection to use SSE to stream responses or notifications as they become available — all over the same request.</p><p>Our current implementation of Streamable HTTP provides feature parity with the previous SSE transport. We're actively working to implement the full capabilities defined in the specification, including <a href="https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#resumability-and-redelivery"><u>resumability</u></a>, cancellability, and <a href="https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#session-management"><u>session management</u></a> to enable more complex, reliable, and scalable agent-to-agent interactions. </p>
    <div>
      <h4>What’s coming next? </h4>
      <a href="#whats-coming-next">
        
      </a>
    </div>
    <p>The <a href="https://modelcontextprotocol.io/specification/2025-03-26"><u>MCP specification</u></a> is rapidly evolving, and we're committed to bringing these changes to the Agents SDK to keep your MCP server compatible with all clients. We're actively tracking developments across both transport and authorization, adding support as they land, and maintaining backward compatibility to prevent breaking changes as adoption grows. Our goal is to handle the complexity behind the scenes, so you can stay focused on building great agent experiences.</p><p>On the transport side, here are some of the improvements coming soon to the Agents SDK:</p><ul><li><p><b>Resumability:</b> If a connection drops during a long-running operation, clients will be able to resume exactly where they left off without missing any responses. This eliminates the need to keep connections open continuously, making it ideal for AI agents that run for hours.</p></li><li><p><b>Cancellability</b>: Clients will have explicit mechanisms to cancel operations, enabling cleaner termination of long-running processes.</p></li><li><p><b>Session management</b>: We're implementing secure session handling with unique session IDs that maintain state across multiple connections, helping build more sophisticated agent-to-agent communication patterns.</p></li></ul>
    <div>
      <h3>Deploying Python MCP Servers on Cloudflare</h3>
      <a href="#deploying-python-mcp-servers-on-cloudflare">
        
      </a>
    </div>
    <p>In 2024, we <a href="https://blog.cloudflare.com/python-workers/"><u>introduced Python Workers</u></a>, which lets you write Cloudflare Workers entirely in Python. Now, you can use them to build and deploy remote MCP servers powered by the <a href="https://github.com/modelcontextprotocol/python-sdk"><u>Python MCP SDK</u></a> — a library for defining tools and resources using regular Python functions.</p><p>You can deploy a Python MCP server to your Cloudflare account with the button below, or read the code <a href="https://github.com/cloudflare/ai/tree/main/demos/python-workers-mcp"><u>here</u></a>. </p><a href="https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/ai/tree/main/demos/python-workers-mcp"><img src="https://deploy.workers.cloudflare.com/button" /></a>
<p></p><p>Here’s how you can define tools and resources in the MCP server:</p>
            <pre><code>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) -&gt; 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) -&gt; 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)</code></pre>
            <p>If you're already building APIs with<a href="https://fastapi.tiangolo.com/"> <u>FastAPI</u></a>, a popular Python package for quickly building high performance API servers, you can use <a href="https://github.com/cloudflare/ai/tree/main/packages/fastapi-mcp"><u>FastAPI-MCP</u></a> to expose your existing endpoints as MCP tools. It handles the protocol boilerplate for you, making it easy to bring FastAPI-based services into the agent ecosystem.</p><p>With recent updates like <a href="https://blog.cloudflare.com/python-workers/"><u>support for Durable Objects</u></a> and <a href="https://developers.cloudflare.com/changelog/2025-04-22-python-worker-cron-triggers/"><u>Cron Triggers in Python Workers</u></a>, it’s now easier to run stateful logic and scheduled tasks directly in your MCP server. </p>
    <div>
      <h3>Start building a remote MCP server today! </h3>
      <a href="#start-building-a-remote-mcp-server-today">
        
      </a>
    </div>
    <p>On Cloudflare, <a href="https://developers.cloudflare.com/agents/guides/remote-mcp-server/"><u>you can start building today</u></a>. We’re ready for you, and ready to help build with you. Email us at <a href="#"><u>1800-mcp@cloudflare.com</u></a>, and we’ll help get you going. There’s lots more to come with MCP, and we’re excited to see what you build.</p>
          <figure>
          <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/77k853sJHhvZ1UQwrQWyy2/22264b8bda63bc40b6568f88ae99804c/image2.png" />
          </figure><p></p> ]]></content:encoded>
            <category><![CDATA[Phython]]></category>
            <category><![CDATA[MCP]]></category>
            <category><![CDATA[AI]]></category>
            <category><![CDATA[Cloudflare Workers]]></category>
            <category><![CDATA[Durable Objects]]></category>
            <guid isPermaLink="false">5BMzZem6hjKhNsSnI5l3BZ</guid>
            <dc:creator>Jeremy Morrell</dc:creator>
            <dc:creator>Dan Lapid</dc:creator>
        </item>
    </channel>
</rss>