mcp-worker-template
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-worker-templateget the weather for San Francisco"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-worker-template
An MCP server on Cloudflare Workers with zero runtime dependencies. No SDK, no framework — a hand-rolled Streamable HTTP transport in ~190 lines you can read in one sitting, plus one file where your tools live.
git clone https://github.com/AayushCharde/mcp-worker-template my-mcp-server
cd my-mcp-server && npm install && cp .dev.vars.example .dev.vars
npm run dev # → http://localhost:8787/mcpTest it:
curl -s http://localhost:8787/mcp \
-H 'Authorization: Bearer dev-token-change-me' \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"echo","arguments":{"message":"hello"}}}'Connect it to Claude Code:
claude mcp add --transport http my-server http://localhost:8787/mcp \
--header "Authorization: Bearer dev-token-change-me"Why no SDK?
Most MCP server examples pull in the official SDK, an HTTP framework, and a session layer. For a tools-only server, the protocol surface is four methods: initialize, tools/list, tools/call, ping. That's small and stable enough to own outright:
Zero runtime dependencies — nothing to update, nothing to audit, no bundle bloat. The Worker is two source files.
Nothing is magic — when a client misbehaves, you read your own 190-line transport, not a stack trace through someone else's abstraction.
Stateless by design — no sessions, no SSE stream, no Durable Objects. Every request is self-contained, which is exactly the shape Cloudflare Workers want.
The trade-off: no server→client notifications, resources, or prompts. If you need those, use the official SDK — this template is for the (very common) case where you just want tools.
Related MCP server: Remote MCP Server (Authless)
Adding a tool
Everything you touch is in src/tools.ts. A tool is a name, a description, a JSON Schema for its input, and a run function:
{
name: 'get_weather',
description: 'Current weather for a city.',
inputSchema: {
type: 'object',
properties: { city: { type: 'string' } },
required: ['city'],
additionalProperties: false
},
async run(args, { env }) {
const res = await fetch(`https://api.example.com/weather?q=${args.city}`);
if (!res.ok) throw new ToolError(`Weather API returned ${res.status}`);
return res.json();
}
}Throw ToolError for failures the client should see verbatim; any other exception is masked as a generic internal error so implementation details never leak. Need bindings (KV, D1, a database URL)? Add them to Environment in src/index.ts — they arrive in every tool via ctx.env.
Auth model — read this before deploying
Auth is a single static bearer token (MCP_BEARER_TOKEN), compared in constant time. That token is the entire trust boundary: anyone who has it can call every tool. This is the right shape for a personal server or an internal integration; it is not multi-tenant. If different users need different permissions, you need OAuth (see the MCP authorization spec) — at which point the official SDK starts earning its keep.
openssl rand -hex 32 # generate a real token
npx wrangler secret put MCP_BEARER_TOKEN # set it in productionDeploy
npm run check # wrangler types + tsc --noEmit
npm run deploy # → https://my-mcp-server.<your-subdomain>.workers.dev/mcpRename the worker in wrangler.jsonc first.
Transport details (for the curious)
The spec-relevant behavior, all in src/index.ts:
Behavior | Implementation |
Protocol versions | Negotiates |
Notifications | No response body; HTTP |
JSON-RPC batches | Accepted; responses filtered of notification slots |
|
|
Unknown method |
|
CORS | Permissive by default ( |
Real-world example
This transport was extracted from Junto, a keyboard-first task tracker whose MCP server lets Claude list, create, and update tasks in a live Postgres database — see apps/mcp there for what a production instance of this pattern looks like (per-request DB clients, workspace scoping, activity logging).
License
MIT © Aayush Charde
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Flicense-qualityCmaintenanceA template for deploying authentication-free MCP servers on Cloudflare Workers. Enables quick deployment of custom tools accessible via SSE from MCP clients like Claude Desktop or Cloudflare AI Playground.Last updated
- Flicense-qualityCmaintenanceA template for deploying an authentication-free remote MCP server on Cloudflare Workers. Enables quick deployment of custom tools accessible from MCP clients like Claude Desktop or the Cloudflare AI Playground via SSE endpoints.Last updated
- Flicense-qualityDmaintenanceA template for deploying an authentication-free MCP server on Cloudflare Workers. Provides a foundation for building custom tools accessible via SSE from MCP clients like Claude Desktop or the Cloudflare AI Playground.Last updated
- Flicense-qualityDmaintenanceA template for deploying an authentication-free MCP server on Cloudflare Workers. Enables custom tool creation and connection from MCP clients like Claude Desktop or the Cloudflare AI Playground.Last updated
Related MCP Connectors
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
An MCP server for Arcjet - the runtime security platform that ships with your AI code.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/AayushCharde/mcp-worker-template'
If you have feedback or need assistance with the MCP directory API, please join our Discord server