capture-pane
Capture content from a tmux pane with configurable lines count and optional color preservation
Read what a tmux pane is showing right now, run a command in it, and reshape the session — without touching the long-running process you already have going.
LABSCO SUMMARY
capture-pane returns what a pane is displaying right now, which makes an already-running process — a watch, a dev server, a half-finished REPL session — something a model can inspect without owning it. The default execution mode wraps commands, and the vendor's own note marks its edge: heredocs and other multi-line constructs conflict with the wrapping, so interactive work belongs in rawMode. Kill tools reach every level, so it is worth being deliberate about which session id ends up in a prompt.
A control surface for tmux on the same machine: sessions, windows and panes are listable, readable and killable, and commands can be run inside a chosen pane with their results collected afterwards.
Tmux running on the same machine as the server, with the sessions you want to reach already in it. No credentials. MIT licensed.
One command — npx -y tmux-mcp
USE CASES
Find the session, locate the pane it is in, and read the last lines it printed. Nothing is restarted and nothing is attached to — the process carries on exactly as it was.
Send the command into the pane and collect its result by id afterwards. Interactive programs need rawMode, because the default mode wraps commands and that wrapping conflicts with multi-line input.
Create the session, add the windows the task needs, and split panes horizontally or vertically at the size you want — so the layout exists before anything is running in it.
Find the session by name, then close it at whichever level makes sense — a single pane that is finished, a window, or the whole session.
Counted once with only startup setup. Other versions, modes or optional credentials may expose a different list.
capture-paneCapture content from a tmux pane with configurable lines count and optional color preservation
create-sessionCreate a new tmux session
create-windowCreate a new window in a tmux session
execute-commandExecute a command in a tmux pane and get results. For interactive applications (REPLs, editors), use rawMode=true. IMPORTANT: When rawMode=false (default), avoid heredoc syntax (cat << EOF) and other multi-line constructs as they conflict with command wrapping. For file writing, prefer: printf 'content\n' > file, echo statements, or write to temp files instead
find-sessionFind a tmux session by name
get-command-resultGet the result of an executed command
kill-paneKill a tmux pane by ID
kill-sessionKill a tmux session by ID
kill-windowKill a tmux window by ID
list-panesList panes in a tmux window
list-sessionsList all active tmux sessions
list-windowsList windows in a tmux session
split-paneSplit a tmux pane horizontally or vertically
BEFORE YOU INSTALL
13 tools when we connected.
npx on PATH
CONTEXT COST
Rated by the size of the 13 tool definitions that ride along on every turn, not by how many there are
INSTALLATION
Add the block to your client, or run the command directly.
{
"mcpServers": {
"tmux-mcp": {
"command": "npx",
"args": [
"-y",
"tmux-mcp"
]
}
}
}npx -y tmux-mcp