Cloudflare MCP Toolbox
Provides tools for Cloudflare Workers AI (chat, classification, and embeddings) and Cloudflare KV storage with TTL, enabling AI agents to run inference and persist key-value data at the edge.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Cloudflare MCP Toolbox
Utility tools for AI agents - date/time, math, text processing, validation, KV storage, and Workers AI integration.
Built on Cloudflare Workers for global edge deployment with zero cold starts.
Live Demo: https://cloudflare-mcp-toolbox.webfonts.workers.dev
π Features
30 Utility Tools across 6 categories
Australia/Sydney timezone as default for all date/time operations
Bearer token authentication for secure access
Cloudflare Workers AI integration with automatic embedding caching
Edge deployment with global low-latency access
MCP Protocol compliant (Model Context Protocol)
Related MCP server: TinyFn MCP Server
π¦ Tool Categories
Category | Tools | Description |
Date/Time (5) | get_current_datetime, convert_timezone, calculate_duration, format_date, parse_date | Timezone conversion, duration calculations, natural language date parsing |
Math (6) | calculate, convert_units, statistics, random_number, percentage, roll_dice | Safe expression evaluation, unit conversions, crypto-secure random, dice rolling |
Text (6) | transform_text, encode_decode, extract_patterns, hash_text, count_words, truncate_text | Text transformation, encoding, pattern extraction, hashing |
Validation (6) | validate_email, validate_url, validate_phone, validate_json, sanitize_html, validate_schema | Input validation and sanitization |
KV Storage (4) | kv_get, kv_set, kv_delete, kv_list | Persistent key-value storage with TTL |
Workers AI (3) | ai_chat, ai_classify, ai_embed | LLM inference, sentiment analysis, text embeddings |
π§ Setup
Prerequisites
Node.js 18+
Cloudflare account with Workers AI enabled
Wrangler CLI
Installation
npm installConfiguration
KV Namespace:
wrangler kv namespace create MCP_TOOLBOX_CACHEUpdate
wrangler.jsoncwith the returned ID:"kv_namespaces": [ { "binding": "CACHE", "id": "YOUR_KV_NAMESPACE_ID" } ]Generate AUTH_TOKEN:
node -e "console.log(require('crypto').randomBytes(32).toString('base64url'))"Update
wrangler.jsonc:"vars": { "AUTH_TOKEN": "YOUR_GENERATED_TOKEN_HERE" }
Deploy
npm run deployLocal Development
npm run devServer will start at http://localhost:8787
π Usage
BetterChat Configuration
Add to your BetterChat MCP servers config:
{
"url": "https://your-worker.workers.dev/mcp",
"headers": {
"Authorization": "Bearer YOUR_AUTH_TOKEN_HERE"
}
}Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"cloudflare-toolbox": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://your-worker.workers.dev/mcp"],
"env": {
"MCP_REMOTE_HEADERS": "{\"Authorization\":\"Bearer YOUR_TOKEN\"}"
}
}
}
}MCP Inspector (Testing)
npx @modelcontextprotocol/inspector \
https://your-worker.workers.dev/mcp \
-H "Authorization: Bearer YOUR_TOKEN"MCP Protocol
Initialize:
{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2024-11-05"
}
}List Tools:
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/list"
}Call Tool:
{
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {
"name": "get_current_datetime",
"arguments": {}
}
}π― Example Tool Calls
Date/Time
// Get current time in Sydney
get_current_datetime({ timezone: "Australia/Sydney", format: "readable" })
// β "Wednesday, November 6, 2025 at 2:30 PM AEDT"
// Parse natural language
parse_date({ expression: "next Friday at 3pm" })
// β "2025-11-08T15:00:00+11:00"Math
// Calculate expression
calculate({ expression: "2 + 2 * 3" })
// β "8"
// Roll dice
roll_dice({ notation: "2d6+5" })
// β { "rolls": [3, 5], "sum": 8, "total": 13 }
// Convert units
convert_units({ value: 100, from_unit: "km", to_unit: "miles" })
// β "62.137"Text
// Transform text
transform_text({ text: "Hello World", operation: "slug" })
// β "hello-world"
// Extract emails
extract_patterns({ text: "Contact us at support@example.com", pattern: "emails" })
// β ["support@example.com"]Validation
// Validate email
validate_email({ email: "user@example.com" })
// β { "valid": true, "email": "user@example.com" }
// Sanitize HTML
sanitize_html({ html: "<script>alert('xss')</script>Hello", mode: "strip" })
// β "Hello"KV Storage
// Store data
kv_set({ key: "user_prefs", value: { theme: "dark" }, ttl: 3600 })
// β { "success": true, "expires_at": 1730894400 }
// Retrieve data
kv_get({ key: "user_prefs", type: "json" })
// β { "found": true, "value": { "theme": "dark" } }Workers AI
// Chat completion
ai_chat({ prompt: "What is the capital of Australia?" })
// β { "response": "The capital of Australia is Canberra.", ... }
// Sentiment analysis
ai_classify({ text: "This is amazing!" })
// β { "classification": "POSITIVE", "score": 0.9987 }
// Generate embeddings (cached)
ai_embed({ text: "Cloudflare Workers are serverless functions" })
// β { "embedding": [...], "dimensions": 768 }π Security
Bearer Token Authentication: All MCP endpoints require valid
Authorization: Bearer TOKENheaderInput Validation: All inputs validated before processing
Safe Expression Evaluation: Math expressions use recursive descent parser (no
eval()orFunction())HTML Sanitization: XSS protection via tag stripping or entity escaping
Rate Limiting: Can be added via KV-based tracking (see Phase 8 docs)
π Documentation
API Endpoints: See
docs/API_ENDPOINTS.mdfor complete tool documentationImplementation: See
docs/IMPLEMENTATION_PHASES.mdfor build phasesMCP Protocol: https://modelcontextprotocol.io
π οΈ Development
Project Structure
cloudflare-mcp-toolbox/
βββ src/
β βββ index.ts # Main Hono app + auth
β βββ mcp/
β β βββ server.ts # MCP request handler
β β βββ types.ts # TypeScript types
β β βββ tools.ts # Tool definitions (30 tools)
β βββ handlers/ # Tool implementations
β β βββ datetime.ts # Date/time tools (5)
β β βββ math.ts # Math tools (6)
β β βββ text.ts # Text tools (6)
β β βββ validation.ts # Validation tools (6)
β β βββ kv.ts # KV tools (4)
β β βββ ai.ts # AI tools (3)
β βββ utils/
β βββ responses.ts # MCP response builders
βββ docs/
β βββ API_ENDPOINTS.md # Complete tool documentation
β βββ IMPLEMENTATION_PHASES.md # Build phases
βββ wrangler.jsonc # Cloudflare config
βββ package.json
βββ tsconfig.jsonAdding New Tools
Create handler function in appropriate
src/handlers/*.tsfileAdd tool definition to
src/mcp/tools.tsWire handler in
src/mcp/server.tsswitch statementTest locally with
npm run devDeploy with
npm run deploy
π¦ Status
β All 30 tools implemented and tested β Deployed to Cloudflare Workers β Bearer token authentication enabled β KV namespace configured β Workers AI binding active β Production ready
π License
MIT
π€ Author
Jeremy Dawes (Jez) Jezweb | AI Engineer jeremy@jezweb.net | www.jezweb.com.au
π Built With
Cloudflare Workers - Serverless edge platform
Hono - Lightweight web framework
Workers AI - LLM inference at the edge
Cloudflare KV - Key-value storage
MCP Protocol - Model Context Protocol
Total Tools: 30 Categories: 6 Global Edge Deployment: β Cold Start Time: 0ms Authentication: Bearer Token Default Timezone: Australia/Sydney
Known Issues
Custom domain timeout issue - Long-lived MCP connections timeout on custom domains but work on
*.workers.devURLs. Tracked at: https://github.com/cloudflare/workers-oauth-provider/issues/121Workaround: Use the workers.dev URL instead of custom domain
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
This server cannot be deployed
Maintenance
Related MCP Connectors
The agent-native cloud: database, functions, AI, storage, computers. 53 tools. OAuth or API key.
JSON/YAML, regex, diff, JWT, SQL dialects β the keyless millisecond ops an agent needs mid-task.
Current time, timezone conversion & date math for AI agents. On Cloudflare Workers.
Pay-per-call tools for AI agents, paid in USDC on Base or Solana. Web search, page and PDF reading, crypto news, Hyperliquid perps, market pulse, Chainlink price history, token checks, SEC filings, weather and more. Free calls every day, and a failed call costs nothing. Works with Tollkit Wallet.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to dynamically discover and invoke containerized tools that can be registered at runtime without redeployment. Built on Cloudflare Workers with scale-to-zero containers for secure, isolated tool execution.-

TinyFn MCP Serverofficial
AlicenseNot gradedqualityCmaintenanceProvides over 500 deterministic tools for math, conversions, validation, hashing, and more, enabling AI agents to perform accurate calculations and data transformations without hallucination.1MIT- AlicenseAqualityCmaintenanceEnables AI agents to access Cloudflare Workers AI for serverless LLM chat completions, text embeddings, and image generation via MCP tools.420 npmMIT
- AlicenseAqualityBmaintenanceEnables AI coding assistants and agents (Cursor, Claude Code, Windsurf) to access 19 native MCP tools and 400+ deterministic sub-30ms edge APIsβweb-to-markdown, TokenSlimmer (-70% LLM cost cutter), prompt security shield, SEPA IBAN VoP, and EU DORA/AI Act complianceβvia https://topaigateway.com1934 npm1MIT