Home / Servers / Cloudflare API / d1_query_database

Query D1 Database

An MCP tool from the Cloudflare API server, hosted on mcp.hjlabs.in.

Query D1 Database Execute a SQL query against a D1 database and return results as objects. [POST /accounts/{account_id}/d1/database/{database_id}/query]

Name on the gateway: cloudflare_api__d1_query_database · may change things.

Parameters

NameTypeDescription
account_id requiredstringaccount_id parameter
database_id requiredstringdatabase_id parameter
paramsarray
sql requiredstringYour SQL query. Supports multiple statements…

How to call it

Through the Smart Gateway, any client can run it by name with call_tool, or let the gateway find it with search_tools:

call_tool arguments
{
  "name": "cloudflare_api__d1_query_database",
  "arguments": {
    "account_id": "…",
    "database_id": "…",
    "sql": "…"
  }
}

Or connect the Cloudflare API server directly, which lists 3,127 tools including this one:

Run in your terminal
claude mcp add --transport http hj-cloudflare-api https://mcp.hjlabs.in/mcp/cloudflare-api \
  --header "Authorization: Bearer YOUR_API_KEY"

Try asking

Use the query d1 database tool with account_id set to ….

More from Cloudflare API