{"id":23616877,"url":"https://github.com/cloudflare/workers-mcp","last_synced_at":"2025-05-14T23:05:52.085Z","repository":{"id":269799179,"uuid":"904965896","full_name":"cloudflare/workers-mcp","owner":"cloudflare","description":"Talk to a Cloudflare Worker from Claude Desktop!","archived":false,"fork":false,"pushed_at":"2025-04-05T01:47:51.000Z","size":252,"stargazers_count":516,"open_issues_count":17,"forks_count":48,"subscribers_count":15,"default_branch":"main","last_synced_at":"2025-05-13T12:07:49.028Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/workers-mcp","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudflare.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-17T22:26:38.000Z","updated_at":"2025-05-12T10:11:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"02faca96-ca95-4187-8f0a-eb0fae6fab4e","html_url":"https://github.com/cloudflare/workers-mcp","commit_stats":null,"previous_names":["cloudflare/workers-mcp"],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2Fworkers-mcp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2Fworkers-mcp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2Fworkers-mcp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2Fworkers-mcp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudflare","download_url":"https://codeload.github.com/cloudflare/workers-mcp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253939184,"owners_count":21987411,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-27T18:14:53.128Z","updated_at":"2025-05-14T23:05:47.001Z","avatar_url":"https://github.com/cloudflare.png","language":"TypeScript","funding_links":[],"categories":["📚 Projects (1974 total)","🌐 Web Development","🧑‍🚀 Tools and code","Cloud Platforms","APIs and HTTP Requests","TypeScript"],"sub_categories":["MCP Servers","How to Submit"],"readme":"# `workers-mcp`\n\n\u003e **Talk to a Cloudflare Worker from Claude Desktop!**\n\n\u003e [!WARNING]  \n\u003e You should start [here](https://developers.cloudflare.com/agents/guides/remote-mcp-server/) instead — and build a **remote** MCP server\n\u003e\n\u003e 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/).\n\n### What is `workers-mcp`?\n\nThis 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:\n\n```ts\nexport class ExampleWorkerMCP extends WorkerEntrypoint\u003cEnv\u003e {\n  /**\n   * Generates a random number. This is extra random because it had to travel all the way to\n   * your nearest Cloudflare PoP to be calculated which... something something lava lamps?\n   *\n   * @return {string} A message containing a super duper random number\n   * */\n  async getRandomNumber() {\n    return `Your random number is ${Math.random()}`\n  }\n  \n  // ...etc\n}\n```\n\n...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.\n\n![image](https://github.com/user-attachments/assets/c16b2631-4eba-4914-8e26-d6ccea0fc578)\n\n\u003e \u003csub\u003eYes, I know that `Math.random()` works the same on a Worker as it does on your local machine, but don't tell Claude\u003c/sub\u003e 🤫\n\n## Usage\n\n### Step 1: Generate a new Worker\n\nUse `create-cloudflare` to generate a new Worker.\n\n```shell\nnpx create-cloudflare@latest my-new-worker\n```\n\nI suggest choosing a `Hello World` worker.\n\n### Step 2: Install `workers-mcp`\n\n```shell\ncd my-new-worker # I always forget this bit\nnpm install workers-mcp\n```\n\n### Step 3: Run the `setup` command\n\n```shell\nnpx workers-mcp setup\n```\n\nNote: if something goes wrong, run `npx workers-mcp help`\n\n### Step 4..♾️: Iterating\n\nAfter 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.\n\nHowever, 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.\n\nYou 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.\n\n## Using with Other MCP Clients\n\n### Cursor\n\nTo 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'.\n\nFor example, if your config file looks like:\n\n```json\n{\n  \"mcpServers\": {\n    \"your-mcp-server-name\": {\n      \"command\": \"/path/to/workers-mcp\",\n      \"args\": [\n        \"run\",\n        \"your-mcp-server-name\",\n        \"https://your-server-url.workers.dev\",\n        \"/path/to/your/project\"\n      ],\n      \"env\": {}\n    }\n  }\n}\n```\n\nIn Cursor, create an MCP server entry with:\n* type: `command`\n* command: `/path/to/workers-mcp run your-mcp-server-name https://your-server-url.workers.dev /path/to/your/project`\n\n### Other MCP Clients\n\nFor Windsurf and other MCP clients, update your configuration file to include your worker so you could use the tools directly from the client:\n\n```json\n{\n  \"mcpServers\": {\n    \"your-mcp-server-name\": {\n      \"command\": \"/path/to/workers-mcp\",\n      \"args\": [\n        \"run\",\n        \"your-mcp-server-name\",\n        \"https://your-server-url.workers.dev\",\n        \"/path/to/your/project\"\n      ],\n      \"env\": {}\n    }\n  }\n}\n```\n\nMake sure to replace the placeholders with your actual server name, URL, and project path.\n\n## Examples\n\nSee the `examples` directory for a few ideas of what to use this for:\n\n* `examples/01-hello-world` is a snapshot taken after the installation instructions above\n* `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.\n* TODO Browser Rendering\n* TODO Durable Objects\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudflare%2Fworkers-mcp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudflare%2Fworkers-mcp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudflare%2Fworkers-mcp/lists"}