DuckDB MCP Server
Enables SQL querying of a DuckDB database, returning results as Markdown tables. The bundled sample database includes employee, department, salary, and attendance tables for exploring joins and reporting.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@DuckDB MCP ServerShow me the average salary by department"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
DuckDB MCP Server

This project is a small Model Context Protocol (MCP) server that lets you query a DuckDB-based employee database through a simple tool interface. It is a beginner-friendly example for exploring how MCP servers work and how SQL can be exposed to AI assistants or local tools.
If you are new to this project, the best way to start is:
set up the environment,
seed the sample database,
run the MCP server locally,
try a few SQL queries.
What this project does
The server exposes a single tool named run_sql that accepts a SQL statement and returns the result as a Markdown table. The sample database contains employee, department, salary, and attendance data so you can explore join queries and reporting-style SQL.
Related MCP server: MCP LlamaIndex SQLite Bridge
Project files
duck_db_mcp.py- the MCP server implementationseed_employee_db.py- creates and populates the DuckDB databaseemployee.duckdb- the generated database filepyproject.toml- project dependenciesMakefile- helper commands for setup
Quick start
1. Create and activate a virtual environment
uv init
uv venv2. Install dependencies
uv add "mcp[cli]" fastmcp duckdb pandas tabulate3. Create the sample database
make setup-dbYou can also run this directly:
python3 seed_employee_db.pyRun the MCP server locally
Test the server in development mode
mcp dev duck_db_mcp.pyOr with uv:
uv run mcp dev duck_db_mcp.pyInstall the MCP server
mcp install duck_db_mcp.pyStart exploring
Once the server is running, try simple queries like these:
Example: list employees and departments
SELECT
e.first_name,
e.last_name,
d.department_name
FROM employee e
JOIN department d
ON e.department_id = d.department_id
ORDER BY e.last_name;Example: view salary information
SELECT
e.first_name,
e.last_name,
s.net_salary,
s.pay_month
FROM employee e
JOIN salary s
ON e.employee_id = s.employee_id
ORDER BY s.net_salary DESC;Example: employee attendance summary
SELECT
e.first_name,
e.last_name,
a.attendance_date,
a.status
FROM employee e
JOIN attendance a
ON e.employee_id = a.employee_id
ORDER BY a.attendance_date, e.last_name;Claude Desktop MCP config
If you want to use this server from Claude Desktop, install it first:
mcp install duck_db_mcp.pyA typical configuration looks like this:
{
"DuckDB SQL Server": {
"command": "/opt/homebrew/bin/uv",
"args": [
"run",
"--frozen",
"--with",
"mcp[cli]",
"mcp",
"run",
"/Users/rahulkumar/Desktop/AI/mcp_server_learning/duck_db_mcp/duck_db_mcp.py"
],
"env": {
"VIRTUAL_ENV": "/Users/rahulkumar/Desktop/AI/mcp_server_learning/duck_db_mcp/.venv",
"PATH": "/Users/rahulkumar/Desktop/AI/mcp_server_learning/duck_db_mcp/.venv/bin:/opt/homebrew/bin:/usr/bin:/bin"
}
}
}Install from GitHub
If you want someone else to install this package directly from GitHub, use this command:
uvx --from git+https://github.com/panditrahulsharma/duck_db_mcp.git duck_mcpFor Claude Desktop, the config can look like this:
{
"mcpServers": {
"DuckDB SQL Server": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/panditrahulsharma/duck_db_mcp.git",
"duck_mcp"
]
}
}
}Make sure the latest changes in pyproject.toml and duck_db_mcp.py have been committed and pushed to GitHub before trying this install method.
Git MCP config
If you also want to use Git-related MCP tools, you can add a Git MCP server configuration in the same client config. A typical example is:
{
"mcpServers": {
"DuckDB SQL Server": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/panditrahulsharma/duck_db_mcp.git",
"duck_mcp"
]
}
}
}
This is useful when you want your MCP client to access Git operations such as status, diff, branch, and commit history while working with this project.
Notes for contributors
When adding or changing tools, make sure the docstring is clear and descriptive. A well-written docstring helps MCP clients understand what the tool does and how to use it correctly.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceA 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.Last updated17MIT
- Flicense-qualityDmaintenanceAn MCP server that exposes SQLite database operations as tools, enabling natural language interactions with simple databases and a comprehensive HR Management System through LlamaIndex clients.Last updated1
- Alicense-qualityCmaintenanceAn open-source MCP server that imports HR CSV data into an in-memory SQLite database for structured querying and metadata retrieval. It enables users to perform read-only SQL queries and structured searches on employee data through natural language.Last updatedMIT
- Alicense-qualityDmaintenanceA local MCP server implementation that interacts with DuckDB and MotherDuck databases, providing SQL analytics capabilities to AI Assistants and IDEs.Last updatedMIT
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Markdown-first MCP server for Notion API with 8 composite tools and 39 actions.
GibsonAI MCP server: manage your databases with natural language
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/panditrahulsharma/duck_db_mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server