a CLI for MotherDuck
I built a CLI for the MotherDuck REST API.
MotherDuck is a serverless analytics platform built on DuckDB. They have a REST API for managing service accounts, tokens, and compute (ducklings). I wanted to manage these from the terminal, so I built dkdc-md-cli.
Important: this is a personal project. I’m not affiliated with MotherDuck.
install #
curl -LsSf https://dkdc.sh/dkdc-md-cli/install.sh | sh
This installs the md command globally. Like Zorto, it’s a Rust CLI distributed as a Python package via uv. You can also install via uv tool install dkdc-md-cli or cargo install dkdc-md-cli.
authentication #
Set your MotherDuck token:
export MOTHERDUCK_TOKEN="your-token-here"
The CLI also checks motherduck_token, motherduck_api_key, and MOTHERDUCK_API_KEY (first non-empty wins). You can pass --token directly or pipe from stdin with --token -.
usage #
The CLI covers service accounts, tokens, duckling config, and account listing.
service accounts #
# create a service account md service-account create my-svc-account # delete it (prompts for confirmation) md service-account delete my-svc-account
tokens #
# list tokens for a user md token list my-svc-account # create a read-write token (no expiration) md token create my-svc-account --name ci-token # create a read-scaling token that expires in 1 hour md token create my-svc-account --name tmp --ttl 3600 --token-type read-scaling # delete a token md token delete my-svc-account <token_id>
ducklings #
Ducklings are MotherDuck’s compute instances. Sizes: pulse, standard, jumbo, mega, giga.
# check current config md duckling get my-svc-account # scale up the read-write instance md duckling set my-svc-account --rw-size jumbo # scale the read-scaling flock md duckling set my-svc-account --rs-size standard --flock-size 8
duckling set fetches the current config and merges your overrides – you only specify what you’re changing.
accounts #
# list active accounts and their ducklings md account list-active
output formats #
Text by default, JSON with -o json:
md token list my-svc-account -o json
JSON output is useful for piping to jq or other tools.
how it’s built #
Same pattern as my other Rust CLIs: pure Rust core with PyO3 bindings and a thin Python wrapper. The HTTP client uses ureq (blocking, minimal dependencies). All API responses come back as serde_json::Value – thin wrapper, not typed responses.