{"library":"mcp-server-duckdb","title":"DuckDB MCP Server","description":"mcp-server-duckdb is a Python library that provides a Micro-Capability Platform (MCP) server exposing a DuckDB database via HTTP. It allows clients to execute SQL queries against a DuckDB instance, supporting both read and write operations, and a read-only mode. The current version is 1.1.0, with an active, feature-driven release cadence.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install mcp-server-duckdb"],"cli":null},"imports":["from mcp_server_duckdb.main import run_server","from mcp_server_duckdb.server import create_app"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import os\nimport requests\nfrom subprocess import Popen, PIPE, TimeoutExpired\nimport time\n\n# Start the server in a separate process\n# For simplicity, we use a temporary in-memory database here\n# In production, specify a persistent .duckdb file, e.g., --db-path my_database.duckdb\nprint('Starting mcp-server-duckdb...')\nserver_process = Popen(['mcp-server-duckdb', '--port', '8001'], stdout=PIPE, stderr=PIPE)\ntime.sleep(2) # Give the server a moment to start\n\n# Example: Send a query\ntry:\n    # Create a table\n    response = requests.post(\n        'http://localhost:8001/queries',\n        json={'query': \"CREATE TABLE users (id INTEGER, name VARCHAR);\"}\n    )\n    response.raise_for_status()\n    print('CREATE TABLE response:', response.json())\n\n    # Insert data\n    response = requests.post(\n        'http://localhost:8001/queries',\n        json={'query': \"INSERT INTO users VALUES (1, 'Alice'), (2, 'Bob');\"}\n    )\n    response.raise_for_status()\n    print('INSERT INTO response:', response.json())\n\n    # Select data\n    response = requests.post(\n        'http://localhost:8001/queries',\n        json={'query': \"SELECT * FROM users;\"}\n    )\n    response.raise_for_status()\n    print('SELECT * response:', response.json())\n\nexcept requests.exceptions.RequestException as e:\n    print(f\"Error communicating with server: {e}\")\nfinally:\n    # Terminate the server process\n    print('Stopping mcp-server-duckdb...')\n    server_process.terminate()\n    try:\n        stdout, stderr = server_process.communicate(timeout=5)\n        print('Server stdout:', stdout.decode())\n        print('Server stderr:', stderr.decode())\n    except TimeoutExpired:\n        server_process.kill()\n        stdout, stderr = server_process.communicate()\n        print('Server (killed) stdout:', stdout.decode())\n        print('Server (killed) stderr:', stderr.decode())\n","lang":"python","description":"This quickstart demonstrates how to start the `mcp-server-duckdb` server programmatically and then interact with it using HTTP requests. It creates a simple table, inserts data, and queries it. For persistent databases, specify a file path with `--db-path` when starting the server.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}