Standalone MCP
Deploy to Cloudflare Workers
Deploy your MCP server to Cloudflare Workers for global edge distribution and zero-ops scaling using Speakeasy’s built-in Cloudflare deployment configuration.
Prerequisites
Section titled “Prerequisites”Before deploying to Cloudflare Workers, you need to do the following:
- Generate an MCP server using Speakeasy.
- Install the Wrangler CLI.
- Set up a Cloudflare account.
Configuration
Section titled “Configuration”Enable Cloudflare Worker deployment by adding the following configuration to your .speakeasy/gen.yaml file:
mcp-typescript: cloudflareEnabled: true cloudflareURL: https://your-worker-name.your-subdomain.workers.devConfiguration options
Section titled “Configuration options”cloudflareEnabled: Set totrueto enable Cloudflare Worker deployment configuration.cloudflareURL: This is the URL where your MCP server will be deployed. It should match the URL of your Cloudflare Worker.
The cloudflareURL determines the endpoint where your MCP server will be
accessible after deployment. Make sure this matches your intended Worker
domain.
Generating the deployment
Section titled “Generating the deployment”After configuring your gen.yaml file, regenerate your SDK to include Cloudflare Worker deployment files:
speakeasy runThis creates an additional file in your generated SDK for the Cloudflare Worker.
Deployment process
Section titled “Deployment process”Use the following steps to deploy your MCP server on a Cloudflare worker.
-
Authenticate with Cloudflare:
Terminal window npx wrangler login -
Navigate to your generated SDK directory and deploy your MCP server:
Terminal window npx wrangler deploy -
Verify that your MCP server is running at the URL specified in your
cloudflareURLconfiguration by accessing it via curl:Terminal window curl https://your-worker-name.your-subdomain.workers.dev/Alternatively, navigate to the URL in a browser window to view the MCP Server configuration.
Using the deployed server
Section titled “Using the deployed server”Configure your MCP client to connect to the deployed Cloudflare Worker. Different clients use different configuration formats.
Claude Code
Section titled “Claude Code”Use the Claude Code CLI to add your deployed MCP server with the following command:
claude mcp add --transport sse MyAPI https://your-worker-name.your-subdomain.workers.dev/sse \--header "X-API-Key: your-api-key-here"Windsurf
Section titled “Windsurf”Add the server configuration to your Windsurf MCP settings:
{ "mcpServers": { "MyAPI": { "serverUrl": "https://your-worker-name.your-subdomain.workers.dev/sse", "headers": { "X-API-Key": "your-api-key-here" } } }}Cursor
Section titled “Cursor”Configure your MCP server in Cursor’s settings:
{ "mcpServers": { "MyAPI": { "url": "https://your-worker-name.your-subdomain.workers.dev/mcp", "headers": { "X-API-Key": "your-api-key-here" } } }}Note the different endpoint paths: Claude Code and Windsurf use /sse for
server-sent events, while Cursor uses /mcp for the standard MCP protocol
endpoint.
Updating your deployment
Section titled “Updating your deployment”You can update your deployed MCP server as follows:
-
Make changes to your OpenAPI document.
-
Regenerate your SDK with the following command:
speakeasy run -
Redeploy by running the following command:
npx wrangler deploy