Cover image

与Claude Desktop的Cloudflare工人交谈!

3 years

Works with Finder

16

Github Watches

43

Github Forks

470

Github Stars

workers-mcp

Talk to a Cloudflare Worker from Claude Desktop!

[!WARNING]
You should start here instead — and build a remote MCP server

You 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.

image

Yes, I know that Math.random() works the same on a Worker as it does on your local machine, but don't tell Claude 🤫

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 above
  • examples/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

相关推荐

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • https://zenepic.net
  • Embark on a thrilling diplomatic quest across a galaxy on the brink of war. Navigate complex politics and alien cultures to forge peace and avert catastrophe in this immersive interstellar adventure.

  • Beria Joey
  • 你的职业规划师,不走弯路就问我。Sponsor:小红书“ ItsJoe就出行 ”

  • pontusab
  • 光标与风浪冲浪社区,查找规则和MCP

  • av
  • 毫不费力地使用一个命令运行LLM后端,API,前端和服务。

  • GeyserMC
  • 与Minecraft客户端/服务器通信的库。

  • Mintplex-Labs
  • 带有内置抹布,AI代理,无代理构建器,MCP兼容性等的多合一桌面和Docker AI应用程序。

  • 1Panel-dev
  • 🔥1Panel提供了直观的Web接口和MCP服务器,用于在Linux服务器上管理网站,文件,容器,数据库和LLMS。

  • awslabs
  • AWS MCP服务器 - 将AWS最佳实践直接带入您的开发工作流程的专门MCP服务器

  • WangRongsheng
  • 🧑‍🚀 llm 资料总结(数据处理、模型训练、模型部署、 o1 模型、mcp 、小语言模型、视觉语言模型)|摘要世界上最好的LLM资源。

  • appcypher
  • 很棒的MCP服务器 - 模型上下文协议服务器的策划列表

  • GLips
  • MCP服务器向像光标这样的AI编码代理提供FIGMA布局信息

  • idosal
  • 结束幻觉! GITMCP是任何GitHub项目的免费,开源的远程MCP服务器

    Reviews

    3 (1)
    Avatar
    user_E6CKIBUN
    2025-04-17

    As a dedicated user of the workers-mcp application, I am thoroughly impressed with its seamless integration and high performance. Cloudflare has truly outdone themselves with this tool. It has made managing multiple cloud processes extremely efficient and hassle-free. Whether you are a developer or an IT professional, I highly recommend giving workers-mcp a try. The ease of use and robust features make it an indispensable asset in any cloud infrastructure.