Coding Agent MCP Setup, Code Mode, Skills and Workers Deployment
How to connect coding agents to edge APIs with MCP, Code Mode, Agent Skills, Wrangler, OAuth, and the cf CLI—per Cloudflare's agent documentation.
This page summarises Cloudflare’s documentation on docs for agents and the agent setup guides: how to let tools such as Cursor, Claude Code, GitHub Copilot, and VS Code call the Cloudflare API, read current product docs, and deploy Workers projects without hand-copying every endpoint.
What you get: Skills, MCP, and Wrangler together
Section titled “What you get: Skills, MCP, and Wrangler together”People usually ask whether they need an MCP server, a CLI, or “skills” files—and the recurring answer in Cloudflare’s agent FAQs is to use all three, because each layer does a different job.
Use both. The Cloudflare API MCP server handles Cloudflare account operations, such as DNS, WAF, R2, and Zero Trust. Wrangler handles local development, deployments, and migrations.
— Cloudflare, Bionic + Cloudflare
Agent Skills (from the cloudflare/skills bundle) load situational knowledge: when to pick Durable Objects versus KV, sensible Workers layout, and when the agent should run npx wrangler deploy instead of an API call. The Cloudflare API MCP server at https://mcp.cloudflare.com/mcp performs authenticated platform operations. Wrangler (and, for some projects, the beta cf CLI) handles local dev, migrations, and deploy commands in the project terminal.
| Layer | Typical use | Install pattern |
|---|---|---|
| Skills | Patterns, CLI vs API judgment | npx skills add https://github.com/cloudflare/skills or agent plugin (e.g. Cloudflare plugin in Cursor) |
API MCP (https://mcp.cloudflare.com/mcp) |
DNS, R2, WAF, Zero Trust, full REST API | OAuth or API token; config file varies by agent |
Wrangler / cf |
wrangler dev, deploy, D1 migrations |
Project root with wrangler.jsonc or cloudflare.config.ts |
For machine-readable API shape without MCP, Cloudflare also publishes a full OpenAPI specification via cloudflare/api-schemas on the docs for agents page.
Cloudflare API MCP server: Code Mode and the three tools
Section titled “Cloudflare API MCP server: Code Mode and the three tools”The central server is documented in Cloudflare’s own MCP servers.
The Cloudflare API MCP server ↗︎ at https://mcp.cloudflare.com/mcp is the only MCP server you need to work with Cloudflare. It provides access to the entire Cloudflare API — over 2,500 endpoints across DNS, Workers, R2, Zero Trust, and every other product — and to the Cloudflare developer documentation.
— Cloudflare, Cloudflare’s own MCP servers
Instead of registering thousands of MCP tools, the server exposes search(), execute(), and docs(). The model writes JavaScript against a typed API client; generated code runs in an isolated Dynamic Worker sandbox.
This approach uses approximately 1,000 tokens regardless of how many API endpoints exist. An equivalent MCP server that exposed every endpoint as a native tool would consume over 1 million tokens — more than the entire context window of most foundation models.
— Cloudflare, Cloudflare’s own MCP servers
| Approach | Tools | Token cost (per Cloudflare docs) |
|---|---|---|
| Native MCP (full schemas) | 2,594 | ~1,170,000 |
| Native MCP (required params only) | 2,594 | ~244,000 |
| Code Mode | 2 | ~1,000 |
If you only see three tools in VS Code or Copilot, that is expected:
Three tools is the correct, healthy state.
— Cloudflare, Visual Studio Code + Cloudflare
Response size: publishers implementing Code Mode should trim what comes back to the model. Build a Code Mode MCP server notes that final MCP responses are limited to roughly 6,000 estimated tokens, with --- TRUNCATED --- when cut—so agents should return focused IDs, statuses, and errors for the next step, not full API dumps.
Documentation-only MCP for Workers and Basin
Section titled “Documentation-only MCP for Workers and Basin”For current docs without account access, Cloudflare documents a separate docs MCP endpoint in Prompting (Workers):
- Add
https://docs.mcp.cloudflare.com/mcpso the agent can learn Workers bindings and commands at runtime. - Optionally add
https://mcp.cloudflare.com/mcpwhen you also want logs, fixes, and API calls.
Prompt an agent to build with Basin makes the same distinction: the docs MCP retrieves current commands and limits but does not replace checking Basin delivery or SQL results.
OAuth, API tokens, and the cf CLI
Section titled “OAuth, API tokens, and the cf CLI”How agents get Cloudflare account access
Section titled “How agents get Cloudflare account access”Interactive setup almost always uses OAuth against https://mcp.cloudflare.com/mcp. The first tool call opens a browser; you choose scopes there. Examples: Bionic + Cloudflare, Claude Code + Cloudflare, Pi + Cloudflare (pi mcp login cloudflare).
For CI/CD or headless agents, pass a Cloudflare API token as a bearer credential instead of OAuth (Claude Code + Cloudflare, Visual Studio Code + Cloudflare). API tokens that use Client IP Address Filtering are not supported for this path.
When to prefer the cf CLI
Section titled “When to prefer the cf CLI”The cf CLI (beta) covers the whole Cloudflare API with JSON output. Install with npm install -g cf, sign in with cf auth login, and tell the agent to prefer it in project instructions (CLAUDE.md, AGENTS.md, or .github/copilot-instructions.md). See Use cf with coding agents and each agent’s FAQ (e.g. Cursor + Cloudflare).
Agent setup: MCP URL and project root
Section titled “Agent setup: MCP URL and project root”Every guide shares the same server URL and project root rule: start in the directory that contains wrangler.jsonc or cloudflare.config.ts so the agent sees bindings and can run deploy commands.
The config file and install command differ by client. Use the official page for your tool rather than copying another agent’s JSON verbatim.
Plugin or marketplace install (Skills + MCP bundled)
Section titled “Plugin or marketplace install (Skills + MCP bundled)”Several agents install Skills and register MCP in one step:
- Cursor:
/add-plugin cloudflare— Cursor + Cloudflare - Claude Code:
/plugin marketplace add cloudflare/skillsthen/plugin install cloudflare@cloudflare— Claude Code + Cloudflare - Codex:
/plugins→ install Cloudflare — Codex + Cloudflare - Droid:
droid plugin marketplace add/droid plugin install cloudflare@skills— Droid + Cloudflare
Or install the Cloudflare Skills plugin on any client that supports the Agent Skills standard (Claude Code, OpenCode, Codex, Pi, and others listed there).
Manual MCP configuration examples
Section titled “Manual MCP configuration examples”Visual Studio Code requires the root key servers, not mcpServers (Visual Studio Code + Cloudflare):
{ "servers": { "cloudflare-api": { "type": "http", "url": "https://mcp.cloudflare.com/mcp" } }}GitHub Copilot: .vscode/mcp.json, .mcp.json, or ~/.copilot/mcp-config.json with mcpServers — GitHub Copilot + Cloudflare.
OpenCode: .opencode.jsonc with "type": "remote" — OpenCode + Cloudflare.
Command Code: cmd mcp add --transport http cloudflare https://mcp.cloudflare.com/mcp — Command Code + Cloudflare.
Bionic: add remote MCP URL https://mcp.cloudflare.com/mcp in the UI — Bionic + Cloudflare.
Vibe: ~/.vibe/config.toml with transport = "streamable-http" — Vibe + Cloudflare.
Stale product answers: llms.txt indexes
Section titled “Stale product answers: llms.txt indexes”If the model cites outdated limits or renamed products, point it at Cloudflare’s agent-oriented doc indexes:
Point the agent directly at developers.cloudflare.com/llms.txt for a directory of every product, or
developers.cloudflare.com/<product>/llms.txtfor a product-specific index.— Cloudflare, Claude Code + Cloudflare
Same guidance appears in OpenCode, Command Code, and Visual Studio Code troubleshooting. For Droid, enabling the docs MCP server is another way to fetch current docs at runtime (Droid + Cloudflare).
Common mistakes
Section titled “Common mistakes”- Wrong MCP JSON root in VS Code — configs copied from Cursor or Claude Desktop use
mcpServersand silently do nothing; VS Code needsserversin.vscode/mcp.json(Visual Studio Code + Cloudflare). - Expecting thousands of MCP tools — Code Mode deliberately exposes ~three tools (Visual Studio Code + Cloudflare).
- Skills only in inline chat — GitHub Copilot Skills work in agentic Copilot Chat, Copilot CLI, and cloud agent—not plain inline completion (GitHub Copilot + Cloudflare).
- Skipping project root — running the agent outside the folder with
wrangler.jsoncweakens binding awareness (Codex + Cloudflare). - Using Bionic Work Projects for deploys — Bionic + Cloudflare recommends a Code Project tied to the Cloudflare source tree for file edits and shell commands.
- Trusting docs MCP for production Basin checks — Basin prompting still requires verifying pipeline delivery and SQL results yourself.
MCP connection and authentication troubleshooting
Section titled “MCP connection and authentication troubleshooting”| Symptom | What Cloudflare docs suggest |
|---|---|
| Server not connecting | Confirm URL https://mcp.cloudflare.com/mcp; remove and re-add the server (Bionic, Command Code). Pi needs streamable HTTP, not /sse (Pi + Cloudflare). |
| Claude Code timeouts | claude mcp list; /reload-plugins after plugin install (Claude Code + Cloudflare). |
| Cursor MCP dead | Validate .cursor/mcp.json JSON; restart Cursor (Cursor + Cloudflare). |
| Codex | codex mcp add cloudflare --url https://mcp.cloudflare.com/mcp; check with codex mcp list (Codex + Cloudflare). |
| Auth fails | Re-add server and complete OAuth again; for Pi, pi mcp logout cloudflare then pi mcp login cloudflare (Pi + Cloudflare). |
| VS Code “Cannot read properties of undefined” | Update VS Code and Copilot to matching versions (Visual Studio Code + Cloudflare). |
For a step-by-step OAuth and DNS demo in the editor, see Visual Studio Code detailed walkthrough.
How to check this on your site
Section titled “How to check this on your site”- Open your agent’s MCP status command (
claude mcp list,cmd mcp list,/mcpin Droid, or the VS Code Start CodeLens on.vscode/mcp.jsonper Visual Studio Code + Cloudflare) and confirmhttps://mcp.cloudflare.com/mcpis connected. - From the project root that contains
wrangler.jsoncorcloudflare.config.ts, ask the agent to describe current bindings and run a read-only API orwrangler whoami-style check. - In the Cloudflare dashboard, open My Profile → Access Management → Connected Applications and confirm the MCP OAuth app’s scope matches what you intend (Visual Studio Code + Cloudflare).
- If answers look outdated, add docs for agents context or
https://developers.cloudflare.com/llms.txtand retry the same question (Claude Code + Cloudflare). - You can check automatically in Answerwell (our tool): https://answerwell.org/workspace
Report an error or ask a question
Section titled “Report an error or ask a question”If something on this page does not match the linked Cloudflare documentation, email yimasynthetic@gmail.com with the page URL and the exact statement you think is wrong so we can correct it.