Skip to content
Back to search

workers-mcp

Talk to a Cloudflare Worker from Claude Desktop!

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/cloudflare--workers-mcp/badge.svg)](/listings/cloudflare--workers-mcp)

HTML

<a href="/listings/cloudflare--workers-mcp"><img src="/api/listings/cloudflare--workers-mcp/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

cd my-new-worker # I always forget this bit
npm install workers-mcp

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 130 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # `workers-mcp`
  2. > **Talk to a Cloudflare Worker from Claude Desktop!**
  3. > [!WARNING]
  4. > You should start [here](https://developers.cloudflare.com/agents/guides/remote-mcp-server/) instead — and build a **remote** MCP server
  5. >
  6. > You can connect to remote MCP servers from Claude Desktop, Cursor, and other clients [using mcp-remote](https://developers.cloudflare.com/agents/guides/test-remote-mcp-server/).
  7. ### What is `workers-mcp`?
  8. This package provides both the CLI tooling and the in-Worker logic to connect Claude Desktop (or any [MCP Client](https://modelcontextprotocol.io/)) 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:
  9. ```ts
  10. export class ExampleWorkerMCP extends WorkerEntrypoint<Env> {
  11. /**
  12. * Generates a random number. This is extra random because it had to travel all the way to
  13. * your nearest Cloudflare PoP to be calculated which... something something lava lamps?
  14. *
  15. * @return {string} A message containing a super duper random number
  16. * */
  17. async getRandomNumber() {
  18. return `Your random number is ${Math.random()}`
  19. }
  20. // ...etc
  21. }
  22. ```
  23. ...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](https://developers.cloudflare.com/products/), back to a LLM in your coding agent, Claude Desktop or other MCP client.
  24. ![image](https://github.com/user-attachments/assets/c16b2631-4eba-4914-8e26-d6ccea0fc578)
  25. > <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> 🤫
  26. ## Usage
  27. ### Step 1: Generate a new Worker
  28. Use `create-cloudflare` to generate a new Worker.
  29. ```shell
  30. npx create-cloudflare@latest my-new-worker
  31. ```
  32. I suggest choosing a `Hello World` worker.
  33. ### Step 2: Install `workers-mcp`
  34. ```shell
  35. cd my-new-worker # I always forget this bit
  36. npm install workers-mcp
  37. ```
  38. ### Step 3: Run the `setup` command
  39. ```shell
  40. npx workers-mcp setup
  41. ```
  42. Note: if something goes wrong, run `npx workers-mcp help`
  43. ### Step 4..♾️: Iterating
  44. 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.
  45. 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.
  46. 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.
  47. ## Using with Other MCP Clients
  48. ### Cursor
  49. 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'.
  50. For example, if your config file looks like:
  51. ```json
  52. {
  53. "mcpServers": {
  54. "your-mcp-server-name": {
  55. "command": "/path/to/workers-mcp",
  56. "args": [
  57. "run",
  58. "your-mcp-server-name",
  59. "https://your-server-url.workers.dev",
  60. "/path/to/your/project"
  61. ],
  62. "env": {}
  63. }
  64. }
  65. }
  66. ```
  67. In Cursor, create an MCP server entry with:
  68. * type: `command`
  69. * command: `/path/to/workers-mcp run your-mcp-server-name https://your-server-url.workers.dev /path/to/your/project`
  70. ### Other MCP Clients
  71. For Windsurf and other MCP clients, update your configuration file to include your worker so you could use the tools directly from the client:
  72. ```json
  73. {
  74. "mcpServers": {
  75. "your-mcp-server-name": {
  76. "command": "/path/to/workers-mcp",
  77. "args": [
  78. "run",
  79. "your-mcp-server-name",
  80. "https://your-server-url.workers.dev",
  81. "/path/to/your/project"
  82. ],
  83. "env": {}
  84. }
  85. }
  86. }
  87. ```
  88. Make sure to replace the placeholders with your actual server name, URL, and project path.
  89. ## Examples
  90. See the `examples` directory for a few ideas of what to use this for:
  91. * `examples/01-hello-world` is a snapshot taken after the installation instructions above
  92. * `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.
  93. * TODO Browser Rendering
  94. * TODO Durable Objects

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.