1. Conduid
  2. Cloud
  3. With D1 Data
MCP server · Cloud

With D1 Data

Demo MCP Server build using Cloudflare MCPAgent Durable Objects and D1 database

44Fair

Scored 5 months ago · breakdown

About With D1 Data

With D1 Data is an MCP server published by jubalm in the Cloud category: demo MCP Server build using Cloudflare MCPAgent Durable Objects and D1 database.

The repository has 2 stars and 0 forks, with the last commit a year ago. Six months or more without a commit doesn't mean the server is broken, but check the open issues before depending on it in production.

Install

From source
git clone https://github.com/jubalm/mcp-with-d1-data

This server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.

Tools (2)

queryQuery compliance database. This tool allows querying the compliance database with SQL. Input should include a valid SQL query string and an optional

Parameters not published.

schema-introspectionRetrieve database schema information, including tables, columns, data types, and relationships. Optionally, specify a table name to get details for a specific table.

Parameters not published.

Ask AI

✦

Ask AI about With D1 Data

Powered by Claude · Grounded in docs

I know everything about With D1 Data. Ask me about installation, configuration, usage, or troubleshooting.

Security checks

Static checks derived from the repository just now. Heuristics on the source, not an audit.

  • ✓README presentThe repository ships documentation.
  • !License declaredNo license file. Legally you have no right to use it in a product.
  • ✓Tests presentA test suite exists in the repository.
  • ✓Dependencies pinnedA lockfile pins dependency versions.
  • ✓No dynamic code executionSource scan found no eval, dynamic Function, or shell execution.
  • !Scoped permissionsDoesn't declare a permission scope. Assume it can do anything its process can.

README

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.

README fetched from the repository just now. The original is authoritative.

Questions

About With D1 Data

How do I install With D1 Data?

No package has been published for this server, so install it from source: clone the repository and follow its README.

Is With D1 Data safe to use with an AI agent?

Its trust score is 44 out of 100 (fair). It passes 4 of the 6 static security checks run so far; the failures are listed above. It has no ConduID identity yet, so agent calls to it are not receipted.

Is With D1 Data still maintained?

The last commit was a year ago. That's long enough that you should check whether the maintainer is responding to issues before depending on it.