• SQL RESULTS
  • KV ACCESS
  • DATA AUDIT
  • HUMAN REVIEW

How to manage D1 and KV data with your AI

Connect your AI to Cloudflare to interact with your databases and key-value stores using plain text.

Ask AI about this page

Short answer

How can I manage D1 and KV data with my AI?

You can execute SQL commands on D1 databases and pull specific values from KV namespaces directly in your chat interface. This lets you inspect your data and run queries without leaving your AI client. You'll see the results immediately in your conversation.

Where every action lands.

Data management outcomes

Your AI handles the heavy lifting of database interaction and data retrieval.

SQL RESULTS

Direct database queries

The AI runs your SQL commands against D1 and returns the rows you requested. You get clean data tables right in the chat.

KV ACCESS

Key-value lookups

Your agent finds specific keys or lists everything in a namespace. It pulls the exact values you need for your application logic.

DATA AUDIT

Namespace inventory

The AI lists your available D1 databases and KV namespaces. This helps you confirm you are targeting the right storage locations.

HUMAN REVIEW

Manual verification

You review the query results or key values before making any decisions. The AI provides the data, but you decide what to do with it.

The workflow

What your AI does when you ask for data.

The AI translates your intent into specific Cloudflare API calls.

  1. Locate storage

    The AI identifies which D1 databases or KV namespaces you want to work with.

    list_d1_databaseslist_kv_namespaces
  2. Fetch keys

    If you need to see what is inside a KV namespace, the AI pulls a list of available keys.

    list_kv_keys
  3. Retrieve values

    The AI grabs the specific data stored under a key.

    get_kv_key
  4. Run queries

    The AI executes your SQL statements to return the requested rows.

    query_d1

Try it

Copy these to start.

Use these prompts to begin interacting with your Cloudflare data.

Starting points

Replace the database names and namespace IDs with your actual Cloudflare identifiers.

Cloudflare Connector

You're all set. Choose your MCP client and follow the setup instructions.

Connector linkhttps://edge.vinkius.com/vk_preview_QxZIaIoAXIL23CyRLSDVkRwHXoDvC0VRLSwRYtQS/mcp

Claude Desktop

Follow the steps below to connect in seconds.

  1. 1In Claude Desktop, open Settings → Connectors.
  2. 2Click “Add custom connector” and paste the connector link above as the remote MCP server URL.
  3. 3Click Add and start a new chat — Cloudflare capabilities are ready to use.
Configuration · claude_desktop_config.jsonCopy
{
  "mcpServers": {
    "cloudflare-mcp": {
      "url": "https://edge.vinkius.com/vk_preview_QxZIaIoAXIL23CyRLSDVkRwHXoDvC0VRLSwRYtQS/mcp"
    }
  }
}
Copy into chat04
  • Show me all my D1 databases.

  • List the keys in my 'session_cache' KV namespace.

  • Run a query on my 'users_db' to find the last 5 signups.

  • Get the value for the key 'config_v1' in my production KV namespace.

  • Claude
  • ChatGPT
  • Cursor
  • VS Code
  • Windsurf
  • Claude Code
  • JetBrains
  • Cline

Start here

Connect Cloudflare once, then ask.

Just link your account once. Your credentials stay encrypted, and you can immediately start chatting with your data.

Connect Cloudflare to your AI

FAQ

How the Cloudflare Connector behaves

  • 01

    Can the AI delete my D1 tables?

    No. The current tools only allow for listing and querying data. It cannot drop tables or delete records.

  • 02

    Can I update KV values through the chat?

    No. The AI can only read and list keys and values. It cannot write or update data in your KV namespaces.

  • 03

    Does the AI see all my Cloudflare data?

    No. The AI only sees the specific D1 databases and KV namespaces you instruct it to interact with using the provided tools.

  • 04

    Can the AI create new D1 databases?

    No. The capability is limited to listing existing databases and running queries against them.

  • 05

    How does the AI handle SQL errors?

    If a query is malformed, the AI will receive the error from Cloudflare and explain what went wrong in plain English.

  • More questions about Cloudflare? See everything the Cloudflare Connector can do

Connect Cloudflare to Claude, Cursor, ChatGPT & more