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
tmux before the first call.
tmux after create_session.
tmux after list_panes: unchanged, the call only reads.
tmux after split_window.
tmux after list_panes: unchanged, the call only reads.
$ pytest -q .. [100%] 2 passed in 0.01s
tmux after run_shell_command.
$ pytest -q .. [100%] 2 passed in 0.01s
$ cat checks.log 2026-01-01 checks started 2026-01-01 checks finished
tmux after run_shell_command.
tmux after kill_session.
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.
Result
{ "sessionId": "$0", "sessionName": "checks"}AgentList the panes, each with the session it belongs to.
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.
Result
{ "paneId": "%1"}AgentList the panes again; each now carries its position and size.
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).
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).
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).
Result
{ "killed": "checks"}pytest printed 2 passed and checks.log ends with checks finished. I removed the checks session.
Install
Choose your client and configuration scope, then run the command or paste the configuration.
$ go install github.com/libtmux/libtmux-go/mcp/cmd/libtmux-mcp@latest$ claude mcp add tmux -- libtmux-mcp$ go install github.com/libtmux/libtmux-go/mcp/cmd/libtmux-mcp@latest$ claude mcp add tmux --scope user -- libtmux-mcp$ go install github.com/libtmux/libtmux-go/mcp/cmd/libtmux-mcp@latest$ claude mcp add tmux --scope project -- libtmux-mcp$ go install github.com/libtmux/libtmux-go/mcp/cmd/libtmux-mcp@latest{
"mcpServers": {
"tmux": {
"command": "libtmux-mcp"
}
}
}$ go install github.com/libtmux/libtmux-go/mcp/cmd/libtmux-mcp@latest$ codex mcp add tmux -- libtmux-mcp$ go install github.com/libtmux/libtmux-go/mcp/cmd/libtmux-mcp@latest[mcp_servers.tmux]
command = "libtmux-mcp"$ go install github.com/libtmux/libtmux-go/mcp/cmd/libtmux-mcp@latest$ gemini mcp add --scope user tmux libtmux-mcp$ go install github.com/libtmux/libtmux-go/mcp/cmd/libtmux-mcp@latest$ gemini mcp add --scope project tmux libtmux-mcp$ go install github.com/libtmux/libtmux-go/mcp/cmd/libtmux-mcp@latest{
"mcpServers": {
"tmux": {
"command": "libtmux-mcp"
}
}
}$ go install github.com/libtmux/libtmux-go/mcp/cmd/libtmux-mcp@latest{
"mcpServers": {
"tmux": {
"command": "libtmux-mcp"
}
}
}$ go install github.com/libtmux/libtmux-go/mcp/cmd/libtmux-mcp@latest$ grok mcp add --scope user tmux -- libtmux-mcp$ go install github.com/libtmux/libtmux-go/mcp/cmd/libtmux-mcp@latest$ grok mcp add --scope project tmux -- libtmux-mcp$ go install github.com/libtmux/libtmux-go/mcp/cmd/libtmux-mcp@latest{
"mcpServers": {
"tmux": {
"command": "libtmux-mcp"
}
}
}$ go install github.com/libtmux/libtmux-go/mcp/cmd/libtmux-mcp@latest$ opencode mcp add tmux -- libtmux-mcpWrites ~/.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.
Connect a client
Install the executable, select a socket, and diagnose startup.
Tool selection
Choose toolsets, individual tools, and exclusions.
List sessions
Run a complete SDK client against its own tmux server.
Run a command
Check command completion, exit status, and captured output.
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.
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.
-
call_read_tools_batchInspect Calls up to sixteen eligible inspect tools serially. -
capture_paneInspect Returns bounded pane content and a cursor. -
capture_sinceInspect Returns pane output produced after a cursor. -
find_pane_by_positionInspect Finds a pane at one of a window's four corners. -
get_pane_infoInspect Returns metadata for one pane. -
get_server_infoInspect Reports whether the pinned server exists and its version. -
get_session_infoInspect Returns metadata for one session. -
get_tmux_variablesInspect Reads a capped list of validated tmux variable names, not free-form formats. -
get_window_infoInspect Returns metadata for one window. -
list_panesInspect Lists pane metadata and stable pane IDs. -
list_sessionsInspect Lists sessions on the pinned tmux server. -
list_windowsInspect Lists windows, optionally only those in one named session. -
search_panesInspect Searches the visible output of every pane. -
show_environmentInspect Read the tmux environment. -
show_hooksInspect Reads configured tmux hooks. -
show_optionInspect Reads one named tmux option. -
snapshot_paneInspect Returns pane metadata and bounded terminal content together. -
wait_for_textInspect Waits for new pane output without accepting executable input.
Manage
Change tmux structure or presentation.
-
break_paneManage Moves a pane into a new window of its own session, keeping its process. -
move_paneManage Moves a pane beside another pane or into another window, keeping its process and id, even for the caller's pane. -
move_windowManage Moves a window to another session, optionally at an index. -
rename_sessionManage Replaces a session's name. -
rename_windowManage Replaces a window's name. -
resize_paneManage Sets a pane's width, height, or both. -
resize_windowManage Sets a window's width, height, or both. -
select_layoutManage Applies a named layout, a unique abbreviation for the running tmux version, or a saved layout from get_window_info. -
select_paneManage Makes one pane active. -
select_windowManage Makes one window active. -
set_history_limitManage Sets a bounded integer scrollback limit for future panes in a session. -
set_mouse_enabledManage Enables or disables tmux mouse handling. -
set_pane_titleManage Replaces a pane's literal title. -
signal_channelManage Signals one server-wide tmux channel. -
swap_paneManage Swaps the positions of two panes. -
wait_for_channelManage 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_sessionExecute Creates a detached session whose first pane runs the configured process. -
create_windowExecute Creates a window whose first pane runs the configured process. -
paste_textExecute Pastes literal text only to its target. -
respawn_paneExecute Kills the pane's current process and starts its configured process again. -
run_shell_commandExecute Run a shell command in a pane with your user's permissions. -
send_keysExecute Sends keys to a pane and to every pane synchronize-panes links it with. -
send_keys_batchExecute Sends up to sixty-four key sequences in order, rechecking before each one which panes synchronize-panes links to its target. -
set_synchronize_panesExecute Sets the window synchronization default (synchronize-panes). -
split_windowExecute Creates a pane whose configured process starts after the split.
Teardown
Delete tmux objects or retained scrollback. Not reversible.
-
clear_pane_scrollbackTeardown Deletes retained scrollback from one pane. -
kill_paneTeardown Deletes one pane and ends its process. -
kill_sessionTeardown Deletes one session and every window and pane in it. -
kill_windowTeardown Deletes one window and every pane in it.
Browse every tool, with its arguments, result and protocol data.