MCP server for querying a Cloudflare D1 database

MCP server for querying a Cloudflare D1 database

mcp-with-d1-data•byjubalm

A demonstration MCP server built with the Model Context Protocol SDK and Cloudflare's MCPAgent that offers tools to query a D1 database and introspect its schema.

License: MIT License•Runtime: Awaiting documentation review•Category: databases storage

WHAT IT DOES

  • •Implements the MCP server as a Durable Object with SSE transport and built-in hibernation when idle.
  • •Provides a query tool that lets the LLM send SQL queries to the database.
  • •Provides a schema-introspection tool to help the LLM understand database structure for better query design.
  • •Includes SQL migration files managing schema and seed data.

BEST FOR

  • •Running SQL queries against a database through an LLM using MCP tools.
  • •Helping an LLM understand a database schema before generating queries.
  • •Learning how to build a stateful MCP server on Cloudflare Workers.

ABOUT MCP-WITH-D1-DATA

MCP server for querying a Cloudflare D1 database is cataloged as an MCP server attributed to jubalm. A demonstration MCP server built with the Model Context Protocol SDK and Cloudflare's MCPAgent that offers tools to query a D1 database and introspect its schema. It is categorized under databases storage. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: MIT License. Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for MCP server for querying a Cloudflare D1 database are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

上游原版 README

在 GitHub 查看同一版本原文

README.md · ca551a6aa5fd · 采集于 2026-11-13 13:44:37 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

MCP Server: Demo

Overview

This repository serves as a demonstration of building an MCP (Model Context Protocol) server that can access and query actual database information. Uses the @modelcontextprotocol/sdk library leveraging Cloudflare's MCPAgent to implement tools, manage resources, and a D1 database.

Features

Database

The project integrates with a D1 database (mcp-agent-d1-data) to retrieve data but you should be able to work with any database with some minor adjustments on the tools. Also included some niceties:

  • Schema Management: SQL migration files (up.sql, down.sql, seed.sql) in the db/ directory manage the database schema and seed data.

MCP Server (MyMCP)

The MyMCP class extends the McpAgent class from the @modelcontextprotocol/sdk library. It acts as the core server implementation, providing server sent events (SSE) as a foundational transport.

  • Durable Object: The server is implemented as a Durable Object, which allows stateful interactions and long process operations. It also comes with hibernation built-in when idle.

Query Tool

The query tool is designed to interact with the database by providing an interface where the LLM can send SQL queries onto the database. Use with care in production environments and practice proper authorization safeguards.

Introspection Tool

The schema-introspection tool is particularly useful to help the LLM understand the structure of the database to produce a more accurate query design.

Integration Tests

Included integration tests in the tests/ directory to get started. Validate the functionality of the MCP server and its tools, or use the tests for TDD.

npm run test

Project Structure

📦 d1-mcp
├── package.json
├── README.md
├── tsconfig.json
├── vitest.config.js
├── worker-configuration.d.ts
├── wrangler.jsonc
├── db
│   ├── down.sql
│   ├── seed.sql
│   └── up.sql
├── public
│   └── index.html
├── src
│   ├── index.ts
│   ├── metadata.ts
│   ├── tools.ts
│   └── utils.ts
└── tests
    ├── index.test.ts
    └── tsconfig.json

Getting Started

Prerequisites

  • Node.js
  • Cloudflare Workers CLI (wrangler)

Installation

  1. Clone the repository.
  2. Install dependencies:
    npm install
    

Development

  • Start the development server:
    npm run dev
    

Deployment

  • Deploy to Cloudflare Workers:
    npm run deploy
    

License

This project is licensed under the MIT License.

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for MCP server for querying a Cloudflare D1 database from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/mcp-with-d1-data)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related databases storage MCP Servers

Alternative and complementary servers in the same category

View all in databases storage →
AIStor MCP server
mcp-server-aistor•minio

This is a Model Context Protocol (MCP) server for interacting with AIStor object stores.

Repository stats unavailable
Databases & Storage
InfluxDB v2 MCP Server
influxdb-mcp-server•idoru

A Model Context Protocol (MCP) server that exposes access to an InfluxDB v2 instance using the InfluxDB OSS API v2.

Repository stats unavailable
Databases & Storage