Cloudflare Server Tools
MCP server: Cloudflare Server Tools
Installation
npx mcp-cloudflare-server-toolsAsk AI about Cloudflare Server Tools
Powered by Claude ยท Grounded in docs
I know everything about Cloudflare Server Tools. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
๐ Cloudflare MCP Server
A production-ready Model Context Protocol (MCP) server built on Cloudflare Workers, exposing 20+ tools that can be consumed by Claude Desktop, MCP Inspector, and future ChatGPT MCP support.
๐ง What is MCP?
Model Context Protocol (MCP) allows AI models (like Claude or ChatGPT) to:
- Discover tools dynamically
- Call tools via structured schemas
- Interact with external systems in a standardized way
This server implements the official MCP specification and exposes reusable utility tools.
โจ Features
- ๐ Remote MCP server (Cloudflare Workers)
- ๐งฐ 20+ tools (Math, Text, Time, Dev utilities)
- ๐ JSON-RPC 2.0 compliant
- โก Serverless & scalable
- ๐ Verified using MCP Inspector
- ๐ค Claude Desktop compatible
- ๐ฎ ChatGPT MCP-ready (when rollout enables UI)
๐๏ธ Project Structure
mcp-cloudflare/
โโโ src/
โ โโโ index.js # MCP server entry point
โ โโโ tools/
โ โโโ index.js # Tool registry
โ โโโ math.js # Math tools
โ โโโ text.js # Text tools
โ โโโ time.js # Time tools
โ โโโ dev.js # Dev/utility tools
โ
โโโ wrangler.jsonc # Cloudflare Worker config
โโโ package.json
โโโ README.md
๐ Quick Start
Prerequisites
- Node.js 16+ installed
- Cloudflare account
- Wrangler CLI installed globally
Installation
# Clone the repository
git clone https://github.com/yashbhadale-20/Cloudflare-based-MCP-server
cd mcp-cloudflare-server_tools
# Install dependencies
npm install
# Login to Cloudflare
wrangler login
Local Development
# Start local dev server
npm run dev
# Test the server (in another terminal)
curl -X POST http://localhost:8787 \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"initialize","params":{},"id":1}'
Deploy to Cloudflare
# Deploy to production
npm run deploy
# Your server will be available at:
# https://mcp-cloudflare30.yashbhadale01.workers.dev
๐ How It Works
1๏ธโฃ MCP Server Initialization
When a client connects, it sends an initialize request:
{
"jsonrpc": "2.0",
"method": "initialize",
"params": {
"protocolVersion": "2024-11-05",
"clientInfo": {
"name": "example-client",
"version": "1.0.0"
}
},
"id": 1
}
The server responds with:
{
"jsonrpc": "2.0",
"result": {
"protocolVersion": "2024-11-05",
"serverInfo": {
"name": "cloudflare-mcp-server",
"version": "1.0.0"
},
"capabilities": {
"tools": {}
}
},
"id": 1
}
2๏ธโฃ Tool Discovery
Client requests available tools:
{
"jsonrpc": "2.0",
"method": "tools/list",
"id": 2
}
Server returns tool definitions:
{
"jsonrpc": "2.0",
"result": {
"tools": [
{
"name": "add",
"description": "Add two numbers",
"inputSchema": {
"type": "object",
"properties": {
"a": { "type": "number" },
"b": { "type": "number" }
},
"required": ["a", "b"]
}
}
]
},
"id": 2
}
3๏ธโฃ Tool Execution
Client calls a tool:
{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "add",
"arguments": {
"a": 5,
"b": 7
}
},
"id": 3
}
Server executes and responds:
{
"jsonrpc": "2.0",
"result": {
"content": [
{
"type": "text",
"text": "12"
}
]
},
"id": 3
}
๐งฐ Available Tools
Math Tools
add- Add two numberssubtract- Subtract two numbersmultiply- Multiply two numbersdivide- Divide two numbers
Text Tools
uppercase- Convert text to uppercaselowercase- Convert text to lowercasereverse_text- Reverse a stringword_count- Count words in textchar_count- Count characters in text
Time Tools
current_time- Get current timecurrent_date- Get current dateunix_timestamp- Get Unix timestamptimezone_ist- Get IST time
Dev/Utility Tools
random_number- Generate random numbergenerate_uuid- Generate UUID v4json_pretty- Pretty-print JSONbase64_encode- Encode to Base64base64_decode- Decode from Base64hash_string- Hash string with SHA-256validate_email- Validate email format
๐ Testing with MCP Inspector
Verify your server using the official MCP Inspector:
# Install and run inspector
npx @modelcontextprotocol/inspector@latest https://mcp-cloudflare30.yashbhadale01.workers.dev
# Or for local testing
npx @modelcontextprotocol/inspector@latest http://localhost:8787
The inspector will verify:
- โ
initializehandshake - โ
tools/listdiscovery - โ
tools/callexecution - โ JSON-RPC compliance
- โ Schema validation
๐ค Client Integration
Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"cloudflare-mcp": {
"transport": "http",
"url": "https://<your-worker>.workers.dev"
}
}
}
Config file locations:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Restart Claude Desktop, and the tools will be available automatically.
ChatGPT (Future)
When ChatGPT enables MCP UI:
- Open ChatGPT settings
- Add MCP server URL
- Tools auto-discover
- No server changes required
๐ Configuration
wrangler.jsonc
{
"name": "mcp-cloudflare-server",
"main": "src/index.js",
"compatibility_date": "2024-01-01",
"node_compat": true
}
package.json
{
"name": "mcp-cloudflare-server",
"version": "1.0.0",
"scripts": {
"dev": "wrangler dev",
"deploy": "wrangler deploy"
},
"devDependencies": {
"wrangler": "^3.0.0"
}
}
๐ก๏ธ Security Considerations
This is a public MCP server with no authentication by default. For production use, consider:
Adding API Key Authentication
// In src/index.js
const API_KEY = env.API_KEY; // Store in Cloudflare secrets
if (request.headers.get('Authorization') !== `Bearer ${API_KEY}`) {
return new Response('Unauthorized', { status: 401 });
}
Rate Limiting
// Using Cloudflare Rate Limiting
// Configure in wrangler.jsonc or via dashboard
CORS Configuration
const corsHeaders = {
'Access-Control-Allow-Origin': 'https://claude.ai',
'Access-Control-Allow-Methods': 'POST, OPTIONS',
'Access-Control-Allow-Headers': 'Content-Type',
};
๐ Future Enhancements
- ๐ค AI-powered tools (OpenAI/Claude integration)
- ๐ Authentication & API keys
- โ๏ธ Database-backed tools (KV/D1)
- ๐ Logging & monitoring (Logpush)
- ๐ Webhooks & async tools
- ๐ฆ MCP template repository
- ๐งช Comprehensive test suite
๐ Troubleshooting
"Tools not showing in Claude Desktop"
- Verify config file path
- Restart Claude Desktop completely
- Check server is accessible:
curl https://mcp-cloudflare30.yashbhadale01.workers.dev - Verify JSON syntax in config
"CORS errors"
Add proper CORS headers in src/index.js
"Invalid JSON-RPC response"
Ensure all responses follow JSON-RPC 2.0 format with jsonrpc, result/error, and id fields
๐ Resources
๐จโ๐ป Author
Yash Bhadale
Built as a hands-on implementation of Model Context Protocol using Cloudflare Workers.
โญ Why This Project Matters
This repository demonstrates:
- โ Real MCP protocol implementation
- โ Cloud-native AI tooling
- โ Production-grade architecture
- โ Future-ready AI integration
- โ Serverless best practices
If you're learning MCP โ this is a complete reference implementation.
๐ License
MIT License - feel free to use this in your own projects!
๐ค Contributing
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
โญ If this project helped you, please star the repository!
