Cloudflare MCP Server
Last Updated: 2025-11-21
Quick Start
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
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/
1---2name: cloudflare-mcp-server3description: Build MCP (Model Context Protocol) servers on Cloudflare Workers with tools, resources, and prompts.4license: MIT5metadata:6 source: https://skillmd.com/skills/secondsky/cloudflare-mcp-server7---89# Cloudflare MCP Server1011**Last Updated**: 2025-11-211213## Quick Start1415```typescript16import { McpServer } from '@modelcontextprotocol/sdk';1718const server = new McpServer({19 name: 'my-server',20 version: '1.0.0'21});2223server.tool('getTodo', async ({ id }) => ({24 id,25 title: 'Task',26 completed: false27}));2829export default server;30```3132## Core Concepts3334- **Tools**: Functions AI can call35- **Resources**: Data AI can access36- **Prompts**: Reusable templates37- **Transports**: SSE, HTTP, WebSocket3839## Example Tool4041```typescript42server.tool('searchDocs', {43 description: 'Search documentation',44 parameters: {45 type: 'object',46 properties: {47 query: { type: 'string' }48 }49 },50 handler: async ({ query }) => {51 return { results: [...] };52 }53});54```5556## Resources5758### Core Documentation59- `references/quick-start-guide.md` (704 lines) - Official Cloudflare templates, complete step-by-step workflow, 5-minute setup60- `references/core-concepts.md` (66 lines) - MCP fundamentals: tools, resources, prompts, transports61- `references/worker-basics.md` (326 lines) - Worker & Durable Objects basics, transport selection, HTTP fundamentals62- `references/stateful-servers.md` (246 lines) - Durable Objects integration, WebSocket hibernation, cost optimization, common patterns63- `references/production-deployment.md` (814 lines) - Deployment & testing, configuration reference, authentication patterns, 22 known errors with solutions6465### Templates66- `templates/basic-mcp.ts` - Minimal MCP server67- `templates/tools-example.ts` - Tool definitions68- `templates/durable-object-mcp.ts` - Stateful MCP with DO69- `templates/websocket-mcp.ts` - WebSocket transport7071**Official Docs**: https://modelcontextprotocol.io | **Cloudflare**: https://developers.cloudflare.com/workers/runtime-apis/durable-objects/