cloudflare-mcp-server — Claude Code skill: MCP servers on Workers
A skill for building MCP servers on Cloudflare Workers: tools, resources, prompts and transport choices. Useful when you write your own server for an AI agent.
npx skills add secondsky/claude-skills --skill cloudflare-mcp-server -a claude-codeWhat cloudflare-mcp-server does
The skill walks through building an MCP server on Cloudflare Workers. It ships TypeScript examples built on @modelcontextprotocol/sdk: creating a server with McpServer, registering tools through server.tool(), defining parameters and handlers. Four templates cover the common shapes — a minimal server, a set of tools, a stateful server with Durable Objects and a WebSocket transport.
The reference files split by topic. references/quick-start-guide.md goes over the official Cloudflare templates and a step-by-step workflow, references/core-concepts.md explains the difference between tools, resources, prompts and transports, and references/worker-basics.md covers Worker and Durable Objects basics with transport selection. For state there is references/stateful-servers.md on Durable Objects, WebSocket hibernation and cost control, while references/production-deployment.md gathers deployment, testing, configuration, auth patterns and 22 known errors with fixes.
Everything here assumes TypeScript and the @modelcontextprotocol/sdk package, so a project without Node and that dependency will not get far. Stateful servers need Durable Objects — that is a separate Cloudflare primitive, and it belongs in the design from the start rather than bolted on after the first deploy.
What it helps with
- scaffold an MCP server on Cloudflare Workers from scratch
- register tools an AI agent can call
- pick between SSE, HTTP and WebSocket transports
- add state to a server with Durable Objects
- work through MCP server deploy errors on Workers
Example prompts for the agent
- build an MCP server on Cloudflare Workers with one docs search tool
- show me how to wire Durable Objects into an MCP server and handle WebSocket hibernation
- help me deploy the MCP server to Workers and check the configuration
How to install cloudflare-mcp-server
1Skills CLI (Vercel)
npx skills add secondsky/claude-skills --skill cloudflare-mcp-server -a claude-code2Manually: put the files in place
~/.claude/skills/cloudflare-mcp-server/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/cloudflare-mcp-server/
1Skills CLI (Vercel)
npx skills add secondsky/claude-skills --skill cloudflare-mcp-server -a codex2Manually: put the files in place
.agents/skills/cloudflare-mcp-server/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add secondsky/claude-skills --skill cloudflare-mcp-server -a cursor2Manually: put the files in place
.cursor/skills/cloudflare-mcp-server/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install secondsky/claude-skills cloudflare-mcp-server2Manually: put the files in place
.github/skills/cloudflare-mcp-server/SKILL.md1Skills CLI (Vercel)
npx skills add secondsky/claude-skills --skill cloudflare-mcp-server -a gemini-cli2Platform CLI
gemini skills install https://github.com/secondsky/claude-skills --path plugins/cloudflare-mcp-server/skills/cloudflare-mcp-serverManually: put the files in place
.devin/skills/cloudflare-mcp-server/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add secondsky/claude-skills --skill cloudflare-mcp-server -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about cloudflare-mcp-server
How do I install cloudflare-mcp-server in Claude?
Run npx skills add secondsky/claude-skills --skill cloudflare-mcp-server -a claude-code. The skill then lives at ~/.claude/skills/cloudflare-mcp-server/SKILL.md.
What does cloudflare-mcp-server do?
It helps you write MCP servers on Cloudflare Workers: tools, resources, prompts and transports. It includes TypeScript templates plus references on deployment and state.
What do I need for the skill to work?
A TypeScript project with the @modelcontextprotocol/sdk package. Stateful servers also need Durable Objects.
Source text
SKILL.md · MIT
---
name: cloudflare-mcp-server
description: Build MCP (Model Context Protocol) servers on Cloudflare Workers with tools, resources, and prompts.
license: MIT
---
# Cloudflare MCP Server
**Last Updated**: 2025-11-21
## Quick Start
```typescript
import { McpServer } from '@modelcontextprotocol/sdk';
const server = new McpServer({
name: 'my-server',
version: '1.0.0'
});
server.tool('getTodo', async ({ id }) => ({
id,
title: 'Task',
completed: false
}));
export default server;
```
## Core Concepts
- **Tools**: Functions AI can call
- **Resources**: Data AI can access
- **Prompts**: Reusable templates
- **Transports**: SSE, HTTP, WebSocket
## Example Tool
```typescript
server.tool('searchDocs', {
description: 'Search documentation',
parameters: {
type: 'object',
properties: {
query: { type: 'string' }
}
},
handler: async ({ query }) => {
return { results: [...] };
}
});
```
## Resources
### Core Documentation
- `references/quick-start-guide.md` (704 lines) - Official Cloudflare templates, complete step-by-step workflow, 5-minute setup
- `references/core-concepts.md` (66 lines) - MCP fundamentals: tools, resources, prompts, transports
- `references/worker-basics.md` (326 lines) - Worker & Durable Objects basics, transport selection, HTTP fundamentals
- `references/stateful-servers.md` (246 lines) - Durable Objects integration, WebSocket hibernation, cost optimization, common patterns
- `references/production-deployment.md` (814 lines) - Deployment & testing, configuration reference, authentication patterns, 22 known errors with solutions
### Templates
- `templates/basic-mcp.ts` - Minimal MCP server
- `templates/tools-example.ts` - Tool definitions
- `templates/durable-object-mcp.ts` - Stateful MCP with DO
- `templates/websocket-mcp.ts` - WebSocket transport
**Official Docs**: https://modelcontextprotocol.io | **Cloudflare**: https://developers.cloudflare.com/workers/runtime-apis/durable-objects/
© secondsky · MIT · secondsky/claude-skills