mcp-with-d1-data

mcp-with-d1-data

1

The MCP Server Demo is a project demonstrating the implementation of an MCP server using Cloudflare technologies to interact with databases. It features a robust system for database management, server events, and testing tools.

Overview

  • This repository demonstrates building an MCP server for accessing and querying database information using the @modelcontextprotocol/sdk library and Cloudflare's MCPAgent.

Features

  • Database Integration: Uses a D1 database with SQL migration files for schema management.
  • Core Server Implementation: MyMCP class extends McpAgent for server sent events and is implemented as a Durable Object.
  • Tools: Includes a query tool for SQL query interfaces and a schema introspection tool for database structure understanding.
  • Integration Tests: Tests are included for validating MCP server functionality.

Getting Started

  • Requires Node.js and Cloudflare Workers CLI.
  • Install dependencies and start development or deploy to Cloudflare Workers.

License

  • Licensed under the MIT License.