mcp

A Cloudflare Worker that exposes Cloudflare API operations as tools for AI agents through MCP, a standard way for AI applications to connect to tools and data.

In plain words
What is it for?
It helps agents call Cloudflare API methods, such as listing all zones in an account, using the documented TypeScript SDK.
Why use it?
It gives an AI agent a consistent interface for working with Cloudflare instead of requiring custom connections for each API operation.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/mardak0/cloudflare-api-mcp/mcp
Clone the repo
git clone --depth 1 https://github.com/Mardak0/cloudflare-api-mcp

Made for: Cursor.

Per session 1,316 This file is loaded in full into every session.
When invoked 1,316 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.01316 $0.01316
Opus 5 $0.00658 $0.00658
Sonnet 5 $0.00263 $0.00263
Haiku 4.5 $0.00132 $0.00132

Measured yesterday against content hash 5c45575368e4, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

mcp scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

2 near-identical copies found in the catalogue:

  • mcp — 89% identical, 10 lines differ
  • mcp — 88% identical, 30 lines differ
.cursor/rules/mcp.mdc · 165 lines

How it starts

The opening of the file, as written. The whole thing — 165 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Cloudflare API MCP Server

Project Context

This is a Model Control Protocol (MCP) server. It is a cloudflare worker that exposes a set of tools to an LLM. We will build a lightweight wrapper for LLMs to interact with the Cloudflare API. The full Typescript API docs is at Cloudflare Typescript SDK.md, you can search this file for the API calls you need.

What is MCP?

MCP is an open protocol that standardizes how applications provide context to LLMs. Think of MCP like a USB-C port for AI applications. Just as USB-C provides a standardized way to connect your devices to various peripherals and accessories, MCP provides a standardized way to connect AI models to different data sources and tools.

MCP Clients are protocol clients that maintain 1:1 connections with servers.

MCP Servers, such as this one, are lightweight programs that each expose specific capabilities through the standardized Model Context Protocol.

Format for Defining Tools

Each method in the MyWorker class automatically becomes an MCP tool that can be used by AI agents. The method signature and JSDoc comments define how the tool appears to the agent.

/**
 * List all Cloudflare zones for the account.
 * @return {Promise<any>} List of zones.
 */
async listZones() {
    const response = await listZones(this.env);
    return response;
}

For tools with parameters:

/**
 * Create a new DNS record.
 * @param zoneId {string} The ID of the zone to create the record in.
 * @param name {string} The name of the DNS record.
 * @param content {string} The content of the DNS record.
 * @param type {string} The type of DNS record (CNAME, A, TXT, or MX).
 * @return {Promise<any>} The created DNS record.
 */
async createDNSRecord(zoneId: string, name: string, content: string, type: string) {
    return await createDNSRecord(this.env, zoneId, name, content, type);
}

The JSDoc structure is critical:

  • The first line becomes the tool's description
  • Each @param defines a parameter with its type and description
  • The @return specifies what the tool returns

Read the full file on GitHub · 165 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 165 lines · 1,316 tokens per session scan A 5c45575368e4

Subscribe to this mod's changes

mcp is a cursor rule published in the GitHub repository Mardak0/cloudflare-api-mcp (0 stars, last pushed 1y ago), licensed MIT. It adds 1,316 tokens to every session, about $0.0066 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.