Cover image
Try Now
2025-03-07

An MCP server on Cloudflare Workers

3 years

Works with Finder

1

Github Watches

1

Github Forks

1

Github Stars

MCP-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

  1. Install Wrangler CLI
  npm install -g wrangler
  1. Log in to Cloudflare
  wrangler login
  1. Clone this repository
  git clone https://github.com/anishgowda21/cf-mcp-server.git
  cd cf-mcp-server
  1. Install dependencies
  npm install
  1. 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:

  1. Go to the Cloudflare Dashboard
  2. Navigate to Workers & Pages
  3. Select your worker
  4. Go to Settings > Variables
  5. 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 headers
  • body: Request body (string or object that will be automatically stringified)

Customization

To modify the worker or add new functions:

  1. Edit src/index.ts
  2. Add new methods to the MyWorker class with JSDoc comments to document the functionality
  3. 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

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Bora Yalcin
  • Evaluator for marketplace product descriptions, checks for relevancy and keyword stuffing.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Callycode Limited
  • A geek-themed horoscope generator blending Bitcoin prices, tech jargon, and astrological whimsy.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Khalid kalib
  • Write professional emails

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Lists Tailwind CSS classes in monospaced font

  • apappascs
  • Discover the most comprehensive and up-to-date collection of MCP servers in the market. This repository serves as a centralized hub, offering an extensive catalog of open-source and proprietary MCP servers, complete with features, documentation links, and contributors.

  • ShrimpingIt
  • Micropython I2C-based manipulation of the MCP series GPIO expander, derived from Adafruit_MCP230xx

  • OffchainLabs
  • Go implementation of Ethereum proof of stake

  • huahuayu
  • A unified API gateway for integrating multiple etherscan-like blockchain explorer APIs with Model Context Protocol (MCP) support for AI assistants.

  • deemkeen
  • control your mbot2 with a power combo: mqtt+mcp+llm

    Reviews

    3 (1)
    Avatar
    user_uo22CNQI
    2025-04-15

    As a dedicated user of simple_mcp_server1 developed by marcusau, I must say this product offers an intuitive and streamlined experience for managing your server needs. The interface is user-friendly, making it easy even for beginners to navigate. Highly recommended for anyone looking for a reliable server management tool! Check it out here: https://mcp.so/server/simple_mcp_server1/marcusau