Skip to main content
Glama
ofershap
by ofershap
README.md
# MCP Server Cloudflare — Workers, KV, R2, DNS & Cache for AI Assistants

[![npm version](https://img.shields.io/npm/v/mcp-server-cloudflare-dns.svg)](https://www.npmjs.com/package/mcp-server-cloudflare-dns)
[![npm downloads](https://img.shields.io/npm/dm/mcp-server-cloudflare-dns.svg)](https://www.npmjs.com/package/mcp-server-cloudflare-dns)
[![CI](https://github.com/ofershap/mcp-server-cloudflare/actions/workflows/ci.yml/badge.svg)](https://github.com/ofershap/mcp-server-cloudflare/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Agent Plugins](https://img.shields.io/badge/Agent_Plugins-1.0.0-0ea5e9.svg)](https://agent-plugins.org)

An MCP server that lets your AI assistant manage Cloudflare Workers, KV, R2, DNS, and cache purging. Vercel, Railway, and Netlify all have MCP servers — now Cloudflare does too.

```
You: "List my Workers and purge cache for example.com"
AI:  Found 3 Workers: api-gateway, auth-worker, image-resizer
     ✅ Cache purged for https://example.com
```

> Works with Claude Desktop, Cursor, and VS Code Copilot.

![MCP server Cloudflare demo — listing Workers and purging cache from Claude Desktop](assets/demo.gif)

## Tools

| Tool               | What it does                         |
| ------------------ | ------------------------------------ |
| `cf_zones`         | List your Cloudflare zones (domains) |
| `cf_dns_list`      | List DNS records for a zone          |
| `cf_dns_create`    | Create a DNS record                  |
| `cf_dns_delete`    | Delete a DNS record                  |
| `cf_workers_list`  | List Workers scripts                 |
| `cf_worker_delete` | Delete a Workers script              |
| `cf_kv_namespaces` | List KV namespaces                   |
| `cf_kv_keys`       | List keys in a KV namespace          |
| `cf_kv_get`        | Get a value from KV                  |
| `cf_kv_put`        | Write a value to KV                  |
| `cf_kv_delete`     | Delete a KV key                      |
| `cf_r2_buckets`    | List R2 storage buckets              |
| `cf_cache_purge`   | Purge cache (all or specific URLs)   |

## Quick Start

### With Claude Desktop

Add to your `claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "cloudflare": {
      "command": "npx",
      "args": ["-y", "mcp-server-cloudflare-dns"],
      "env": {
        "CLOUDFLARE_API_TOKEN": "your_api_token",
        "CLOUDFLARE_ACCOUNT_ID": "your_account_id"
      }
    }
  }
}
```

### With Cursor

Add to your `.cursor/mcp.json`:

```json
{
  "mcpServers": {
    "cloudflare": {
      "command": "npx",
      "args": ["-y", "mcp-server-cloudflare-dns"],
      "env": {
        "CLOUDFLARE_API_TOKEN": "your_api_token",
        "CLOUDFLARE_ACCOUNT_ID": "your_account_id"
      }
    }
  }
}
```

## Authentication

1. Go to [Cloudflare Dashboard > API Tokens](https://dash.cloudflare.com/profile/api-tokens)
2. Create a token with the permissions you need:
   - **Zone:Read** — for listing zones and DNS
   - **Zone:Edit** — for creating/deleting DNS records
   - **Workers Scripts:Edit** — for managing Workers
   - **Workers KV Storage:Edit** — for KV operations
   - **Zone:Cache Purge** — for cache purging
3. Set `CLOUDFLARE_API_TOKEN` environment variable
4. Set `CLOUDFLARE_ACCOUNT_ID` for Workers, KV, and R2 operations

## Examples

Ask your AI assistant:

- "List my Cloudflare zones"
- "Show DNS records for zone xyz"
- "Create an A record pointing to 1.2.3.4"
- "List my Workers"
- "Show KV keys in namespace abc"
- "Purge the cache for https://example.com/page"
- "List my R2 buckets"

## Agent Plugins

This repo is an [Agent Plugins](https://agent-plugins.org) 1.0.0 package: `plugin.json`, portable `mcp.json`, and `skills/` ship together with the MCP server.

For Cursor, clone the repo and copy or symlink it to `~/.cursor/plugins/local/mcp-server-cloudflare`, then reload the window. Skills and MCP show up under Customize > Plugins.

Agent Plugins v1 does not ship OAuth. Set `CLOUDFLARE_API_TOKEN` and `CLOUDFLARE_ACCOUNT_ID` in your MCP client env (see Quick Start). One-click install is not offered because credentials stay in env.

Install and run via npm package **`mcp-server-cloudflare-dns`** (not the unrelated `mcp-server-cloudflare` stub on npm).

## FAQ

### What npm package do I install?

Use `npx -y mcp-server-cloudflare-dns`. The repo is named `mcp-server-cloudflare` on GitHub; npm publishes as `mcp-server-cloudflare-dns`.

### Which env vars are required?

`CLOUDFLARE_API_TOKEN` for all API calls. `CLOUDFLARE_ACCOUNT_ID` for Workers, KV, and R2 tools.

### Can I install it as an Agent Plugin in Cursor?

Yes, via `~/.cursor/plugins/local/mcp-server-cloudflare`. Configure the same env vars in Cursor MCP settings.

### What can this MCP manage?

Zones and DNS, Workers scripts, KV namespaces, R2 bucket listing, and cache purge for a zone.

### Why no one-click Cursor button?

API token and account id cannot be embedded in a portable install link. Use the JSON under Quick Start.

## Development

```bash
npm install
npm test
npm run build
```

## Author

[![Made by ofershap](https://gitshow.dev/api/card/ofershap)](https://gitshow.dev/ofershap)

[![LinkedIn](https://img.shields.io/badge/LinkedIn-Connect-0A66C2?style=flat&logo=linkedin&logoColor=white)](https://linkedin.com/in/ofershap)
[![GitHub](https://img.shields.io/badge/GitHub-Follow-181717?style=flat&logo=github&logoColor=white)](https://github.com/ofershap)

---

<sub>README built with [README Builder](https://ofershap.github.io/readme-builder/)</sub>

## License

[MIT](LICENSE) &copy; [Ofer Shapira](https://github.com/ofershap)

TDQS

A3.5/5.0

Scored across 13 tools

Disambiguation5/5

Every tool has a clearly distinct purpose targeting specific Cloudflare resources and actions, with no overlap or ambiguity. For example, cf_dns_create, cf_dns_delete, and cf_dns_list are distinct operations on DNS records, while cf_kv_get, cf_kv_put, and cf_kv_delete handle different KV operations.

Naming Consistency5/5

All tools follow a consistent cf_resource_action naming pattern using snake_case throughout, such as cf_dns_create, cf_kv_get, and cf_worker_delete. This predictable structure makes it easy to understand each tool's domain and function at a glance.

Tool Count5/5

With 13 tools, the server is well-scoped for managing Cloudflare services like DNS, KV, Workers, R2, and zones. Each tool earns its place by covering essential operations without being excessive or sparse for the domain.

Completeness4/5

The tool set provides strong coverage for core Cloudflare operations, including CRUD for DNS and KV, and listing for zones, Workers, and R2. Minor gaps exist, such as missing create/update for Workers or R2 buckets, but agents can work around these with the available tools.

Maintenance

ActivitySlowing
ResponsivenessUnresponsive