Skip to content
AnswerWell geo Documentation

Research · 8 min read · Answerwell

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/mcp so the agent can learn Workers bindings and commands at runtime.
  • Optionally add https://mcp.cloudflare.com/mcp when 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.

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.

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).

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:

Or install the Cloudflare Skills plugin on any client that supports the Agent Skills standard (Claude Code, OpenCode, Codex, Pi, and others listed there).

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.

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.txt for 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).

  • Wrong MCP JSON root in VS Code — configs copied from Cursor or Claude Desktop use mcpServers and silently do nothing; VS Code needs servers in .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.jsonc weakens 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.

  1. Open your agent’s MCP status command (claude mcp list, cmd mcp list, /mcp in Droid, or the VS Code Start CodeLens on .vscode/mcp.json per Visual Studio Code + Cloudflare) and confirm https://mcp.cloudflare.com/mcp is connected.
  2. From the project root that contains wrangler.jsonc or cloudflare.config.ts, ask the agent to describe current bindings and run a read-only API or wrangler whoami-style check.
  3. 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).
  4. If answers look outdated, add docs for agents context or https://developers.cloudflare.com/llms.txt and retry the same question (Claude Code + Cloudflare).
  5. You can check automatically in Answerwell (our tool): https://answerwell.org/workspace

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.