Tmux MCP

Read, create, split and kill tmux sessions, windows and panes, and run commands inside panes

By Nicolò G. (individual) TypeScript Local · stdio Developer tools

28 popularity score ★ 306 ↓ 614/wk

Connect your client

Local (npm)

Add in one click

Opens the app, which asks before it adds the server.

Or add it by command or config

Claude CodeTerminal
claude mcp add tmux -- npx -y tmux-mcp
Claude Desktopclaude_desktop_config.json
{
  "mcpServers": {
    "tmux": {
      "command": "npx",
      "args": [
        "-y",
        "tmux-mcp"
      ]
    }
  }
}
Cursor~/.cursor/mcp.json
{
  "mcpServers": {
    "tmux": {
      "command": "npx",
      "args": [
        "-y",
        "tmux-mcp"
      ]
    }
  }
}
VS Code.vscode/mcp.json
{
  "servers": {
    "tmux": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "tmux-mcp"
      ]
    }
  }
}
Codex~/.codex/config.toml
[mcp_servers.tmux]
command = "npx"
args = ["-y", "tmux-mcp"]
Gemini CLITerminal
gemini mcp add --scope user tmux npx -- -y tmux-mcp

What it does

Tmux MCP is a local stdio server that wraps the tmux command line so an assistant can work with the terminal sessions already open on your machine. It lists sessions, windows and panes, finds a session by name, and captures the visible text of any pane. It can also open new sessions and windows, split a pane side by side or top and bottom at a chosen percentage, and close sessions, windows or panes by ID.

The main use is running shell commands in a pane and reading back what happened. By default execute-command wraps the command with start and end markers so get-command-result can report the output and the exit code; the --shell-type flag (bash, zsh or fish, bash by default) tells it how to read that exit status. A rawMode option sends the text without markers for REPLs and editors, and noEnter sends keystrokes such as Up, Escape or Tab without pressing Enter, for driving full-screen terminal programs. Besides the 13 tools it exposes three resources: the session list, a pane's content and the result of an executed command.

From the source: capture-pane returns the last 200 lines of a pane unless the lines argument asks for another count, and an unrecognised --shell-type value falls back to bash without an error (src/tmux.ts).

What it needs

RuntimeNode.js

Node.js to run it with npx, and tmux installed with a tmux server running on the same machine (the tools call the tmux binary directly). That means macOS, Linux or another system where tmux runs. Pass --shell-type=zsh or --shell-type=fish if the panes run those shells, so exit codes are read correctly.

Limits

It only works on tmux on the machine where it runs; there is no remote or hosted mode. With the default wrapped mode, multi-line constructs such as heredocs conflict with the markers, so the tool's own description advises printf or echo instead. Commands sent with rawMode or noEnter are not tracked, so get-command-result cannot report them; capture-pane must be used to see the outcome. Command results are kept in the server's memory and are lost when it restarts. capture-pane returns 200 lines by default. The makers flag command execution as use at your own risk.

Who it suits

Suits developers who already live in tmux and want an assistant to watch build output, run commands in an existing pane, or drive a REPL or terminal program they can see at the same time. Because it can type any command into a shell and kill sessions, it fits a personal workstation more than a shared machine. Someone who does not use tmux, or who wants a sandboxed command runner rather than access to their live sessions, should look elsewhere.

Tools 13

list-sessions
Lists every running tmux session.
find-session
Looks up a tmux session by its name.
list-windows
Lists the windows in a given session.
list-panes
Lists the panes in a given window.
capture-pane
Returns a pane's text, 200 lines by default, optionally with colour codes.
create-session
Starts a new named tmux session.
create-window
Opens a new named window in a session.
split-pane
Splits a pane horizontally or vertically, 50% by default.
kill-session
Closes a session by ID.
kill-window
Closes a window by ID.
kill-pane
Closes a pane by ID.
execute-command
Types a command or keystrokes into a pane, tracked or raw.
get-command-result
Returns output, status and exit code of a tracked command.

Similar servers