agentCreate the session.
Result
{ "id": "$0", "name": "checks", "attached": false, "windows": 1}Choose documentation 3
No matching documentation.
No matching versions.
Current version
latestNo matching languages.
Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.
Java-based tmux client
tmux client library for Java. Control tmux, connect to and create servers, navigate sessions, windows, and panes, send keys, watch for changes via control mode, capture pane contents
import io.github.libtmux.Server;import io.github.libtmux.ServerConfig;import io.github.libtmux.ServerEndpoint;import io.github.libtmux.TextOutcome;import java.nio.file.Path;import java.time.Duration;import java.util.UUID;
public final class Main { public static void main(String[] args) throws Exception { var socket = "libtmux-home-" + UUID.randomUUID(); var config = ServerConfig.builder() .endpoint(ServerEndpoint.namedSocket(socket)) .configFile(Path.of("/dev/null")) .defaultTimeout(Duration.ofSeconds(5)) .build();
try (Server server = Server.open(config)) { var session = server.newSession("demo");
// Lay out the session: name its window, split it, add another. var first = session.activeWindow().orElseThrow(); var editor = first.rename("editor"); var left = editor.activePane().orElseThrow(); var right = left.split(spec -> spec.toRight().detached()); var logs = session.newWindow( spec -> spec.named("logs").detached());
// Type a command into the new pane and wait for what it prints. right.sendLine("printf 'hello from %s\\n' tmux"); var seen = right.awaitText( "hello from tmux", Duration.ofSeconds(5)); if (seen == TextOutcome.TIMED_OUT) { throw new IllegalStateException("output did not arrive"); }
// Move the focus an attached client sees: pane, then window. right.select(); logs.select();
// Walk the objects: down from the server, up from one pane. var snapshot = server.snapshot(); var sessions = snapshot.sessions(); for (var each : sessions) { System.out.println("session " + each.name()); var windows = snapshot.windowsOf(each.id()); for (var win : windows) { var index = win.context().index(); System.out.printf(" window %s:%s:", index, win.name()); var panes = snapshot.panesOf(win.context()); for (var pane : panes) { System.out.print(" " + pane.id()); } System.out.println(); } } var window = right.window(); var owner = window.session(); System.out.println( right.id() + " is in window " + window.name() + " of session " + owner.name()); } }}import io.github.libtmux.Server;import io.github.libtmux.ServerConfig;import io.github.libtmux.ServerEndpoint;import io.github.libtmux.TextOutcome;import java.nio.file.Path;import java.time.Duration;import java.util.UUID;
public final class Main { public static void main(String[] args) throws Exception { var socket = "libtmux-home-" + UUID.randomUUID(); var config = ServerConfig.builder() .endpoint(ServerEndpoint.namedSocket(socket)) .configFile(Path.of("/dev/null")) .defaultTimeout(Duration.ofSeconds(5)) .build();
try (Server server = Server.open(config)) { try { var session = server.newSession("demo");
// Lay out the session: name its window, split it, add another. var first = session.activeWindow().orElseThrow(); var editor = first.rename("editor"); var left = editor.activePane().orElseThrow(); var right = left.split(spec -> spec.toRight().detached()); var logs = session.newWindow( spec -> spec.named("logs").detached());
// Type a command into the new pane and wait for what it prints. right.sendLine("printf 'hello from %s\\n' tmux"); var seen = right.awaitText( "hello from tmux", Duration.ofSeconds(5)); if (seen == TextOutcome.TIMED_OUT) { throw new IllegalStateException("output did not arrive"); }
// Move the focus an attached client sees: pane, then window. right.select(); logs.select();
// Walk the objects: down from the server, up from one pane. var snapshot = server.snapshot(); var sessions = snapshot.sessions(); for (var each : sessions) { System.out.println("session " + each.name()); var windows = snapshot.windowsOf(each.id()); for (var win : windows) { var index = win.context().index(); System.out.printf(" window %s:%s:", index, win.name()); var panes = snapshot.panesOf(win.context()); for (var pane : panes) { System.out.print(" " + pane.id()); } System.out.println(); } } var window = right.window(); var owner = window.session(); System.out.println( right.id() + " is in window " + window.name() + " of session " + owner.name()); } catch (Exception error) { throw new IllegalStateException( "tmux quickstart failed", error); } } }}import io.github.libtmux.Server;import io.github.libtmux.ServerConfig;import io.github.libtmux.ServerEndpoint;import io.github.libtmux.TextOutcome;import java.nio.file.Path;import java.time.Duration;import java.util.UUID;
public final class Main { public static void main(String[] args) throws Exception { var socket = "libtmux-home-" + UUID.randomUUID(); var config = ServerConfig.builder() .endpoint(ServerEndpoint.namedSocket(socket)) .configFile(Path.of("/dev/null")) .defaultTimeout(Duration.ofSeconds(5)) .build();
try (Server server = Server.open(config)) { try { var session = server.newSession("demo");
// Lay out the session: name its window, split it, add another. var first = session.activeWindow().orElseThrow(); var editor = first.rename("editor"); var left = editor.activePane().orElseThrow(); var right = left.split(spec -> spec.toRight().detached()); var logs = session.newWindow( spec -> spec.named("logs").detached());
// Type a command into the new pane and wait for what it prints. right.sendLine("printf 'hello from %s\\n' tmux"); var seen = right.awaitText( "hello from tmux", Duration.ofSeconds(5)); if (seen == TextOutcome.TIMED_OUT) { throw new IllegalStateException("output did not arrive"); }
// Move the focus an attached client sees: pane, then window. right.select(); logs.select();
// Walk the objects: down from the server, up from one pane. var snapshot = server.snapshot(); var sessions = snapshot.sessions(); for (var each : sessions) { System.out.println("session " + each.name()); var windows = snapshot.windowsOf(each.id()); for (var win : windows) { var index = win.context().index(); System.out.printf(" window %s:%s:", index, win.name()); var panes = snapshot.panesOf(win.context()); for (var pane : panes) { System.out.print(" " + pane.id()); } System.out.println(); } } var window = right.window(); var owner = window.session(); System.out.println( right.id() + " is in window " + window.name() + " of session " + owner.name()); } finally { server.killServer(); } } }}import io.github.libtmux.Server;import io.github.libtmux.ServerConfig;import io.github.libtmux.ServerEndpoint;import io.github.libtmux.TextOutcome;import java.nio.file.Path;import java.time.Duration;import java.util.UUID;
public final class Main { public static void main(String[] args) throws Exception { var socket = "libtmux-home-" + UUID.randomUUID(); var config = ServerConfig.builder() .endpoint(ServerEndpoint.namedSocket(socket)) .configFile(Path.of("/dev/null")) .defaultTimeout(Duration.ofSeconds(5)) .build();
try (Server server = Server.open(config)) { try { var session = server.newSession("demo");
// Lay out the session: name its window, split it, add another. var first = session.activeWindow().orElseThrow(); var editor = first.rename("editor"); var left = editor.activePane().orElseThrow(); var right = left.split(spec -> spec.toRight().detached()); var logs = session.newWindow( spec -> spec.named("logs").detached());
// Type a command into the new pane and wait for what it prints. right.sendLine("printf 'hello from %s\\n' tmux"); var seen = right.awaitText( "hello from tmux", Duration.ofSeconds(5)); if (seen == TextOutcome.TIMED_OUT) { throw new IllegalStateException("output did not arrive"); }
// Move the focus an attached client sees: pane, then window. right.select(); logs.select();
// Walk the objects: down from the server, up from one pane. var snapshot = server.snapshot(); var sessions = snapshot.sessions(); for (var each : sessions) { System.out.println("session " + each.name()); var windows = snapshot.windowsOf(each.id()); for (var win : windows) { var index = win.context().index(); System.out.printf(" window %s:%s:", index, win.name()); var panes = snapshot.panesOf(win.context()); for (var pane : panes) { System.out.print(" " + pane.id()); } System.out.println(); } } var window = right.window(); var owner = window.session(); System.out.println( right.id() + " is in window " + window.name() + " of session " + owner.name()); } catch (Exception error) { throw new IllegalStateException( "tmux quickstart failed", error); } finally { server.killServer(); } } }}tmux before the first call: no server is running.
tmux after Server.open: no server is running; the call sent no command.
tmux after Server.newSession: added session demo.
tmux after Session.activeWindow: unchanged, the call sent no command.
tmux after Window.rename: renamed window 0:sh to 0:editor.
tmux after Window.activePane: unchanged, the call sent no command.
tmux after Pane.split: added pane %1 to window 0:editor.
tmux after Session.newWindow: added window 1:logs.
tmux after Pane.sendLine: sent keys to pane %1.
$ printf 'hello from %s\n' tmux hello from tmux $
tmux after Pane.awaitText: read pane %1.
$ printf 'hello from %s\n' tmux hello from tmux $
tmux after Pane.select: selected pane %1 in window 0:editor.
$ printf 'hello from %s\n' tmux hello from tmux $
tmux after Window.select: selected window 1:logs.
$ printf 'hello from %s\n' tmux hello from tmux $
tmux after Server.snapshot: unchanged.
$ printf 'hello from %s\n' tmux hello from tmux $
tmux after ServerSnapshot.sessions: unchanged, the call sent no command.
$ printf 'hello from %s\n' tmux hello from tmux $
tmux after ServerSnapshot.windowsOf: unchanged, the call sent no command.
$ printf 'hello from %s\n' tmux hello from tmux $
tmux after ServerSnapshot.panesOf: unchanged, the call sent no command.
$ printf 'hello from %s\n' tmux hello from tmux $
tmux after ServerSnapshot.panesOf: unchanged, the call sent no command.
$ printf 'hello from %s\n' tmux hello from tmux $
tmux after Pane.window: unchanged, the call sent no command.
$ printf 'hello from %s\n' tmux hello from tmux $
tmux after Window.session: unchanged, the call sent no command.
tmux after Server.killServer: the server has exited.
No tmux server is running yet.
Server.open returned Server { "configFile": "/dev/null", "endpoint": "named socket"}The call sent no tmux command.
Server.newSession returned Session { "id": "$0", "name": "demo"}new-session -d -s demo -P -F #{session_id} $0 list-sessions -F #{session_id}57eb126467cffa8294689a1050a5c2c5#{session_name}57eb126467cffa8294689a1050a5c2c5#{session_attached}57eb126467cffa8294689a1050a5c2c5#{session_windows}0fc557c03bd011c37bdc9ee411899f33 ; display-message -p 57eb126467cffa8294689a1050a5c2c5:0 ; list-windows -a -F #{session_id}57eb126467cffa8294689a1050a5c2c5#{window_id}57eb126467cffa8294689a1050a5c2c5#{window_index}57eb1264… $057eb126467cffa8294689a1050a5c2c5demo57eb126467cffa8294689a1050a5c2c5057eb126467cffa8294689a1050a5c2c510fc557c03bd011c37bdc9ee411899f33
57eb126467cffa8294689a1050a5c2c5:0
$057eb126467cffa8294689a1050a5c2c5@057eb126467cffa8294689a1050a5c2c5057eb126467cffa8294689a1050a5c2c5sh57eb126467cffa8294689a1050a5c2c5157eb126467cffa8294689a1050a5c2c5157eb126467cffa8294689a1050a5c2c5057eb126467cffa8294689a1050… Before these, the library asked tmux about itself 4 times (its version, its daemon, how a control client reads escapes).
Session.activeWindow returned Optional<Window> { "id": "@0", "name": "sh"}The call sent no tmux command.
Window.rename returned Window { "id": "@0", "name": "editor"}rename-window -t @0 -- editor no output list-sessions -F #{session_id}57eb126467cffa8294689a1050a5c2c5#{session_name}57eb126467cffa8294689a1050a5c2c5#{session_attached}57eb126467cffa8294689a1050a5c2c5#{session_windows}0fc557c03bd011c37bdc9ee411899f33 ; display-message -p 57eb126467cffa8294689a1050a5c2c5:0 ; list-windows -a -F #{session_id}57eb126467cffa8294689a1050a5c2c5#{window_id}57eb126467cffa8294689a1050a5c2c5#{window_index}57eb1264… $057eb126467cffa8294689a1050a5c2c5demo57eb126467cffa8294689a1050a5c2c5057eb126467cffa8294689a1050a5c2c510fc557c03bd011c37bdc9ee411899f33
57eb126467cffa8294689a1050a5c2c5:0
$057eb126467cffa8294689a1050a5c2c5@057eb126467cffa8294689a1050a5c2c5057eb126467cffa8294689a1050a5c2c5editor57eb126467cffa8294689a1050a5c2c5157eb126467cffa8294689a1050a5c2c5157eb126467cffa8294689a1050a5c2c5057eb126467cffa8294689a… Before these, the library asked tmux about itself 1 time (its version, its daemon, how a control client reads escapes).
Window.activePane returned Optional<Pane> { "id": "%0"}The call sent no tmux command.
Pane.split returned Pane { "id": "%1"}split-window -h -d -t %0 -P -F #{pane_id}0fc557c03bd011c37bdc9ee411899f33 %10fc557c03bd011c37bdc9ee411899f33 list-sessions -F #{session_id}57eb126467cffa8294689a1050a5c2c5#{session_name}57eb126467cffa8294689a1050a5c2c5#{session_attached}57eb126467cffa8294689a1050a5c2c5#{session_windows}0fc557c03bd011c37bdc9ee411899f33 ; display-message -p 57eb126467cffa8294689a1050a5c2c5:0 ; list-windows -a -F #{session_id}57eb126467cffa8294689a1050a5c2c5#{window_id}57eb126467cffa8294689a1050a5c2c5#{window_index}57eb1264… $057eb126467cffa8294689a1050a5c2c5demo57eb126467cffa8294689a1050a5c2c5057eb126467cffa8294689a1050a5c2c510fc557c03bd011c37bdc9ee411899f33
57eb126467cffa8294689a1050a5c2c5:0
$057eb126467cffa8294689a1050a5c2c5@057eb126467cffa8294689a1050a5c2c5057eb126467cffa8294689a1050a5c2c5editor57eb126467cffa8294689a1050a5c2c5157eb126467cffa8294689a1050a5c2c5257eb126467cffa8294689a1050a5c2c5057eb126467cffa8294689a… Before these, the library asked tmux about itself 1 time (its version, its daemon, how a control client reads escapes).
Session.newWindow returned Window { "id": "@1", "name": "logs"}new-window -d -n logs -t $0 -P -F #{session_id}57eb126467cffa8294689a1050a5c2c5#{window_id}57eb126467cffa8294689a1050a5c2c5#{window_index}0fc557c03bd011c37bdc9ee411899f33 $057eb126467cffa8294689a1050a5c2c5@157eb126467cffa8294689a1050a5c2c510fc557c03bd011c37bdc9ee411899f33 list-sessions -F #{session_id}57eb126467cffa8294689a1050a5c2c5#{session_name}57eb126467cffa8294689a1050a5c2c5#{session_attached}57eb126467cffa8294689a1050a5c2c5#{session_windows}0fc557c03bd011c37bdc9ee411899f33 ; display-message -p 57eb126467cffa8294689a1050a5c2c5:0 ; list-windows -a -F #{session_id}57eb126467cffa8294689a1050a5c2c5#{window_id}57eb126467cffa8294689a1050a5c2c5#{window_index}57eb1264… $057eb126467cffa8294689a1050a5c2c5demo57eb126467cffa8294689a1050a5c2c5057eb126467cffa8294689a1050a5c2c520fc557c03bd011c37bdc9ee411899f33
57eb126467cffa8294689a1050a5c2c5:0
$057eb126467cffa8294689a1050a5c2c5@057eb126467cffa8294689a1050a5c2c5057eb126467cffa8294689a1050a5c2c5editor57eb126467cffa8294689a1050a5c2c5157eb126467cffa8294689a1050a5c2c5257eb126467cffa8294689a1050a5c2c5057eb126467cffa8294689a… Before these, the library asked tmux about itself 1 time (its version, its daemon, how a control client reads escapes).
Pane.sendLine returned void nulldisplay-message -p -t %1 -- #{version}0000-version#{pane_synchronized}57eb126467cffa8294689a1050a5c2c5-end 3.8a57eb126467cffa8294689a1050a5c2c5-version057eb126467cffa8294689a1050a5c2c5-end send-keys -l -t %1 -- 'printf '\''hello from %s\n'\'' tmux\r' no output Pane.awaitText returned TextOutcome "PRESENT_AT_ENTRY"capture-pane -p -J -t %1 $ printf 'hello from %s\n' tmux
hello from tmux
$ Pane.select returned void nullselect-pane -t %1 no output Window.select returned void nullselect-window -t $0:1 no output Server.snapshot returned ServerSnapshot { "sessions": 1, "windows": 2, "panes": 3}list-sessions -F #{session_id}57eb126467cffa8294689a1050a5c2c5#{session_name}57eb126467cffa8294689a1050a5c2c5#{session_attached}57eb126467cffa8294689a1050a5c2c5#{session_windows}0fc557c03bd011c37bdc9ee411899f33 ; display-message -p 57eb126467cffa8294689a1050a5c2c5:0 ; list-windows -a -F #{session_id}57eb126467cffa8294689a1050a5c2c5#{window_id}57eb126467cffa8294689a1050a5c2c5#{window_index}57eb1264… $057eb126467cffa8294689a1050a5c2c5demo57eb126467cffa8294689a1050a5c2c5057eb126467cffa8294689a1050a5c2c520fc557c03bd011c37bdc9ee411899f33
57eb126467cffa8294689a1050a5c2c5:0
$057eb126467cffa8294689a1050a5c2c5@057eb126467cffa8294689a1050a5c2c5057eb126467cffa8294689a1050a5c2c5editor57eb126467cffa8294689a1050a5c2c5057eb126467cffa8294689a1050a5c2c5257eb126467cffa8294689a1050a5c2c5057eb126467cffa8294689a… Before these, the library asked tmux about itself 1 time (its version, its daemon, how a control client reads escapes).
ServerSnapshot.sessions returned List<SessionState> [ "$0"]The call sent no tmux command.
ServerSnapshot.windowsOf returned List<WindowState> [ "@0", "@1"]The call sent no tmux command.
ServerSnapshot.panesOf returned List<PaneState> [ "%0", "%1"]The call sent no tmux command.
ServerSnapshot.panesOf returned List<PaneState> [ "%2"]The call sent no tmux command.
Pane.window returned Window { "id": "@0", "name": "editor"}The call sent no tmux command.
Window.session returned Session { "id": "$0", "name": "demo"}The call sent no tmux command.
Server.killServer returned void nulldisplay-message -p #{pid} ; kill-server 3081433 libtmux/libtmux-java
at e8a39689d on a private tmux 3.8a server.
A person matched each call to its lines; the values, commands and tmux states are what the run produced.
Commands appear without the library's if-shell guard, and the socket name and paths are set to fixed values.
JDK 25 and tmux on Linux/macOS
Save the program above as src/main/java/Main.java in a new directory, along with the files below.
Cleanup is omitted; the private tmux server and its temporary files may remain. Select Cleanup to remove them when the program finishes. The program stops its private tmux server and removes any temporary files it created when it finishes. Error handling adds diagnostics; every version checks required results and deadlines.
plugins { application}
repositories { mavenCentral() }
dependencies { implementation("io.github.libtmux:libtmux:0.1.2")}
java { toolchain { languageVersion.set(JavaLanguageVersion.of(25)) } }
application { mainClass.set(providers.gradleProperty("exampleMain")) }rootProject.name = "api-example"org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=768m -Dfile.encoding=UTF-8kotlin.daemon.jvmargs=-Xmx2gorg.gradle.workers.max=2# Save the files above at their displayed relative paths.git clone https://github.com/libtmux/libtmux-java.git libtmux-sourcegit -C libtmux-source checkout --detach e8a39689d8d60968ac978a1dd2a89c6112333896./libtmux-source/gradlew --project-dir . --console=plain --no-daemon --max-workers=2 \ installDist -PexampleMain=MainSHELL=/bin/sh build/install/api-example/bin/api-examplesession demo window 0:editor: %0 %1 window 1:logs: %2%1 is in window editor of session demoLibrary revision: e8a39689d8d6.
APIs used
io.github.libtmux:libtmuxThe platform BOM names the version once and every other coordinate follows it, which is what stops a project mixing two releases of modules built against each other.
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.
{ "id": "$0", "name": "checks", "attached": false, "windows": 1}agentList the panes, each with the session it belongs to.
{ "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.
{ "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).
{ "values": { "window_layout": "{\"V\":2,\"L\":{\"t\":\"h\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"c\":[{\"t\":\"p\",\"w\":39,\"h\":24,\"x\":0,\"y\":0,\"l\":0,\"i\":0,\"I\":\"%0\"},{\"t\":\"p\",\"w\":40,\"h\":24,\"x\":40,\"y\":0,\"a\":true,\"i\":1,\"I\":\"%1\"}]}}" }}agentRun the tests in the pane the list returned (%0).
{ "pane_id": "%0", "outcome": "SIGNALLED", "exit_status": 0, "output": [ "..", " [100%", "]", "2 passed in 0.00s" ], "truncated": false, "lines_dropped": 0, "framed": true, "seconds": 0.29, "effective_timeout": 30}agentShow the log in the new pane the split returned (%1).
{ "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).
{ "kind": "session", "id": "$0"}agent in %0 it printed 2 passed in 0.00s
; in %1 it printed 2026-01-01 checks finished
.
Calls and results are recorded against libtmux/libtmux-java
at fe25ff5ed, on a private tmux 3.8a server, running pytest 9.2.0.
The preview takes its layout and panes from the recording's own tmux server after each call, and a pane's output from the results of the calls.
The agent's narration is illustrative.
This page documents 873f3ac6c, a different revision. The calls have the same input and output schemas there, but the results at that revision may differ from the recorded ones. The sandbox's project directory is shown as /home/user/project.
libtmux-mcpChoose your client and configuration scope, then run the command or paste the configuration.
Build or install the server first:
$ ./gradlew :libtmux-mcp:installDistThen register:
$ claude mcp add tmux -- /absolute/path/to/libtmux-mcpNothing 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.
Config file: ~/.claude.json (this project)
Build or install the server first:
$ ./gradlew :libtmux-mcp:installDistThen register:
$ claude mcp add tmux --scope user -- /absolute/path/to/libtmux-mcpNothing 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.
Config file: ~/.claude.json (all projects)
Build or install the server first:
$ ./gradlew :libtmux-mcp:installDistThen register:
$ claude mcp add tmux --scope project -- /absolute/path/to/libtmux-mcpNothing 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.
Config file: .mcp.json (in repo, version-controlled)
Build or install the server first:
$ ./gradlew :libtmux-mcp:installDistThen use this config:
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.
Config file: claude_desktop_config.json
Build or install the server first:
$ ./gradlew :libtmux-mcp:installDistThen register:
$ codex mcp add tmux -- /absolute/path/to/libtmux-mcpNothing 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.
Config file: ~/.codex/config.toml
Build or install the server first:
$ ./gradlew :libtmux-mcp:installDistThen register:
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.
Config file: .codex/config.toml (in repo)
Build or install the server first:
$ ./gradlew :libtmux-mcp:installDistThen register:
$ gemini mcp add --scope user tmux /absolute/path/to/libtmux-mcpNothing 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.
Config file: ~/.gemini/settings.json
Build or install the server first:
$ ./gradlew :libtmux-mcp:installDistThen register:
$ gemini mcp add --scope project tmux /absolute/path/to/libtmux-mcpNothing 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.
Config file: .gemini/settings.json (in repo)
Build or install the server first:
$ ./gradlew :libtmux-mcp:installDistThen use this config:
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.
Config file: .cursor/mcp.json (in repo)
Build or install the server first:
$ ./gradlew :libtmux-mcp:installDistThen use this config:
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.
Config file: ~/.cursor/mcp.json
Build or install the server first:
$ ./gradlew :libtmux-mcp:installDistThen register:
$ grok mcp add --scope user tmux -- /absolute/path/to/libtmux-mcpNothing 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.
Config file: ~/.grok/config.toml
Build or install the server first:
$ ./gradlew :libtmux-mcp:installDistThen register:
$ grok mcp add --scope project tmux -- /absolute/path/to/libtmux-mcpNothing 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.
Config file: ./.grok/config.toml (in repo)
Build or install the server first:
$ ./gradlew :libtmux-mcp:installDistThen use this config:
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.
Config file: ~/.gemini/config/mcp_config.json
Build or install the server first:
$ ./gradlew :libtmux-mcp:installDistThen register:
$ opencode mcp add tmux -- /absolute/path/to/libtmux-mcpNothing 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.
Config file: ~/.config/opencode/opencode.jsonc
ServerConfig config = ServerConfig.builder() .endpoint(ServerEndpoint.socketPath(socket)) .build();
try (Server server = Server.open(config)) { // A real client speaks over this process's stdin and stdout, which TmuxMcpServer.overStdio // wires up. Here the streams are empty and discarded: the point is the surface, not a // conversation, and an example that wrote JSON-RPC to stdout could not also print. StdioServerTransportProvider transport = new StdioServerTransportProvider( new JacksonMcpJsonMapper(new ObjectMapper()), InputStream.nullInputStream(), OutputStream.nullOutputStream());
// Serving hands the transport over; closing the returned server closes it. McpSyncServer mcp = TmuxMcpServer.serving(server, transport); try { return mcp.listTools().stream() .map(McpSchema.Tool::name) .sorted() .toList(); } finally { mcp.close(); }}
Excerpt of examples/src/main/java/io/github/libtmux/examples/ServeTmuxOverMcp.java,
which ./gradlew :libtmux-mcp:test check runs in the repository's CI
(.github/workflows/ci.yml).
libtmux-workspace-cliThe workspace package is separate from the core library.
Run from a libtmux-java checkout with JDK 25 or newer. The launcher is libtmux-workspace-cli/build/install/tmux-workspace/bin/tmux-workspace; keep its adjacent libraries.
private static final String WORKSPACE = """ session_name: built windows: - window_name: editor layout: even-horizontal panes: - shell_command: echo editor-pane-one - shell_command: echo editor-pane-two - window_name: server panes: - echo server-pane """;
void theDescribedSessionIsWhatGetsBuilt(Server server) { Session built = WorkspaceBuilder.build(server, WorkspaceBuilder.parse(WORKSPACE));
assertEquals("built", built.name()); assertEquals( List.of("editor", "server"), built.windows().stream().map(Window::name).toList(), "the first window is renamed, not added alongside the one tmux made"); assertEquals(2, built.windows().get(0).panes().size()); assertEquals(1, built.windows().get(1).panes().size());}
Excerpt of libtmux-workspace/src/test/java/io/github/libtmux/workspace/WorkspaceBuilderTest.java,
which ./gradlew :libtmux-mcp:test check runs in the repository's CI
(.github/workflows/ci.yml).
Subject-by-subject, with Java in every code block.
Task guides for Java.
Complete programs, sourced from the code each port tests.
The domain model every port shares.
Reference preview