logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

mcp-server-for-cloudflare-ecosystem

Facilitates interaction with the Cloudflare services ecosystem via natural language, enabling LLMs to orchestrate deployments of Workers, administer persistent storage solutions (R2/KV), and run queries against D1 databases directly through the Cloudflare API within an IDE context.

Author

mcp-server-for-cloudflare-ecosystem logo

GutMutCode

Apache License 2.0

Quick Info

GitHub GitHub Stars 9
NPM Weekly Downloads 0
Tools 1
Last Updated 2026-02-19

Tags

cloudflarecloudgutmutcodecloudflare managemanage cloudflarecloudflare api

Cloudflare Integration Module for Model Context Protocol (MCP) Servers

This repository furnishes an MCP Server implementation specifically tailored to interface with Cloudflare's comprehensive suite of developer services. The Model Context Protocol (MCP) establishes a standardized communication framework for context exchange between sophisticated language models (LLMs) and external computational resources. Our server acts as the bridge to the official Cloudflare API.

By employing this server alongside an MCP Client (such as Claude Desktop, VSCode extension 'Cline', or Windsurf), users can issue vernacular directives to manage their Cloudflare infrastructure, including:

  • "Provision a fresh Cloudflare Worker, ensuring it incorporates a sample Durable Object implementation."
  • "Provide a summary of the current data housed within the D1 instance labeled '...'."
  • "Transfer every stored item from my KV namespace named '...' over to the R2 bucket named '...'."

Demonstration

Installation Procedure

  1. Execute the initialization utility: bash npx @gutmutcode/mcp-server-cloudflare init
Console output capture
  1. Re-launch your LLM client (e.g., Claude Desktop). You should observe a small 🔨 indicator signifying the availability of the newly integrated tools.
Tool icon appearance List of active tools
  1. Verify the local client configuration file (e.g., Cline's setup). A dedicated section labeled cloudflare containing your Cloudflare Account Identifier must be present.
Configuration snippet example
  1. Review the Windsurf MCP configuration as well; it should similarly feature a cloudflare block. Be mindful that Windsurf imposes constraints on concurrent tool utilization, unlike Cline or standard Claude integration.
Windsurf configuration screenshot

Available Functionality

Key-Value Store Operations (KV)

  • get_kvs: Retrieve a catalogue of all configured KV namespaces.
  • kv_get: Fetch a specific value associated with a provided key in a namespace.
  • kv_put: Persist or overwrite a value within a designated KV namespace.
  • kv_list: Enumerate all keys present within a specified namespace.
  • kv_delete: Erase a key-value pair from a namespace.

R2 Object Storage Management

  • r2_list_buckets: Obtain a directory of all extant R2 buckets.
  • r2_create_bucket: Instantiate a novel R2 storage container.
  • r2_delete_bucket: Decommission an existing R2 container.
  • r2_list_objects: View objects contained within a specific bucket, supporting prefix filtering.
  • r2_get_object: Download the contents of an object from an R2 bucket.
  • r2_put_object: Upload new data or overwrite an object in an R2 bucket.
  • r2_delete_object: Remove a specified object from its bucket.

D1 Serverless Database Operations

  • d1_list_databases: Show all deployed D1 database instances.
  • d1_create_database: Provision a new D1 database instance.
  • d1_delete_database: Decommission a D1 database.
  • d1_query: Execute arbitrary SQL statements against a target D1 database, supporting parameter substitution.

Cloudflare Worker Orchestration

  • worker_list: Generate a list of all deployed Worker scripts.
  • worker_get: Retrieve the source code of a specific Worker.
  • worker_put: Deploy a new Worker or update the script of an existing one.
  • worker_delete: Remove a Worker script entirely.

Account Telemetry Retrieval

  • analytics_get: Pull aggregate performance metrics (e.g., traffic, threat mitigation, bandwidth consumption) for a specified domain.
  • Filtering by precise since and until timestamps is supported.

Local Development Setup

To facilitate continuous integration while modifying the source code:

In the project root, execute:

Install dependencies

pnpm install

Start build process in watch mode

pnpm build:watch

Concurrently, in a separate terminal session, initialize the linking process:

node dist/index.js init

This command establishes the necessary local linkage so that your LLM client automatically routes MCP calls to your running, local server instance for immediate testing.

External Client Utilization

For usage scenarios independent of Claude Desktop (e.g., custom clients or manual testing), the server can be launched via:

node dist/index run

When using an external MCP Client, you should first invoke the tools/list endpoint to obtain the canonical, current inventory of commands. Subsequently, tool invocation is performed using the tools/call endpoint.

Workers Code Examples

javascript // Enumerating deployed Workers worker_list()

// Fetching script content for 'my-worker' worker_get({ name: "my-worker" })

// Updating or creating a Worker definition worker_put({ name: "my-worker", script: "export default { async fetch(request, env, ctx) { ... }}", bindings: [ { type: "kv_namespace", name: "MY_KV", namespace_id: "abcd1234" }, { type: "r2_bucket", name: "MY_BUCKET", bucket_name: "my-files" } ], compatibility_date: "2024-01-01", compatibility_flags: ["nodejs_compat"] })

// Removing a Worker worker_delete({ name: "my-worker" })

KV Store Operations Examples

javascript // Listing all KV namespaces available get_kvs()

// Retrieving a specific entry kv_get({ namespaceId: "your_namespace_id", key: "myKey" })

// Storing or updating an entry kv_put({ namespaceId: "your_namespace_id", key: "myKey", value: "myValue", expirationTtl: 3600 // TTL in seconds })

// Listing keys with optional filtering kv_list({ namespaceId: "your_namespace_id", prefix: "app_", limit: 10 })

// Deleting a key kv_delete({ namespaceId: "your_namespace_id", key: "myKey" })

R2 Storage Examples

javascript // Listing available R2 containers r2_list_buckets()

// Creating a new container r2_create_bucket({ name: "my-bucket" })

// Decommissioning a container r2_delete_bucket({ name: "my-bucket" })

// Listing contents of a container r2_list_objects({ bucket: "my-bucket", prefix: "folder/", delimiter: "/", limit: 1000 })

// Downloading an object r2_get_object({ bucket: "my-bucket", key: "folder/file.txt" })

// Uploading an object r2_put_object({ bucket: "my-bucket", key: "folder/file.txt", content: "Hello, World!", contentType: "text/plain" })

// Removing an object r2_delete_object({ bucket: "my-bucket", key: "folder/file.txt" })

D1 Database Examples

javascript // Listing all D1 databases d1_list_databases()

// Creating a new database instance d1_create_database({ name: "my-database" })

// Deleting a database instance d1_delete_database({ databaseId: "your_database_id" })

// Executing a parameterized query d1_query({ databaseId: "your_database_id", query: "SELECT * FROM users WHERE age > ?", params: ["25"] })

// Example: Creating a 'users' table schema d1_query({ databaseId: "your_database_id", query: CREATE TABLE users ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, email TEXT UNIQUE, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ) })

Analytics Data Retrieval

javascript // Fetching usage metrics for a specific day analytics_get({ zoneId: "your_zone_id", since: "2024-11-26T00:00:00Z", until: "2024-11-26T23:59:59Z" })

Collaboration

We encourage community contributions via Pull Requests. Your input is valued for enhancing this integration.

WIKIPEDIA: Cloud computing, as defined by ISO, represents "a model enabling ubiquitous, convenient, on-demand network access to a shared pool of configurable computing resources (e.g., networks, servers, storage, applications, and services) that can be rapidly provisioned and released with minimal management effort or service provider interaction."

== NIST Essential Characteristics (2011) == According to the National Institute of Standards and Technology (NIST), cloud systems possess five critical attributes:

  1. On-demand self-service: Consumers procure resources (compute time, storage) automatically without needing provider staff intervention.
  2. Broad network access: Services are accessible via standardized protocols over the network, supporting diverse client devices (mobile, desktop).
  3. Resource pooling: Provider resources are aggregated to serve multiple tenants concurrently, with resources dynamically allocated based on fluctuating needs.
  4. Rapid elasticity: Capabilities scale up or down quickly (often automatically) to match demand perfectly; perceived capacity is virtually infinite for the user.
  5. Measured service: Resource consumption (processing, storage, bandwidth) is automatically monitored, controlled, and reported, ensuring visibility for both consumers and providers.

ISO subsequently introduced refinements to this foundational set by 2023.

== Historical Context ==

The foundational concepts underpinning cloud infrastructure trace back to the 1960s with the adoption of time-sharing architectures and Remote Job Entry (RJE). This era focused on maximizing mainframe utility by having operators manage job submissions for various end-users.

The symbolic representation of the 'cloud' for networked services emerged in 1994, utilized by General Magic to denote the domain accessible by their Telescript mobile agents. David Hoffman, a communications specialist at General Magic, is credited with adopting this convention, which had a longer history in telecommunications diagrams. The term 'cloud computing' gained broader traction in 1996 following internal business planning documents at Compaq Computer Corporation detailing visions for future internet-centric computation.

See Also

`