跳转到主要内容

Claude Code + Cloudflare

import { Steps } from "/components"; import AgentHeader from "/components/agent-setup/AgentHeader.astro"; import PlatformAccess from "/components/agent-setup/PlatformAccessSection.astro"; import ExamplePromptsList from "/components/agent-setup/ExamplePromptsList.astro"; import RandomPrompt from "/components/agent-setup/RandomPrompt.astro"; import TipsList from "/components/agent-setup/TipsList.astro"; import FAQList from "/components/agent-setup/FAQList.astro"; import FAQItem from "/components/agent-setup/FAQItem.astro"; import TroubleshootingList from "/components/agent-setup/TroubleshootingList.astro"; import TroubleshootingItem from "/components/agent-setup/TroubleshootingItem.astro"; import BuildAgentsCallout from "/components/agent-setup/BuildAgentsCallout.astro"; import OtherAgents from "/components/agent-setup/OtherAgents.astro"; import { LinkCard } from "~/components";

Quick start

1. **Install Claude Code**
	Install the Claude Code CLI. For Windows, Homebrew, WinGet, or npm, see the [Claude Code setup guide](https://docs.anthropic.com/en/docs/claude-code/setup).

	```bash
	curl -fsSL https://claude.ai/install.sh | bash
	```

2. **Launch Claude Code in your project**

	Start Claude Code from the root of your project, where `wrangler.jsonc` or `cloudflare.config.ts` lives (if either exists).

	```bash
	claude
	```

3. **Install the Cloudflare plugin**

	In Claude Code, run these two slash commands one at a time, waiting for the first to finish before running the second. This installs Cloudflare Skills and registers the Cloudflare MCP servers.

	```txt
	/plugin marketplace add cloudflare/skills
	```
	```txt
	/plugin install cloudflare@cloudflare
	```

4. **Try a prompt**

	For example:

	<RandomPrompt />

Cloudflare platform access

Example prompts

Tips

  • The Skills plugin includes a wrangler Skill — Claude knows when to reach for npx wrangler deploy, wrangler d1 migrations apply, and other CLI commands automatically.
  • The Cloudflare API MCP server uses Code Mode — Claude writes JavaScript against a TypeScript API to hit any of 2,500+ endpoints in ~1,000 tokens.
  • Claude Code works best from the root of your Workers project where wrangler.jsonc or cloudflare.config.ts lives — this is what the agent uses to understand your bindings.
  • Use claude mcp list to verify Cloudflare servers are connected. For CI/CD, skip OAuth by passing a Cloudflare API token as a bearer token instead.

FAQ

All three — and the Skills plugin configures them together. Skills give Claude persistent Cloudflare knowledge (when to use Durable Objects vs KV, what a good Workers project layout looks like). The Cloudflare API MCP server handles platform operations (DNS, WAF, R2 buckets, Zero Trust). Wrangler runs local dev and Workers-specific commands. The `wrangler` Skill teaches Claude when to reach for which. For tasks across the whole Cloudflare API, Claude can also use the [Cloudflare CLI](/cf/), `cf`. Yes. The [Cloudflare CLI](/cf/), `cf`, is in beta and covers the whole Cloudflare API and prints JSON output. Install it with `npm install -g cf`, sign in with `cf auth login`, and tell Claude Code to prefer it in `CLAUDE.md`. Refer to [Use cf with AI agents](/cf/agents/). The first time Claude calls a Cloudflare tool, you will be redirected to authorize via OAuth and choose what permissions to grant. Yes. Run Claude Code from your existing project directory where `wrangler.jsonc` or `cloudflare.config.ts` is located, and it will understand your project configuration and deploy accordingly. Code Mode is how the Cloudflare API MCP server fits all 2,500+ API endpoints into ~1,000 tokens. Instead of exposing every endpoint as a separate tool, it exposes two — `search()` and `execute()` — and Claude writes JavaScript to call them. [Learn more about Code Mode](https://blog.cloudflare.com/code-mode-mcp/).

Troubleshooting

Run `claude mcp list` to verify the server is registered. If you installed the Cloudflare plugin, run `/reload-plugins` to reload its MCP configuration. The MCP server uses OAuth. When prompted, complete the authorization flow in your browser. For CI/CD, create a Cloudflare API token and pass it as a bearer token instead. Point the agent directly at developers.cloudflare.com/llms.txt for a directory of every product, or developers.cloudflare.com/<product>/llms.txt for a product-specific index.

Build agents on Cloudflare

Other agents