MotherDuck CLI

CLI for the MotherDuck REST API.

lostmygithubaccount/dkdc-md-cli

MotherDuck CLI #

CLI for the MotherDuck REST API.

Important: This is a personal project. I am not affiliated with MotherDuck.

Install #

Recommended:

curl -LsSf https://dkdc.sh/dkdc-md-cli/install.sh | sh

Pre-built binaries are available for Linux and macOS via Python (uv). Windows users should install via cargo or use macOS/Linux.

uv:

uv tool install dkdc-md-cli

cargo:

cargo install dkdc-md-cli

Either option will install the md command globally. You can use uvx to run it without installing:

uvx --from dkdc-md-cli md

Authentication #

Set a MotherDuck API token via environment variable:

export MOTHERDUCK_TOKEN="your-token-here"

Token resolution order (first non-empty wins):

  1. --token flag (pass - to read from stdin)
  2. motherduck_token
  3. MOTHERDUCK_TOKEN
  4. motherduck_api_key
  5. MOTHERDUCK_API_KEY

Usage #

md [--output text|json] [--token TOKEN] [--yes] <command>

Global flags #

FlagShortDescription
--output-oOutput format: text (default) or json
--tokenAPI token (overrides env vars; - reads from stdin)
--yes-ySkip confirmation prompts

service-account #

# Create a service account
md service-account create <username>

# Delete a service account (prompts for confirmation)
md service-account delete <username>

token #

# List tokens for a user
md token list <username>

# Create a new token
md token create <username> --name <name> [--ttl <seconds>] [--token-type <type>]

# Delete a token (prompts for confirmation)
md token delete <username> <token_id>

--ttl: time-to-live in seconds (300–31536000). Omit for no expiration.

--token-type: read-write (default) or read-scaling.

duckling #

# Get current duckling config
md duckling get <username>

# Set duckling config (at least one override required)
md duckling set <username> [--rw-size <size>] [--rs-size <size>] [--flock-size <n>]

Instance sizes: pulse, standard, jumbo, mega, giga.

Flock size: 0–64. duckling set fetches the current config and merges your overrides, so you only need to specify what you’re changing.

account #

# List active accounts and their ducklings
md account list-active