Cloudflare Workers
About
Cloudflare Workers-based MCP implementation enables AI assistants to execute custom serverless logic at the edge.
Details
- Author
- geelen
- Repository
- geelen/workers-mcp
- GitHub stars
- 21
- Downloads
- 379
- Categories
- Productivity, Design, Developer Tools, AI, Infrastructure, Cloud Service, Frontend
Jump to
- Connects Claude Desktop to Cloudflare Workers
- Exposes Worker RPC methods as MCP tools
- Uses simple shared‑key authentication
- Generates tool documentation from JSDoc
- Automates secret generation and deployment
- Supports iterative development with redeploy
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.)npxArguments-
Argument 1
-y -
Argument 2
@highlight/mcp-server
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
Install with npm install workers-mcp, then run npx workers-mcp help for instructions. Create a Worker with a WorkerEntrypoint that exports RPC methods documented with JSDoc. Add workers-mcp docgen src/index.ts to your deploy script, add a fetch handler that proxies events to your entrypoint using ProxyToSelf, generate a shared secret with workers-mcp secret generate, deploy with npm run deploy, and finally run workers-mcp install <alias> <url> to add the Worker to Claude Desktop.
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"cloudflare workers": {
"env": {},
"args": [
"-y",
"@highlight/mcp-server"
],
"command": "npx"
}
}
}
Linux
{
"env": [],
"args": [
"-y",
"@highlight/mcp-server"
],
"command": "npx"
}
Macos
{
"env": [],
"args": [
"-y",
"@highlight/mcp-server"
],
"command": "npx"
}
Windows
{
"env": [],
"args": [
"/c",
"npx",
"-y",
"@highlight/mcp-server"
],
"command": "cmd"
}
\# \workers-mcp\
\> \\Talk to a Cloudflare Worker from Claude Desktop!\\
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.
Usage
Step 1: Generate a new Worker
Use \npx create-cloudflare@latest\ to generate a new Worker.
You could also start with an existing one, as long as you route your \fetch\ calls appropriately.
Make a new \WorkerEntrypoint\ as your default export, then add \RPC methods\, documented with JSDoc, that Claude can call:
\\\tsYour random number is ${Math.random()}\
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 \\
}
}
\\
\> <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\> 🤫
Step 2: Install \workers-mcp\ & run \help\ for instructions
\\\\
npm install workers-mcp
npx workers-mcp help
\\
Step 3: Add \workers-mcp docgen\ to your \deploy\ step
\\\json\
"scripts": {
"deploy:worker": "workers-mcp docgen src/index.ts && wrangler deploy"
}
\\
Step 4: Add a \fetch\ handler to proxy events to your WorkerEntrypoint
Your Worker must (for now) be available on a public URL for Claude to access it. So we need a fetch handler that both handles auth (we're using simple shared-key auth) and proxies events to the right RPC method.
At the moment, only \ProxySelf\ is provided, but \ProxyToServiceBinding\ and \ProxyToDurableObject\ are planned.
\\\ts\
export class ExampleWorkerMCP extends WorkerEntrypoint<Env\> {
// ...
async fetch(request: Request): Promise<Response\> {
return new ProxyToSelf(this).fetch(request)
}
}
\\
\> Note, you may get a TS error as your \Env\ doesn't contain the \SHARED\_SECRET\ variable. We'll add that in the next step.
Step 5: Generate the secret & do the first deployment
Generate a secret in \.dev.vars\ for use locally, then upload it once we have a Worker to attach it to:
\\\sh\
Generate the secret
npx workers-mcp secret generate
(Optional) Update Env to include SHARED\_SECRET
npx wrangler types
Generate docs and deploy your Worker
npm run deploy
Set the secret on our newly created Worker
npx workers-mcp secret upload
\\
Step 6: Install it into Claude
Use the URL from your successful deployment in step 5, and any local alias you choose.
\\\sh\
npx workers-mcp install <local-alias\> https://<worker-name\>.<my-name\>.workers.dev
\\
Step 7: Start Claude Desktop!
Prompt Claude with something that causes it to invoke the function in your Worker:
!\image\
Step 8..♾️: 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.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





