Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

“Cloudflare Workers MCP server” can mean three different things: the older workers-mcp bridge, a remote Model Context Protocol (MCP) server that you build and deploy on Workers, or Cloudflare-operated MCP servers for calling Cloudflare APIs. Choose the first when you need a local stdio bridge to an existing Worker, the second when you are publishing your own tools over the internet, and the third when an AI client must operate Cloudflare products.

Identify the MCP server you actually need

Option Purpose Where it runs Tool scope Access model
workers-mcp package Translates TypeScript methods in a Worker into MCP tools and proxies client stdio calls Local Node.js proxy plus a Worker on Cloudflare Your Worker methods Controlled by your local MCP client and Worker deployment
Custom remote MCP server Expose a service you design to agents through Streamable HTTP Your Cloudflare Worker, normally at a route such as /mcp Your deliberately defined tools Unauthenticated, or authenticated and authorized
Cloudflare-hosted MCP servers Let agents use Cloudflare APIs Cloudflare-operated endpoints Code Mode for broad API access, or curated product-specific tools Cloudflare’s service and your credentials

Cloudflare’s workers-mcp README points readers toward the remote-server approach for new projects. Repository instructions and package commands change, so verify the current README before running setup commands.

Build a remote MCP server on Workers

The current Cloudflare guide uses Streamable HTTP. The workflow is: create a Worker, define MCP tools, test locally with Wrangler and MCP Inspector, then deploy with Wrangler and expose the deployed /mcp route.

1. Define the boundary and tools

  • Write down each operation an agent may perform and the data it may read or change.
  • Keep tools narrow and explicit. A tool that can delete resources should not also silently create or modify them.
  • Validate arguments inside the Worker; never rely on the model to provide safe input.
  • Decide whether callers need authentication before writing the endpoint. An unauthenticated endpoint is callable by anyone who can reach it.

2. Create the Worker project

Start with Cloudflare’s current MCP example or the project generator documented in the remote-server guide. The exact generated file names and package versions are version-sensitive. Configure a route for /mcp, and keep secrets in Worker secrets rather than source control.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

3. Implement Streamable HTTP handling

Your Worker must accept MCP requests over HTTP, dispatch each requested tool, and return protocol responses. Use the SDK and template from Cloudflare’s current guide rather than hand-writing a protocol implementation; this avoids subtle incompatibilities as MCP evolves. A conceptual tool definition has four parts:

  1. A stable tool name.
  2. A human-readable description that states side effects.
  3. An input schema with required and optional fields.
  4. A handler that authenticates the caller, validates input, invokes the needed binding or API, and returns structured output or a clear error.

Do not expose administrative bindings merely because they are available in the Worker. Grant each tool only the permissions it needs.

4. Test locally with Wrangler and MCP Inspector

  1. Run the local Worker with the command supplied by the current Cloudflare guide.
  2. Point MCP Inspector at the local /mcp endpoint.
  3. Initialize a session, list tools, and invoke each tool with valid and invalid arguments.
  4. Check authentication failures, malformed input, timeouts, and partial upstream failures.

Inspector testing confirms protocol behavior, but it does not make local resources identical to production. Workers local execution uses Miniflare and the workerd runtime. Bindings normally use simulated resources unless you configure remote resources, so a local test can differ from production data and limits.

5. Deploy and verify the endpoint

Deploy with:

npx wrangler@latest deploy

The guide’s example produces a workers.dev address with an /mcp path. Record the actual hostname and route shown by Wrangler, then repeat the Inspector tests against the deployed URL. Treat the command, generated hostname, and route as current-guide details rather than permanent API guarantees.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Authentication and authorization decisions

When an unauthenticated endpoint is acceptable

Public access can fit read-only, low-risk tools where the data is intentionally public and abuse is bounded. Rate-limit expensive operations and reject unexpected origins or payload sizes where appropriate.

When authentication is required

Use authentication when tools access private data, consume paid services, mutate infrastructure, or act on behalf of users. Authentication proves who connected; authorization decides which tools and records that identity may use. Enforce both in the Worker before dispatching a handler.

Protect high-impact tools

  • Separate read and write tools.
  • Require confirmation outside the model for destructive actions.
  • Log tool name, identity, request ID, and outcome without logging secrets.
  • Return actionable errors, but do not disclose credentials or internal topology.

Using the older workers-mcp bridge

The package follows a different architecture: TypeScript methods in a Worker are translated into MCP tools, while a local Node.js process proxies MCP client’s stdio traffic to the Worker. The repository README documents a flow based on create-cloudflare, installing workers-mcp, and running its setup command, followed by client configuration. Because those commands and configuration keys can change, copy them from the repository’s current README, then verify that the generated Worker and local proxy agree on the same deployment and tool names.

This bridge is useful when your MCP client expects local stdio and you already have Worker methods. It is not the same as publishing a directly reachable Streamable HTTP server.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choosing Cloudflare’s hosted MCP servers

Code Mode

Cloudflare positions its Code Mode server for broad access across Cloudflare APIs. The model works through a compact interface rather than receiving every API tool schema up front.

Domain-specific servers

Curated servers expose typed tools for particular product areas. The repository lists a Workers Bindings server for building Workers applications with storage, AI, and compute primitives. Choose these when predictable, product-focused operations are more valuable than broad API coverage.

Token figures, with the necessary caveat

Cloudflare’s cloudflare/mcp README reports a comparison across 2,594 endpoints/tools: approximately 1,100 tokens for Code Mode, 1,170,523 tokens for native MCP with full schemas, and 244,047 tokens for native MCP with only required-parameter schemas. These are repository-reported figures; the README does not provide enough methodology to treat them as an independent benchmark or to generalize them to every client and workload. Token count alone also does not establish latency, accuracy, or total cost.

Local development does not perfectly mirror production

Miniflare and workerd run Worker code locally, while bindings may be simulated or connected to remote resources. Remote-resource development can introduce network, data, and cost trade-offs. Cloudflare’s local-development documentation also states that Workers AI has no current local simulation. If your MCP tool depends on Workers AI, test the integration against the real service in a controlled environment before release.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Common failures and fixes

Inspector cannot connect

Confirm the local Worker is running, the URL includes the MCP route, and the protocol mode matches Streamable HTTP. Check Wrangler’s terminal output for the actual local address.

Tools list is empty or stale

Verify that the deployed Worker contains the latest tool registration code and that Inspector is connected to the intended hostname. Restart the client after changing schemas.

Works locally, fails after deployment

Compare bindings, secrets, environment variables, and authentication configuration. Local simulated resources are not production resources, and Workers AI has no local simulation.

Requests are rejected as unauthorized

Check which identity the client is sending, how the Worker validates it, and whether authorization permits that specific tool. Do not “fix” the problem by making a sensitive endpoint public.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Long-running tools time out

Break expensive work into asynchronous steps, set explicit upstream timeouts, and return progress or a job identifier instead of holding an MCP request indefinitely.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your workflow needs screenshots of pages used in documentation, tests, or agent tools, ScreenshotNeo provides a website screenshot API and MCP server. A single request returns PNG, JPEG, WebP, or PDF, while consent banners are accepted and more than 60 known consent platforms, newsletter popups, and chat widgets are removed before capture. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status.

cURL:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

See the ScreenshotNeo documentation for the full option set, including full-page and element capture, device and retina settings, PDFs, custom JavaScript and CSS, request blocking, cookies, headers, geolocation, caching, signed links, asynchronous webhooks, bulk capture, and usage reporting. Its MCP server includes take_screenshot, get_page_info, and capture_pdf for AI clients. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Create a free ScreenshotNeo account.

Frequently Asked Questions

Can I use both workers-mcp and a remote MCP endpoint?

Yes. They are different access patterns: the bridge serves clients that communicate through local stdio, while the remote design exposes Streamable HTTP directly from a deployed Worker.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Does local Wrangler testing use my production data?

Not by default. Local execution and bindings are separate; bindings normally use simulated resources unless remote-resource development is configured.

Should every Cloudflare API be exposed as an MCP tool?

No. Select a narrow, authorized tool set, especially for operations that mutate infrastructure or incur charges.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.