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.
npx agentmods add instructions/cloudflare/mcp/agents-mdgit clone --depth 1 https://github.com/cloudflare/mcpWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.03207 | $0.03207 |
| Opus 5 | $0.01604 | $0.01604 |
| Sonnet 5 | $0.00641 | $0.00641 |
| Haiku 4.5 | $0.00321 | $0.00321 |
Grade A, and why
mcp AGENTS.md 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 2d ago.
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.
How it starts
The opening of the file, as written. The whole thing — 251 lines — stays where its author put it; the contents beside it link to each section on GitHub.
AGENTS.md
Project overview
cloudflare-mcp is a token-efficient Model Context Protocol (MCP) server that exposes the entire Cloudflare API (~2,500 endpoints) using Cloudflare's Code Mode pattern. Instead of registering thousands of MCP tools, it uses just two tools (search and execute) that let agents write JavaScript to query the OpenAPI spec and call APIs — fitting all 2,500 endpoints into ~1,000 tokens.
Production URL: mcp.cloudflare.com
MCP specification compliance
When modifying MCP or OAuth functionality, always check the latest published MCP specification:
- Specification: https://modelcontextprotocol.io/specification/2026-07-28
- Authorization section: https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization
Repository structure
cloudflare-mcp/
├── src/
│ ├── index.ts # Worker entry point & OAuth routing
│ ├── mcp-handler.ts # Stateless MCP HTTP handler & deployment guards
│ ├── server.ts # MCP server setup & tool registration
│ ├── executor.ts # Code executor (Worker Loader API)
│ ├── spec-processor.ts # OpenAPI spec fetching & $ref resolution
│ ├── truncate.ts # Response truncation (~6K token limit)
│ ├── metrics.ts # Analytics Engine metrics (auth_user/tool_call)
│ ├── auth/
│ │ ├── types.ts # Auth props schemas (Zod discriminated union)
│ │ ├── api-token-mode.ts # Prefix classification & external resolver
│ │ ├── cloudflare-identity.ts # Owner-aware Cloudflare API identity probes
│ │ ├── cloudflare-auth.ts # PKCE & OAuth utilities
│ │ ├── oauth-handler.ts # OAuth authorization flow
│ │ ├── refresh-admission-gate.ts # Best-effort per-grant KV refresh admission
│ │ ├── derived-oauth-scopes.ts # Canonical production OAuth scope API metadata
│ │ ├── scopes.ts # Canonical picker config and OAuth bootstrap scopes
│ │ └── workers-oauth-utils.ts # OAuth provider helpers
├── tests/ # Vitest suite (top-level, mirrors src/)
│ ├── index.test.ts
│ ├── auth/
│ ├── executor.test.ts
│ ├── spec-processor.test.ts
│ ├── truncate.test.ts
│ └── e2e/ # End-to-end tests (real worker via exports.default.fetch)
│ └── tool-call.test.ts
├── scripts/
│ └── seed-r2.ts # Seed OpenAPI spec to R2 bucket
├── .github/workflows/
│ ├── ci.yml # PR validation
│ └── bonk.yml # AI code review
├── wrangler.jsonc # Workers config (dev/staging/prod)
├── .oxfmtrc.json # oxfmt formatter config
└── README.md
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.
- 2d ago First seen · 251 lines · 3,207 tokens per session scan A ec17123987aa
mcp AGENTS.md is an instructions file published in the GitHub repository cloudflare/mcp (773 stars, last pushed 7d ago), licensed Apache-2.0. It adds 3,207 tokens to every session, about $0.0160 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-30.
Other instructions, from other repositories
cloudflare-workers-nextjs-saas-template AGENTS.md
Instructions for LubomirGeorgiev/cloudflare-workers-nextjs-saas-template, covering project context, vinext, general coding rules, control flow and comments.
cloudbox AGENTS.md
Instructions for acoyfellow/cloudbox, covering cloudbox agent guide, canonical commands, deploy model, cloudflare account boundaries and required production secrets.
mcp-migration-check AGENTS.md
Instructions for AlpayC/mcp-migration-check, covering working in this repository, shape, rules that are not negotiable, before you say it works and adding a rule.
rewind AGENTS.md
Instructions for pdugan20/rewind, covering rewind, work modes, development commands, agent configuration and architecture overview.
svelteflare AGENTS.md
Instructions for pinebasedev/svelteflare, covering agent rules for this project, theme fidelity (non-negotiable), talking to the user and deep-dive skills.
cld-flare-maxxing AGENTS.md
Instructions for AbhiiGatty/cld-flare-maxxing, covering cld-flare-maxxing — operating contract, what this is, golden rules, vocabulary: what "deploy it" (and similar) actually means and confirming a deploy landed.