Developers · Run it yourself
Access control
The access token, host checks, sandboxed mode and capability switches.
By default the server listens on loopback and has no login. Anyone who can reach its port can generate audio, read and delete the library, change settings and call every MCP tool. Four mechanisms control access: the access token, the host checks, sandboxed mode and single capability switches. To set them up, see Reach Mirli from another machine.
Access token
MIRLI_API_TOKEN turns on authentication.
| Property | Value |
|---|---|
| Length | At least 16 characters. A shorter token stops the server at startup. |
| Startup banner | Shows Access token -> required when a token is in force. |
| Protected paths | /api/*, /v1/*, /mcp, /files/* and /artwork/*. Without the token, they answer 401. |
| Open paths | GET /api/health (used by the Docker health check and the desktop app's startup probe; it says nothing about the library), the sign-in routes, and the web UI's static files. |
| Rate limit | 30 wrong tokens from one address in ten minutes, by bearer header, cookie or sign-in form, earn that address 429 until the ten minutes are up, even with the right token. Requests with no token or the right one don't count. Behind a reverse proxy every client shares the proxy's address. |
| Changing the token | Signs every browser out. |
How each client sends the token:
| Client | Method |
|---|---|
| Web UI | A sign-in screen. The browser then holds an HttpOnly cookie for 30 days. The cookie holds a value derived from the token, not the token itself. |
| Scripts, MCP clients, another Mirli | Authorization: Bearer <TOKEN> |
Stdio MCP bridge, soundbox ps, soundbox enhance |
Sent automatically when MIRLI_API_TOKEN is set in their own environment. |
Over plain http://, the token and the cookie cross the network unencrypted.
Behind a proxy that terminates HTTPS, the cookie is marked Secure when the
proxy sends X-Forwarded-Proto: https.
Host checks
The checks defend against DNS rebinding. They apply with or without a token.
| Check | Rule |
|---|---|
UI and /api/* |
A Host header other than localhost, 127.0.0.1, ::1 or a listed name gets 403 Forbidden host. Binding a specific address with --host also accepts that address. Binding 0.0.0.0 turns this check off. |
/mcp |
Host and, when a browser sends one, Origin must be loopback or a listed name, whatever the bind address. Otherwise 403. |
| Browser origins | CORS and the MCP Origin check trust loopback and the listed names. |
MIRLI_ALLOWED_HOSTS is the list. It is comma-separated:
| Entry | Matches |
|---|---|
host |
That name on any port. |
host:port |
That name on that port only. |
Under npm run dev, Vite reads the same list as SOUNDBOX_ALLOWED_HOSTS for
its own server.allowedHosts, with ports dropped. Vite accepts IP addresses
as Host without a list.
Sandboxed mode
MIRLI_SANDBOXED=1 is for a server whose users don't own the machine, such
as a shared server, a NAS or a container behind a sign-in proxy. The UI then
offers nothing that touches the host, and the server answers 403 if asked
anyway:
- folder browsing, folder settings, Open in Finder in a sound's menu, and creating or removing profiles
- model, engine and sample downloads, and models run on this machine
- custom endpoints, so the server never fetches a URL a page hands it
- the update check, the GPU readout, the server log, the connection details for agents, and installing agent skills
- first-run setup
Settings that name a path, a device, an engine or a URL are locked. Generation still works through whatever model sources the server has.
Capability switches
MIRLI_DISABLE turns off single capabilities, as a comma-separated list. The
names are the flags GET /api/capabilities reports:
| Name | Turns off |
|---|---|
filesystem |
Folder browsing and folder settings |
reveal |
Open in Finder in a sound's menu, which opens the system file manager |
downloads |
Model weights, engine and sample pack downloads |
local_models |
Models run on this machine through audio.cpp |
custom_endpoints |
Adding and editing custom endpoints. Also locks the prompt assistant's and artwork's external URLs and the OpenTelemetry endpoint. |
updates |
The daily update check and the update notice |
gpu_status |
The GPU and memory readout |
agent_connect |
The MCP endpoint and stdio command shown to agents |
skills_install |
Installing the bundled agent skills into a client's folder |
logs |
Reading the server log |
setup_wizard |
The first-run setup dialog |
For example, to turn off Open in Finder and the update check:
MIRLI_DISABLE=reveal,updates soundbox