---
title: "How to Connect or Build a Cloudflare MCP Server"
description: "Cloudflare MCP can refer to two different systems. Determine which one applies to your setup and understand the key distinctions."
url: https://www.activepieces.com/blog/how-to-connect-or-build-a-cloudflare-mcp-server
updated: 2026-12-02
---

> Every page on www.activepieces.com is available as markdown: add `.md` to the URL, or send `Accept: text/markdown`. Site index: https://www.activepieces.com/llms.txt

# How to Connect or Build a Cloudflare MCP Server

By Emeka Vantongeren · December 2, 2026 · 14 min read · Filed under [Automation thoughts](https://www.activepieces.com/blog/category/automation-thoughts)

**Summary**

Connect Cloudflare MCP servers by authorizing your AI client, or build your own remote server on Workers with OAuth authentication, session state via Durable Objects, and tools you define.

- 16,470 of 26,548 scanned MCP servers needed no sign-in.
- Native API has 2,594 tools and 1,170,523 tokens versus 3 Code Mode tools.
- 9,691 MCP servers expose tools that aren't read-only.

[Cloudflare](https://www.cloudflare.com/plans/developer-platform-pricing/) MCP means one of two things.

It's either Cloudflare's own MCP servers, which let an AI client operate your Cloudflare account, or a remote MCP server you build and host on Cloudflare Workers, its serverless runtime, much as teams using tools like [Activepieces](https://www.activepieces.com) might expose their own services to an AI client.

The two **share a name and almost nothing else**.

By the end you'll have a deployed remote server connected to an AI client, in well under an hour. Details were checked on 2 December 2026.

Before anything else, decide whether you're consuming a product or building one.

## Two distinct Cloudflare MCP systems

When you use Cloudflare's own MCP servers, Cloudflare builds and runs them: you connect your AI client and grant it access to your account.

When you host your own remote MCP server on Workers, you build it and you run it on Cloudflare's infrastructure, so you write the tools, deploy, secure and maintain it.

### Cloudflare's own MCP servers

These are a catalogue Cloudflare maintains. You don't write or host anything. You point a client at them and authorise access, and the client can then work with things like your DNS, Workers and logs through natural language.

![Activepieces MCP Server setup page with client configuration instructions and code example.](https://ap-marketing-media.fra1.cdn.digitaloceanspaces.com/uploads/8affcbbd-a52f-4275-ac83-32c629beafe3/suno-mcp-how-to-connect-it-to-ai-tools-2026-guid-4dc1cc00.webp)

You **trade control for convenience**. You get breadth without engineering effort, but you can't change what the tools do. Your main job is scoping: the permissions you grant are the ceiling on what an agent can change in your account.

### Hosting your own remote MCP server

Here the server is your product. You decide which tools exist, what data they touch and who may call them. Workers hosts it, so you skip servers and scaling, but you own the logic and its consequences.

This is the path the rest of the article follows. The code is the quick part. Authentication and scoping take the time, because a **public endpoint with broad tools is a liability** the moment it goes live.

### Local versus remote MCP servers

When a server runs as a process on one person's machine, it serves only that person's client.

A remote server lives at a URL, so teammates and hosted AI clients can all reach it, which is how [Activepieces](https://www.activepieces.com) exposes its 751 integrations: through a per-project MCP server.

That reach is why remote servers need real authentication. A local server inherits the trust of your laptop, while a remote one inherits the trust of whoever holds the URL. Both Cloudflare meanings are remote, so the security question applies to each.

## How a remote MCP server on Cloudflare works

In practice, a remote MCP server on Cloudflare is a Worker that exposes a list of tools over HTTPS. A Durable Object holds session state, and an OAuth login sits in front of it.

![A simple drawing of a Worker box holding a short list of tools, a Durable Object cylinder beside it, and an OAuth login…](https://ap-marketing-media.fra1.cdn.digitaloceanspaces.com/uploads/6421ff9e-50bb-4dc1-92bb-380308845d83/how-to-connect-or-build-a-cloudflare-mcp-server-784503dd.webp)

The AI client sends it over Streamable HTTP, the user passes through an OAuth login, and the Worker receives the call and runs the matching tool, with a Durable Object keeping the session.

### MCP tools, transport and session state on Cloudflare

A tool is a named function the client can call, with a description and an input schema. The tools list lives inside the Worker, and it's the product you're shipping.

To reach the Worker, the client uses a transport. Streamable HTTP is the current standard: ordinary HTTPS requests, with streaming when a response needs it.

Legacy SSE is the older approach, kept mainly so older clients keep working. For a new server, build on Streamable HTTP and add SSE only if a client you must support still requires it.

Workers are stateless between requests. A Durable Object is what gives a session a memory: it holds the state for one client's conversation, such as who they are and what they've done so far.

![A Durable Object drawn as a small filing cabinet with one open drawer holding a card for one client's session, beside a…](https://ap-marketing-media.fra1.cdn.digitaloceanspaces.com/uploads/5d29e240-1ac6-4833-bcba-5959a3a790d9/how-to-connect-or-build-a-cloudflare-mcp-server-124f1811.webp)

If your tools carry context from one call to the next, the Durable Object is the part that makes that possible.

### Cloudflare MCP server authentication with OAuth

Because the server is reachable from the internet, it has to know who is calling. OAuth handles that: the user signs in through a login step, the server receives a token tied to that person, and the tools run with that person's permissions.

Without it, anyone who finds the URL can use your tools, and your server acts with one shared set of rights.

Scoping is the second half. Authentication says who the caller is; scoping says what they may do.

A signed-in user who can read data shouldn't automatically be able to delete it. Decide per tool which permission it requires, and check it on each call, not once at login.

![Three tool cards in a row, read, edit and delete, each with its own padlock; a signed-in user's badge opens the read lock…](https://ap-marketing-media.fra1.cdn.digitaloceanspaces.com/uploads/0fc6d518-f279-4f84-bdf7-65f37446d0f1/how-to-connect-or-build-a-cloudflare-mcp-server-d9377eca.webp)

### Local vs Workers-hosted vs self-hosted MCP servers

Where the server runs, who authenticates and who can reach it all differ across the three options.

| | Where it runs | Who authenticates | Who can reach it |
|---|---|---|---|
| Local | On the user's own machine | Usually no one; the machine is the boundary | Only that user's client |
| Workers-hosted | On Cloudflare's network | Your OAuth login, which you configure | Any client with a valid sign-in |
| Self-hosted | On infrastructure you operate | Whatever you build or integrate | Whatever your network rules allow |

Local is the cheapest to start and the hardest to share, since every user installs and runs their own copy.

## Stage-by-stage deployment of a remote MCP server

Four stages get you there, each leaving you with something that works, all done before authentication enters the picture. The build is the quick part. Start with the authless template, because it lets you prove the plumbing before you take on the harder decisions.

### Stages 1 and 2: Account, Wrangler and a local scaffold

You need a free Cloudflare account and Node.js. Wrangler is Cloudflare's command-line tool, and `npx` runs it without a global install. Log in once so later commands can deploy for you:

```bash
npx wrangler login
```

This opens a browser for approval.

To get a remote MCP server that requires no login, scaffold it from Cloudflare's template repository, then start the local dev server:

```bash
npm create cloudflare@latest -- my-mcp-server --template=cloudflare/ai/demos/remote-mcp-authless
cd my-mcp-server
npm start
```

The server now listens on `http://localhost:8788/mcp`. You've got a running server with a sample tool, so any later failure is in your changes rather than the setup.

### Stage 3: Test with MCP Inspector

Test before any client is involved. In a second terminal, run:

```bash
npx @modelcontextprotocol/inspector@latest
```

Open the address it prints, enter `http://localhost:8788/mcp`, and connect. List the tools and call one.

If the call returns a result here, a later failure in Claude or another client is a configuration problem, not a server problem.

### Stage 4: Deploy and connect a client

Deploy with:

```bash
npm run deploy
```

Wrangler prints a URL ending in `workers.dev`, shaped like `https://my-mcp-server.your-subdomain.workers.dev/sse`. Note it down. Then run the Inspector again and connect to that URL, which confirms the deployed copy behaves like the local one.

To connect a client that only speaks local transports, such as Claude Desktop, use the `mcp-remote` proxy. Add this to its MCP configuration, then restart the client and call the sample tool:

![Activepieces MCP Server configuration page with client setup instructions and server configuration code](https://ap-marketing-media.fra1.cdn.digitaloceanspaces.com/uploads/0eed6f5f-5a12-4a89-88f0-78055256395d/claude-enterprise-automation-a-complete-2026-gui-577ef85d.webp)

```json
{
 "mcpServers": {
 "my-mcp-server": {
 "command": "npx",
 "args": ["mcp-remote", "https://my-mcp-server.your-subdomain.workers.dev/sse"]
 }
 }
}
```

That URL is public, and this template has no login. **Anyone who finds it can call your tools, so treat this as a working prototype rather than something to point at real data.** Authentication and scoping come next.

## Cloudflare MCP requirements, pricing and common mistakes

**Price is not what fails you**. Cloudflare MCP costs cents per million requests, so the failures that matter are authentication and scope.

### Cloudflare MCP free and paid plan limits

You need a Cloudflare account and Workers. Stateful servers also need Durable Objects, so check the plan limits on your account before you promise a client a production date.

> Price is not what fails you. Cloudflare MCP costs cents per million requests, so the failures that matter are authentication and scope.

Check Cloudflare's [pricing page](https://developers.cloudflare.com/kv/platform/pricing/) and you'll find per-million rates: Durable Object requests at $0.15, Workers requests at $0.30, KV reads at $0.50, D1 row writes at $1 and KV writes at $5.

A KV write costs ten times a KV read, so keep per-request session state out of KV and in the Durable Object.

### Five common Cloudflare MCP server mistakes

- Shipping with no sign-in. [Spellwarden](https://spellwarden.ai/research/mcp-server-security-2026-11.pdf) scanned 59,944 registry entries, and 26,548 answered as MCP servers. Of those, **16,470 needed no sign-in, about 62%**. Another 9,691 expose tools that aren't read-only, so an open endpoint can change data.
- Issuing over-broad API tokens, so one leak exposes the whole account.
- Using the old SSE endpoint when current clients expect the streamable HTTP transport.
- Ignoring plan limits until a demo hits them.
- Exposing too many tools.

![How many public MCP servers answer without a sign-in](https://ap-marketing-media.fra1.cdn.digitaloceanspaces.com/uploads/06591910-5bd0-4ab5-a1b2-eaa06d240f20/how-to-connect-or-build-a-cloudflare-mcp-server-7f65a3f6.svg "Source: Spellwarden (2026)")

The last one is the easiest to measure. Cloudflare's own API as native MCP tools is 2,594 tools and 1,170,523 tokens of definitions, against roughly 1,100 tokens across 3 tools in Code Mode.

Those definitions load before the user types a word, so the native version can't fit in most context windows. Even a small server pays this cost on every conversation, so a short, curated tool list is cheaper and gets better tool choices.

### Security scoping for API tokens and tools

Put authentication in front of the server first, then scope everything behind it. Create API tokens for one purpose, one account and one zone, with the minimum permissions that job needs. A token that can only read analytics does little damage if it leaks.

Apply the same rule to tools. Register read-only tools by default, and add a write tool only when a named user needs it.

Keep it behind its own permission check.

## Where Activepieces fits next to Cloudflare MCP

If the server is one you write in code, Cloudflare MCP on Workers suits it.

If you want an AI client to trigger actions across business apps without you writing a server, Activepieces suits that, and MoneyGram, Moneypenny, Alan and FundingSocieties already run it in production.

![The Activepieces MCP Server configuration interface with setup instructions for Claude, Cursor, Windsurf and other clients.](https://ap-marketing-media.fra1.cdn.digitaloceanspaces.com/uploads/ff7f3dff-f733-4e19-8254-96c00caccb0d/run-minicpm-v-4-7-locally-step-by-step-setup-gui-30d9d332.webp)

You are trading control against speed. With Workers you own every tool definition and every line of auth.

With Activepieces you accept its catalogue of app integrations and its way of exposing them, which sits in an MIT-licensed core you can read, and in return you skip the build.

Read the difference as a question about who carries the maintenance.

Cloudflare MCP on Workers is best for custom, code-level servers around your own API or logic. Your team builds it in code, you implement auth yourself (typically OAuth or a token you validate), and the AI client can call exactly the tools you wrote.

For triggering actions across business apps you already use, Activepieces gives an AI client a per-project MCP server over its 751 integrations, each one available to the assistant as a tool, so you can focus on designing automations rather than building custom connectors.

Connect a piece once and an agent can call it: the same piece action that runs as a step in a flow is exposed as a tool on the per-project MCP server, which Claude, ChatGPT, Cursor or an agent you wrote yourself can reach.

Nothing gets published to a second catalogue and nothing is registered twice, across all 751 integrations in packages/pieces of the open source repo, meaning each of the 751 integrations has a single source of truth.

The server is per project, so an agent reaches the integrations connected in that project, and MCPs are included on the free plan, which comes with 1,000 credits a month and unlimited flows.

Workers gives you a narrower, sharper tool, and Activepieces gives you breadth you didn't have to write, with roughly 60% of its integrations contributed by the community, meaning you get the breadth without the company bearing all the maintenance.

Neither removes the scoping work from the earlier sections.

### When a no-code MCP server is the better tool

Choose Activepieces when the job is "let the assistant create a ticket, send a message, update a record" across several apps. Nobody on the team wants to own a codebase for it.

The integrations already exist, so the cost is deciding which actions to expose, not writing handlers.

Choose Workers when the logic is yours: a proprietary API, custom validation, or rules that a pre-built action can't express. The same goes when you need to control precisely how authentication is checked.

You pay in engineering time and get a server shaped to your needs.

Scoping still applies on the no-code side. Expose a short list of actions, not everything connected, for the same security and token-cost reasons as before.

### Next steps for your Cloudflare MCP server

Work through these in order:

1. Choose local or remote first: run it locally if only you'll use it, or remote if a team or hosted client needs to reach it.
2. Deploy it, either as a Worker you write or as an Activepieces MCP server you enable.
3. Restrict the token so it can reach only the tools this client needs, and nothing else.

Test one tool end to end from your AI client before you add a second.

## Frequently asked questions

Keeping the action list short keeps the server cheap and safe, but a few practical questions are still open, and each one changes what you budget or build.

### Is Cloudflare MCP free to use?

Yes for getting started. Cloudflare's own MCP servers cost nothing beyond the account you already hold, and the Workers free plan is enough to build and demo your own remote server. That means a prototype carries no commercial risk.

Once real traffic or heavier state arrives, you're on usage-based paid plans, so price that before you promise a team an internal rollout.

### Does Cloudflare MCP work with ChatGPT and Claude?

Yes, with a caveat about transport. A remote server on Workers speaks streamable HTTP, which current clients, including Claude and ChatGPT, can connect to. Older SSE connections are still supported for clients that haven't moved, but build new work on streamable HTTP.

Where a client only supports local servers, a small proxy bridges the gap, which adds a moving part you must own.

### Do I need to write code to run a remote MCP server on Cloudflare?

For your own server, yes, though not much. You write a Worker that defines your tools and wire in authentication, and the starter templates cover the rest.

A stateless server that answers each call independently can skip Durable Objects, which aren't required for every server.

You need them when the server must remember something between calls, such as a session or user state. Connecting to Cloudflare's own servers needs no code at all, only client configuration.

### Is a remote MCP server safe to leave public?

Not without authentication. A public URL with no login lets anyone who finds it call your tools, so treat the endpoint like any other internet-facing API.

Put OAuth in front of it, scope each token to the minimum set of actions, and keep destructive operations out of the tool list. A narrow tool list limits the damage if a token leaks.

### What is the difference between MCP and an API?

An API is the interface a developer codes against, while MCP is a standard way for an AI client to discover and call tools on its own.

Most MCP servers sit on top of an existing API. You keep the API for your applications, and MCP becomes the layer that lets a model use the same capabilities without custom glue for each client.

## Related reading

- [Connect Claude to Webflow with the MCP Server](https://www.activepieces.com/blog/connect-claude-to-webflow-with-the-mcp-server)
- [How to Connect the Klaviyo MCP Server in 2026](https://www.activepieces.com/blog/how-to-connect-the-klaviyo-mcp-server-in-2026)
- [Fal AI MCP Server: Connect Claude, ChatGPT & Agents](https://www.activepieces.com/blog/fal-ai-mcp-server-connect-claude-chatgpt-agents)

## References

- [Spellwarden](https://spellwarden.ai/research/mcp-server-security-2026-11.pdf)
- [Cloudflare](https://developers.cloudflare.com/kv/platform/pricing/)
