Cloudflare Workers
About
Enables MCP capabilities in Cloudflare Workers for deploying low-latency, scalable AI services at the network edge.
Details
- Author
- cloudflare
- Repository
- cloudflare/workers-mcp
- GitHub stars
- 485
- Downloads
- 31,508
- License
- Apache License 2.0
- Categories
- Cloud Service, Other, Developer Tools, Infrastructure, AI, API
Jump to
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
Cloudflare WorkersCommand (node, npx, python, etc.)/path/to/workers-mcpArguments-
Argument 1
run -
Argument 2
your-mcp-server-name -
Argument 3
https://your-server-url.workers.dev -
Argument 4
/path/to/your/project
Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
-
Argument 1
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
cd my-new-worker # I always forget this bit
npm install workers-mcp
npx workers-mcp setup
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"cloudflare workers": {
"env": {},
"args": [
"run",
"your-mcp-server-name",
"https://your-server-url.workers.dev",
"/path/to/your/project"
],
"command": "/path/to/workers-mcp"
}
}
}
Linux
{
"env": [],
"args": [
"run",
"your-mcp-server-name",
"https://your-server-url.workers.dev",
"/path/to/your/project"
],
"command": "/path/to/workers-mcp"
}
Macos
{
"env": [],
"args": [
"run",
"your-mcp-server-name",
"https://your-server-url.workers.dev",
"/path/to/your/project"
],
"command": "/path/to/workers-mcp"
}
Windows
{
"env": [],
"args": [
"/c",
"/path/to/workers-mcp run your-mcp-server-name https://your-server-url.workers.dev /path/to/your/project"
],
"command": "cmd"
}
Talk to a Cloudflare Worker from Claude Desktop!
[!WARNING]
You should starthereinstead — and build aremoteMCP server
You can connect to remote MCP servers from Claude Desktop, Cursor, and other clientsusing mcp-remote.
This package provides both the CLI tooling and the in-Worker logic to connect Claude Desktop (or anyMCP Client) to a Cloudflare Worker on your account, so you can customise it to suit your needs. It works via a build step that can translate TypeScript methods of your Worker like this:
export class ExampleWorkerMCP extends WorkerEntrypoint<Env> { /* Generates a random number. This is extra random because it had to travel all the way to your nearest Cloudflare PoP to be calculated which... something something lava lamps? @return {string} A message containing a super duper random number */ async getRandomNumber() { return Your random number is ${Math.random()} } // ...etc }
...into MCP tools that a local Node.js server can expose to MCP clients. The Node.js server acts as a proxy, handling stdio transport locally, and calling the relevant method of your Worker running on Cloudflare. This allows you to expose any function or API in your app, or any service inCloudflare's developer platform, back to a LLM in your coding agent, Claude Desktop or other MCP client.
Yes, I know thatMath.random()works the same on a Worker as it does on your local machine, but don't tell Claude🤫
Usecreate-cloudflareto generate a new Worker.
npx create-cloudflare@latest my-new-worker
I suggest choosing aHello Worldworker.
cd my-new-worker # I always forget this bit npm install workers-mcp
Note: if something goes wrong, runnpx workers-mcp help
After changing your Worker code, you only need to runnpm run deployto update both Claude's metadata about your function and your live Worker instance.
However, if you change the names of your methods, or their parameters, or add or remove methods, Claude will not see the updates until you restart it.
You shouldn't ever need to rerunnpx workers-mcp install:claude, but it's safe to do so if you want to rule out Claude config as a source of errors.
To get your Cloudflare MCP server working in Cursor, you need to combine the 'command' and 'args' from your config file into a single string and use type 'command'.
For example, if your config file looks like:
{ "mcpServers": { "your-mcp-server-name": { "command": "/path/to/workers-mcp", "args": [ "run", "your-mcp-server-name", "https://your-server-url.workers.dev", "/path/to/your/project" ], "env": {} } } }
In Cursor, create an MCP server entry with:
- type:command
- command:/path/to/workers-mcp run your-mcp-server-name https://your-server-url.workers.dev /path/to/your/project
For Windsurf and other MCP clients, update your configuration file to include your worker so you could use the tools directly from the client:
{ "mcpServers": { "your-mcp-server-name": { "command": "/path/to/workers-mcp", "args": [ "run", "your-mcp-server-name", "https://your-server-url.workers.dev", "/path/to/your/project" ], "env": {} } } }
Make sure to replace the placeholders with your actual server name, URL, and project path.
See theexamplesdirectory for a few ideas of what to use this for:
- examples/01-hello-worldis a snapshot taken after the installation instructions above
- examples/02-image-generationuses Workers AI to run the Flux image generation model. Claude is really good at suggesting prompts and can actually interpret the outcome and decide what new prompts to try to achieve the outcome you want.
- TODO Browser Rendering
- TODO Durable Objects
An example for deploying a remote, authentication-free MCP server on Cloudflare Workers.
A remote MCP server deployable on Cloudflare Workers, featuring OAuth login support and local development capabilities.
An example of a remote MCP server without authentication, deployable on Cloudflare Workers or runnable locally via npm.
An authentication-free, remote MCP server designed for deployment on Cloudflare Workers.
An authentication-free remote MCP server designed for deployment on Cloudflare Workers.
A template for deploying a remote, auth-less MCP server on Cloudflare Workers.
A template for deploying a remote MCP server on Cloudflare Workers without authentication.
An example MCP server designed for easy deployment on Cloudflare Workers, operating without authentication.
A template for deploying a remote, authentication-free MCP server on Cloudflare Workers.
A template for deploying a remote, auth-less MCP server on Cloudflare Workers.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





