Skip to content

Cloudflare

Cloudflare Workers support in xmcp uses a Cloudflare-native bundle and Wrangler for local dev and deploy.

For the complete documentation index, see llms.txt. Markdown variants of every page are available by appending .md to the URL.

Cloudflare Workers support is built into xmcp with the --cf flag. The easiest path is to bootstrap a project that includes Wrangler and the Cloudflare build pipeline.

Keep @xmcp-dev/compiler installed as a development dependency in the build environment. It is only needed to produce the Worker bundle and is not part of the deployed runtime.

Create a new project

Start with create-xmcp-app and the Cloudflare flag (you can also pass --cloudflare when cloning an example with --example):

This initializes a Workers-ready setup and wires the following defaults:

  • xmcp build --cf for production builds
  • xmcp dev --cf alongside wrangler dev for local development
  • wrangler deploy for deployment

Build and deploy with the CLI

Build a Cloudflare Workers bundle and emit worker.js (plus wrangler.jsonc if you don’t already have a Wrangler config):

Then deploy with Wrangler:

The first deploy prompts you to log in to your Cloudflare account. Once deployed, the Worker serves your configured endpoint, /mcp by default, on your workers.dev subdomain, along with a /health check route.

Local development

Run the watcher and Wrangler together:

This runs xmcp dev --cf (to rebuild the Worker output) and wrangler dev to serve it locally.

Learn more about deploying Workers in the Cloudflare Workers documentation.

On this page

One framework to rule them all