Agent Skill · MotherDuck

motherduck-connect

Connect to MotherDuck from any application. Use when setting up database connectivity via the Postgres endpoint (recommended), pg_duckdb, native DuckDB API, or JDBC. Covers connection strings, authentication, SSL, and environment variable configuration.

Provider: MotherDuck Path in repo: plugins/motherduck-skills/skills/motherduck-connect/SKILL.md

Skill body

Connect to MotherDuck

Use this skill when establishing database connectivity from any application, script, or service to MotherDuck. Start here before running queries or loading data.

Source Of Truth

Default Posture

Runtime Selection

Pick the connection method (above) and the runtime separately. The runtime is what actually executes queries: an MCP server, a Python script, a Node script, or the DuckDB CLI.

Classify the workload first:

Then resolve in this order, stopping at the first match:

  1. MotherDuck MCP available + workload is ad-hoc → use the MCP tools (query, list_databases, list_tables, list_columns, search_catalog). No client to install. Stop here.
  2. uv is installed (command -v uv) → run scripts via uv run --with "duckdb==<version>" script.py. Preferred for both ad-hoc scripts and pipelines because dependencies are declared inline and reproducible.
  3. python3 + pip availablepip install "duckdb==<version>" inside a project-managed venv.
  4. node + npm availablenpm install @duckdb/node-api@<version>.
  5. None of the above → install the DuckDB CLI: curl -s https://install.motherduck.com | env -u motherduck_token HOME="$install_home" sh. Pick $install_home as a writable, project-local path (for example ./.duckdb) rather than polluting the user’s home.

If the host project already declares a language (a pyproject.toml, package.json, or similar lockfile is present), follow that language even if the priority order would suggest otherwise. Do not introduce a second runtime alongside an existing one.

Before any install step, fetch https://motherduck.com/docs/duckdb-versions.json and pick the highest MotherDuck-supported DuckDB version. Pin that version explicitly in the install command. Latest upstream DuckDB is not automatically supported on MotherDuck.

Workflow

  1. Choose one connection method and do not mix methods in the same application.
  2. Put the MotherDuck token in environment-managed secrets, not in source code.
  3. Establish the connection with explicit SSL settings where required.
  4. Verify the connection with SELECT 1 AS connected and then list reachable tables.
  5. If the workload is read-heavy and concurrent, evaluate read scaling and session_hint.

Open Next

Skill frontmatter

license: MIT