CF-MCP
Demonstrates how to deploy an MCP server on Cloudflare Workers edge network, wrapping REST API endpoints as MCP tools for globally distributed access with low latency.
Uses Hono as the routing framework to serve both REST API endpoints and MCP protocol handlers within a single Cloudflare Worker application.
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., "@CF-MCPlist all electronics products"
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.
CF-MCP: REST API + MCP Server on Cloudflare Workers
A single Cloudflare Worker that serves both a REST API and an MCP (Model Context Protocol) interface.
Architecture
┌─────────────────────────────────────┐
│ Cloudflare Worker (Edge) │
│ │
│ ┌────────────────────────────────┐ │
│ │ Hono Router │ │
│ │ │ │
│ │ /api/* ─── REST API │ │
│ │ │ │
│ │ /mcp ─── MCP Protocol │ │
│ │ (wraps REST) │ │
│ └────────────────────────────────┘ │
└─────────────────────────────────────┘Related MCP server: Remote MCP Server
Features
REST API Endpoints
GET /api/products- List all products (with filtering)GET /api/products/:id- Get a single productPOST /api/products- Create a new productPUT /api/products/:id- Update a productDELETE /api/products/:id- Delete a product
MCP Tools
The MCP endpoint wraps all REST operations as tools:
list_products- Query products with filtersget_product- Retrieve product detailscreate_product- Add new productsupdate_product- Modify existing productsdelete_product- Remove products
Getting Started
Install Dependencies
npm installRun Locally
npm run devThe server will start at http://localhost:8787
Test REST API
# List all products
curl http://localhost:8787/api/products
# Get a specific product
curl http://localhost:8787/api/products/1
# Filter by category
curl http://localhost:8787/api/products?category=Electronics
# Create a product
curl -X POST http://localhost:8787/api/products \
-H "Content-Type: application/json" \
-d '{"name":"Laptop","price":999,"description":"Powerful laptop","category":"Electronics"}'Test MCP Endpoint
# List available tools
curl -X POST http://localhost:8787/mcp \
-H "Content-Type: application/json" \
-d '{"method":"tools/list","params":{}}'
# Call a tool
curl -X POST http://localhost:8787/mcp \
-H "Content-Type: application/json" \
-d '{"method":"tools/call","params":{"name":"list_products","arguments":{"category":"Electronics"}}}'Deploy to Cloudflare
npm run deployAfter deployment, your API will be available globally on Cloudflare's edge network!
Key Patterns Demonstrated
1. REST-to-MCP Translation
Each REST endpoint maps to an MCP tool:
REST parameters → MCP tool arguments
REST responses → MCP tool results
REST authentication → MCP tool context
2. Edge Deployment
Single worker serves both interfaces
Global distribution via Cloudflare's network
Low latency for both REST and MCP calls
3. Unified Codebase
Share business logic between REST and MCP
DRY principle: define operations once
Easy to maintain and extend
Project Structure
cf-mcp/
├── src/
│ ├── index.ts # Main Hono app + routing
│ ├── api.ts # REST API endpoints
│ └── mcp.ts # MCP protocol handler
├── wrangler.toml # Cloudflare config
├── package.json
└── tsconfig.jsonNext Steps
Add authentication (API keys, OAuth)
Implement rate limiting
Add caching with Cloudflare KV
Connect to Cloudflare D1 for persistent storage
Add streaming responses
Implement pagination
Learn More
Course Title
"From the Edge and Back: Turn Any REST API into an MCP Server"
A practical, code-heavy session showing how to wrap any REST API with the Model Context Protocol and deploy it to Cloudflare Workers for lightning-fast, globally distributed access.
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
- AlicenseBqualityDmaintenanceA demonstration project that uses Cloudflare Workers MCP to create custom AI tools that can be integrated with Claude, Cursor, and other AI assistants supporting the Model Context Protocol.Last updated21430MIT
- Flicense-qualityCmaintenanceA Cloudflare Workers-based implementation of Model Context Protocol (MCP) server that enables AI assistants like Claude to access external tools and capabilities through a standardized interface with OAuth authentication.Last updated14
- Flicense-qualityFmaintenanceA Cloudflare Workers implementation of Model Context Protocol (MCP) server that enables AI tools to be exposed to Claude and other assistants through OAuth authentication.Last updated14
- Flicense-qualityCmaintenanceA deployable Cloudflare Workers service that implements Model Context Protocol without authentication, allowing AI models to access custom tools via clients like Claude Desktop or Cloudflare AI Playground.Last updated
Related MCP Connectors
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
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/HeyGarrison/cf-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server