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

# Command reference

> Review MiniMax Code CLI top-level commands, options, and machine-readable output entry points.

This page lists the public CLI commands. The installed version is the final contract; run `mcode --help` or `mcode <command> --help` for the exact options available locally.

## Global entry point

```text theme={null}
mcode [options] [prompt]
```

| Option | Purpose |
| - | - |
| `--version` | Print the CLI version |
| `--help` | Print help |
| `--session [id]` | Open a session; omit the ID to browse sessions |
| `-c, --continue` | Continue the latest session in the current workspace |
| `--tui-mode <mode>` | `regular` (default) or `fullscreen` |
| `[prompt]` | Initial task submitted when starting the TUI |

`--session`, `--continue`, and the compatibility option `--resume <id>` cannot be combined.

## Task and integration commands

### init

```text theme={null}
mcode init [directory]
```

Analyze a codebase and generate or update `AGENTS.md`. The directory defaults to the current directory; the command starts the TUI for the initialization task.

### exec

```text theme={null}
mcode exec [options] [prompt]
```

Run one Headless task without starting the TUI. See [Headless and CI](https://agent.minimax.io/docs/cli/automation.md) for input, output, schemas, and exit codes.

Starting with 0.4.7, regular tasks support `--prompt-mode tui|coding|work`, with `tui` as the default. See [Choose task instructions](https://agent.minimax.io/docs/cli/automation.md#choose-task-instructions) for usage and resume restrictions.

### acp

```text theme={null}
mcode acp
mcode acp login --region <region>
```

Start an Agent Client Protocol server over stdio. `region` is `cn` or `global`.

## Account commands

```text theme={null}
mcode login [--region <region>]
mcode logout
```

`--region` accepts `cn` or `global`; omit it for the mainland China account region.

## Provider commands

```text theme={null}
mcode provider
mcode provider list [--json]
mcode provider add [options]
mcode provider remove <provider-id> --yes
mcode provider test <provider-id> [options]
mcode provider use <token-plan|api-key>
mcode provider set-minimax-key [--api-key-env <name>]
```

`provider add` options:

| Option | Purpose |
| - | - |
| `--name <name>` | Provider display name, required |
| `--base-url <url>` | Provider API base URL, required |
| `--api-format <format>` | `anthropic-messages`, `openai-completions`, `openai-responses`, or `google-generative-ai` |
| `--model <id>` | Model ID; repeatable and at least one is required |
| `--api-key-env <name>` | Environment variable containing the API key |
| `--use` | Select the first model as the default |

Without `--api-key-env`, the command reads `MCODE_PROVIDER_API_KEY`. See [Configuration and models](https://agent.minimax.io/docs/cli/configuration.md).

## Plugin commands

```text theme={null}
mcode plugin list [options]
mcode plugin add <plugin[@marketplace]> [options]
mcode plugin remove <plugin[@marketplace]> [options]
mcode plugin enable <plugin[@marketplace]> [options]
mcode plugin disable <plugin[@marketplace]> [options]
mcode plugin marketplace list [--json]
mcode plugin marketplace upgrade [--json]
```

| Option | Purpose |
| - | - |
| `-m, --marketplace <marketplace>` | `official` or `local` |
| `--available` | Include uninstalled plugins in `plugin list` |
| `--json` | Print JSON |

## Update

```text theme={null}
mcode update
```

Check for and install an update supported by the current installation source. Restart the current MCode process after updating.

## Exit codes

Stable `mcode exec` exit codes:

| Exit code | Meaning |
| -: | - |
| `0` | Success |
| `2` | Invocation or input error |
| `3` | Configuration error |
| `4` | Runtime or task failure |
| `6` | Timeout |
| `7` | Runtime limit exceeded |
| `70` | Internal error |
| `130` | Cancelled |
| `141` | Broken pipe |
