tmux MCP, built in Java
tmux terminal control for AI agents, built on libtmux for Java and MCP Java 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 get_tmux_variables: unchanged, the call only reads.
$ pytest -q
..
[100%
]
2 passed in 0.00s tmux after run_shell_command.
$ pytest -q
..
[100%
]
2 passed in 0.00s $ 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
{ "id": "$0", "name": "checks", "attached": false, "windows": 1}AgentList the panes, each with the session it belongs to.
Result
{ "count": 1, "panes": [ { "id": "%0", "session": "checks", "window": "sh", "window_id": "@0", "command": "sh", "path": "/home/user/project", "size": "80x24", "active": true } ]}AgentSplit the pane the list returned (%0) in two.
Result
{ "id": "%1", "index": 1, "window_id": "@0", "session_id": "$0", "active": true, "command": "sh", "path": "/home/user/project", "title": "host", "size": "40x24"}AgentRead the window's layout through the pane the list returned (%0).
Result
{ "values": { "window_layout": "89f5,80x24,0,0{39x24,0,0,0,40x24,40,0,1}" }}AgentRun the tests in the pane the list returned (%0).
Result
{ "pane_id": "%0", "outcome": "SIGNALLED", "exit_status": 0, "output": [ "..", " [100%", "]", "2 passed in 0.00s" ], "truncated": false, "lines_dropped": 0, "framed": true, "seconds": 0.33, "effective_timeout": 30}AgentShow the log in the new pane the split returned (%1).
Result
{ "pane_id": "%1", "outcome": "SIGNALLED", "exit_status": 0, "output": [ "2026-01-01 checks started", "2026-01-01 checks finished" ], "truncated": false, "lines_dropped": 0, "framed": true, "seconds": 0.01, "effective_timeout": 30}AgentRemove the session by the id the create result returned ($0).
Result
{ "kind": "session", "id": "$0"}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.
$ ./gradlew :libtmux-mcp:installDist$ claude mcp add tmux -- /absolute/path/to/libtmux-mcp$ ./gradlew :libtmux-mcp:installDist$ claude mcp add tmux --scope user -- /absolute/path/to/libtmux-mcp$ ./gradlew :libtmux-mcp:installDist$ claude mcp add tmux --scope project -- /absolute/path/to/libtmux-mcp$ ./gradlew :libtmux-mcp:installDist{
"mcpServers": {
"tmux": {
"command": "/absolute/path/to/libtmux-mcp"
}
}
}$ ./gradlew :libtmux-mcp:installDist$ codex mcp add tmux -- /absolute/path/to/libtmux-mcp$ ./gradlew :libtmux-mcp:installDist[mcp_servers.tmux]
command = "/absolute/path/to/libtmux-mcp"$ ./gradlew :libtmux-mcp:installDist$ gemini mcp add --scope user tmux /absolute/path/to/libtmux-mcp$ ./gradlew :libtmux-mcp:installDist$ gemini mcp add --scope project tmux /absolute/path/to/libtmux-mcp$ ./gradlew :libtmux-mcp:installDist{
"mcpServers": {
"tmux": {
"command": "/absolute/path/to/libtmux-mcp"
}
}
}$ ./gradlew :libtmux-mcp:installDist{
"mcpServers": {
"tmux": {
"command": "/absolute/path/to/libtmux-mcp"
}
}
}$ ./gradlew :libtmux-mcp:installDist$ grok mcp add --scope user tmux -- /absolute/path/to/libtmux-mcp$ ./gradlew :libtmux-mcp:installDist$ grok mcp add --scope project tmux -- /absolute/path/to/libtmux-mcp$ ./gradlew :libtmux-mcp:installDist{
"mcpServers": {
"tmux": {
"command": "/absolute/path/to/libtmux-mcp"
}
}
}$ ./gradlew :libtmux-mcp:installDist$ opencode mcp add tmux -- /absolute/path/to/libtmux-mcpWrites ~/.claude.json (this project).
Nothing publishes this server as a binary yet. The build writes a launcher at libtmux-mcp/build/install/libtmux-mcp/bin/libtmux-mcp; use its absolute path.
Writes ~/.claude.json (all projects).
Nothing publishes this server as a binary yet. The build writes a launcher at libtmux-mcp/build/install/libtmux-mcp/bin/libtmux-mcp; use its absolute path.
Writes .mcp.json (in repo, version-controlled).
Nothing publishes this server as a binary yet. The build writes a launcher at libtmux-mcp/build/install/libtmux-mcp/bin/libtmux-mcp; use its absolute path.
Nothing publishes this server as a binary yet. The build writes a launcher at libtmux-mcp/build/install/libtmux-mcp/bin/libtmux-mcp; use its absolute path.
Writes ~/.codex/config.toml.
Nothing publishes this server as a binary yet. The build writes a launcher at libtmux-mcp/build/install/libtmux-mcp/bin/libtmux-mcp; use its absolute path.
Codex's CLI doesn't support project scope yet — paste this into .codex/config.toml at the repo root.
Nothing publishes this server as a binary yet. The build writes a launcher at libtmux-mcp/build/install/libtmux-mcp/bin/libtmux-mcp; use its absolute path.
Writes ~/.gemini/settings.json.
Nothing publishes this server as a binary yet. The build writes a launcher at libtmux-mcp/build/install/libtmux-mcp/bin/libtmux-mcp; use its absolute path.
Writes .gemini/settings.json (in repo).
Nothing publishes this server as a binary yet. The build writes a launcher at libtmux-mcp/build/install/libtmux-mcp/bin/libtmux-mcp; use its absolute path.
Nothing publishes this server as a binary yet. The build writes a launcher at libtmux-mcp/build/install/libtmux-mcp/bin/libtmux-mcp; use its absolute path.
Nothing publishes this server as a binary yet. The build writes a launcher at libtmux-mcp/build/install/libtmux-mcp/bin/libtmux-mcp; use its absolute path.
Writes ~/.grok/config.toml.
Nothing publishes this server as a binary yet. The build writes a launcher at libtmux-mcp/build/install/libtmux-mcp/bin/libtmux-mcp; use its absolute path.
Writes ./.grok/config.toml (in repo).
Nothing publishes this server as a binary yet. The build writes a launcher at libtmux-mcp/build/install/libtmux-mcp/bin/libtmux-mcp; use its absolute path.
Nothing publishes this server as a binary yet. The build writes a launcher at libtmux-mcp/build/install/libtmux-mcp/bin/libtmux-mcp; use its absolute path.
Writes ~/.config/opencode/opencode.jsonc.
Nothing publishes this server as a binary yet. The build writes a launcher at libtmux-mcp/build/install/libtmux-mcp/bin/libtmux-mcp; use its absolute path.
io.github.libtmux:libtmux-mcp
provides a Java MCP server and a
libtmux-mcp application launcher. It discovers tmux objects, captures
terminal output, runs framed shell commands, and applies typed topology
operations.
Use JDK 21 or newer and tmux. The launcher selects its endpoint and toolsets at startup. It serves MCP over stdin and stdout.
Start here
- Install points an MCP client at this server.
- Tools lists the MCP operations, arguments, and results.
- Guides build the server and connect a client.
- Topics explain toolsets, input preflight, and wait semantics.
- Examples call a tool, then explore server internals.
- Language API documents embedding and implementation types.
The only MCP resource is the static tmux://capabilities report.
The server does not register workflow prompts or dynamic resource
subscriptions.
The Workspace Manager is a separate Java module. Application code can parse and build declarative workspaces; MCP clients compose the exposed topology tools.
Tools by tier
The Java 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 what a pane shows now, its newest lines first to go when bounded, and a cursor for capture_since. -
capture_sinceInspect Returns only the output a pane produced after a cursor from capture_pane or an earlier capture_since. -
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 session, named by ID or by name. -
search_panesInspect Searches the visible output of every pane. -
show_environmentInspect Reads the environment tmux passes to processes. -
show_hooksInspect Reads configured tmux hooks. -
show_optionInspect Reads one named tmux option. -
snapshot_paneInspect Returns what a pane shows and its metadata, as list_panes describes a pane, in one call. -
wait_for_textInspect Waits for new pane output without accepting executable input.
Manage
Change tmux structure or presentation.
-
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 tmux layout, a unique abbreviation or a checksummed saved layout. -
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 one literal text block into one target pane through an ephemeral buffer. -
respawn_paneExecute Kills the pane's current process and starts its configured process again. -
run_shell_commandExecute Runs one authored command in a trusted pane shell and waits for singular framed output and completion. -
send_keysExecute Sends input to the target's configured effective synchronized cohort without waiting for output. -
send_keys_batchExecute Sends up to sixty-four ordered pane-input operations, resolving and guarding the configured effective cohort separately for each ordered operation. -
set_synchronize_panesExecute When enabled, sets the inherited window default. -
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.