Automation
The CLI, REST API, and MCP server use the same btmux server as the UI, at
127.0.0.1:8004 by default.
| To | Use |
|---|---|
| Script panes and windows from a shell | tmux-style commands |
| Call btmux over HTTP | REST API |
| Give an agent tools for btmux | MCP server |
| Ask the user something from a script | Widgets |
| Run a program over a pane | Popups |
| Tell the user something | Notifications |
| Hand work to agents and wait for it | Orchestrating agents |
| React to changes as they happen | Events |
Authentication
Section titled “Authentication”The btmux commands find the server and its token themselves. HTTP and MCP
requests need the access token in a header:
Authorization: Bearer $BTMUX_AUTH_TOKENInside a pane, BTMUX_AUTH_TOKEN and BTMUX_API_URL are already set. Outside
one, read the token from its file:
export BTMUX_AUTH_TOKEN="$(cat "${XDG_STATE_HOME:-$HOME/.local/state}/btmux/state.token")"A profile has its own token file.