TD

teaguesterling/duckdb_mcp

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

70 stars 8 forks 品質 73 トレンド 14Apache-2.0

teaguesterling/duckdb mcp は [https://github.com/teaguesterling/duckdb_mcp.] からインポートされた MCP サーバー候補です

概要

teaguesterling/duckdb mcp は [https://github.com/teaguesterling/duckdb_mcp.] からインポートされた MCP サーバー候補です

概要(AI 翻訳)

DuckDBのモデルコンテキストプロトコル(MCP)拡張機能で、ClaudeのようなSQLデータベースとAIアシスタント間でシームレスな統合を実現します。

##特徴

  • MCPサーバーとして実行: DuckDBデータベースをAIアシスタントに公開し、クエリ、記述、およびデータを探索するための組み込みツール -HTTP Transport:Webベースのクライアントの認証でHTTPサーバーとして実行
  • MCPクライアントとして機能: 外部MCPサーバーに接続し、SQLを使用してリソースをクエリ
  • カスタムツール:AIアシスタントが発見し、呼び出しることができるツールとしてパラメータ化されたSQLクエリを発行 -複数のフォーマット:JSON、JSONL、Markdown(トークン効率)、CSV、またはプレーンテキストとして出力結果

クイックスタート

##MCPサーバーとして(AIアシスタント向け)

init-server.sql を作成します。

stdioの輸送はstdoutを所有します。 JSON-RPCはstdoutで組み立てられます、従って他のものは印刷しました チャンネルを破損しています。 エクステンションは他の作家から離れる記述子を取ります サーバが起動すると、クライアントはホスト出力を許容し、前に到着します。 handhake (CLI は -- Loading resources from …]]] バナーを [[-init]] に加えて、 結果表/ステートメント).

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。

README

以下は原文 README の抜粋です。原文を見る。

DuckDB MCP Extension

A Model Context Protocol (MCP) extension for DuckDB that enables seamless integration between SQL databases and AI assistants like Claude.

Features

  • Run as MCP Server: Expose your DuckDB database to AI assistants with built-in tools for querying, describing, and exploring data
  • HTTP Transport: Run as an HTTP server with authentication for web-based clients
  • Act as MCP Client: Connect to external MCP servers and query their resources using SQL
  • Custom Tools: Publish parameterized SQL queries as tools that AI assistants can discover and call
  • Multiple Formats: Output results as JSON, JSONL, Markdown (token-efficient), CSV, or plain text

Quick Start

As an MCP Server (for AI Assistants)

Create init-server.sql:

LOAD 'duckdb_mcp';

CREATE TABLE products (id INT, name VARCHAR, price DECIMAL(10,2));
INSERT INTO products VALUES (1, 'Widget', 9.99), (2, 'Gadget', 24.99);

PRAGMA mcp_server_start('stdio');

stdio transport owns stdout. JSON-RPC is framed on stdout, so anything else printed there corrupts the channel. The extension takes the descriptor away from other writers when the server starts, and the client tolerates host output that arrives before the handshake (the CLI prints an -- Loading resources from … banner for -init, plus a result table per statement). For a server whose output you cannot afford to have parsed at all, put .output /dev/null as the first line of the init script.

Add to Claude Desktop configuration:

{
  "mcpServers": {
    "my-database": {
      "command": "duckdb",
      "args": ["-init", "/path/to/init-server.sql"]
    }
  }
}

Now Claude can query your database directly!

As an HTTP Server

Run DuckDB as an HTTP server that any HTTP client can connect to:

LOAD 'duckdb_mcp';

-- Start HTTP server with authentication
PRAGMA mcp_server_start('http', 'localhost', 8080, '{"auth_token": "secret"}');

Then connect via HTTP:

# Health check
curl http://localhost:8080/health

# Query with authentication
curl -X POST http://localhost:8080/mcp \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer secret" \
    -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"query","arguments":{"sql":"SELECT 1"}}}'

As an MCP Client

Windows: MCP client connections are not available — attaching to a server means spawning it over stdio, which is not implemented on Windows (#67). Use WSL. Running DuckDB as an MCP server works on Windows.

LOAD 'duckdb_mcp';

-- Connect to an MCP server
ATTACH 'python3' AS server (TYPE mcp, ARGS '["path/to/server.py"]');
GitHub で README 全文を見る

インストール

This server does not publish a one-line install command.

Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →

設定

{ "mcpServers": { "my-database": { "command": "duckdb", "args": ["-init", "/path/to/init-server.sql"] } } }