TD

teaguesterling/duckdb_mcp

Developer tools

Эта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал

71 stars 8 forks Качество 73 Тренд 14Apache-2.0

teaguesterling/duckdb mcp - кандидат на сервер MCP, импортированный из https://github.com/teaguesterling/duckdb_mcp.

Обзор

teaguesterling/duckdb mcp - кандидат на сервер MCP, импортированный из https://github.com/teaguesterling/duckdb_mcp.

Обзор (машинный перевод)

Расширение Model Context Protocol (MCP) для DuckDB, которое обеспечивает бесшовную интеграцию между базами данных SQL и помощниками ИИ, такими как Клод.

Особенности

Беги как MCP Server: Размещение базы данных DuckDB для помощников ИИ со встроенными инструментами для запроса, описания и изучения данных HTTP Transport: работает как HTTP-сервер с аутентификацией для веб-клиентов ** Действуйте как клиент MCP**: Подключайтесь к внешним MCP-серверам и запрашивайте их ресурсы с помощью SQL Пользовательские инструменты: публикуйте параметризированные SQL-запросы как инструменты, которые могут найти и вызвать помощники ИИ

  • Множественные форматы: результаты вывода в виде JSON, JSONL, Markdown (эффективность токенов), CSV или простого текста

Быстрый старт

Как MCP-сервер (для помощников ИИ)

Создать [[Т0]]:

stdio transport владеет stdout. JSON-RPC обрамлен на stdout, поэтому все остальное напечатано Там портится канал. Расширение уводит дескриптора от других писателей.

когда сервер запускается, и клиент допускает вывод хоста, который поступает до [править] [править] [править] [править] [править] [править] таблица результатов за каждое заявление.

Эта страница переведена автоматически. Технические детали смотрите в оригинале.

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"]');
Открыть полный README на GitHub

Установка

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"] } } }