MCP HubMCP Hub
cloudflare

mcp-server-cloudflare

by: cloudflare

mcp server cloudflare

1323created 27/11/2024
Visit
cloudflare

📌Overview

Purpose: The Model Context Protocol (MCP) aims to standardize the management of context between large language models (LLMs) and external systems, specifically for interactions with Cloudflare's services.

Overview: The MCP Server facilitates natural language interactions with Cloudflare's API, allowing users to perform a variety of tasks related to their Cloudflare accounts seamlessly using LLMs like Claude Desktop or any other MCP Client.

Key Features:

  • KV Store Management: Provides comprehensive commands to manage key-value stores, including listing namespaces, retrieving, storing, and deleting key-value pairs.

  • R2 Storage Management: Enables users to manage R2 buckets by listing, creating, deleting, and operating on objects within these buckets.

  • D1 Database Management: Allows for easy handling of D1 databases, including listing databases, querying, creating, and deleting.

  • Workers Management: Simplifies the management of Workers by enabling users to list, retrieve, update, and delete worker scripts.

  • Durable Objects Management: Offers commands to manage Durable Objects namespaces and instances.

  • Queues System: Facilitates queue management, including creating, retrieving, and deleting queues along with their messages.

  • AI Integration: Provides access to available AI models and the ability to run inference using Workers AI.

  • Workflows Management: Supports the creation, deletion, and execution of workflows.

  • Templates Management: Allows users to list, get, and create workers from predefined templates, streamlining initial development.

  • Zone and Domain Management: Empowers users to manage zones and domains efficiently, including creation, deletion, and checking activation statuses.

This MCP Server enhances interaction with Cloudflare services by integrating natural language capabilities, making it accessible for both technical and non-technical users.


Cloudflare MCP Server

Model Context Protocol (MCP) is a new, standardized protocol for managing context between large language models (LLMs) and external systems. This repository provides an installer and an MCP Server for Cloudflare's API.

This allows you to use Claude Desktop or any MCP Client to perform natural language commands on your Cloudflare account, for example:

  • List all the Cloudflare workers on my <some-email>@gmail.com account.
  • Can you tell me about any potential issues on this particular worker '...'?

Access the remote MCP server from Claude Desktop

Open Claude Desktop and navigate to Settings -> Developer -> Edit Config to open the configuration file controlling which MCP servers Claude can access.

Replace the content with the following configuration:

{
  "mcpServers": {
    "cloudflare": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://observability.mcp.cloudflare.com/sse"
      ]
    }
  }
}

After restarting Claude Desktop, a browser will open prompting for OAuth login. Complete the authentication flow to grant Claude access to your MCP server. Once access is granted, the tools will be available.

Need access to more Cloudflare tools?

We're gradually migrating functionality to this remote MCP server repo. Meanwhile, the local-only mcp-server-cloudflare package has more tools available.

Visit: https://www.npmjs.com/package/@cloudflare/mcp-server-cloudflare

Paid Features

Some features may require a paid Cloudflare Workers plan. Ensure your Cloudflare account has the necessary subscription for the intended features.

Features

Workers Management

  • worker_list: List all Workers in your account
  • worker_get_worker: Get a Worker's script content

Workers Logs

  • worker_logs_by_worker_name: Analyze recent logs for a Cloudflare Worker by worker name
  • worker_logs_by_ray_id: Analyze recent logs across all workers for a specific request by Cloudflare Ray ID
  • worker_logs_keys: Get available telemetry keys for a Cloudflare Worker

Developing

Apps

  • workers-observability: The Workers Observability MCP server

Packages

  • eslint-config: ESLint configuration used by all apps and packages
  • typescript-config: TypeScript configuration used by all apps and packages
  • mcp-common: Shared tools and scripts to help manage this repo

For more details on development, see workers-observability.

Testing

The project uses Vitest as the testing framework with MSW (Mock Service Worker) for API mocking.

Running Tests

Run all tests:

pnpm test

Run a specific test file:

pnpm test -- tests/tools/queues.test.ts

Run tests in watch mode (useful during development):

pnpm test:watch

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.