Skip to content
Platform Status

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.

Before deploying to Cloudflare Workers, you need to do the following:

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.dev
  • cloudflareEnabled: Set to true to 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.

After configuring your gen.yaml file, regenerate your SDK to include Cloudflare Worker deployment files:

Terminal window
speakeasy run

This creates an additional file in your generated SDK for the Cloudflare Worker.

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 cloudflareURL configuration 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.

Configure your MCP client to connect to the deployed Cloudflare Worker. Different clients use different configuration formats.

Use the Claude Code CLI to add your deployed MCP server with the following command:

Terminal window
claude mcp add --transport sse MyAPI https://your-worker-name.your-subdomain.workers.dev/sse \
--header "X-API-Key: your-api-key-here"

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"
}
}
}
}

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.

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