MCP Configs2026年4月8日·1 分钟阅读

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.

Agent 就绪

这个资产会安全暂存

这个资产会先安全暂存。复制的指令会要求 Agent 读取暂存文件,并在激活脚本、MCP 配置或全局配置前先确认。

Stage only · 17/100策略:需暂存
Agent 入口
任意 MCP/CLI Agent
类型
Mcp Config
安装
Stage only
信任
信任等级:Community
入口
Wrangler MCP — Cloudflare Workers for AI Agents
安全暂存命令
npx -y tokrepo@latest install 70204503-1a90-4c8b-9e87-b36f65798fe7 --target codex

先暂存文件;激活前需要读取暂存 README 和安装计划。

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.

常见问题

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.

引用来源 (3)
🙏

来源与感谢

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产