Browse documentation

@motherbase/cli is the operator CLI for Motherbase.

It is designed as a Supabase-style terminal surface for the same things exposed by the Platform Console and Project Studio: projects, database, RLS, auth users, storage buckets, edge functions, secrets, realtime, webhooks, cron, settings, diagnostics, backups, and local self-host workflows.

npm install -g @motherbase/cli
motherbase --help
Note

The CLI talks to two surfaces: the Platform Console for account and project lifecycle commands, then a linked project for resource commands through the Console proxy. Recent resource commands also cover branches, domains, network/SSL policy, JWT key generation, queues, Vault, Wrappers and index-advisor inspection.

Connection model

  1. Log in to a Console.
  2. Link the current directory to a project.
  3. Run project commands from that directory.
motherbase login --url https://console.example.com
motherbase projects list
motherbase link todo
motherbase status
motherbase db tables

The same command tree falls back to a direct single-project mode for local automation. It applies only when the context has no Console token and no linked project:

MOTHERBASE_URL=http://localhost:5001 \
MOTHERBASE_ADMIN_TOKEN=... \
motherbase users list

What it controls

AreaCommands
Connectionlogin, logout, whoami, link, unlink, status
Projectsprojects list, create, start, stop, restart, update, rebuild, delete, logs, info, limits
Local stackinit, start, stop, deploy, logs
Databasedb tables, db sql, db dump, db restore, db backups, db indexes, db types, db roles, db publications, migration new, migrations *, import
RLSrls list, enable, disable, policy create/delete, preset, simulate, lint
Usersusers list, get, create, update, delete, reset-password, promote, demote, revoke-sessions
Storagestorage buckets *, storage ls, storage cp, storage rm
Edge functionsfunctions list, get, new, deploy, pull, serve, delete, invoke, logs
Operationssecrets, keys, realtime, webhooks, cron, queues, vault, wrappers, branches, domains, config, inspect, index-advisor
Codegen and agentsgen types typescript, mcp

Config files

Global credentials are stored outside your project:

~/.motherbase/config.json

The project link is stored locally:

.motherbase/config.json

Example local link:

{
  "consoleUrl": "https://console.example.com",
  "projectId": "todo",
  "projectName": "todo"
}

The local file contains routing metadata only. Do not put tokens in it.

CI and non-interactive use

Use Console mode when CI should operate a project through the Platform Console:

MOTHERBASE_CONSOLE_URL=https://console.example.com \
MOTHERBASE_TOKEN=mbp_... \
MOTHERBASE_PROJECT=todo \
motherbase db sql -e "select 1"

Use direct mode when CI points straight at one project API:

MOTHERBASE_URL=https://todo.example.com \
MOTHERBASE_ADMIN_TOKEN=... \
motherbase db tables

Each value resolves in that order: explicit flag, environment variable, the local link file, then ~/.motherbase/config.json. Direct mode is chosen only when MOTHERBASE_URL and MOTHERBASE_ADMIN_TOKEN are both set and Console mode has no token or no project.

Supabase migration

The CLI includes a first-class Supabase import path:

motherbase import --from-supabase "$SUPABASE_DB_URL" --preview --json
motherbase import --from-supabase "$SUPABASE_DB_URL" --yes

It imports public schema, data, RLS policies, and email/password users. Storage objects are not copied. See Migrate from Supabase.