mcp-tmux
mcp-tmux is an MCP server that lets an AI agent fully control tmux sessions, windows, and panes — locally or over SSH — enabling automation, live pair programming, and deep tmux integration.
Session Management: create, rename, list, kill, and check existence of sessions.
Window Management: create, rename, move, swap, link, unlink, break, join, list, kill, and find windows.
Pane Management: split, select, resize, swap, kill, clear history, set title, respawn, and pipe output.
Input & Output:
Send literal text or key sequences (e.g.,
C-c,Enter) to any paneCapture visible content and scrollback from a pane
Run a shell command and reliably capture its output and exit code (
tmux_run)Wait for a specific text pattern to appear, or for output to settle (idle)
Live Streaming: open a persistent control-mode stream to watch pane output and tmux events in real-time, send commands through the stream, resize the control client, and auto-reconnect on disconnection.
Configuration & State: set/show options (server, session, window, pane scope), manage environment variables, set hooks, bind/unbind keys, and run if-shell/run-shell commands.
Clipboard/Buffers: set, list, paste, delete, save, and load paste buffers.
Copy Mode: enter/exit, scroll (page, half-page, top/bottom), and search scrollback history.
Clients & Server Info: list attached clients, display status-line messages, and report server PID, socket path, and tmux version.
Utilities:
Evaluate tmux format strings (e.g.,
#{pane_current_path})Run any arbitrary tmux subcommand via
tmux_commandpassthroughList configured targets (local + named SSH profiles)
Remote Support: every tool accepts an optional target parameter to operate against a local tmux instance or a remote host via SSH (ad-hoc user@host or named config profiles). Supports tmux 1.8+.
MCP Resources: read-only tmux://... URI scheme for browsing sessions, windows, and panes.
Provides tools for managing tmux sessions, windows, and panes, including sending keystrokes, capturing pane output, streaming live output, and executing arbitrary tmux commands on local or remote hosts via SSH.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-tmux create a new tmux session named 'dev' and run 'npm start'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-tmux
A comprehensive, universal MCP server for driving tmux — sessions, windows, panes, sending keystrokes, and reading pane output — on the local machine or on remote hosts over SSH.
Source: https://github.com/laszlopere/mcp-tmux
Shared, visible sessions — pair with the AI
This is the whole point, not a caveat: the agent drives real tmux sessions, not a private sandbox. When you attach to a session the agent is using, you see its keystrokes and command output live, and you can type into the very same pane. Nothing the agent does is hidden from an attached human — by design.
That makes tmux a natural medium for pair programming with the AI: open a shared session, watch it work, take the keyboard when you want to step in, and hand it back. The agent and you cooperate in one place instead of the agent operating out of sight. (Because writes into an attached session are visible and real, be deliberate with destructive commands — you're both driving the same terminal.)
Related MCP server: MCPretentious
Design goals
Comprehensive. Curated tools cover the common operations ergonomically, and a raw
tmux_commandpassthrough runs any tmux subcommand — so whatever your tmux supports, this server supports.Universal. Works against tmux 1.8+ (≈2013 — covers virtually every live distro). The server detects the target's tmux version and only uses flags/format variables that version understands.
Local + remote. Any tool can run against the local tmux or a remote host over SSH (ad-hoc
user@hostor a named profile from the config file). Old or minimal boxes only needtmux+ssh; the server itself runs on a modern host with Python 3.10+.
Install
uvx mcp-tmux # run directly with uv (no install)
# or install it as an isolated, easily-removable tool:
uv tool install mcp-tmux
# or
pipx install mcp-tmuxRequires Python 3.10+ on the host running the server, plus the tmux binary
(and ssh for remote targets).
Installing ≠ registering. Installing the package only puts the
mcp-tmuxexecutable on your PATH — it does not tell any MCP client about it. Python wheels can't run post-install code, so registration is always a separate step (see below). If a client "can't find" the server after install, it just hasn't been registered yet.
Register with Claude Code
The package can register itself — no hand-editing of config files:
mcp-tmux register # add to Claude Code at *user* scope
mcp-tmux unregister # remove it againUser scope matters. mcp-tmux register defaults to --scope user, so the
server is visible from every directory/session. The plain
claude mcp add tmux -- mcp-tmux defaults to local (project) scope, which is
the usual reason a server "doesn't show up" in another session — it was only
added for the directory you ran it in. To pick a scope explicitly:
mcp-tmux register --scope user # everywhere (default)
mcp-tmux register --scope project # shared via this repo's .mcp.json
mcp-tmux register --scope local # just this directoryAfter registering, confirm with claude mcp list (you should see
tmux: mcp-tmux - ✓ Connected). A client session already running must be
restarted to pick up a newly registered server.
Equivalent manual form, if you prefer the raw CLI:
claude mcp add -s user tmux -- mcp-tmux # for an installed tool
claude mcp add -s user tmux -- uvx mcp-tmux # without installingOne-shot install + register (and clean removal)
From a checkout, the helper scripts do install and registration together — the closest thing to "it happens at install time":
scripts/install.sh # build wheel, `uv tool install`, then `mcp-tmux register`
scripts/uninstall.sh # `mcp-tmux unregister`, then `uv tool uninstall`To remove everything by hand:
mcp-tmux unregister # drop it from Claude Code
uv tool uninstall mcp-tmux # remove the isolated tool (or: pipx uninstall mcp-tmux)Run from a checkout (development)
python -m mcp_tmux # stdio serverTools (overview)
Tools are grouped into toolsets so a session only pays the schema cost of
what it needs. core is always loaded; the rest are opt-in (see
Selecting toolsets). A default session loads
core + automation (~19 tools); ["all"] loads the full surface (61).
Toolset | Tools |
core (always loaded) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Every tool accepts an optional target (omit / "local", a named profile, or
user@host). For anything not covered by a dedicated tool — including anything
gated out of the active toolsets — use tmux_command(args=[...]), which is in
core and reaches every tmux subcommand.
Selecting toolsets
Pick toolsets with the toolsets config key or the MCP_TMUX_TOOLSETS
environment variable (comma-separated; env wins over config). core is always
included. The special value all loads every toolset. An unknown name is a
startup error listing the valid toolsets.
# ~/.config/mcp-tmux/config.toml
toolsets = ["core", "automation", "stream"] # or ["all"] for the full surface// or in the MCP server env, e.g. Claude Code's mcp config:
"env": { "MCP_TMUX_TOOLSETS": "core,layout,stream" }With no setting, the default is ["core", "automation"].
The consolidated tools take a kind discriminator instead of having one
tool per entity — e.g. tmux_kill(kind="window", id="dev:2"),
tmux_kill(kind="server"), tmux_swap(kind="pane", src="%1", dst="%2"),
tmux_rename(kind="session", id="old", new_name="new"),
tmux_list(kind="window", scope="dev"). Valid kinds: kill →
session/window/pane/server; rename → session/window; select/last/swap →
window/pane; respawn → pane/window; list → session/window/client/buffer
(tmux_list returns {items, kind}; panes have their own tmux_list_panes
because they scope by window or session).
Live streaming (opt-in)
The one-shot CLI is the universal default. For watching a pane as it
produces output — a build, a tail, a long job — tmux_stream_* opens a
persistent control-mode (tmux -C) connection and lets you long-poll its
event stream instead of repeatedly calling tmux_capture_pane:
tmux_stream_start(session="work") # -> {"stream_id": "cm-1a2b3c4d", ...}
tmux_stream_read("cm-1a2b3c4d", timeout=10, kinds=["output"])
# -> blocks until output, then {"events": [{"type":"output","pane":"%0",
# "data":"...","seq":42}], "cursor":42}
tmux_stream_stop("cm-1a2b3c4d") # detaches; the session keeps runningtmux_stream_read auto-advances a cursor, so just call it again for the next
batch; filter by pane and/or kinds ("output", "window-add",
"layout-change", …). One connection is shared per (target, session) and
tmux_stream_start is idempotent.
Read-only state is also exposed as MCP resources: tmux://sessions,
tmux://{session}/windows, tmux://{window}/panes (local), plus target-aware
variants tmux://{target}/sessions, tmux://{target}/{session}/windows,
tmux://{target}/{window}/panes.
A typical agent flow:
tmux_new_session(detached=True) # -> {"id": "$0", "name": "0"}
tmux_send_keys("0", text="echo hi", enter=True)
tmux_capture_pane("0") # -> {"content": "... hi ..."}Where send_keys text is evaluated
tmux_send_keys types its text into the pane — it is not a local shell
command. So any shell syntax in it ($(...), backticks, $VAR, ~, globs, …)
is expanded by the shell running in that pane, at the moment the keys are
executed — not on the machine running this MCP server. For an SSH target that
means the remote pane's shell does the expansion; the server only ships the
literal text across (the SSH layer shell-quotes the tmux argv so it survives the
hop intact).
# `$(hostname)` runs in the pane, so it prints the *target's* hostname,
# not the server's:
tmux_send_keys("work", text="echo $(hostname)", enter=True)If you need a value from the server side instead, interpolate it yourself before
calling send_keys.
Configuration
Optional TOML at ~/.config/mcp-tmux/config.toml (override with
MCP_TMUX_CONFIG):
# toolsets = ["core", "automation"] # which tool groups to load; ["all"] = full
# # (also via MCP_TMUX_TOOLSETS, env wins)
[defaults]
timeout = 15 # seconds per tmux invocation
# transport = "control" # see "Transport" below; default "oneshot"
# socket_name = "work" # default `tmux -L`
# socket_path = "/tmp/sock" # default `tmux -S`
[targets.prod]
host = "user@prod-db"
ssh_options = ["-J", "bastion", "-p", "2222"]
# socket_name = "work"With no config file the server still works against local tmux and any ad-hoc
user@host target (SSH options come from your ~/.ssh/config).
Transport
By default every tmux command is a separate tmux process (ssh host tmux ...
for a remote target): about 2 ms per command locally and about 20 ms to a LAN
host. transport = "control" (tmux 3.2+, in [defaults] or a
[targets.<name>] table) instead keeps one control-mode client
(tmux -C attach -f no-output,ignore-size) per target and sends the commands
through it: about 0.1 ms locally and about 1 ms to a LAN host. With it,
tmux_wait_for_text / tmux_wait_for_idle are woken by the pane's output
instead of polling.
The cost: that client is attached to one of the target's sessions. The session
shows as attached (to you as well), attaching makes it tmux's most recent
session (what a plain tmux attach or a command without -t picks), commands
sent without -t default to it, and list-clients shows the client. The wait
tools attach a read-only client to the waited-on pane's session while they
wait. Commands that block or act on the client itself (wait-for,
run-shell, if-shell, attach/detach/switch, kill-server, new-session,
...) still run one-shot, as does everything while the target has no session.
The tmux_transport tool reports the transport and can switch it until the
server restarts; its description tells the AI to ask you first.
SSH multiplexing
SSH connections are multiplexed: every remote call adds -o ControlMaster=auto -o ControlPersist=10m -o ControlPath=<private dir>/ssh-%C, so only the first
call to a host pays for the SSH handshake. The private directory is
$XDG_RUNTIME_DIR/mcp-tmux-<uid> (or the same name under the temp dir), mode
0700. A profile's ssh_options override any of the three, and
ssh_options = ["-o", "ControlMaster=no"] turns multiplexing off for that
target.
Development
python -m venv .venv && . .venv/bin/activate
pip install -e ".[dev]"
pytest # unit tests always run; integration tests run if tmux existsSee CONTRIBUTING.md for the full checklist (ruff, mypy, pytest) and contribution guidelines.
Contributing
Bug reports, feature requests, and pull requests are welcome on GitHub: https://github.com/laszlopere/mcp-tmux. Please read CONTRIBUTING.md first.
Sponsor
If this project is useful to you, consider sponsoring its development via GitHub Sponsors. ❤️
License
MIT © László Pere
Available Tools
71 toolstmux_bind_keyB
Bind key to a tmux command.
command is the tmux command + args as a list, e.g.
["new-window", "-n", "logs"]. table selects the key table; root=True
(-n) binds in the root table so no prefix is needed; repeat=True (-r)
allows the key to repeat. Returns {"bound": key}.
Inputs: key (required), command (required), table, repeat, +2 more.
tmux_break_paneB
Break a pane out into a new window of its own.
window_name names the new window; select=False creates it in the
background (-d). Returns the new window's {"id", "index", "name"}.
Inputs: target_pane (required), window_name, select, target.
tmux_capture_paneARead-only
Capture (read) the visible contents and/or scrollback of a pane.
This is the primary way to observe output. start/end select a
scrollback line range (-S/-E): negative or "-" for the start of history,
e.g. start=-100 grabs the last 100+ lines. escapes=True keeps ANSI
color/escape sequences (-e). join=True rejoins wrapped lines (-J).
trim=True (default) drops the empty padding lines tmux emits below the
last line of real content; set trim=False to keep the raw capture.
Returns {"content": }.
Inputs: target_pane, start, end, escapes, +3 more.
tmux_clear_historyADestructive
Wipe a pane's scrollback history (clear-history -t pane).
Use this before a tmux_send_keys / tmux_run so a subsequent
tmux_capture_pane(start=...) starts from a clean slate, without the
previous output bleeding into the captured range. It clears the
scrollback buffer only — the visible screen is untouched.
Returns {"cleared": True, "pane": target_pane}.
Inputs: target_pane, target.
tmux_commandA
Run an arbitrary tmux command and return its raw result.
This is the universal escape hatch — it runs tmux <args> verbatim, so
it can do anything the target's tmux supports. Pass the subcommand and
its flags as a list, e.g. args=["new-window", "-t", "mysess", "-n",
"logs"]. Do NOT include the leading "tmux".
Returns {"stdout", "stderr", "exit_code"}. Non-zero exit codes are returned, not raised, so you can inspect failures.
target selects where tmux runs: omit (or "local") for the local
machine, a named profile from the config file, or an ad-hoc ssh
destination like "user@host".
Inputs: args (required), target, timeout.
tmux_copy_modeA
Enter (or exit) copy mode in a pane.
page_up=True (-u) scrolls up one page on entry. exit=True leaves copy
mode instead (sends the copy-mode cancel command, tmux 2.4+).
Returns {"copy_mode": bool}.
Inputs: target_pane (required), page_up, exit, target.
tmux_copy_scrollB
Scroll within copy mode.
direction is one of: up, down, page-up, page-down, halfpage-up,
halfpage-down, top, bottom. amount repeats the step (ignored for
top/bottom). Enters copy mode first if needed. Requires tmux 2.4+.
Inputs: target_pane (required), direction, amount, target.
tmux_copy_searchA
Search the scrollback in copy mode for pattern.
backward=True searches towards the top of history (the usual direction for finding recent output); set backward=False to search forward. Enters copy mode first if needed. Requires tmux 2.4+. Returns {"searched": ...}.
Inputs: target_pane (required), pattern (required), backward, target.
tmux_delete_bufferBDestructive
Delete a named paste buffer.
Inputs: name (required), target.
tmux_display_messageA
Show a message on a client's status line.
Unlike tmux_query (which prints an expanded format to you via
display-message -p), this displays message on the tmux screen of
the attached client. #{...} format variables in message are expanded
against target_pane's context if given. Returns {"displayed": True}.
Inputs: message (required), target_client, target_pane, target.
tmux_find_windowARead-only
Find windows whose name, title, or current command matches pattern.
pattern is matched case-insensitively as a substring. Scope to a
session, or search the whole server (default). Returns the matching
window records {"matches": [...]}.
(tmux's own find-window is interactive — it opens a chooser in an
attached client — so this performs a non-interactive search over
list-windows instead, which is what an agent actually wants.)
Inputs: pattern (required), session, target.
tmux_has_sessionBRead-only
Check whether a session exists. Returns {"exists": bool}.
Inputs: session (required), target.
tmux_if_shellA
Run a tmux command conditionally with if-shell.
Runs condition as a shell command; if it succeeds, runs the tmux
command if_command, otherwise else_command (if given). is_format=True
(-F) treats condition as a tmux format that is true unless it evaluates
to empty or "0" (no shell). background=True (-b) runs in the background.
Inputs: condition (required), if_command (required), else_command, background, +2 more.
tmux_join_paneA
Join pane src into dst's window as a new split (the inverse of
break-pane).
By default splits left/right; vertical=True stacks top/bottom.
percentage sizes the joined pane. select=False keeps focus on the
original pane (-d).
Inputs: src (required), dst (required), vertical, percentage, +2 more.
tmux_kill_paneCDestructive
Kill a pane (destructive).
Inputs: target_pane (required), target.
tmux_kill_serverADestructive
Kill the tmux server on the target (destructive: ends ALL sessions).
Inputs: target.
tmux_kill_sessionBDestructive
Kill a session (destructive). Ends all its windows and panes.
Inputs: session (required), target.
tmux_kill_windowCDestructive
Kill a window (destructive).
Inputs: window (required), target.
tmux_last_paneA
Switch to the previously active pane (last-pane).
With window (-t), acts on that window; otherwise the current one.
Returns {"selected": "last"}.
Inputs: window, target.
tmux_last_windowA
Switch to the previously selected window (last-window).
With session (-t), acts on that session; otherwise the current one.
Returns {"selected": "last"}.
Inputs: session, target.
tmux_link_windowA
Link a window into another location (it then appears in both).
src is the source window (e.g. "sess1:2"), dst the destination
(e.g. "sess2:" for the next free index, or "sess2:5"). select=False
links it in the background (-d). The same window now lives in both spots;
use tmux_unlink_window to remove a link.
Inputs: src (required), dst (required), select, target.
tmux_list_buffersBRead-only
List paste buffers with their names and sizes.
Inputs: target.
tmux_list_clientsARead-only
List clients attached to the server.
With session, lists only the clients attached to that session (-t).
Each client has its tty, attached session, and size. Returns
{"clients": [...]}.
Inputs: session, target.
tmux_list_keysARead-only
List key bindings, optionally restricted to one key table (e.g.
"prefix", "root", "copy-mode"). Returns the raw bindings as
{"keys": , "lines": [...]} — one bind-key ... line each.
Inputs: table, target.
tmux_list_panesARead-only
List panes. Scope to a window (-t), a session (-s), or the whole
server (default, -a).
Inputs: window, session, target.
tmux_list_sessionsBRead-only
List all sessions on the target with id, name, window count, etc.
Inputs: target.
tmux_list_targetsARead-only
List configured targets: 'local' plus any named profiles from config.
Inputs: no named parameters.
tmux_list_windowsARead-only
List windows. With session, lists that session's windows; otherwise
all windows on the server (-a).
Inputs: session, target.
tmux_load_bufferA
Load a file's contents into a paste buffer (load-buffer).
name stores it under a named buffer (-b). IMPORTANT: path is resolved
on the target — for an SSH target it is a file on the remote host,
not the local machine.
Returns {"loaded": path, "name": name}.
Inputs: path (required), name, target.
tmux_move_windowC
Move/renumber a window from src to dst (e.g. "sess:5").
Inputs: src (required), dst (required), target.
tmux_new_sessionA
Create a new session (detached by default).
Optional command runs as the first pane's command; start_directory
sets the working dir; width/height size the detached session.
attach_or_create=True makes the call idempotent: if a session named
name already exists it is reused (its id/name returned) instead of
erroring, otherwise it is created. tmux's own new-session -A attaches
the existing session, which a headless MCP server has no terminal to do;
so the reuse here is a detached has-session check (the create-time
options below only apply when the session is actually created).
env (-e KEY=VAL, tmux 3.0+) sets session environment variables before
the first command launches; ignored with a note on older tmux.
Returns the created (or existing) session's {"id", "name"}.
Inputs: name, start_directory, command, width, +5 more.
tmux_new_windowB
Create a window. session is the target session (or "sess:index").
Set select=False to create it in the background (-d). Returns the new window's {"id", "index", "name"}.
Inputs: session, name, start_directory, command, +2 more.
tmux_next_layoutA
Rotate a window to its next preset layout (next-layout).
With window (-t), acts on that window; otherwise the current one.
Returns {"window": window}.
Inputs: window, target.
tmux_paste_bufferC
Paste a buffer into a pane. delete=True removes the buffer after (-d).
Inputs: target_pane (required), name, delete, target.
tmux_pipe_paneB
Pipe a pane's output to a shell command (great for logging).
With command, tmux feeds everything the pane prints to that command's
stdin, e.g. command="cat >> /tmp/pane.log". only_new=True (-o) toggles:
if a pipe is already open it is closed, otherwise opened. Call with no
command to stop piping. Returns {"piping": bool}.
Inputs: target_pane (required), command, only_new, target.
tmux_queryARead-only
Evaluate a tmux format string (e.g. "#{pane_current_path}").
Uses display-message -p to expand any #{...} format variable. Optional
target_pane sets the context (-t) the format is evaluated against.
Returns {"value": }.
Inputs: format (required), target_pane, target.
tmux_rename_sessionC
Rename a session.
Inputs: session (required), new_name (required), target.
tmux_rename_windowC
Rename a window.
Inputs: window (required), new_name (required), target.
tmux_resize_paneC
Resize a pane by a number of cells in one or more directions.
Inputs: target_pane (required), left, right, up, +2 more.
tmux_respawn_paneA
Restart the command in a pane (respawn-pane), reusing it in place.
Useful for retrying a crashed command or supervising a service without
recreating the window layout. By default tmux only respawns a pane whose
command has already exited; set kill=True (-k) to force-restart one that
is still running. command is the shell command to run (defaults to the
pane's original command); start_directory sets its cwd (-c). env
(-e KEY=VAL, tmux 3.0+) injects environment variables; ignored with a
note on older tmux.
Returns {"respawned": True, "pane": target_pane}.
Inputs: target_pane (required), command, kill, start_directory, +2 more.
tmux_respawn_windowA
Restart the command in a window (respawn-window), reusing it in place.
Like tmux_respawn_pane but for a whole window (its single/first pane).
By default tmux only respawns a window whose command has exited; set
kill=True (-k) to force-restart a live one. command defaults to the
window's original command; start_directory sets its cwd (-c). env
(-e KEY=VAL, tmux 3.0+) injects environment variables; ignored with a
note on older tmux.
Returns {"respawned": True, "window": window}.
Inputs: window (required), command, kill, start_directory, +2 more.
tmux_runA
Run a shell command in a pane and return just its output + exit code.
Types command into the pane bracketed by unique markers, then polls
until the command finishes, and returns the text printed between the
markers. This is the reliable alternative to send-keys + sleep + capture.
Intended for NON-interactive commands at a shell prompt. Returns {"completed", "exit_code", "output", "elapsed"}; on timeout, completed is False and output holds the raw capture so far.
Inputs: target_pane (required), command (required), timeout, history, +2 more.
tmux_run_shellA
Run a shell command from tmux via run-shell.
background=True (-b) runs it without waiting. Note: tmux surfaces the
command's stdout in a message/copy buffer rather than returning it here,
so output is usually empty — to capture a command's output prefer
tmux_run. Returns {"output", "exit_code"}.
Inputs: command (required), background, target_pane, target.
tmux_save_bufferA
Write a paste buffer to a file (save-buffer).
name selects a named buffer (-b); the default is the most recent one.
append=True appends to the file instead of overwriting (-a). IMPORTANT:
path is resolved on the target — for an SSH target it is a file on
the remote host, not the local machine.
Returns {"saved": path, "name": name}.
Inputs: path (required), name, append, target.
tmux_select_layoutC
Apply a named layout (even-horizontal, even-vertical, main-horizontal, main-vertical, tiled) or a layout string to a window.
Inputs: layout (required), window, target.
tmux_select_paneC
Make a pane the active one.
Inputs: target_pane (required), target.
tmux_select_windowC
Make a window the active one (e.g. window="mysess:2").
Inputs: window (required), target.
tmux_send_keysA
Send input to a pane.
Two modes (provide exactly one of text / keys):
text: a literal string. With literal=True (default) it is sent exactly as written viasend-keys -l(so "C-c" types those three characters). Set literal=False to let tmux interpret key names inside the string.keys: a list of tmux key tokens interpreted by tmux, e.g. ["C-c"], ["Escape"], ["Up", "Up", "Enter"].
enter=True appends an Enter keypress after the input — the usual way to
"run" a typed command. Returns {"sent": True}.
Inputs: target_pane (required), text, keys, enter, +2 more.
tmux_server_infoCRead-only
Report basic server facts: pid, socket path, and tmux version.
Returns {"pid", "socket_path", "version", "supported"}.
Inputs: target.
tmux_set_bufferC
Set a paste buffer's contents (optionally named with -b).
Inputs: data (required), name, target.
tmux_set_environmentA
Set or unset an environment variable for a session (or globally).
Set global_=True (-g) to affect the global environment that new
sessions inherit, instead of one session. With a value, sets the
variable; commands spawned afterwards in that session's panes inherit it
(the race-free alternative to an export typed via send_keys).
To clear a variable, pass remove=True (-r, mark it for removal so the
child sees it unset even if it exists globally) or unset=True (-u,
delete it from this session's environment). session is the -t target.
Returns {"set"/"removed"/"unset": name, ...}.
Inputs: name (required), value, global_, remove, +3 more.
tmux_set_hookA
Set (or unset) a hook that runs a tmux command on an event.
hook is the event name, e.g. "pane-died" or "session-created";
command is the tmux command to run (a command string like
'display "gone"'). global_=True (-g) sets it server-wide; unset=True
(-u) removes the hook instead. Requires tmux 2.2+.
Inputs: hook (required), command, global_, unset, +1 more.
tmux_set_optionB
Set a tmux option.
scope is one of "server" (-s), "session" (default), "window" (-w),
or "pane" (-p, requires newer tmux). target_entity is the -t target
for session/window/pane scope.
Inputs: name (required), value (required), scope, target_entity, +1 more.
tmux_set_pane_titleA
Set a pane's title (select-pane -T, tmux 2.6+).
The title is the #{pane_title} reported by tmux_list_panes; it's a
handy label for agents driving several panes (it does not change the
window name). Requires tmux 2.6+; on older tmux it is a no-op with a
note.
Returns {"pane": target_pane, "title": title} (or {"notes": [...]}).
Inputs: title (required), target_pane, target.
tmux_show_environmentARead-only
Show a session's environment (or the global one with global_=True).
With name, returns just that variable. Variables tmux has marked for
removal (shown by tmux as -NAME) are reported as removed=True with a
null value.
Returns {"environment": {name: value_or_None}, "removed": [names...]}.
Inputs: name, global_, session, target.
tmux_show_hooksARead-only
Show the hooks set on the server/session. Returns {"hooks": {name: command}}.
Inputs: global_, target_entity, target.
tmux_show_optionsCRead-only
Show tmux options for a scope. Returns {"options": {name: value}}.
Inputs: scope, target_entity, global_, target.
tmux_split_windowB
Split a pane. By default splits left/right; vertical=True splits
top/bottom. percentage sizes the new pane (e.g. 30). select=False
keeps focus on the original pane (-d).
Returns the new pane's {"id", "index"}.
Inputs: target_pane, vertical, start_directory, command, +3 more.
tmux_stream_listARead-only
List active control-mode streams and their state. Returns {"streams": [{stream_id, session, target, alive, buffered, panes, ...}]}.
Inputs: no named parameters.
tmux_stream_readARead-only
Long-poll new events from a stream (blocks until output or timeout).
Returns {"events", "cursor", "alive", "lagged"}. Each event has a seq,
a type ("output", "window-add", "layout-change", "exit", ...) and,
where relevant, pane/window/session ids and data. For "output"
events data is the decoded pane text (ANSI stripped unless
strip_ansi=False).
Filter with pane (e.g. "%0") and/or kinds (e.g. ["output"]). The
cursor auto-advances between calls, so just call again to get the next
batch; pass an explicit cursor to re-read from a known point. lagged
is true if the buffer overflowed and some events were dropped.
Inputs: stream_id (required), timeout, max_events, pane, +3 more.
tmux_stream_resizeA
Set a stream's control-client size (refresh-client -C WxH, tmux 2.4+).
Use this when pane output wraps at the wrong width — a control client defaults to 80x24. The size sticks across auto-reconnects. Returns {"stream_id", "width", "height"}.
Inputs: stream_id (required), width (required), height (required).
tmux_stream_sendA
Run a tmux command over the stream's control connection.
command is a tmux command line (no leading "tmux"), e.g.
"list-windows". Returns {"reply"} with the command's text reply. Errors
from tmux are raised. Output the command triggers in panes still arrives
as %output events via tmux_stream_read.
Inputs: stream_id (required), command (required), timeout.
tmux_stream_startA
Open (or reuse) a control-mode stream attached to session.
Starts a persistent tmux -C attach -t <session> connection that
captures pane output and window/layout events. Idempotent per
(target, session). Returns {"stream_id", "session", "target", "alive"};
pass the stream_id to tmux_stream_read/_send/_stop.
Pass width/height (both, tmux 2.4+) to set the control client's size
via refresh-client -C WxH right after attach — otherwise it defaults to
80x24 and wraps %output for wider panes oddly. The size is re-applied
automatically if the connection drops and reconnects; tmux_stream_resize
changes it later. The connection also auto-reconnects on an unexpected
drop (e.g. a flaky SSH link), surfacing reconnected/disconnected
events in the stream.
Inputs: session (required), target, width, height.
tmux_stream_stopA
Stop a stream: detach the control client (the session keeps running) and free the connection. Returns {"stopped": stream_id}.
Inputs: stream_id (required).
tmux_swap_paneC
Swap two panes.
Inputs: src (required), dst (required), target.
tmux_swap_windowD
Swap two windows.
Inputs: src (required), dst (required), target.
tmux_unbind_keyA
Unbind a key. Provide key, or all=True (-a) to clear every binding
(in table if given). root=True (-n) targets the root table. Returns
{"unbound": ...}.
Inputs: key, table, root, all, +1 more.
tmux_unlink_windowA
Unlink a window (remove one of its links).
Fails if the window is only linked once, unless it is not the last —
tmux refuses to leave a window with no links. Use tmux_kill_window to
destroy it outright.
Inputs: window (required), target.
tmux_versionBRead-only
Report the target's tmux version and whether it is supported (1.8+).
Inputs: target.
tmux_wait_for_idleARead-only
Wait until a pane's visible content stops changing.
Returns once the capture is unchanged for idle_seconds (i.e. output
has settled), or after timeout. Returns {"idle", "elapsed", "content"}.
Inputs: target_pane (required), idle_seconds, timeout, poll_interval, +1 more.
tmux_wait_for_textARead-only
Wait until pattern appears in a pane, or timeout seconds elapse.
pattern is a substring by default, or a regular expression when
regex=True. history optionally includes that many scrollback lines in
each check (-S -history). Returns {"matched", "elapsed", "content"} where
content is the last capture taken.
Caveat: the pane also shows the command you typed, so a pattern can match
your own echoed input line rather than the command's output. To wait for
a command to finish and get just its output, prefer tmux_run.
Inputs: target_pane (required), pattern (required), timeout, regex, +3 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 71 tools
Each tool targets a specific tmux operation with clear, non-overlapping purposes. Even related tools like tmux_run, tmux_send_keys, and tmux_command have distinct behaviors: run executes and captures output, send_keys sends input, and command runs arbitrary tmux commands. Buffer tools are also clearly differentiated.
All tools follow the consistent 'tmux_verb_noun' pattern in snake_case. Verbs are imperative and predictably describe the action (e.g., list_*, kill_*, set_*, select_*). No mixing of styles or ambiguous abbreviations.
With 71 tools, the set is large and may feel heavy for agents, but it mirrors tmux's extensive command set. The number is reasonable given the server aims to provide comprehensive control of a complex terminal multiplexer, though it exceeds the typical well-scoped range.
The tool surface covers virtually all tmux operations: session, window, pane management; buffer handling; environment, options, hooks, key bindings; copy mode; streaming; and auxiliary commands like version check and server info. No significant gaps are apparent.
Maintenance
Related MCP Connectors
Remote MCP server exposing your Node Command fleet (files, shell, processes, browser) to AI hosts.
Shared memory MCP server for Claude Code, Codex, Gemini CLI and Cursor. Cited, editable.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Real-time chat for AI agents. Claude Code, Cursor, Cline and Codex join channels over MCP.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceMCP server for tmux operations that provides comprehensive control over tmux sessions, windows, and panes.1-
- AlicenseAqualityDmaintenanceMCP server for terminal control enabling AI to manage terminal sessions via iTerm2 or tmux, with features like screen reading, keyboard/mouse input, and background execution.991 npm22MIT
- AlicenseAqualityDmaintenanceMCP server that gives AI assistants full visibility into your tmux sessions — browse sessions, windows, and panes, read terminal output, and send commands.1453 npm1MIT
- AlicenseAqualityCmaintenanceMCP server for tmux enabling AI assistants to manage tmux sessions, windows, panes, layouts, and execute commands securely through natural language. Supports multiple profiles including read-only and full tool sets.222MIT