1. Conduid
  2. Data
  3. ktanaka101/mcp-server-duckdb
MCP server · Data

ktanaka101/mcp-server-duckdb

A Model Context Protocol (MCP) server implementation for DuckDB, providing database interaction capabilities

Unclaimed MIT last commit a year ago data
72Good

Scored yesterday · breakdown

About ktanaka101/mcp-server-duckdb

ktanaka101/mcp-server-duckdb is an MCP server published by ktanaka101 in the Data category: a Model Context Protocol (MCP) server implementation for DuckDB, providing database interaction capabilities.

The repository has 179 stars and 21 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

Claude Code
claude mcp add duckdb -- npx -y duckdb-mcp
npx
npx -y duckdb-mcp

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 (1)

queryExecute any SQL query on the DuckDB database

Parameters not published.

Ask AI

✦

Ask AI about ktanaka101/mcp-server-duckdb

Powered by Claude · Grounded in docs

I know everything about ktanaka101/mcp-server-duckdb. Ask me about installation, configuration, usage, or troubleshooting.

Security checks

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

  • ✓README presentThe repository ships documentation.
  • ✓License declaredUsable under a stated license.
  • ✓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.

Releases

v1.1.0v1.1.0 · 5 May 2025What's Changed Add `--keep-connection` option – keeps a persistent DuckDB connection so `TEMP` tables and `TEMP MACRO` objects survive across queries by @risyou in https://github.com/ktanaka101/mcp-server-duckdb/pull/24 New Contributors…
v1.0.1v1.0.1 · 18 Mar 2025What's Changed Update README to reflect unified query function by @ktanaka101 in https://github.com/ktanaka101/mcp-server-duckdb/pull/20 Full Changelog: https://github.com/ktanaka101/mcp-server-duckdb/compare/v1.0.0...v1.0.1
v1.0.0v1.0.0 · 18 Mar 2025What's Changed update packages by @ktanaka101 in https://github.com/ktanaka101/mcp-server-duckdb/pull/14 Allow PRAGMA and SHOW commands in read-query by @ktanaka101 in https://github.com/ktanaka101/mcp-server-duckdb/pull/16 Consolidate…
v0.2.4v0.2.4 · 5 Jan 2025What's Changed fix: Fix log message by @ktanaka101 in https://github.com/ktanaka101/mcp-server-duckdb/pull/8 Add test code by @ktanaka101 in https://github.com/ktanaka101/mcp-server-duckdb/pull/10 test: Add unit tests for Config class by…
v0.2.3v0.2.3 · 4 Jan 2025What's Changed chore: Bump version to 0.2.3 by @ktanaka101 in https://github.com/ktanaka101/mcp-server-duckdb/pull/7 Full Changelog: https://github.com/ktanaka101/mcp-server-duckdb/compare/v0.2.2...v0.2.3

README

mcp-server-duckdb

PyPI - Version PyPI - License smithery badge

A Model Context Protocol (MCP) server implementation for DuckDB, providing database interaction capabilities through MCP tools. It would be interesting to have LLM analyze it. DuckDB is suitable for local analysis.

Overview

This server enables interaction with a DuckDB database through the Model Context Protocol, allowing for database operations like querying, table creation, and schema inspection.

Components

Resources

Currently, no custom resources are implemented.

Prompts

Currently, no custom prompts are implemented.

Tools

The server implements the following database interaction tool:

  • query: Execute any SQL query on the DuckDB database
    • Input: query (string) - Any valid DuckDB SQL statement
    • Output: Query results as text (or success message for operations like CREATE/INSERT)

[!NOTE] The server provides a single unified query function rather than separate specialized functions, as modern LLMs can generate appropriate SQL for any database operation (SELECT, CREATE TABLE, JOIN, etc.) without requiring separate endpoints.

[!NOTE] When the server is running in readonly mode, DuckDB's native readonly protection is enforced. This ensures that the Language Model (LLM) cannot perform any write operations (CREATE, INSERT, UPDATE, DELETE), maintaining data integrity and preventing unintended changes.

Configuration

Required Parameters

  • db-path (string): Path to the DuckDB database file
    • The server will automatically create the database file and parent directories if they don't exist
    • If --readonly is specified and the database file doesn't exist, the server will fail to start with an error

Optional Parameters

  • --readonly: Run server in read-only mode (default: false)
    • Description: When this flag is set, the server operates in read-only mode. This means:
      • The DuckDB database will be opened with read_only=True, preventing any write operations.
      • If the specified database file does not exist, it will not be created.
      • Security Benefit: Prevents the Language Model (LLM) from performing any write operations, ensuring that the database remains unaltered.
    • Reference: For more details on read-only connections in DuckDB, see the DuckDB Python API documentation.
  • --keep-connection: Re-uses a single DuckDB connection mode (default: false)
    • Description: When this flag is set, Re-uses a single DuckDB connection for the entire server lifetime. Enables TEMP objects & slightly faster queries, but can hold an exclusive lock on the file.

Installation

Installing via Smithery

To install DuckDB Server for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install mcp-server-duckdb --client claude

Claude Desktop Integration

Configure the MCP server in Claude Desktop's configuration file:

MacOS

Location: ~/Library/Application Support/Claude/claude_desktop_config.json

Windows

Location: %APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "duckdb": {
      "command": "uvx",
      "args": [
        "mcp-server-duckdb",
        "--db-path",
        "~/mcp-server-duckdb/data/data.db"
      ]
    }
  }
}
  • Note: ~/mcp-server-duckdb/data/data.db should be replaced with the actual path to the DuckDB database file.

Development

Prerequisites

  • Python with uv package manager
  • DuckDB Python package
  • MCP server dependencies

Debugging

Debugging MCP servers can be challenging due to their stdio-based communication. We recommend using the MCP Inspector for the best debugging experience.

Using MCP Inspector

  1. Install the inspector using npm:
npx @modelcontextprotocol/inspector uv --directory ~/codes/mcp-server-duckdb run mcp-server-duckdb --db-path ~/mcp-server-duckdb/data/data.db
  1. Open the provided URL in your browser to access the debugging interface

The inspector provides visibility into:

  • Request/response communication
  • Tool execution
  • Server state
  • Error messages

README fetched from the repository yesterday. The original is authoritative.

Questions

About ktanaka101/mcp-server-duckdb

How do I install ktanaka101/mcp-server-duckdb?

Run claude mcp add duckdb -- npx -y duckdb-mcp, then add the server to your MCP client's configuration.

Is ktanaka101/mcp-server-duckdb safe to use with an AI agent?

Its trust score is 72 out of 100 (good). It passes 5 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 ktanaka101/mcp-server-duckdb still maintained?

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