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

# Configuration

> Config file, environment variables, and global flags for the meepachat CLI

The CLI resolves configuration from three sources, in order of priority:

1. **Command-line flags** (highest)
2. **Environment variables**
3. **Config file** (lowest)

## Config file

Default location: `~/.config/meepachat/config.json`

```json theme={null}
{
  "url": "https://chat.example.com",
  "token": "your-session-token",
  "tokenType": "Bearer"
}
```

| Field       | Description                                            |
| ----------- | ------------------------------------------------------ |
| `url`       | Base URL of your MeepaChat instance                    |
| `token`     | Authentication token                                   |
| `tokenType` | `"Bearer"` for user sessions, `"Bot"` for bot accounts |

`meepachat login` creates and updates this file automatically. To use a different path:

```bash theme={null}
meepachat --config /path/to/config.json servers list
```

## Environment variables

| Variable               | Description                                            |
| ---------------------- | ------------------------------------------------------ |
| `MEEPACHAT_URL`        | Base URL of MeepaChat instance (equivalent to `--url`) |
| `MEEPACHAT_TOKEN`      | Authentication token (equivalent to `--token`)         |
| `MEEPACHAT_TOKEN_TYPE` | Token type: `Bearer` or `Bot`                          |

```bash theme={null}
export MEEPACHAT_URL="https://chat.example.com"
export MEEPACHAT_TOKEN="your-session-token"
meepachat servers list
```

## Global flags

Available on every command:

| Flag        | Short | Description                                                   |
| ----------- | ----- | ------------------------------------------------------------- |
| `--url`     | `-u`  | Base URL of MeepaChat instance                                |
| `--token`   | `-t`  | Authentication token                                          |
| `--json`    | `-j`  | Output as JSON instead of a table                             |
| `--config`  |       | Config file path (default: `~/.config/meepachat/config.json`) |
| `--verbose` | `-v`  | Show HTTP request and response details                        |

Flags override environment variables, which override the config file.

## Output formats

### Table (default)

Human-readable. Used in interactive workflows.

```bash theme={null}
meepachat servers list
```

```
ID   Name          Role
1    Engineering   owner
2    Design        member
```

### JSON

Machine-readable. Useful with `jq` or in scripts.

```bash theme={null}
meepachat servers list --json
```

```json theme={null}
[
  { "id": "1", "name": "Engineering", "role": "owner" },
  { "id": "2", "name": "Design", "role": "member" }
]
```

### Key-value

Detail views (e.g. `servers get`) print key-value pairs:

```bash theme={null}
meepachat servers get 1
```

```
ID          1
Name        Engineering
Created By  42
Members     12
```

## Verbose mode

`--verbose` prints the HTTP method, URL, request headers, response status, and response body before formatted output. Useful for debugging API calls.

```bash theme={null}
meepachat servers list --verbose
```
