Skip to main content
Glama
tmux-mcp

tmux-mcp

by WENLIXIAO-CS

tmux-mcp

PyPI License: MIT

An MCP server for controlling tmux sessions. Allows AI assistants to create, manage, and interact with tmux sessions, windows, and panes programmatically.

Prerequisites

  • Python 3.10+

  • tmux installed and available on PATH

Related MCP server: Tmux MCP Server

Installation

Claude Code (stdio)

claude mcp add tmux-mcp -- uvx tmux-mcp

Claude Code (HTTP)

# Start the server
tmux-mcp --transport streamable-http --port 8888

# Add to Claude Code
claude mcp add --transport http tmux-mcp http://localhost:8888/mcp

Claude Code (from GitHub)

claude mcp add tmux-mcp -- uvx --from git+https://github.com/WENLIXIAO-CS/tmux-mcp tmux-mcp

pip

pip install tmux-mcp

Available Tools

Sessions

Tool

Description

tmux_list_sessions

List all tmux sessions with names, IDs, window count, and attached status

tmux_create_session

Create a new detached session (returns session/window/pane IDs)

tmux_rename_session

Rename an existing session

Windows

Tool

Description

tmux_list_windows

List windows, optionally filtered by session (includes pane count)

tmux_create_window

Create a new window in a session (returns window/pane IDs)

tmux_select_window

Switch to a specific window

tmux_rename_window

Rename a window

Panes

Tool

Description

tmux_list_panes

List panes with IDs, dimensions, active status, and running command

tmux_split_window

Split a window/pane horizontally or vertically (returns new pane ID)

tmux_select_pane

Focus a specific pane

tmux_resize_pane

Resize a pane by direction+amount or absolute width/height

I/O

Tool

Description

tmux_send_keys

Send keys or commands to a pane (supports special keys like Enter, C-c, Tab)

tmux_read_pane

Capture visible content from a pane (supports scrollback history)

tmux_read_cc_pane

Monitor a Claude Code pane — auto-waits during processing, auto-approves permissions, returns output when idle

Lifecycle

Tool

Description

tmux_kill

Kill a session, window, or pane by target

Usage Examples

Create a session and run a command:

> Create a tmux session called "dev" and run "python server.py" in it

Tool call: tmux_create_session(name="dev")
-> Session 'dev' created. session_id=$1 window_id=@1 pane_id=%1

Tool call: tmux_send_keys(target="dev", keys="python server.py Enter")
-> Keys sent.

Read output from a pane:

> What's the output in the dev session?

Tool call: tmux_read_pane(target="dev")
-> $ python server.py
   Server running on port 8080

Split a window and run a second process:

> Split the dev window and start a log tail

Tool call: tmux_split_window(target="dev:0")
-> Pane created. pane_id=%2

Tool call: tmux_send_keys(target="%2", keys="tail -f app.log Enter")
-> Keys sent.

Monitor a Claude Code session (auto-wait + auto-approve):

> Run a task in the "cc" tmux session and wait for it to finish

Tool call: tmux_read_cc_pane(target="cc")
[  0.0s] Monitoring Claude Code pane 'cc'
[  0.0s] Permission requested: Do you want to → sending '1'
[  1.0s] Processing: Shimmying…
[  8.1s] Processing: · ↓ 345 tokens
[ 16.2s] Permission requested: 2. Yes, allow all edits → sending '1'
[ 32.4s] Processing: · ↓ 1.6k tokens
[115.3s] Idle: no activity indicators

-> (captured pane content with scrollback)

Development

git clone https://github.com/WENLIXIAO-CS/tmux-mcp.git
cd tmux-mcp
uv sync
uv run tmux-mcp

License

MIT

Available Tools

19 tools
remote_bash_connectA

Connect to a remote host via SSH with a persistent shell session.

Shell state (working directory, environment variables) persists across subsequent remote_bash_execute calls to the same connection.

Args: host: Hostname or IP address. username: SSH username. Defaults to current local username. port: SSH port (default 22). password: SSH password (optional; prefer key-based auth). key_filename: Path to private key file (optional; defaults to SSH agent). connection_id: Optional alias for this connection (default: "user@host:port"). connect_timeout: Timeout in seconds for the connection attempt.

Inputs: host (required), port, password, username, +3 more. Returns: result

remote_bash_disconnectA

Disconnect an SSH connection or all connections.

Args: connection_id: Which connection to close. Required if all is false. all: If true, disconnect all active connections.

Inputs: all, connection_id. Returns: result

remote_bash_executeA

Execute a command on a remote host via an established SSH connection.

Shell state (working directory, environment variables, aliases) persists across calls to the same connection_id.

Args: command: Shell command to execute. connection_id: Which connection to use. If omitted, uses the most recently active connection. timeout: Max seconds to wait for the command to complete (default 120).

Inputs: command (required), timeout, connection_id. Returns: result

remote_bash_list_connectionsA

List all active SSH connections with their status and idle time.

Inputs: no named parameters. Returns: result

tmux_create_sessionA

Create a new tmux session.

Args: name: Name for the new session. command: Optional command to run in the initial window. window_name: Optional name for the first window.

Inputs: name (required), command, window_name. Returns: result

tmux_create_windowA

Create a new window in an existing tmux session.

Args: session: Target session name or ID. name: Optional name for the new window. command: Optional command to run in the new window.

Inputs: session (required), name, command. Returns: result

tmux_killA

Kill a tmux session, window, or pane.

Args: target: Tmux target to kill. type: What to kill - "session", "window", or "pane".

Inputs: target (required), type. Returns: result

tmux_list_panesA

List tmux panes with their IDs, dimensions, and status.

Args: target: Session or window target (e.g. "mysession", "mysession:0"). If omitted, lists panes from all sessions.

Inputs: target. Returns: result

tmux_list_sessionsA

List all tmux sessions with their names, IDs, window count, and status.

Inputs: no named parameters. Returns: result

tmux_list_windowsA

List all tmux windows. Optionally filter by session name or ID.

Args: session: Session name or ID to filter by. If omitted, lists windows from all sessions.

Inputs: session. Returns: result

tmux_read_cc_paneA

Monitor a tmux pane running Claude Code, auto-waiting and auto-approving.

Polls the pane in a loop:

  • While Claude Code is processing (spinners, "Running…", activity text): logs the status and sleeps.

  • When Claude Code asks for permission (numbered options): sends "1" to approve and continues monitoring.

  • When Claude Code is idle (waiting for next prompt): returns the captured pane content.

Args: target: Tmux target pane (e.g. "session:window.pane", "%3"). timeout: Max seconds to wait before returning (default 1800). poll_interval: Seconds between polls (default 0.5). last_n_lines: Number of trailing non-empty lines to analyze (default 20).

Inputs: target (required), timeout, last_n_lines, poll_interval. Returns: result

tmux_read_paneA

Read/capture content from a tmux pane.

Args: target: Tmux target (e.g. "session:window.pane"). line_count: Number of lines to capture. If omitted, captures entire visible pane. start_line: Start line for history capture (negative = lines before visible area, e.g. -100).

Inputs: target (required), line_count, start_line. Returns: result

tmux_rename_sessionA

Rename a tmux session.

Args: old_name: Current session name or ID. new_name: New name for the session.

Inputs: new_name (required), old_name (required). Returns: result

tmux_rename_windowA

Rename a tmux window.

Args: target: Tmux target for the window (e.g. "session:window"). new_name: New name for the window.

Inputs: target (required), new_name (required). Returns: result

tmux_resize_paneA

Resize a tmux pane.

Use direction+amount for relative resize, or width/height for absolute resize.

Args: target: Pane target (e.g. "%3", "session:window.pane"). direction: Direction to grow: "up", "down", "left", or "right". amount: Number of cells to resize by (default 5). Used with direction. width: Absolute width in columns. Overrides direction/amount. height: Absolute height in rows. Overrides direction/amount.

Inputs: target (required), width, amount, height, +1 more. Returns: result

tmux_select_paneA

Select/focus a specific tmux pane.

Args: target: Pane target (e.g. "session:window.pane", "%3").

Inputs: target (required). Returns: result

tmux_select_windowA

Navigate/switch to a specific tmux window.

Args: target: Tmux target (e.g. "session:window").

Inputs: target (required). Returns: result

tmux_send_keysA

Send keys or commands to a tmux pane.

Args: target: Tmux target (e.g. "session:window.pane", "session:window", "session"). keys: Keys to send. Use special key names like "Enter", "C-c", "Escape", "Tab", "Space", etc. literal: If true, send keys literally (the -l flag) without special key lookup.

Inputs: keys (required), target (required), literal. Returns: result

tmux_split_windowA

Split a window/pane to create a new pane.

Args: target: Target window or pane to split (e.g. "session:window", "session:window.pane", or "%3"). horizontal: If true, split horizontally (top/bottom). Default is vertical (left/right). size: Size of new pane — percentage (e.g. "50%") or line/column count (e.g. "20"). command: Optional command to run in the new pane.

Inputs: target (required), size, command, horizontal. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 19 tools

    Disambiguation4/5

    Most tools have clearly distinct purposes (create, list, read, send, resize, kill). The only potential confusion is between tmux_read_pane (general pane capture) and tmux_read_cc_pane (specialized for Claude Code monitoring), but their descriptions clearly differentiate them. Remote bash tools are clearly separated by the remote_bash_ prefix.

    Naming Consistency5/5

    All tools use consistent verb_noun snake_case with a domain prefix (tmux_, remote_bash_). The pattern is highly predictable (list_*, create_*, rename_*, select_*, etc.) across the entire set.

    Tool Count3/5

    At 19 tools, the set is slightly heavy for a single server, especially since 4 tools handle remote SSH (a separate domain). The tmux-specific tools alone (15) would be well-scoped; adding remote_bash pushes it into the borderline range.

    Completeness5/5

    The tmux lifecycle is fully covered: create, list, read, update, and delete for sessions, windows, and panes, plus send_keys, split, and resize. The remote_bash set is also complete with connect, execute, disconnect, and list. There are no obvious dead ends.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables programmatic control over tmux terminal sessions for SSH access, command execution, and terminal automation. Supports creating sessions, sending commands, capturing output, and managing multiple panes for interactive debugging and monitoring.
      8
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables AI assistants to manage local tmux sessions, including creating and controlling sessions, windows, and panes, sending commands, and capturing terminal output.
      16
      7 npm
      Do What The F*ck You Want To Public
    • F
      license
      Not graded
      quality
      D
      maintenance
      Exposes tmux features to AI agents for managing sessions, windows, and panes with built-in command execution. It includes comprehensive guardrails to prevent destructive system operations, file deletions, and unauthorized network changes.
      -