# Environment variables

Mirli reads these environment variables. The server reads each one as
`MIRLI_*` first, then by its name from before the rename, `SOUNDBOX_*`, so
existing Docker, service and MCP client configs keep working; if both are
set, `MIRLI_*` wins. Releases up to 0.5.0 read only the `SOUNDBOX_*` names.
The few variables that only `npm run dev`, Vite or the desktop shell read
still use the `SOUNDBOX_*` name, as the table shows.

Server variables are read by the process running `soundbox`, `npm run dev`
or the desktop shell, which passes its environment through. The server sets
`MIRLI_LOG_FILE` for its own use. How the access variables fit together is
described in [Access control](https://mirli.app/docs/install-access/index.md).

| Variable | Read by | What it does |
|---|---|---|
| `MIRLI_DATA_DIR` | server | The data folder. Default `~/.mirli`, or `~/.soundbox` when that exists and `~/.mirli` doesn't. `--data-dir` does the same for one run. |
| `MIRLI_AUDIOCPP_BIN` | server | Absolute path to an `audiocpp_cli` of yours. Nothing is downloaded. |
| `MIRLI_LLAMA_SERVER_BIN` | server | The same, for `llama-server`. |
| `MIRLI_SD_SERVER_BIN` | server | The same, for `sd-server`. |
| `MIRLI_AUDIOCPP_BACKEND` | server | Force the audio.cpp backend instead of detecting it: `cuda`, `hip`, `metal`, `vulkan`, `cpu`. |
| `MIRLI_LLAMA_SERVER_BACKEND` | server | Changes the backend that `soundbox model status llm` and the app report for `llama-server`. It does not change the download; use `soundbox model install llm --backend <NAME>` for that. |
| `MIRLI_SD_SERVER_BACKEND` | server | Changes the backend the app reports for `sd-server`. It does not change the download. |
| `MIRLI_ALLOW_UNVERIFIED_BINARIES` | server | `1` installs an engine archive that no published SHA-256 covers. Off by default. A checksum mismatch is refused regardless. |
| `HF_TOKEN`, `HUGGING_FACE_HUB_TOKEN` | server | Hugging Face token for gated models, used when none is saved in Settings. |
| `HF_HOME` | server | Hugging Face cache location. Left alone if set; otherwise Mirli points it at `<DATA_DIR>/models`. |
| `MIRLI_API_TOKEN` | server, stdio MCP bridge, CLI | An access token of at least 16 characters. Set on the server, every `/api/*`, `/v1/*`, `/mcp`, `/files` and `/artwork` request needs it as `Authorization: Bearer <TOKEN>` or a session cookie from the UI's sign-in screen; `GET /api/health` stays open. Set for the stdio bridge, `soundbox ps` or `soundbox enhance`, it is sent to the server. See [Access token](https://mirli.app/docs/install-access/index.md#access-token). |
| `MIRLI_ALLOWED_HOSTS` | server, Vite | Comma-separated `host` (any port) or `host:port` (that port only). Adds `Host` values the server accepts (UI, `/api/*` and `/mcp`) and trusted browser origins (CORS and the MCP `Origin` check); under `npm run dev` also Vite's `server.allowedHosts`, which reads it only as `SOUNDBOX_ALLOWED_HOSTS`. See [Host checks](https://mirli.app/docs/install-access/index.md#host-checks) and [SECURITY.md](https://github.com/HamSanders/soundbox/blob/main/SECURITY.md). |
| `MIRLI_SANDBOXED` | server | `1` for a server whose users don't own the machine: nothing in the UI touches the host. See [Sandboxed mode](https://mirli.app/docs/install-access/index.md#sandboxed-mode). |
| `MIRLI_DISABLE` | server | Comma-separated capabilities to turn off (`filesystem`, `reveal`, `downloads`, `local_models`, `custom_endpoints`, `updates`, `gpu_status`, `agent_connect`, `skills_install`, `logs`, `setup_wizard`). Turning off `custom_endpoints` also locks the prompt assistant's and artwork's external URLs and the OpenTelemetry endpoint. |
| `MIRLI_URL` | stdio MCP bridge | Where the running server is. Default `http://127.0.0.1:17494`. Set `MIRLI_API_TOKEN` too if that server needs one. |
| `OTEL_EXPORTER_OTLP_ENDPOINT` | server | OpenTelemetry collector for MCP call traces and metrics. Wins over the Settings value. |
| `MIRLI_LOG_LEVEL` | server | `debug`, `info` (default), `warning`, `error` or `critical`; `warn` works too. Used when `--log-level` isn't given, so it reaches `npm run dev`, Docker and the desktop app, none of which pass the flag. An unknown value logs a warning and runs at `info`. See [Troubleshoot a source install](https://mirli.app/docs/install-troubleshooting/index.md#find-the-server-log). |
| `MIRLI_IDLE_EXIT_MINUTES` | server | Exit (status 0) after this many minutes with no requests, none still being answered, and no queued or running jobs. For hosts that scale to zero and start the server again on the next request. Health checks don't count as use. Off by default. |
| `MIRLI_UPDATE_CHECK` | server | `0` (or `false`, `off`, `no`) turns off the daily "is there a newer version?" request, whatever Settings says; Settings shows the switch as locked. `npm run dev` sets it to `0`. See [PRIVACY.md](https://mirli.app/docs/privacy/index.md). |
| `MIRLI_UPDATE_URL` | server | Where the update check asks. Default `https://mirli.app/api/update`. |
| `PORT` | server, Vite | The Vite dev server's port (default 5174). The server also trusts it as a dev origin. |
| `SOUNDBOX_PORT` | `npm run dev`, Vite | The port `scripts/dev.mjs` starts the server on, and the port Vite proxies to. Default 17494. The `soundbox` CLI itself takes `--port`. |
| `SOUNDBOX_DEV_HOST` | `npm run dev`, Vite | The address Vite listens on (`0.0.0.0`, a LAN IP). Default localhost. The server stays on `127.0.0.1`. No authentication, so open it only on a network you trust. |
| `MIRLI_DESKTOP_PORT` | desktop shell | The port the desktop app starts, or adopts, its server on. Default 17494. Also read as `SOUNDBOX_DESKTOP_PORT`. |
| `SOUNDBOX_NODE` | desktop shell | The Node to run the built server with, if `node` is not on `PATH`. |
| `SOUNDBOX_PROJECT_ROOT` | desktop shell | The path to the checkout, if the shell can't find it from its own location. |
| `VITE_MOCK` | app build | `1` runs the UI against the in-browser fake backend (`npm run dev:mock` sets it). |
| `VITE_MOCK_FIXTURE` | app build | With `VITE_MOCK=1`, `demo` starts the fake backend from the demo library the screenshots are taken from (`npm run capture:media` sets it). |
| `VITE_REPO_URL` | app build | The repository URL in the app's links. Default `https://github.com/HamSanders/soundbox`. |
| `VITE_SITE_ORIGIN` | app and site builds | The absolute origin for canonical URLs and the site's RSS feed. |
