# Cloudflare MCP for AI Agents AI Agent Connect

> Cloudflare MCP gives your AI agents direct access to manage your edge infrastructure. You can deploy Workers, manage KV and D1 databases, handle R2 buckets, and monitor real-time analytics without leaving your chat window. It replaces manual CLI commands and dashboard navigation with natural language instructions for your entire Cloudflare stack.

## Overview
- **Category:** ai-frontier
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_QxZIaIoAXIL23CyRLSDVkRwHXoDvC0VRLSwRYtQS/ai-agent-connect
- **Tags:** serverless, edge-computing, infrastructure-as-code, api-management, deployment-automation, secrets-management

## Description

This Connector lets your AI agent take over the heavy lifting of managing your Cloudflare environment. Instead of context-switching between your code editor, the Wrangler CLI, and the Cloudflare dashboard, you can just tell your agent what needs to happen. If you need to roll out a new Worker version, check a KV key, or grab some D1 database results, the agent handles the interaction for you. It's built to handle the nitty-gritty of edge computing, from rotating secrets to purging CDN caches. You get a way to treat your infrastructure as a conversation. Because Vinkius hosts this Connector, you can plug it into your existing workflow and start managing your edge presence through a single interface. It's about moving faster by letting the agent do the clicking and typing while you focus on the logic. You don't have to remember specific CLI flags or navigate through nested menus to find a specific R2 bucket or a zone's analytics. The agent knows how to talk to the platform so you don't have to. Whether you are trying to debug a production issue with real-time logs or you need to perform a bulk purge of your CDN cache to reflect a major update, the agent handles the specific steps for you. It bridges the gap between your high-level intent and the low-level platform actions. You can manage your entire edge stack, including serverless functions, key-value storage, and object storage, without ever leaving your primary workspace. It turns your infrastructure into a manageable set of commands that your agent can execute on your behalf.

## Tools

### create_deployment
Deploy a specific Worker version using immediate or gradual traffic strategies. This helps you manage rollouts and rollbacks easily.

### create_secret
Create or update encrypted secrets like API keys for your Workers. It ensures your sensitive data stays secure while being accessible to your code.

### create_tail_session
Start a real-time logging session for a specific Worker. Use this to debug production errors as they happen.

### create_worker_route
Set up a new URL pattern to trigger your Worker. This is how you expose your edge functions to the web.

### delete_secret
Remove old secrets or rotate credentials to keep your environment clean. This ensures your Worker stops using outdated keys.

### delete_tail_session
Close a logging session once you're done debugging. This keeps your active sessions organized.

### delete_worker_route
Stop serving a Worker at a specific URL pattern. Use this to clean up old routes or reassign paths.

### delete_worker
Permanently remove a Worker script and its resources. You should confirm this before running it to avoid accidental deletion.

### get_kv_key
Fetch the value of a specific key from a KV namespace. This is great for reading config values or cached data.

### get_worker_analytics
Pull recent performance data for a specific Worker. Use it to track usage trends and identify errors.

### get_worker
Retrieve the full configuration of a specific Worker. This is helpful for auditing settings before you make changes.

### get_worker_version
Get the details of a specific Worker version. Use this to audit code snapshots or prepare for a rollback.

### get_zone_analytics
Get aggregated traffic data for a specific zone. It helps you see spikes and measure CDN performance.

### list_d1_databases
See all D1 databases in your account. Use this to find the right database ID before running a query.

### list_deployments
View all deployments for a Worker, including traffic percentages. This lets you see what's live right now.

### list_kv_keys
List all keys in a KV namespace. It's the best way to audit your stored data or find a specific key.

### list_kv_namespaces
See every KV namespace in your account. Use this to identify where your data is stored.

### list_r2_buckets
View all R2 storage buckets. This helps you see your available object storage at a glance.

### list_secrets
See which secrets are configured for a Worker. This helps you audit your environment without exposing the actual values.

### list_worker_routes
See all URL patterns that trigger a Worker. Use this to understand your current edge routing.

### list_worker_versions
See the history of all deployed Worker snapshots. This is your audit trail for rollbacks and updates.

### list_workers
List every Worker script in your account. Use this as a starting point to find the scripts you need to manage.

### list_zones
See all DNS zones in your account. This gives you the zone IDs needed for routes and cache operations.

### purge_cache
Clear all cached content for a specific zone. This ensures your users see the latest updates immediately.

### query_d1
Run SQL queries against your D1 database. Use this for migrations, data analysis, or quick checks.

## Prompt Examples

**Prompt:** 
```
I just updated the production Worker. Can you deploy it with a 10% gradual rollout?
```

**Response:** 
```
### Deployment Initiated

I'm starting the gradual rollout for your Worker.

*   **Target Version:** `v2.4.1` (latest)
*   **Strategy:** Gradual (10% traffic)
*   **Status:** In progress

I'll monitor the deployment and let you know if it completes successfully.
```

**Prompt:** 
```
I need to see the latest logs for the 'auth-worker' to see why users are getting 500 errors.
```

**Response:** 
```
### Tail Logs: auth-worker

I've started a real-time logging session. Here are the latest entries:

| Timestamp | Level | Message |
| :--- | :--- | :--- |
| 14:02:01 | ERROR | `Internal Server Error: Database connection timeout` |
| 14:02:05 | ERROR | `Internal Server Error: Database connection timeout` |

It looks like the database might be struggling to keep up with requests.
```

**Prompt:** 
```
Get me the API URL from the KV namespace called 'config' and then check if the D1 database has any new entries.
```

**Response:** 
```
### Data Retrieval

**KV Result:**
*   **Key:** `gateway_url`
*   **Value:** `https://api.vinkius.cloud` 

**D1 Database Query:**
I've checked the `production_db` and found **3 new entries** in the `users` table since the last check.
```

## Capabilities

### Deploy Worker versions
Roll out new code to the edge using immediate or percentage-based traffic strategies.

### Manage environment secrets
Create, list, and rotate encrypted API keys and passwords for your scripts.

### Query D1 and KV data
Run SQL queries against your SQLite databases or fetch key-value pairs instantly.

### Monitor R2 storage
List and manage your object storage buckets and contents via chat.

### Stream production logs
Create real-time tailing sessions to debug Worker errors as they happen.

### Control CDN and routes
Configure URL patterns and purge cached content to serve fresh data.

## Use Cases

### Rolling back a buggy production Worker
A developer notices a bug and asks their agent to find the last stable version using list_worker_versions. The agent then uses create_deployment to shift 100% of traffic back to that version.

### Rotating a leaked API key
An engineer tells their agent to delete the old secret using delete_secret and then create a new one with create_secret to update the Worker environment safely.

### Checking production data values
An analyst asks the agent to fetch a config URL from a KV namespace using get_kv_key and then run a query_d1 to see if the database matches that configuration.

### Purging cache after a major update
A site owner notices old assets appearing and asks the agent to purge_cache for their zone to ensure all users see the fresh content immediately.

## Benefits

- Speed up rollouts by using create_deployment to handle gradual traffic shifts without manual configuration.
- Secure your environment by using create_secret and delete_secret to rotate keys without touching the dashboard.
- Debug production issues faster with create_tail_session to stream logs directly into your chat.
- Simplify data management by using query_d1 and get_kv_key to check your databases and keys instantly.
- Monitor your traffic health with get_zone_analytics and get_worker_analytics to spot issues before users do.
- Clean up your infrastructure by using list_workers and list_kv_namespaces to audit what's actually running.

## How It Works

The bottom line is you swap manual CLI commands and dashboard clicks for direct natural language control of your edge infrastructure.

1. Generate a Cloudflare API token with permissions for Workers, KV, D1, R2, and Analytics.
2. Provide your Cloudflare Account ID to your AI client.
3. Ask your agent to perform tasks like deploying code, querying databases, or purging cache.

## Frequently Asked Questions

**Can I use the Cloudflare MCP to deploy my Workers?**
Yes. You can tell your AI agent to deploy specific versions of your Workers, including choosing whether to send 100% of traffic immediately or perform a gradual rollout.

**How does the Cloudflare MCP help with managing my secrets?**
It allows you to create, list, and rotate encrypted secrets like API keys or database passwords through natural language. This keeps your sensitive credentials out of your source code.

**Can I run SQL queries on my Cloudflare D1 database using this?**
Yes. Your agent can execute SELECT, INSERT, UPDATE, and DELETE queries against your D1 databases to help with data analysis or migrations.

**Does the Cloudflare MCP support managing R2 buckets?**
It does. You can ask your agent to list your R2 buckets or manage the objects inside them without needing to navigate the storage dashboard.

**How do I monitor my Worker performance with the Cloudflare MCP?**
You can ask the agent to pull analytics for specific Workers or zones. It will retrieve data on traffic patterns, CPU usage, and error rates for you.

**Can the Cloudflare MCP help me purge my CDN cache?**
Yes. You can tell your agent to purge the cache for a specific zone, which is helpful when you've updated static assets and need them to refresh for everyone immediately.

**Can I deploy new Worker scripts directly through the AI agent?**
Yes! You can orchestrate deployments natively mapping source code variables seamlessly without touching Wrangler.

**Does it interact with specific D1 Serverless SQL definitions?**
Absolutely. Ask your agent to parse complex D1 databases and query tables instantly utilizing precise analytical calls.

**How are environment variables and secrets handled?**
All `add_secret` queries execute symmetrically securely masking output variables while committing seamlessly inside Cloudflare matrices.