How to Use the New Unified Cloudflare CLI and Local Explorer
Learn how to use Cloudflare's new cf CLI and Local Explorer to streamline cross-product development and debug local data for AI agents and human developers.
Cloudflare’s new unified Cloudflare CLI and Local Explorer lets you manage over 100 products and debug local infrastructure through a single terminal interface. Released during the April 2026 Agents Week, the cf tool consolidates nearly 3,000 API operations into one command-line utility optimized for both human developers and AI coding assistants. This tutorial covers how to install the CLI, configure unified infrastructure files, and inspect development resources using the local mirror API.
Installing the Unified CLI
The new cf tool is currently available as a technical preview. It operates independently of the legacy Wrangler toolset during this phase. Cloudflare plans to merge these capabilities back into the main Wrangler CLI over the coming months.
You can run the technical preview immediately without permanent installation using npx cf. For continuous availability across your system, install the package globally via npm with npm install -g cf.
The core architectural shift is scope. Wrangler historically focused specifically on Cloudflare Workers and related edge compute features. The cf command spans the entire Cloudflare ecosystem. You can provision DNS records, configure zero-trust policies, and deploy serverless functions from the same executable.
Configuring Infrastructure as Code
The unified CLI relies on a comprehensive Infrastructure-as-Code approach. You manage the configuration for all Cloudflare products within a single wrangler.jsonc file.
This consolidation moves away from separate configuration files or dashboard toggles for different services. A single repository can now dictate the routing, caching, and compute rules for an entire application. State changes are executed across the 3,000 available API operations based on the unified JSON with comments format.
Debugging with Local Explorer
Local Explorer is an open beta feature available for Wrangler and the Cloudflare Vite plugin. It provides a visual interface for inspecting simulated resources running on your local machine.
When executing a Worker application locally, pressing the e keyboard shortcut in your active terminal session launches a dedicated local web application. This dashboard renders all active resource bindings and the data held within them.
The Local Explorer interface supports introspection for five core storage and compute resources.
| Resource Type | Introspection Capability |
|---|---|
| KV | View and modify local key-value pairs |
| R2 | Inspect simulated storage buckets and objects |
| D1 | Query local development SQLite databases |
| Durable Objects | Inspect state for active singleton instances |
| Workflows | Monitor local execution steps and status |
Working with the Local Mirror API
The Local Explorer architecture includes a local mirror of the Cloudflare API. This offline endpoint is automatically provisioned at /cdn-cgi/explorer/api whenever you start a Wrangler-powered application in development mode.
You can route CLI commands directly to this local mirror. Appending the --local flag to your terminal commands intercepts the request. The tool redirects the payload away from Cloudflare’s production network and processes it against your local simulated environment.
This routing mechanism allows developers to test destructive commands offline. You can test database migrations, object deletions, or workflow cancellations against the local mirror before applying those changes to production infrastructure.
Exposing the API to Agents via MCP
Cloudflare optimized the cf CLI specifically for automated systems. Navigating web dashboards requires complex browser automation. Command-line interfaces provide a rigid, predictable target for AI agents interacting with cloud infrastructure.
To support this programmatic usage, Cloudflare provides a Code Mode server implementing the Model Context Protocol. This server exposes the entire Cloudflare API surface to connected language models.
The MCP server implementation requires fewer than 1,000 tokens of context. This tight token budget preserves the maximum possible context window for your actual application code, logs, and reasoning steps during an automated debugging session.
Managing Agent Environments and State
The CLI release coordinates with several new infrastructure primitives designed for agent execution. You can provision Cloudflare Sandboxes directly from the CLI to create persistent, isolated environments. These environments provide automated systems with a full shell and filesystem.
Security for these automated environments relies on Outbound Workers. This acts as a programmable zero-trust egress proxy. You can safely inject API credentials into the sandbox environment and enforce strict security policies restricting where the agent can send data.
Managing state for these systems utilizes Durable Object Facets. This open beta feature allows Dynamic Workers to instantiate Durable Objects equipped with isolated, per-agent SQLite databases. You can manage these databases via the CLI to inspect exactly what a stateful AI agent has recorded during its lifecycle.
Technical Tradeoffs and Limitations
The heavy optimization for autonomous agents creates distinct friction points for human developers. The technical preview prioritizes machine-readable outputs and predictable command structures over ergonomic human terminal displays.
Granular permission checking requires further development. Commands for auditing access levels, such as cf permissions check, are absent from the current technical preview. You must rely on the web dashboard to audit API token scopes and user roles.
Integration with external infrastructure provisioning tools is currently limited. The unified CLI and the wrangler.jsonc specification lack robust support for the V5 Terraform provider. Teams relying heavily on Terraform for cross-cloud orchestration will need to maintain parallel configuration pipelines.
Start testing the local mirror API by running your current Worker project with Wrangler, pressing e to verify your local bindings, and executing a test query against the /cdn-cgi/explorer/api endpoint.
Get Insanely Good at AI
The book for developers who want to understand how AI actually works. LLMs, prompt engineering, RAG, AI agents, and production systems.
Keep Reading
Anthropic Makes Claude's 1M Token Context Generally Available
Anthropic made 1M-token context GA for Claude 4.6, removing long-context premiums and boosting throughput for large code and agent tasks.
How to Speed Up Regex Search for AI Agents
Learn how Cursor uses local sparse n-gram indexes to make regex search fast enough for interactive AI agent workflows.
What Are Agent Skills and Why They Matter
Agent skills are portable packages of instructions that extend AI coding agents. Here's what they are, how they work, and why the open standard changes how developers work with AI tools.
How to Deploy Enterprise MCP with Cloudflare Workers
Learn to secure and scale Model Context Protocol deployments using Cloudflare’s reference architecture for remote MCP servers and centralized portals.
How to Use Subagents in Gemini CLI
Learn how to build and orchestrate specialized AI subagents in Gemini CLI to prevent context rot and improve development speed using isolated expert loops.