MCPSERV.CLUB
ktanaka101

DuckDB MCP Server

MCP Server

SQL for LLMs, powered by DuckDB

Stale(55)
166stars
1views
Updated 14 days ago

About

A lightweight MCP server that exposes a single unified SQL query tool for DuckDB, enabling LLMs to perform read/write operations or run in secure readonly mode.

Capabilities

Resources
Access data sources
Tools
Execute functions
Prompts
Pre-built templates
Sampling
AI model interactions

mcp-server-duckdb MCP server

The mcp-server-duckdb server bridges the gap between conversational AI assistants and local analytical databases by exposing DuckDB through the Model Context Protocol (MCP). DuckDB is a column‑store engine optimized for analytical workloads, making it ideal for lightweight data exploration on a single machine. By turning DuckDB into an MCP service, developers can let language models query, create, and inspect data without leaving the chat interface or writing custom adapters.

At its core, the server offers a single, versatile tool called . This endpoint accepts any valid DuckDB SQL statement and returns the results as plain text or a success message for data‑definition operations. The simplicity of one unified function aligns with modern LLM capabilities, which can generate appropriate SQL for a wide range of tasks—SELECT, JOIN, CREATE TABLE, INSERT, and more—without needing multiple specialized endpoints. The server also supports a read‑only mode that leverages DuckDB’s native protection to lock the database against write operations, ensuring data integrity when an assistant is performing exploratory analysis.

Key features include:

  • Unified SQL execution: One endpoint for all database interactions, reducing the surface area and complexity of the MCP interface.
  • Read‑only protection: Optional flag that opens DuckDB with , preventing accidental schema changes or data mutations.
  • Connection reuse: An optional flag keeps a single connection alive, allowing temporary objects and slightly faster query performance at the cost of holding an exclusive file lock.
  • Automatic database creation: When not in read‑only mode, the server creates the specified database file and parent directories if they do not exist.

Typical use cases involve data scientists or analysts who want to ask an AI assistant questions like “Show me the top 10 sales by region” or “Add a new column for total revenue.” The assistant can generate the SQL, send it to the MCP server via the tool, and receive a human‑readable answer—all without leaving the chat. In security‑sensitive environments, the read‑only mode guarantees that the assistant cannot modify production data while still enabling rich analytical queries.

Integrating mcp-server-duckdb into an AI workflow is straightforward: the server is registered in the MCP client configuration, and the assistant can invoke the tool by name. Because DuckDB is embedded and runs locally, latency remains low, making the interaction feel instantaneous. This server therefore empowers developers to add powerful, local data analysis capabilities to conversational AI systems with minimal overhead and maximum safety.