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. This server enables interaction with a DuckDB database through the Model Context Protocol, allowing for database operations like querying, table creation, and schema inspection. Current
Add this skill
npx mdskills install ktanaka101/mcp-server-duckdbWell-documented DuckDB integration with clear setup and useful read-only protection
1# mcp-server-duckdb23[](https://pypi.org/project/mcp-server-duckdb/)4[](LICENSE)5[](https://smithery.ai/server/mcp-server-duckdb)67A Model Context Protocol (MCP) server implementation for DuckDB, providing database interaction capabilities through MCP tools.8It would be interesting to have LLM analyze it. DuckDB is suitable for local analysis.910<a href="https://glama.ai/mcp/servers/fwggl49w22"><img width="380" height="200" src="https://glama.ai/mcp/servers/fwggl49w22/badge" alt="mcp-server-duckdb MCP server" /></a>1112## Overview1314This server enables interaction with a DuckDB database through the Model Context Protocol, allowing for database operations like querying, table creation, and schema inspection.1516## Components1718### Resources1920Currently, no custom resources are implemented.2122### Prompts2324Currently, no custom prompts are implemented.2526### Tools2728The server implements the following database interaction tool:2930- **query**: Execute any SQL query on the DuckDB database31 - **Input**: `query` (string) - Any valid DuckDB SQL statement32 - **Output**: Query results as text (or success message for operations like CREATE/INSERT)3334> [!NOTE]35> 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.3637> [!NOTE]38> When the server is running in `readonly` mode, DuckDB's native readonly protection is enforced.39> This ensures that the Language Model (LLM) cannot perform any write operations (CREATE, INSERT, UPDATE, DELETE), maintaining data integrity and preventing unintended changes.4041## Configuration4243### Required Parameters4445- **db-path** (string): Path to the DuckDB database file46 - The server will automatically create the database file and parent directories if they don't exist47 - If `--readonly` is specified and the database file doesn't exist, the server will fail to start with an error4849### Optional Parameters5051- **--readonly**: Run server in read-only mode (default: `false`)52 - **Description**: When this flag is set, the server operates in read-only mode. This means:53 - The DuckDB database will be opened with `read_only=True`, preventing any write operations.54 - If the specified database file does not exist, it **will not** be created.55 - **Security Benefit**: Prevents the Language Model (LLM) from performing any write operations, ensuring that the database remains unaltered.56 - **Reference**: For more details on read-only connections in DuckDB, see the [DuckDB Python API documentation](https://duckdb.org/docs/api/python/dbapi.html#read_only-connections).57- **--keep-connection**: Re-uses a single DuckDB connection mode (default: `false`)58 - **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.5960## Installation6162### Installing via Smithery6364To install DuckDB Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/mcp-server-duckdb):6566```bash67npx -y @smithery/cli install mcp-server-duckdb --client claude68```6970### Claude Desktop Integration7172Configure the MCP server in Claude Desktop's configuration file:7374#### MacOS75Location: `~/Library/Application Support/Claude/claude_desktop_config.json`7677#### Windows78Location: `%APPDATA%/Claude/claude_desktop_config.json`7980```json81{82 "mcpServers": {83 "duckdb": {84 "command": "uvx",85 "args": [86 "mcp-server-duckdb",87 "--db-path",88 "~/mcp-server-duckdb/data/data.db"89 ]90 }91 }92}93```9495* Note: `~/mcp-server-duckdb/data/data.db` should be replaced with the actual path to the DuckDB database file.9697## Development9899### Prerequisites100101- Python with `uv` package manager102- DuckDB Python package103- MCP server dependencies104105### Debugging106107Debugging MCP servers can be challenging due to their stdio-based communication. We recommend using the [MCP Inspector](https://github.com/modelcontextprotocol/inspector) for the best debugging experience.108109#### Using MCP Inspector1101111. Install the inspector using npm:112```bash113npx @modelcontextprotocol/inspector uv --directory ~/codes/mcp-server-duckdb run mcp-server-duckdb --db-path ~/mcp-server-duckdb/data/data.db114```1151162. Open the provided URL in your browser to access the debugging interface117118The inspector provides visibility into:119- Request/response communication120- Tool execution121- Server state122- Error messages123
Full transparency — inspect the skill content before installing.