MCP ConfigsApr 8, 2026·3 min read

Wrangler MCP — Cloudflare Workers for AI Agents

MCP server for managing Cloudflare Workers, KV, R2, and D1 from AI agents. Deploy serverless functions, manage storage, and query databases through Claude Code tool calls.

TL;DR
MCP server that lets AI agents deploy Cloudflare Workers, manage KV/R2/D1 storage, and run serverless functions.
§01

What it is

Wrangler MCP is a Model Context Protocol server that exposes Cloudflare's developer platform to AI agents. It wraps the Wrangler CLI, enabling Claude Code and other MCP-compatible agents to deploy Workers, read and write KV namespaces, manage R2 object storage, and query D1 databases through tool calls.

This MCP server targets developers who use AI agents for infrastructure management. Instead of switching to a terminal to run wrangler commands, you tell your agent what you need and it handles the Cloudflare API interactions.

§02

How it saves time or tokens

Managing Cloudflare resources through the dashboard or CLI requires context-switching from your coding environment. With Wrangler MCP, your AI agent handles deployments, KV writes, and D1 queries inline during a coding session. A single natural language instruction like 'deploy this worker to production' triggers the correct sequence of wrangler commands.

§03

How to use

  1. Install the Wrangler MCP server in your Claude Code configuration.
  2. Authenticate with your Cloudflare API token.
  3. Use natural language to manage Cloudflare resources.
// Claude Code MCP configuration
{
  "mcpServers": {
    "wrangler": {
      "command": "npx",
      "args": ["wrangler", "mcp", "server"],
      "env": {
        "CLOUDFLARE_API_TOKEN": "your-api-token"
      }
    }
  }
}
§04

Example

// Example Worker deployed via Wrangler MCP
export default {
  async fetch(request: Request, env: Env): Promise<Response> {
    // Read from KV
    const value = await env.MY_KV.get('config');

    // Query D1 database
    const result = await env.DB.prepare(
      'SELECT * FROM users WHERE active = ?'
    ).bind(1).all();

    return Response.json({
      config: value,
      users: result.results
    });
  }
};
§05

Related on TokRepo

§06

Common pitfalls

  • The Cloudflare API token must have the correct permissions for each resource type (Workers, KV, R2, D1). A token with only Workers permissions cannot manage KV namespaces.
  • Wrangler MCP executes real deployments. There is no dry-run mode by default. Test against a staging Cloudflare account before using it on production resources.
  • Large R2 object uploads through MCP may time out. For bulk data transfers, use the Wrangler CLI directly with streaming support.

Frequently Asked Questions

What Cloudflare services can I manage through Wrangler MCP?+

Wrangler MCP supports Workers (deploy, update, delete), KV namespaces (read, write, list, delete), R2 object storage (upload, download, list), and D1 databases (query, migrations). It covers the most commonly used Cloudflare developer services.

Does Wrangler MCP work with Claude Code?+

Yes. Wrangler MCP is an MCP server that integrates with Claude Code and any other MCP-compatible AI agent. You configure it in your Claude Code settings and the agent can call Cloudflare tools during coding sessions.

Is there a cost to using Wrangler MCP?+

The MCP server itself is free and open source. You pay standard Cloudflare pricing for the resources you use (Workers invocations, KV reads/writes, R2 storage, D1 queries). Cloudflare offers generous free tiers for all these services.

Can I use Wrangler MCP for production deployments?+

Yes, but with caution. Wrangler MCP executes real Cloudflare API calls. Set up separate API tokens for staging and production environments. Review the agent's planned actions before confirming production deployments.

How does Wrangler MCP authenticate with Cloudflare?+

Wrangler MCP uses a Cloudflare API token passed as an environment variable. You create the token in the Cloudflare dashboard with specific permissions for the services you want to manage. The token is stored in your MCP configuration file.

Citations (3)
🙏

Source & Thanks

Created by Cloudflare. Official MCP server.

cloudflare/mcp-server-cloudflare

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.