> ## Documentation Index
> Fetch the complete documentation index at: https://docs.merchantops.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI (`mo`)

> A command-line client for the MerchantOps API, authenticated with OAuth.

`mo` is a command-line client over the MerchantOps API. You authenticate once
with **OAuth 2.0 (PKCE)** — a browser sign-in that stores tokens in your OS
keychain — and the CLI then rides the same authenticated, organization-scoped
API as the dashboard. It holds no database credentials or service secrets.

<Note>
  A packaged install (Homebrew / PyPI) is on the way. For now, install from source
  as shown below.
</Note>

## Install

```bash theme={null}
# from the repo root, into your virtualenv
pip install -e ./merchantops-sdk -e ./merchantops-cli
mo --help          # or: python -m merchantops_cli --help
```

## Configure

Settings resolve in order: **environment variable → `~/.config/merchantops/config.toml` → default.**

| Setting       | Env var                       | Notes                                           |
| ------------- | ----------------------------- | ----------------------------------------------- |
| API base URL  | `MERCHANTOPS_API_URL`         | default `http://localhost:8000`                 |
| OAuth issuer  | `MERCHANTOPS_OAUTH_ISSUER`    | the Stytch Connected Apps authorization server  |
| CLI client id | `MERCHANTOPS_OAUTH_CLIENT_ID` | the CLI's public OAuth client (PKCE, no secret) |
| API audience  | `MERCHANTOPS_API_AUDIENCE`    | the resource the access token is bound to       |

```toml config.toml theme={null}
api_url = "https://api.merchantops.ai"
oauth_issuer = "https://<project>.customers.stytch.dev"
client_id = "connected-app-..."
audience = "https://api.merchantops.ai"
```

## Sign in

```bash theme={null}
mo auth login      # browser PKCE sign-in; stores tokens in the keychain
mo auth status     # token presence + expiry
mo auth whoami     # identity from the stored token
mo auth logout
```

## Commands

```bash theme={null}
mo products list --limit 20 --brand HOKA
mo products get 1000047719
mo products search "clifton 10"
mo product-types list
```

All output is JSON — pipe it into [`jq`](https://jqlang.github.io/jq/):

```bash theme={null}
mo products search "clifton 10" | jq '.[].key'
```

<Tip>
  Tokens are keyed by `api_url`, so if you change the API URL, run `mo auth login`
  again.
</Tip>
