Early release
libtmux is released, and its APIs may still change between releases.
This site's structure and URLs may change too.
libtmux for TypeScript
TypeScript-based tmux client
tmux client library for TypeScript. Control tmux, connect to and create servers, navigate sessions, windows, and panes, send keys, watch for changes via control mode, capture pane contents
Start with TypeScript
import { mkdtemp } from"node:fs/promises";
import { tmpdir } from"node:os";
import { join } from"node:path";
import { setTimeout as delay } from"node:timers/promises";
if (failures.length) thrownewAggregateError(failures);
Run this example
POSIX shell, Git, tmux 3.3a or newer and Bun 1.4.2.
Save the program above as quickstart.ts in a new directory, along with the files below.
Cleanup is omitted; the private tmux server and its temporary files may remain. Select Cleanup to remove them when the program finishes.The program stops its private tmux server and removes any temporary files it created when it finishes. Error handling adds diagnostics; every version checks required results and deadlines.
The checkbox turns a cooldown on and off for every picker on the site. It applies to what an install pulls
in; the package itself, and the libtmux it pins, stay current.
What are cooldowns?
Cooldowns delay picking up newly uploaded packages so the community has time to spot supply-chain
attacks before you install. Most package managers don't apply one by default; you opt in through a
global setting in your tool's configuration.
Bun cannot exempt libtmux from its own cooldown, so a cooldown here would also hold back the release this installs. This command runs without one.
$ bun add --minimum-release-age=0 libtmux
MCP
The TypeScript server lets an agent work with tmux through 45 tools, grouped as Inspect, Manage, Execute and Teardown.
Worked example
Given this prompt, an agent connected to the TypeScript server makes these calls and gets these results.
ReplayHover a call to preview the tmux state after it. Click to pin it.
Before the first call.
%0
[checks]@0
After create_session.
Panes, sizes not read yet
%0
%1 sh
[checks]@0
After split_window.
%0
%1 sh
[checks]sh
list_windows read the windows; tmux itself is unchanged.
%0
$ pytest -q
.. [100%]
2 passed in 0.00s
%1 sh
[checks]sh
After run_shell_command.
%0
$ pytest -q
.. [100%]
2 passed in 0.00s
%1 sh
$ cat checks.log
2026-01-01 checks started
2026-01-01 checks finished
[checks]sh
After run_shell_command.
No sessions
After kill_session.
you
Create a tmux session called checks, split its window into two panes, run pytest -q in one and show checks.log in the other, show me the results, then remove the session.
agent in %0 it printed 2 passed in 0.00s; in %1 it printed 2026-01-01 checks finished.
6/6
Calls and results are recorded against libtmux/libtmux-ts
at ecc3eaca0, on a private tmux 3.8a server, running pytest 9.2.0. The preview draws only what those results state.
The agent's narration is illustrative.
Long values in a result are shortened here; the recording keeps them. The sandbox's project directory is shown as /home/user/project.
Install @libtmux/mcp
Choose your client and configuration scope, then run the command or paste the configuration.
$ claude mcp add tmux -- npx -y @libtmux/mcp
Config file: ~/.claude.json (this project)
$ claude mcp add tmux -- npx -y @libtmux/mcp
npx ignores --min-release-age-exclude, so a cooldown here would also hold back the release it runs; this runs without one. The Global install tab applies a cooldown to the server's dependencies.
Config file: ~/.claude.json (this project)
$ claude mcp add tmux -- npx -y --min-release-age=0 @libtmux/mcp
Config file: ~/.claude.json (this project)
$ claude mcp add tmux --scope user -- npx -y @libtmux/mcp
Config file: ~/.claude.json (all projects)
$ claude mcp add tmux --scope user -- npx -y @libtmux/mcp
npx ignores --min-release-age-exclude, so a cooldown here would also hold back the release it runs; this runs without one. The Global install tab applies a cooldown to the server's dependencies.
Config file: ~/.claude.json (all projects)
$ claude mcp add tmux --scope user -- npx -y --min-release-age=0 @libtmux/mcp
npx ignores --min-release-age-exclude, so a cooldown here would also hold back the release it runs; this runs without one. The Global install tab applies a cooldown to the server's dependencies.
Config file: .mcp.json (in repo, version-controlled)
npx ignores --min-release-age-exclude, so a cooldown here would also hold back the release it runs; this runs without one. The Global install tab applies a cooldown to the server's dependencies.
The package installs a `libtmux-mcp` binary. Requires Node 22 or newer, or Bun 1.3.14 or newer.
Config file: claude_desktop_config.json
$ codex mcp add tmux -- npx -y @libtmux/mcp
Config file: ~/.codex/config.toml
$ codex mcp add tmux -- npx -y @libtmux/mcp
npx ignores --min-release-age-exclude, so a cooldown here would also hold back the release it runs; this runs without one. The Global install tab applies a cooldown to the server's dependencies.
npx ignores --min-release-age-exclude, so a cooldown here would also hold back the release it runs; this runs without one. The Global install tab applies a cooldown to the server's dependencies.
Config file: .codex/config.toml (in repo)
Codex's CLI doesn't support project scope yet — paste this into .codex/config.toml at the repo root.
npx ignores --min-release-age-exclude, so a cooldown here would also hold back the release it runs; this runs without one. The Global install tab applies a cooldown to the server's dependencies.
npx ignores --min-release-age-exclude, so a cooldown here would also hold back the release it runs; this runs without one. The Global install tab applies a cooldown to the server's dependencies.
npx ignores --min-release-age-exclude, so a cooldown here would also hold back the release it runs; this runs without one. The Global install tab applies a cooldown to the server's dependencies.
npx ignores --min-release-age-exclude, so a cooldown here would also hold back the release it runs; this runs without one. The Global install tab applies a cooldown to the server's dependencies.
npx ignores --min-release-age-exclude, so a cooldown here would also hold back the release it runs; this runs without one. The Global install tab applies a cooldown to the server's dependencies.
npx ignores --min-release-age-exclude, so a cooldown here would also hold back the release it runs; this runs without one. The Global install tab applies a cooldown to the server's dependencies.
npx ignores --min-release-age-exclude, so a cooldown here would also hold back the release it runs; this runs without one. The Global install tab applies a cooldown to the server's dependencies.
The package installs a `libtmux-mcp` binary. Requires Node 22 or newer, or Bun 1.3.14 or newer.
Config file: ~/.gemini/config/mcp_config.json
$ opencode mcp add tmux -- npx -y @libtmux/mcp
Config file: ~/.config/opencode/opencode.jsonc
$ opencode mcp add tmux -- npx -y @libtmux/mcp
npx ignores --min-release-age-exclude, so a cooldown here would also hold back the release it runs; this runs without one. The Global install tab applies a cooldown to the server's dependencies.
The package installs a `libtmux-mcp` binary. Requires Node 22 or newer, or Bun 1.3.14 or newer.
Config file: ~/.config/opencode/opencode.jsonc
Dependency cooldowns
Use the Configure cooldowns checkbox above to enable or disable. These settings choose how cooldown behaves
once enabled.
What are cooldowns?
Cooldowns delay picking up newly uploaded packages so the community has time to spot supply-chain attacks before
you install. Most package managers don't apply one by default — you opt in via a global setting in your
tool's config.
The workspace package is separate from the core library.
Dependency cooldowns
The checkbox turns a cooldown on and off for every picker on the site. It applies to what an install pulls
in; the package itself, and the libtmux it pins, stay current.
What are cooldowns?
Cooldowns delay picking up newly uploaded packages so the community has time to spot supply-chain
attacks before you install. Most package managers don't apply one by default; you opt in through a
global setting in your tool's configuration.
Runs tmux-workspace without installing it. Pass a command such as load ./workspace.yaml in place of --help.
$ bunx --bun @libtmux/workspace-cli --help
$ bunx --bun @libtmux/workspace-cli --help
Bun cannot exempt @libtmux/workspace-cli from its own cooldown, so a cooldown here would also hold back the release this installs. This command runs without one.
Bun cannot exempt @libtmux/workspace-cli from its own cooldown, so a cooldown here would also hold back the release this installs. This command runs without one.
$ bun add -g --minimum-release-age=0 @libtmux/workspace-cli