Back Home

AI 安全/MCP

Cloudflare API MCP Adopts Optional OAuth Scopes, Letting Agents Narrow Permissions to What Each Task Requires

Wrangler and Cloudflare API MCP Server now allow users to reject unnecessary scopes during authorization instead of requiring them to accept all requested permissions. Required scopes still cannot be deselected, and tool calls lacking the necessary scope can run only after reauthorization.

G.Goodwin Jr. and Snark · CC BY-SA 3.0 · Image source
zh-Hant

Cloudflare updated the OAuth flow in Wrangler and Cloudflare API MCP Server on August 22, marking some requested permissions as optional scopes. Users can open the permission editor on the consent screen and retain only the read and write access needed for the current task; required scopes remain selected. If an agent later attempts to execute a command that requires a previously rejected scope, the user must reauthorize and add that permission.

This is a substantive security change to agent infrastructure. Cloudflare’s MCP Server can access products including Workers, KV, R2, D1, Pages, DNS, Firewall, Load Balancing, AI Gateway, and Vectorize. Rather than placing the complete schemas for roughly 2,500 API endpoints into the model context, the official server uses Code Mode to expose three primary tools: `docs`, `search`, and `execute`. The agent first searches server-side specifications, then generates code that calls the actual API. According to Cloudflare’s estimates, this reduces tool descriptions from approximately 244K tokens to about 1.1K tokens, but it does not inherently narrow credential permissions; a compact `execute` interface may still represent a large range of backend operations. Trimming scopes by task at the OAuth layer therefore directly limits the blast radius of prompt injection, model misjudgments, or a compromised session.

The new flow does not provide per-operation approval, nor is it equivalent to a tool-layer policy. After a user grants a write scope, the token can still perform the corresponding operations for as long as it remains valid. Whether human confirmation is required still depends on the MCP client, agent framework, and organizational policies. Rejecting a scope also does not necessarily cause the model to automatically remove unauthorized tools from its context, so engineers must still handle authorization failures and reauthentication flows.

Deployment teams should create least-privilege templates for common tasks—for example, permitting read-only access to Workers status without simultaneously granting write access to DNS or account administration. Key issues to watch next include whether Cloudflare publishes a migration path for existing tokens, a complete mapping between scopes and endpoints, and whether clients can dynamically hide tools based on the scopes actually granted, reducing invalid calls and permission confusion.

Sources

  1. Choose OAuth scopes for Wrangler and the Cloudflare API MCP server
  2. Cloudflare MCP Server repository
  3. OAuth provider library for Cloudflare Workers