mcp-server-cloudflare
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Integrations
Allows management of Cloudflare resources including Workers, KV namespaces, R2 storage buckets, D1 databases, and analytics. Capabilities include deploying Workers, querying D1 databases, manipulating data in KV stores, managing R2 buckets and objects, and retrieving analytics data for domains.
Cloudflare MCP Server
Model Context Protocol (MCP) is a new, standardized protocol for managing context between large language models (LLMs) and external systems. In this repository, we provide an installer as well as an MCP Server for Cloudflare's API.
This lets you use Claude Desktop, or any MCP Client, to use natural language to accomplish things on your Cloudflare account, e.g.:
Please deploy me a new Worker with an example durable object.
Can you tell me about the data in my D1 database named '...'?
Can you copy all the entries from my KV namespace '...' into my R2 bucket '...'?
Demo
Setup
- Run
npx @cloudflare/mcp-server-cloudflare init
Note: The MCP server will automatically run
npx wrangler login
if you're not already authenticated with Cloudflare. You'll be prompted to complete the authentication process in your browser if needed.
- Restart Claude Desktop, you should see a small 🔨 icon that shows the following tools available for use:
Paid Features
Some features in this MCP server require a paid Cloudflare Workers plan:
- Observability and Analytics: The
analytics_get
tool and related analytics features require a paid Workers plan to access these metrics - Other premium Cloudflare features like advanced D1 database capabilities and higher usage limits also require appropriate paid plans
Ensure your Cloudflare account has the necessary subscription level for the features you intend to use.
Features
KV Store Management
get_kvs
: List all KV namespaces in your accountkv_get
: Get a value from a KV namespacekv_put
: Store a value in a KV namespacekv_list
: List keys in a KV namespacekv_delete
: Delete a key from a KV namespace
R2 Storage Management
r2_list_buckets
: List all R2 buckets in your accountr2_create_bucket
: Create a new R2 bucketr2_delete_bucket
: Delete an R2 bucketr2_list_objects
: List objects in an R2 bucketr2_get_object
: Get an object from an R2 bucketr2_put_object
: Put an object into an R2 bucketr2_delete_object
: Delete an object from an R2 bucket
D1 Database Management
d1_list_databases
: List all D1 databases in your accountd1_create_database
: Create a new D1 databased1_delete_database
: Delete a D1 databased1_query
: Execute a SQL query against a D1 database
Workers Management
worker_list
: List all Workers in your accountworker_get
: Get a Worker's script contentworker_put
: Create or update a Worker scriptworker_delete
: Delete a Worker script
Durable Objects
durable_objects_list
: List all Durable Objects namespacesdurable_objects_create
: Create a new Durable Objects namespacedurable_objects_delete
: Delete a Durable Objects namespacedurable_objects_list_instances
: List all instances for a specific Durable Objects namespacedurable_objects_get_instance
: Get details about a specific Durable Objects instancedurable_objects_delete_instance
: Delete a specific Durable Objects instance
Queues
queues_list
: List all Queues in your accountqueues_create
: Create a new Queuequeues_delete
: Delete a Queuequeues_get
: Get details about a specific Queuequeues_send_message
: Send a message to a Queuequeues_get_messages
: Get messages from a Queuequeues_update_consumer
: Update a Queue consumer
Workers AI
workers_ai_list_models
: List available AI modelsworkers_ai_get_model
: Get details about a specific AI modelworkers_ai_run_inference
: Run inference using Workers AIworkers_ai_list_tasks
: List AI tasks
Workflows
workflows_list
: List all Workflows in your accountworkflows_create
: Create a new Workflowworkflows_delete
: Delete a Workflowworkflows_get
: Get details about a specific Workflowworkflows_update
: Update a Workflowworkflows_execute
: Execute a Workflow
Templates
templates_list
: List available Worker templatestemplates_get
: Get details about a specific templatetemplates_create_from_template
: Create a new Worker from a template
Workers for Platforms
w4p_list_dispatchers
: List all Workers for Platforms dispatchersw4p_create_dispatcher
: Create a new dispatcherw4p_delete_dispatcher
: Delete a dispatcherw4p_get_dispatcher
: Get details about a specific dispatcherw4p_update_dispatcher
: Update a dispatcher configuration
Service Bindings
bindings_list
: List all service bindings for a Workerbindings_create
: Create a new service bindingbindings_update
: Update a service bindingbindings_delete
: Delete a service binding
URL Routing
routing_list_routes
: List all routes for a Workerrouting_create_route
: Create a new routerouting_update_route
: Update a routerouting_delete_route
: Delete a route
Cron Triggers
cron_list
: List all cron triggers for a Workercron_create
: Create a new cron triggercron_update
: Update a cron triggercron_delete
: Delete a cron trigger
Zones & Domains
zones_list
: List all zones in your accountzones_create
: Create a new zonezones_delete
: Delete a zonezones_get
: Get details about a specific zonezones_check_activation
: Check zone activation status
Secrets
secrets_list
: List all secrets for a Workersecrets_put
: Create or update a secretsecrets_delete
: Delete a secret
Version Management
versions_list
: List all versions of a Workerversions_get
: Get details about a specific versionversions_rollback
: Rollback to a previous version
Wrangler Config
wrangler_get_config
: Get the current Wrangler configurationwrangler_update_config
: Update Wrangler configuration
Analytics
analytics_get
: Retrieve analytics data for your domain- Includes metrics like requests, bandwidth, threats, and page views
- Supports date range filtering
Developing
In the current project folder, run:
Then, in a second terminal:
This will link Claude Desktop against your locally-installed version for you to test. If you're not already authenticated with Wrangler, the server will automatically prompt you to complete the authentication process in your browser.
Testing
The project uses Vitest as the testing framework with MSW (Mock Service Worker) for API mocking.
Running Tests
To run all tests:
To run tests with coverage:
To run a specific test file:
To run tests in watch mode (useful during development):
Test Structure
The test suite is organized as follows:
tests/tools/
: Contains tests for each Cloudflare API tooltests/mocks/
: Contains mock data and request handlerstests/utils/
: Contains test helper functionstests/setup.ts
: Global test setup configuration
Each tool test file follows a consistent pattern of testing both successful operations and error handling scenarios.
Usage outside of Claude
To run the server locally, run node dist/index run <account-id>
.
If you're using an alternative MCP Client, or testing things locally, emit the tools/list
command to get an up-to-date list of all available tools. Then you can call these directly using the tools/call
command.
Workers
KV Store
R2 Storage
D1 Database
Analytics
Durable Objects
Queues
Workers AI
Workflows
Templates
Workers for Platforms
Service Bindings
URL Routing
Cron Triggers
Zones & Domains
Secrets
Version Management
Wrangler Config
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
This server cannot be installed
Lets you use Claude Desktop, or any MCP Client, to use natural language to accomplish things on your Cloudflare account.