Skip to main content
skill CX Codex

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.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add secondsky/claude-skills --skill cloudflare-mcp-server -a claude-code
Open on GitHub

What 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-code

2Manually: put the files in place

~/.claude/skills/cloudflare-mcp-server/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/cloudflare-mcp-server/

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

Similar skills

All skills for Backend and APIs →

From the same set94

multi-ai-consultant A skill that pulls in outside AIs when Claude is stuck on a bug or weighing an architecture call. Their answers get merged into one review. CX Codex +1 384installs graphql-implementation A skill for building GraphQL APIs: schema, resolvers, error codes and N+1 protection. Useful when moving off REST or adding real-time subscriptions. CX Codex +1 380installs model-deployment A skill for getting a trained model into production: FastAPI server, Docker, Kubernetes, monitoring and drift detection. Useful once the model works and serving does not. CX Codex +1 379installs cloudflare-agents A skill for building AI agents on Cloudflare Workers with tools, MCP and LLM providers. Useful when the agent runs inside a worker. CX Codex +1 378installs thesys-generative-ui A skill that teaches your agent to build React components from plain-language prompts with the Thesys SDK. Handy when you want a UI sketched out from a description. CX Codex +1 371installs maz-ui This skill teaches your agent Maz-UI v4: 50+ components, composables and directives for Vue 3 and Nuxt 3. Handy when you build forms, dialogs or data tables. CX Codex +1 369installs woocommerce-dev-cycle A skill that walks you through the WooCommerce dev cycle: run tests, fix code style, sort out linting errors. CX Codex +1 361installs woocommerce-copy-guidelines A skill that sets the rules for user-facing text in WooCommerce: button labels, field names, messages and docs. Useful when more than one person writes the storefront strings. CX Codex +1 363installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor