Skip to content
Back to search

mcp-server-duckdb

A Model Context Protocol (MCP) server implementation for DuckDB, providing database interaction capabilities

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/ktanaka101--mcp-server-duckdb/badge.svg)](/listings/ktanaka101--mcp-server-duckdb)

HTML

<a href="/listings/ktanaka101--mcp-server-duckdb"><img src="/api/listings/ktanaka101--mcp-server-duckdb/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

Installing via Smithery

To install DuckDB Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/mcp-server-duckdb):

npx -y @smithery/cli install mcp-server-duckdb --client claude

Claude Desktop Integration

Configure the MCP server in Claude Desktop's configuration file:

MacOS

Location: `~/Library/Application Support/Claude/claude_desktop_config.json`

Windows

Location: `%APPDATA%/Claude/claude_desktop_config.json`

{
  "mcpServers": {
    "duckdb": {
      "command": "uvx",
      "args": [
        "mcp-server-duckdb",
        "--db-path",
        "~/mcp-server-duckdb/data/data.db"
      ]
    }
  }
}

* Note: `~/mcp-server-duckdb/data/data.db` should be replaced with the actual path to the DuckDB database file.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 122 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # mcp-server-duckdb
  2. [![PyPI - Version](https://img.shields.io/pypi/v/mcp-server-duckdb)](https://pypi.org/project/mcp-server-duckdb/)
  3. [![PyPI - License](https://img.shields.io/pypi/l/mcp-server-duckdb)](LICENSE)
  4. [![smithery badge](https://smithery.ai/badge/mcp-server-duckdb)](https://smithery.ai/server/mcp-server-duckdb)
  5. A Model Context Protocol (MCP) server implementation for DuckDB, providing database interaction capabilities through MCP tools.
  6. It would be interesting to have LLM analyze it. DuckDB is suitable for local analysis.
  7. <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>
  8. ## Overview
  9. This server enables interaction with a DuckDB database through the Model Context Protocol, allowing for database operations like querying, table creation, and schema inspection.
  10. ## Components
  11. ### Resources
  12. Currently, no custom resources are implemented.
  13. ### Prompts
  14. Currently, no custom prompts are implemented.
  15. ### Tools
  16. The server implements the following database interaction tool:
  17. - **query**: Execute any SQL query on the DuckDB database
  18. - **Input**: `query` (string) - Any valid DuckDB SQL statement
  19. - **Output**: Query results as text (or success message for operations like CREATE/INSERT)
  20. > [!NOTE]
  21. > 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.
  22. > [!NOTE]
  23. > When the server is running in `readonly` mode, DuckDB's native readonly protection is enforced.
  24. > This ensures that the Language Model (LLM) cannot perform any write operations (CREATE, INSERT, UPDATE, DELETE), maintaining data integrity and preventing unintended changes.
  25. ## Configuration
  26. ### Required Parameters
  27. - **db-path** (string): Path to the DuckDB database file
  28. - The server will automatically create the database file and parent directories if they don't exist
  29. - If `--readonly` is specified and the database file doesn't exist, the server will fail to start with an error
  30. ### Optional Parameters
  31. - **--readonly**: Run server in read-only mode (default: `false`)
  32. - **Description**: When this flag is set, the server operates in read-only mode. This means:
  33. - The DuckDB database will be opened with `read_only=True`, preventing any write operations.
  34. - If the specified database file does not exist, it **will not** be created.
  35. - **Security Benefit**: Prevents the Language Model (LLM) from performing any write operations, ensuring that the database remains unaltered.
  36. - **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).
  37. - **--keep-connection**: Re-uses a single DuckDB connection mode (default: `false`)
  38. - **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.
  39. ## Installation
  40. ### Installing via Smithery
  41. To install DuckDB Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/mcp-server-duckdb):
  42. ```bash
  43. npx -y @smithery/cli install mcp-server-duckdb --client claude
  44. ```
  45. ### Claude Desktop Integration
  46. Configure the MCP server in Claude Desktop's configuration file:
  47. #### MacOS
  48. Location: `~/Library/Application Support/Claude/claude_desktop_config.json`
  49. #### Windows
  50. Location: `%APPDATA%/Claude/claude_desktop_config.json`
  51. ```json
  52. {
  53. "mcpServers": {
  54. "duckdb": {
  55. "command": "uvx",
  56. "args": [
  57. "mcp-server-duckdb",
  58. "--db-path",
  59. "~/mcp-server-duckdb/data/data.db"
  60. ]
  61. }
  62. }
  63. }
  64. ```
  65. * Note: `~/mcp-server-duckdb/data/data.db` should be replaced with the actual path to the DuckDB database file.
  66. ## Development
  67. ### Prerequisites
  68. - Python with `uv` package manager
  69. - DuckDB Python package
  70. - MCP server dependencies
  71. ### Debugging
  72. Debugging 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.
  73. #### Using MCP Inspector
  74. 1. Install the inspector using npm:
  75. ```bash
  76. npx @modelcontextprotocol/inspector uv --directory ~/codes/mcp-server-duckdb run mcp-server-duckdb --db-path ~/mcp-server-duckdb/data/data.db
  77. ```
  78. 2. Open the provided URL in your browser to access the debugging interface
  79. The inspector provides visibility into:
  80. - Request/response communication
  81. - Tool execution
  82. - Server state
  83. - Error messages

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.