CLI Reference

All commands are available as both lds <command> and localdb-simulator <command>.

Run lds start first: most commands (lds status, lds logs, lds seed, lds compat, lds snapshot) require a running server. lds test --reset starts the server automatically if it is not running.

lds start [service]

Start all enabled services, or a specific service by name.

# Start all services defined in localdb-simulator.yaml
$ lds start

# Start only Redis
$ lds start redis

# Start only PostgreSQL
$ lds start postgres

The server process stays running in the background. The dashboard is available at http://127.0.0.1:8080.

lds stop [service]

Stop all services (and the server), or stop a specific service.

$ lds stop          # stop everything + server
$ lds stop redis    # stop only Redis, keep server running

lds status

Show a status table of all services with port, uptime, and memory usage.

$ lds status
  NAME      STATUS   PORT   UPTIME   MEMORY
  redis     running  6379   2m 14s   4.2 MB
  postgres  running  5432   2m 14s   38.1 MB

lds logs <service> [options]

Stream logs from a service in real time. Press Ctrl+C to stop.

$ lds logs redis
$ lds logs postgres
$ lds logs redis --tail 200   # show last 200 lines, then stream
FlagDescription
--tail <n>Show last n log lines before streaming

lds restart [service]

Restart all services or a specific one. Data is preserved.

$ lds restart
$ lds restart redis

lds init

Create a localdb-simulator.yaml in the current directory. Aborts if the file already exists.

$ lds init
✔ Created localdb-simulator.yaml

lds compat [service]

Print the compatibility matrix for every service (or one): which commands are supported, partial, or unsupported. AI agents should read this before writing queries to avoid false failures.

$ lds compat
$ lds compat redis

lds seed <file>

Apply a YAML/JSON fixture file to the running services. See examples/fixtures/baseline.yaml for the format.

$ lds seed examples/fixtures/baseline.yaml

lds test --reset [--fixture <file>] [--service <name>]

Deterministic test environment. --reset flushes and restarts services; --fixture seeds a baseline afterwards. Idempotent: the result state is always the baseline.

$ lds test --reset --fixture examples/fixtures/baseline.yaml

lds mcp

Run the MCP (Model Context Protocol) stdio server so AI coding agents (Claude Code, Cursor, OpenCode…) can manage and query the emulators. Register it once per project:

$ claude mcp add localdb -- npx @localdb/cli mcp
# or add to .mcp.json:
{ "mcpServers": { "localdb": { "command": "lds", "args": ["mcp"] } } }

Exposed tools: list_services, service_status, start_service, stop_service, restart_service, reset_service, run_query, list_keys, get_key, snapshot_save, snapshot_list, snapshot_restore, compat_report, get_metrics. Resources: localdb://services, localdb://services/{name}/compat.

Exit codes

CodeMeaning
0Success
1General error (service failed, network error, etc.)
2Config error (invalid YAML, unknown service name, etc.)