
Workers MCPOfficial
A package that connects Claude Desktop and other MCP clients to Cloudflare Workers, enabling custom functionality to be accessed via natural language through the Model Context Protocol.
cloudflare
README
workers-mcp
Talk to a Cloudflare Worker from Claude Desktop!
[!WARNING]
You should start here instead — and build a remote MCP serverYou can connect to remote MCP servers from Claude Desktop, Cursor, and other clients using mcp-remote.
What is workers-mcp
?
This package provides both the CLI tooling and the in-Worker logic to connect Claude Desktop (or any MCP 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 in Cloudflare's developer platform, back to a LLM in your coding agent, Claude Desktop or other MCP client.
<sub>Yes, I know that
Math.random()
works the same on a Worker as it does on your local machine, but don't tell Claude</sub> 🤫
Usage
Step 1: Generate a new Worker
Use create-cloudflare
to generate a new Worker.
npx create-cloudflare@latest my-new-worker
I suggest choosing a Hello World
worker.
Step 2: Install workers-mcp
cd my-new-worker # I always forget this bit
npm install workers-mcp
Step 3: Run the setup
command
npx workers-mcp setup
Note: if something goes wrong, run npx workers-mcp help
Step 4..♾️: Iterating
After changing your Worker code, you only need to run npm run deploy
to 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 rerun npx workers-mcp install:claude
, but it's safe to do so if you want to rule out Claude config as a source of errors.
Using with Other MCP Clients
Cursor
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
Other MCP Clients
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.
Examples
See the examples
directory for a few ideas of what to use this for:
examples/01-hello-world
is a snapshot taken after the installation instructions aboveexamples/02-image-generation
uses 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
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Playwright MCP Server
Provides a server utilizing Model Context Protocol to enable human-like browser automation with Playwright, allowing control over browser actions such as navigation, element interaction, and scrolling.
MCP Package Docs Server
Facilitates LLMs to efficiently access and fetch structured documentation for packages in Go, Python, and NPM, enhancing software development with multi-language support and performance optimization.
Claude Code MCP
An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.
@kazuph/mcp-taskmanager
Model Context Protocol server for Task Management. This allows Claude Desktop (or any MCP client) to manage and execute tasks in a queue-based system.
Apple MCP Server
Enables interaction with Apple apps like Messages, Notes, and Contacts through the MCP protocol to send messages, search, and open app content using natural language.
contentful-mcp
Update, create, delete content, content-models and assets in your Contentful Space