Cloudflare MCP Server Setup Guide

Prerequisites
  • Ensure you have npx installed on your system.
  • Make sure you have a Cloudflare account with the necessary subscription level for the features you intend to use.

Installation

  1. Initialize MCP Server:

    Run the following command to initialize the MCP server for Cloudflare:

    npx @cloudflare/mcp-server-cloudflare init
     

    Note: If you are not authenticated with Cloudflare, the MCP server will automatically run npx wrangler login and prompt you to complete the authentication process in your browser.

  2. Restart Claude Desktop:

    After initializing the MCP server, restart Claude Desktop. You should see a small icon indicating the available tools for use.

Development Setup

  1. Install Dependencies:

    In the current project folder, run:

    pnpm install
     
  2. Build and Watch:

    Build the project and watch for changes by running:

    pnpm build:watch
     
  3. Link Claude Desktop:

    In a second terminal, run:

    node dist/index.js init
     

    This will link Claude Desktop against your locally-installed version for testing. If not authenticated with Wrangler, the server will prompt you to authenticate in your browser.

Testing

  1. Run All Tests:

    Execute all tests using:

    pnpm test
     
  2. Run Tests with Coverage:

    To run tests with coverage, use:

    pnpm test:coverage
     
  3. Run a Specific Test File:

    To run a specific test file, execute:

    pnpm test -- tests/tools/queues.test.ts
     
  4. Run Tests in Watch Mode:

    For development, run tests in watch mode:

    pnpm test:watch
     

Usage Outside of Claude

To run the server locally, use the following command:

node dist/index run <account-id>
 

Contribution

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

Share this post: