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

# CLI Installation

> Install and configure the MutagenT CLI

# CLI Installation

The MutagenT CLI (`@mutagent/cli`) is available on [npm](https://www.npmjs.com/package/@mutagent/cli). The current version is **0.1.186**.

## Install

<CodeGroup>
  ```bash bun (recommended) theme={null}
  bun add -g @mutagent/cli
  ```

  ```bash npm theme={null}
  npm install -g @mutagent/cli
  ```

  ```bash pnpm theme={null}
  pnpm add -g @mutagent/cli
  ```
</CodeGroup>

## Verify Installation

```bash theme={null}
mutagent --version
# Expected output: 0.1.186
```

## Authenticate

### Interactive Login

```bash theme={null}
mutagent auth login
```

This will present authentication options:

* **Browser OAuth** (recommended) -- opens your browser for secure login
* **API Key** -- enter your `mt_` prefixed API key directly

### Non-Interactive Login

For CI/CD pipelines, set the `MUTAGENT_API_KEY` environment variable (no login step needed):

```bash theme={null}
export MUTAGENT_API_KEY="mt_xxxx"
export MUTAGENT_ENDPOINT="https://api.mutagent.io"
```

You can also use the `--non-interactive` flag or set `CI=true` to suppress interactive prompts and auto-select browser auth:

```bash theme={null}
# Using the flag
mutagent --non-interactive auth login

# Using the CI environment variable
CI=true mutagent auth login
```

### Environment Variables

```bash theme={null}
export MUTAGENT_API_KEY="mt_xxxx"
export MUTAGENT_ENDPOINT="https://api.mutagent.io"
```

<Note>
  When `MUTAGENT_API_KEY` and `MUTAGENT_ENDPOINT` are set, the CLI uses them automatically -- no `auth login` step is needed. This is the recommended pattern for AI agents and CI/CD pipelines.
</Note>

### Check Status

```bash theme={null}
mutagent auth status
```

## System Requirements

| Requirement | Minimum Version       | Notes                                   |
| ----------- | --------------------- | --------------------------------------- |
| Bun         | >= 1.1.0              | Recommended runtime for package install |
| Node.js     | >= 18.0.0             | Alternative runtime for package install |
| OS          | macOS, Linux, Windows | Supported platforms                     |

<Tip>
  Using the **standalone binary**? No runtime dependencies are required -- it works on any supported OS out of the box.
</Tip>

### Supported Binary Platforms

<Mermaid>
  graph LR
  CLI\["@mutagent/cli<br />v0.1.186"]
  CLI --> L64\["linux-x64"]
  CLI --> LA\["linux-arm64"]
  CLI --> D64\["darwin-x64"]
  CLI --> DA\["darwin-arm64"]
  CLI --> W64\["windows-x64"]
</Mermaid>

## Configuration

The CLI uses a configuration hierarchy (highest to lowest priority):

<Mermaid>
  graph TD
  A\["1. Command-line flags<br />--api-key, --endpoint"] --> B\["2. Environment variables<br />MUTAGENT\_API\_KEY, MUTAGENT\_ENDPOINT"]
  B --> C\["3. Credentials file<br />~~/.config/mutagent/credentials.json"]
  C --> D\["4. RC files<br />.mutagentrc, .mutagentrc.json, mutagent.config.js"]
  D --> E\["5. Global config<br />~~/.config/mutagent/config.json"]
</Mermaid>

### Configuration File Example

Create `.mutagentrc.json` in your project:

```json theme={null}
{
  "endpoint": "https://api.mutagent.io",
  "format": "table",
  "timeout": 30000,
  "ui": {
    "colors": true,
    "verbosity": "info"
  }
}
```

Or `mutagent.config.js`:

```javascript theme={null}
module.exports = {
  endpoint: 'https://api.mutagent.io',
  format: 'table',
  ui: {
    colors: true,
    progressIndicators: true
  }
};
```

### View Configuration

```bash theme={null}
# List all config
mutagent config list

# Get specific value
mutagent config get apiKey
mutagent config get endpoint
```

## Uninstall

<CodeGroup>
  ```bash bun theme={null}
  bun remove -g @mutagent/cli
  ```

  ```bash npm theme={null}
  npm uninstall -g @mutagent/cli
  ```
</CodeGroup>

To also remove credentials:

```bash theme={null}
rm -rf ~/.config/mutagent
```
