DuckDB MCP Server
A Model Context Protocol server implementation that connects AI assistants to DuckDB, enabling them to query and analyze data from various sources including CSV, Parquet, JSON, and cloud storage through SQL.
README
DuckDB MCP Server
A Model Context Protocol (MCP) server implementation that enables AI assistants like Claude to interact with DuckDB for powerful data analysis capabilities.
🌟 What is DuckDB MCP Server?
DuckDB MCP Server connects AI assistants to DuckDB - a high-performance analytical database - through the Model Context Protocol (MCP). This allows AI models to:
- Query data directly from various sources like CSV, Parquet, JSON, etc.
- Access data from cloud storage (S3, etc.) without complex setup
- Perform sophisticated data analysis using SQL
- Generate data insights with proper context and understanding
🚀 Key Features
- SQL Query Tool: Execute any SQL query with DuckDB's powerful syntax
- Multiple Data Sources: Query directly from:
- Local files (CSV, Parquet, JSON, etc.)
- S3 buckets and cloud storage
- SQLite databases
- All other data sources supported by DuckDB
- Auto-Connection Management: Automatic database file creation and connection handling
- Smart Credential Handling: Seamless AWS/S3 credential management
- Documentation Resources: Built-in DuckDB SQL and data import reference for AI assistants
📋 Requirements
- Python 3.10+
- An MCP-compatible client (Claude Desktop, Cursor, VS Code with Copilot, etc.)
💻 Installation
Using pip
pip install duckdb-mcp-server
From source
git clone https://github.com/yourusername/duckdb-mcp-server.git
cd duckdb-mcp-server
pip install -e .
🔧 Configuration
Command Line Options
duckdb-mcp-server --db-path path/to/database.db [options]
Required Parameters:
--db-path- Path to DuckDB database file (will be created if doesn't exist)
Optional Parameters:
--readonly- Run in read-only mode (will error if database doesn't exist)--s3-region- AWS S3 region (default: uses AWS_DEFAULT_REGION env var)--s3-profile- AWS profile for S3 credentials (default: uses AWS_PROFILE or 'default')--creds-from-env- Use AWS credentials from environment variables
🔌 Setting Up with Claude Desktop
-
Install Claude Desktop from claude.ai/download
-
Edit Claude Desktop's configuration file:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
Windows:%APPDATA%/Claude/claude_desktop_config.json -
Add DuckDB MCP Server configuration:
{
"mcpServers": {
"duckdb": {
"command": "duckdb-mcp-server",
"args": [
"--db-path",
"~/claude-duckdb/data.db"
]
}
}
}
📊 Example Usage
Once configured, you can ask your AI assistant to analyze data using DuckDB:
"Load the sales.csv file and show me the top 5 products by revenue"
The AI will generate and execute the appropriate SQL:
-- Load and query the CSV data
SELECT
product_name,
SUM(quantity * price) AS revenue
FROM read_csv('sales.csv')
GROUP BY product_name
ORDER BY revenue DESC
LIMIT 5;
Working with S3 Data
Query data directly from S3 buckets:
"Analyze the daily user signups from our analytics data in S3"
The AI will generate appropriate SQL to query S3:
SELECT
date_trunc('day', signup_timestamp) AS day,
COUNT(*) AS num_signups
FROM read_parquet('s3://my-analytics-bucket/signups/*.parquet')
GROUP BY day
ORDER BY day DESC;
🌩️ Cloud Storage Authentication
DuckDB MCP Server handles AWS authentication in this order:
- Explicit credentials (if
--creds-from-envis enabled) - Named profile credentials (via
--s3-profile) - Default credential chain (environment, shared credentials file, etc.)
🛠️ Development
# Clone the repository
git clone https://github.com/yourusername/duckdb-mcp-server.git
cd duckdb-mcp-server
# Set up a virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install in development mode
pip install -e ".[dev]"
# Run tests
pytest
📜 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。