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

# CLI

> Install and use the Majordomo CLI to authenticate and manage API keys and Steward instances from your terminal.

The `majordomo` CLI lets you authenticate, manage API keys, and administer self-hosted Steward instances without leaving the terminal.

## Install

Install with Homebrew:

```bash theme={null}
brew install go-majordomo/majordomo/majordomo
```

Verify:

```bash theme={null}
majordomo version
```

## Global flags

| Flag              | Default                          | Description                                                |
| ----------------- | -------------------------------- | ---------------------------------------------------------- |
| `--api-url <url>` | `https://butler.gomajordomo.com` | Butler API base URL. Override for self-hosted deployments. |

## Authentication

### login

Opens a browser window, completes the OAuth flow, and stores your token locally at `~/.majordomo/config.yaml`.

```bash theme={null}
majordomo login
```

### logout

Removes stored credentials.

```bash theme={null}
majordomo logout
```

### whoami

Shows the currently authenticated user.

```bash theme={null}
majordomo whoami
```

Output: email, username, and user ID.

## API keys

Manage the Majordomo API keys (`mdm_sk_...`) used to authenticate gateway requests.

### keys create

```bash theme={null}
majordomo keys create --name "Production" [--description "Main production key"]
```

| Flag            | Required | Description               |
| --------------- | -------- | ------------------------- |
| `--name`        | Yes      | Display name for the key. |
| `--description` | No       | Optional description.     |

The key value is shown once at creation and cannot be retrieved afterward. Store it in your secrets manager immediately.

### keys list

```bash theme={null}
majordomo keys list
```

Output columns: ID, NAME, STATUS, REQUESTS, CREATED.

### keys revoke

```bash theme={null}
majordomo keys revoke <id>
```

Revokes the key immediately. All gateway requests using it will be rejected.

## Stewards

Manage self-hosted Steward instances registered to your account. Each Steward gets a token (`mdm_st_...`) it uses to authenticate with Butler.

### stewards create

```bash theme={null}
majordomo stewards create --name "prod-vpc"
```

| Flag     | Required | Description                   |
| -------- | -------- | ----------------------------- |
| `--name` | Yes      | Display name for the Steward. |

The token is shown once at creation. Pass it to your Steward instance as `MAJORDOMO_STEWARD_TOKEN`.

### stewards list

```bash theme={null}
majordomo stewards list
```

Output columns: ID, NAME, STATUS, LAST SEEN, CREATED.

### stewards revoke

```bash theme={null}
majordomo stewards revoke <id>
```

Revokes the Steward token. The Steward will stop being able to sync metadata to Butler.

## Steward admin

Commands for administering a running Steward instance directly. Requires the Steward's admin token.

```bash theme={null}
majordomo steward --url <steward-url> --admin-token <token> <subcommand>
```

| Flag            | Default                 | Description                                                                       |
| --------------- | ----------------------- | --------------------------------------------------------------------------------- |
| `--url`         | `http://localhost:7680` | Steward base URL.                                                                 |
| `--admin-token` | —                       | Admin token for the Steward. Can also be set via `MAJORDOMO_STEWARD_ADMIN_TOKEN`. |

### steward orgs

List orgs registered on this Steward instance.

```bash theme={null}
majordomo steward --url https://steward.internal --admin-token $TOKEN orgs
```

Output columns: ORG ID, NAME, PENDING, BUTLER URL, REGISTERED.

### steward register

Register an org on this Steward instance. Run this once during initial setup to connect the Steward to Butler.

```bash theme={null}
majordomo steward --url https://steward.internal --admin-token $TOKEN register \
  --token mdm_st_... \
  --butler-url https://butler.gomajordomo.com
```

| Flag           | Required | Description                                                   |
| -------------- | -------- | ------------------------------------------------------------- |
| `--token`      | Yes      | Steward token (`mdm_st_...`) obtained from `stewards create`. |
| `--butler-url` | Yes      | Butler base URL.                                              |

### steward deregister

Remove an org registration from this Steward instance.

```bash theme={null}
majordomo steward --url https://steward.internal --admin-token $TOKEN deregister <org-id>
```
