MCP-Enabled Cloudflare Worker for Claude
LocalAbout MCP-Enabled Cloudflare Worker for Claude
MCP-Enabled Cloudflare Worker for Claude is an MCP server deployed on Cloudflare Workers that gives Claude access to weather, IP geolocation, Google Search, and custom HTTP requests. It is for using these external services and APIs from conversations.
Key features
- 01Fetch current weather for a city
- 02Look up IP geolocation details
- 03Perform Google searches
- 04Proxy custom HTTP requests
- 05Configure API keys for services
Use cases
- 01Check a city's weather in a conversation
- 02Inspect an IP address's location
- 03Search the web
- 04Send a custom request to an endpoint
MCP support
The Cloudflare Worker implements MCP and exposes weather, IP geolocation, Google Search, and HTTP request tools to Claude and other MCP clients.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEMCP-Enabled Cloudflare Worker for Claude
This repository contains a Cloudflare Worker implementing the Model Context Protocol (MCP), which allows Claude to access various external services and APIs directly from your conversations.
Features
The worker provides the following tools for Claude to use:
- Weather Information: Fetch current weather data for any city
- IP Geolocation: Look up detailed information about any IP address
- Web Search: Perform Google searches with customizable result count
- HTTP Request Proxy: Make custom HTTP requests to any endpoint with full control over headers, methods, and body data
Setup Instructions
Prerequisites
- Node.js and npm installed
- Cloudflare account
Installation
- Install Wrangler CLI
npm install -g wrangler
- Log in to Cloudflare
wrangler login
- Clone this repository
git clone https://github.com/anishgowda21/cf-mcp-server.git
cd cf-mcp-server
- Install dependencies
npm install
- Set up MCP
npx workers-mcp setup
Configuration
You'll need to set the following environment variables in the Cloudflare Dashboard (recommended for security) instead of in the wrangler.toml file:
OPENWEATHERMAP_API_KEY(for weather data)IPINFO_API_KEY(for IP geolocation)GOOGLE_API_KEY(for web search)GOOGLE_CX(for web search)
To do this:
- Go to the Cloudflare Dashboard
- Navigate to Workers & Pages
- Select your worker
- Go to Settings > Variables
- Add your environment variables under "Environment Variables"
Note: If you don't need a particular service, you can simply not set its API key. The corresponding function will return an error when called, but the rest of the worker will continue to function.
Deployment
Deploy your worker to Cloudflare:
npm run deploy
Usage with Claude
Once deployed, you can use your MCP server with Claude. To do this, simply ask Claude to use your worker for various tasks:
- "Get the weather for Tokyo"
- "Look up information about IP address 8.8.8.8"
- "Search the web for 'latest AI developments'"
- "Make a GET request to https://example.com/api/data"
Claude will automatically use the appropriate function based on your request.
Function Reference
getWeatherData(cityName: string)
Fetches current weather data for the specified city.
getIpDetails(ipAddr: string)
Retrieves detailed geolocation information for an IP address. Use "me" to get information about the client's IP.
googleWebSearch(query: string, num?: number)
Performs a Google search with the specified query and returns the specified number of results (1-10, default: 5).
makeRequest(url: string, method: string, params?: object)
Makes a custom HTTP request with specified method, headers, and body data. The params object can include:
headers: Record of HTTP headersbody: Request body (string or object that will be automatically stringified)
Customization
To modify the worker or add new functions:
- Edit
src/index.ts - Add new methods to the
MyWorkerclass with JSDoc comments to document the functionality - Deploy using
npm run deploy
Troubleshooting
- If you encounter issues with API responses, check that you've set up the appropriate environment variables in the Cloudflare Dashboard
- If a specific function isn't working, you might need to obtain the corresponding API key
- For functions you don't need, you can comment out the relevant code in
src/index.ts
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.