# Configuration Reference

All config lives in `~/.claude-collab/config.json`.

## Fields

| Field | Type | Default | Description |
|---|---|---|---|
| `mcp_url` | string | `http://127.0.0.1:3010` | collab-mcp HTTP base URL |
| `api_key` | string | `null` | plaintext `cmcp_xxx.<secret>` used as `X-API-Key` |
| `api_key_file` | string | `null` | path to a file holding the plaintext key (alternative to inline) |
| `from_user` | string | `claude-code` | sender identity for outbound calls |
| `to_user` | string | `baobei` | default recipient for `collab-send` |
| `session_key` | string | `null` | OpenClaw agent session id (`agent:main:dashboard:<uuid>`) for wakeup command association |
| `poll_interval_ms` | number | `5000` | reserved for future listener integration |
| `pending_dir` | string | `D:/myopenclaw/.tmp` | where `pending-<target>.json` state files drop |

## Where to get an api_key

On the **host running collab-mcp**, run:

```bash
collab-mcp keys create claude-collab --scopes=read,write
```

You'll get a one-time plaintext like:

```
id:        cmcp_3308f3a50c8a991020e4249beb92a820
plaintext: cmcp_3308f3a50c8a991020e4249beb92a820.VevFGOZaNwFbCs29BpTeZ11xVijAmBnL2pDUTGIiVSY
```

The plaintext is shown **only once**. Save it immediately and:

```bash
claude-collab-config set api_key cmcp_3308f3a50c8a991020e4249beb92a820.VevFGOZaNwFbCs29BpTeZ11xVijAmBnL2pDUTGIiVSY
```

Or via the wizard:

```bash
claude-collab-config init
```

## Security

- `config.json` contains the plaintext secret → **chmod 600** (auto-applied on POSIX by `init`)
- Add `config.json` to `.gitignore` (it's outside the project, so this is automatic — but if you copy it elsewhere, exclude it)
- For higher security, use `api_key_file` and point it at a path only the Claude Code user can read; the file contents become the api_key at request time

## Verifying

```bash
collab-doctor
```

If `api_key accepted by server` fails with `HTTP 401`, the key was revoked — create a new one.