MCPconceptHome

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

MoreLess about this notice

Concept example A working example of the core library. It can change without notice. What concept means

Edit this page on GitHub

tmux MCP, built in Go

tmux terminal control for AI agents, built on libtmux for Go and MCP Go SDK. This server maps tmux's object hierarchy — sessions, windows, panes — into MCP tools grouped by the operation they request. The server enforces the selected groups at the MCP tool boundary.

tmux through MCP

Replay Hover a call to preview the tmux state after it. Use its pin button to hold it. With the replay focused, the arrow keys, Home and End step through the calls.

tmux before the first call.

tmux window of 1 pane
%0 sh
[checks] 0:sh*

tmux after create_session.

tmux window of 1 pane
%0 sh
[checks] 0:sh*

tmux after list_panes: unchanged, the call only reads.

tmux window of 2 panes
%0 sh
%1 sh
[checks] 0:sh*

tmux after split_window.

tmux window of 2 panes
%0 sh
%1 sh
[checks] 0:sh*

tmux after list_panes: unchanged, the call only reads.

tmux window of 2 panes
%0 sh
$ pytest -q
..                               [100%]
2 passed in 0.01s
%1 sh
[checks] 0:sh*

tmux after run_shell_command.

tmux window of 2 panes
%0 sh
$ pytest -q
..                               [100%]
2 passed in 0.01s
%1 sh
$ cat checks.log
2026-01-01 checks started
2026-01-01 checks finished
[checks] 0:sh*

tmux after run_shell_command.

No sessions

tmux 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.

AgentCreate the session.

create_session Execute {"session_name":"checks"}
Result
{
"sessionId": "$0",
"sessionName": "checks"
}

AgentList the panes, each with the session it belongs to.

list_panes Inspect {}
Result
{
"panes": [
{
"active": true,
"currentCommand": "sh",
"geometry": {
"height": 24,
"left": 0,
"top": 0,
"width": 80
},
"id": "%0",
"index": 0,
"isCaller": null,
"session": "checks",
"window": "sh",
"windowId": "@0"
}
],
"total": 1
}

AgentSplit the pane the list returned (%0) in two.

split_window Execute {"pane_id":"%0","direction":"right"}
Result
{
"paneId": "%1"
}

AgentList the panes again; each now carries its position and size.

list_panes Inspect {}
Result
{
"panes": [
{
"active": true,
"currentCommand": "sh",
"geometry": {
"height": 24,
"left": 0,
"top": 0,
"width": 40
},
"id": "%0",
"index": 0,
"isCaller": null,
"session": "checks",
"window": "sh",
"windowId": "@0"
},
{
"active": false,
"currentCommand": "sh",
"geometry": {
"height": 24,
"left": 41,
"top": 0,
"width": 39
},
"id": "%1",
"index": 1,
"isCaller": null,
"session": "checks",
"window": "sh",
"windowId": "@0"
}
],
"total": 2
}

AgentRun the tests in the pane the list returned (%0).

run_shell_command Execute {"pane_id":"%0","command":"pytest -q"}
Result
{
"effective_timeout_seconds": 120,
"exit_status": 0,
"output": [
".. [100%]",
"2 passed in 0.01s"
],
"pane_id": "%0",
"resolved_pane_ids": [
"%0"
],
"timed_out": false
}

AgentShow the log in the new pane the split returned (%1).

run_shell_command Execute {"pane_id":"%1","command":"cat checks.log"}
Result
{
"effective_timeout_seconds": 120,
"exit_status": 0,
"output": [
"2026-01-01 checks started",
"2026-01-01 checks finished"
],
"pane_id": "%1",
"resolved_pane_ids": [
"%1"
],
"timed_out": false
}

AgentRemove the session by the id the create result returned ($0).

kill_session Teardown {"session_id":"$0"}
Result
{
"killed": "checks"
}
Agent

pytest printed 2 passed and checks.log ends with checks finished. I removed the checks session.

1/7

Install

Choose your client and configuration scope, then run the command or paste the configuration.

Terminal
Terminal
Terminal
claude_desktop_config.json
Terminal
.codex/config.toml
Terminal
Terminal
.cursor/mcp.json
~/.cursor/mcp.json
Terminal
Terminal
~/.gemini/config/mcp_config.json
Terminal
github.com/libtmux/libtmux-go/mcp concept pkg.go.dev
First
$ go install github.com/libtmux/libtmux-go/mcp/cmd/libtmux-mcp@latest
$ claude mcp add tmux -- libtmux-mcp
First
$ go install github.com/libtmux/libtmux-go/mcp/cmd/libtmux-mcp@latest
$ claude mcp add tmux --scope user -- libtmux-mcp
First
$ go install github.com/libtmux/libtmux-go/mcp/cmd/libtmux-mcp@latest
$ claude mcp add tmux --scope project -- libtmux-mcp
First
$ go install github.com/libtmux/libtmux-go/mcp/cmd/libtmux-mcp@latest
{
    "mcpServers": {
        "tmux": {
            "command": "libtmux-mcp"
        }
    }
}
First
$ go install github.com/libtmux/libtmux-go/mcp/cmd/libtmux-mcp@latest
$ codex mcp add tmux -- libtmux-mcp
First
$ go install github.com/libtmux/libtmux-go/mcp/cmd/libtmux-mcp@latest
[mcp_servers.tmux]
command = "libtmux-mcp"
First
$ go install github.com/libtmux/libtmux-go/mcp/cmd/libtmux-mcp@latest
$ gemini mcp add --scope user tmux libtmux-mcp
First
$ go install github.com/libtmux/libtmux-go/mcp/cmd/libtmux-mcp@latest
$ gemini mcp add --scope project tmux libtmux-mcp
First
$ go install github.com/libtmux/libtmux-go/mcp/cmd/libtmux-mcp@latest
{
    "mcpServers": {
        "tmux": {
            "command": "libtmux-mcp"
        }
    }
}
First
$ go install github.com/libtmux/libtmux-go/mcp/cmd/libtmux-mcp@latest
{
    "mcpServers": {
        "tmux": {
            "command": "libtmux-mcp"
        }
    }
}
First
$ go install github.com/libtmux/libtmux-go/mcp/cmd/libtmux-mcp@latest
$ grok mcp add --scope user tmux -- libtmux-mcp
First
$ go install github.com/libtmux/libtmux-go/mcp/cmd/libtmux-mcp@latest
$ grok mcp add --scope project tmux -- libtmux-mcp
First
$ go install github.com/libtmux/libtmux-go/mcp/cmd/libtmux-mcp@latest
{
    "mcpServers": {
        "tmux": {
            "command": "libtmux-mcp"
        }
    }
}
First
$ go install github.com/libtmux/libtmux-go/mcp/cmd/libtmux-mcp@latest
$ opencode mcp add tmux -- libtmux-mcp

Writes ~/.claude.json (this project).

That puts libtmux-mcp in $(go env GOPATH)/bin, which has to be on your PATH for the command below to resolve.

Writes ~/.claude.json (all projects).

That puts libtmux-mcp in $(go env GOPATH)/bin, which has to be on your PATH for the command below to resolve.

Writes .mcp.json (in repo, version-controlled).

That puts libtmux-mcp in $(go env GOPATH)/bin, which has to be on your PATH for the command below to resolve.

That puts libtmux-mcp in $(go env GOPATH)/bin, which has to be on your PATH for the command below to resolve.

Writes ~/.codex/config.toml.

That puts libtmux-mcp in $(go env GOPATH)/bin, which has to be on your PATH for the command below to resolve.

Codex's CLI doesn't support project scope yet — paste this into .codex/config.toml at the repo root.

That puts libtmux-mcp in $(go env GOPATH)/bin, which has to be on your PATH for the command below to resolve.

Writes ~/.gemini/settings.json.

That puts libtmux-mcp in $(go env GOPATH)/bin, which has to be on your PATH for the command below to resolve.

Writes .gemini/settings.json (in repo).

That puts libtmux-mcp in $(go env GOPATH)/bin, which has to be on your PATH for the command below to resolve.

That puts libtmux-mcp in $(go env GOPATH)/bin, which has to be on your PATH for the command below to resolve.

That puts libtmux-mcp in $(go env GOPATH)/bin, which has to be on your PATH for the command below to resolve.

Writes ~/.grok/config.toml.

That puts libtmux-mcp in $(go env GOPATH)/bin, which has to be on your PATH for the command below to resolve.

Writes ./.grok/config.toml (in repo).

That puts libtmux-mcp in $(go env GOPATH)/bin, which has to be on your PATH for the command below to resolve.

That puts libtmux-mcp in $(go env GOPATH)/bin, which has to be on your PATH for the command below to resolve.

Writes ~/.config/opencode/opencode.jsonc.

That puts libtmux-mcp in $(go env GOPATH)/bin, which has to be on your PATH for the command below to resolve.

github.com/libtmux/libtmux-go/mcp is a separate Go module that exposes tmux through MCP. Its executable is libtmux-mcp. Installing the core tmux module does not install this server or its protocol dependencies.

The server requires Go 1.26 or newer to build and tmux 3.3a or newer to run. A daemon older than 3.3a is refused before any effect; see tmux support. The MCP client launches libtmux-mcp and exchanges messages over stdin and stdout. The server selects one tmux endpoint and its offered tools at startup. Reconnect after changing that configuration.

Start here

  • Install points an MCP client at this server.
  • Tools lists the MCP operations, arguments, and results.
  • Guides install the command and diagnose its connection.
  • Topics explain toolsets, command waits, and capability discovery.
  • Examples include complete client programs and their setup.
  • Language API documents embedding and implementation types.

Read tmux://capabilities for the effective startup selection. The Workspace Manager is a separate module; the current MCP catalog does not include a workspace-file operation.

Module contract.

Tools by tier

The Go server groups its tools by what they request. A tier badge tells you how far a call reaches before you approve it. Set LIBTMUX_TOOLSETS to a comma-separated list of tiers, such as inspect,manage, to offer only those tools.

Inspect

Request tmux state and terminal output.

Manage

Change tmux structure or presentation.

  • break_pane Manage Moves a pane into a new window of its own session, keeping its process.
  • move_pane Manage Moves a pane beside another pane or into another window, keeping its process and id, even for the caller's pane.
  • move_window Manage Moves a window to another session, optionally at an index.
  • rename_session Manage Replaces a session's name.
  • rename_window Manage Replaces a window's name.
  • resize_pane Manage Sets a pane's width, height, or both.
  • resize_window Manage Sets a window's width, height, or both.
  • select_layout Manage Applies a named layout, a unique abbreviation for the running tmux version, or a saved layout from get_window_info.
  • select_pane Manage Makes one pane active.
  • select_window Manage Makes one window active.
  • set_history_limit Manage Sets a bounded integer scrollback limit for future panes in a session.
  • set_mouse_enabled Manage Enables or disables tmux mouse handling.
  • set_pane_title Manage Replaces a pane's literal title.
  • signal_channel Manage Signals one server-wide tmux channel.
  • swap_pane Manage Swaps the positions of two panes.
  • wait_for_channel Manage Waits on tmux's channel state with a bounded timeout.

Execute

Start or drive pane processes, or store state that can control later execution.

  • create_session Execute Creates a detached session whose first pane runs the configured process.
  • create_window Execute Creates a window whose first pane runs the configured process.
  • paste_text Execute Pastes literal text only to its target.
  • respawn_pane Execute Kills the pane's current process and starts its configured process again.
  • run_shell_command Execute Run a shell command in a pane with your user's permissions.
  • send_keys Execute Sends keys to a pane and to every pane synchronize-panes links it with.
  • send_keys_batch Execute Sends up to sixty-four key sequences in order, rechecking before each one which panes synchronize-panes links to its target.
  • set_synchronize_panes Execute Sets the window synchronization default (synchronize-panes).
  • split_window Execute Creates a pane whose configured process starts after the split.

Teardown

Delete tmux objects or retained scrollback. Not reversible.

  • clear_pane_scrollback Teardown Deletes retained scrollback from one pane.
  • kill_pane Teardown Deletes one pane and ends its process.
  • kill_session Teardown Deletes one session and every window and pane in it.
  • kill_window Teardown Deletes one window and every pane in it.

Browse every tool, with its arguments, result and protocol data.

Esc
Search in

Type to search.

Reference previewOpen reference