agentCreate the session.
Result
{ "id": "$0", "name": "checks", "ref": "tmux1_AQ3atHtng1Jj30-gqW-Fv541MVcZ4sFXqPNXZIudQNAT", "isAttached": false, "windowCount": 1, "createdAt": 1793757185}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.
Swift-based tmux client
tmux client library for Swift. Control tmux, connect to and create servers, navigate sessions, windows, and panes, send keys, watch for changes via control mode, capture pane contents
import Foundationimport LibTmux
@mainstruct Quickstart { static func main() async throws { let server = try Server( socketName: "libtmux-home-\(UUID().uuidString)", configurationFile: "/dev/null" )
try await work(server) }
static func work(_ server: Server) async throws { let session = try await server.newSession( named: "demo", shell: "/bin/sh" ) let layout = try await server.snapshot() guard let editor = layout.windows(of: session).first, let left = layout.panes(of: editor).first(where: \.isActive) else { throw QuickstartError.missing } try await server.rename(editor, to: "editor") let right = try await server.split( left, direction: .right, shell: "/bin/sh" ) let logs = try await server.newWindow( in: session, named: "logs", shell: "/bin/sh" )
try await server.run("printf 'hello from %s\\n' tmux", in: right) let ready = try RegexPattern("^hello from tmux$") let result = try await server.waitForOutput( in: right, matching: [ready] ) guard result.outcome == .matched else { throw QuickstartError.outputTimedOut }
try await server.select(right) try await server.select(logs.link)
let snapshot = try await server.snapshot() for session in snapshot.sessions { print("session \(session.name)") let windows = snapshot.windows(of: session) let links = snapshot.windowLinks(of: session) for (window, link) in zip(windows, links) { let panes = snapshot.panes(of: window) let ids = panes.map { $0.id.rawValue }.joined(separator: " ") print(" window \(link.index):\(window.name): \(ids)") } }
let home = right.windowID guard let window = snapshot.windows.first(where: { $0.id == home }), let owner = snapshot.sessions(of: window).first else { throw QuickstartError.missing } print("\(right.id.rawValue) is in window \(window.name)" + " of session \(owner.name)") }
enum QuickstartError: Error { case missing case outputTimedOut }}import Foundationimport LibTmux
@mainstruct Quickstart { static func main() async throws { let server = try Server( socketName: "libtmux-home-\(UUID().uuidString)", configurationFile: "/dev/null" )
do { try await work(server) } catch { print("tmux quickstart failed: \(error)") throw error } }
static func work(_ server: Server) async throws { let session = try await server.newSession( named: "demo", shell: "/bin/sh" ) let layout = try await server.snapshot() guard let editor = layout.windows(of: session).first, let left = layout.panes(of: editor).first(where: \.isActive) else { throw QuickstartError.missing } try await server.rename(editor, to: "editor") let right = try await server.split( left, direction: .right, shell: "/bin/sh" ) let logs = try await server.newWindow( in: session, named: "logs", shell: "/bin/sh" )
try await server.run("printf 'hello from %s\\n' tmux", in: right) let ready = try RegexPattern("^hello from tmux$") let result = try await server.waitForOutput( in: right, matching: [ready] ) guard result.outcome == .matched else { throw QuickstartError.outputTimedOut }
try await server.select(right) try await server.select(logs.link)
let snapshot = try await server.snapshot() for session in snapshot.sessions { print("session \(session.name)") let windows = snapshot.windows(of: session) let links = snapshot.windowLinks(of: session) for (window, link) in zip(windows, links) { let panes = snapshot.panes(of: window) let ids = panes.map { $0.id.rawValue }.joined(separator: " ") print(" window \(link.index):\(window.name): \(ids)") } }
let home = right.windowID guard let window = snapshot.windows.first(where: { $0.id == home }), let owner = snapshot.sessions(of: window).first else { throw QuickstartError.missing } print("\(right.id.rawValue) is in window \(window.name)" + " of session \(owner.name)") }
enum QuickstartError: Error { case missing case outputTimedOut }}import Foundationimport LibTmux
@mainstruct Quickstart { static func main() async throws { let server = try Server( socketName: "libtmux-home-\(UUID().uuidString)", configurationFile: "/dev/null" )
do { try await work(server) } catch { if try await server.isRunning() { try await server.killServer() } throw error } try await server.killServer() }
static func work(_ server: Server) async throws { let session = try await server.newSession( named: "demo", shell: "/bin/sh" ) let layout = try await server.snapshot() guard let editor = layout.windows(of: session).first, let left = layout.panes(of: editor).first(where: \.isActive) else { throw QuickstartError.missing } try await server.rename(editor, to: "editor") let right = try await server.split( left, direction: .right, shell: "/bin/sh" ) let logs = try await server.newWindow( in: session, named: "logs", shell: "/bin/sh" )
try await server.run("printf 'hello from %s\\n' tmux", in: right) let ready = try RegexPattern("^hello from tmux$") let result = try await server.waitForOutput( in: right, matching: [ready] ) guard result.outcome == .matched else { throw QuickstartError.outputTimedOut }
try await server.select(right) try await server.select(logs.link)
let snapshot = try await server.snapshot() for session in snapshot.sessions { print("session \(session.name)") let windows = snapshot.windows(of: session) let links = snapshot.windowLinks(of: session) for (window, link) in zip(windows, links) { let panes = snapshot.panes(of: window) let ids = panes.map { $0.id.rawValue }.joined(separator: " ") print(" window \(link.index):\(window.name): \(ids)") } }
let home = right.windowID guard let window = snapshot.windows.first(where: { $0.id == home }), let owner = snapshot.sessions(of: window).first else { throw QuickstartError.missing } print("\(right.id.rawValue) is in window \(window.name)" + " of session \(owner.name)") }
enum QuickstartError: Error { case missing case outputTimedOut }}import Foundationimport LibTmux
@mainstruct Quickstart { static func main() async throws { let server = try Server( socketName: "libtmux-home-\(UUID().uuidString)", configurationFile: "/dev/null" )
do { try await work(server) } catch { print("tmux quickstart failed: \(error)") if try await server.isRunning() { try await server.killServer() } throw error } try await server.killServer() }
static func work(_ server: Server) async throws { let session = try await server.newSession( named: "demo", shell: "/bin/sh" ) let layout = try await server.snapshot() guard let editor = layout.windows(of: session).first, let left = layout.panes(of: editor).first(where: \.isActive) else { throw QuickstartError.missing } try await server.rename(editor, to: "editor") let right = try await server.split( left, direction: .right, shell: "/bin/sh" ) let logs = try await server.newWindow( in: session, named: "logs", shell: "/bin/sh" )
try await server.run("printf 'hello from %s\\n' tmux", in: right) let ready = try RegexPattern("^hello from tmux$") let result = try await server.waitForOutput( in: right, matching: [ready] ) guard result.outcome == .matched else { throw QuickstartError.outputTimedOut }
try await server.select(right) try await server.select(logs.link)
let snapshot = try await server.snapshot() for session in snapshot.sessions { print("session \(session.name)") let windows = snapshot.windows(of: session) let links = snapshot.windowLinks(of: session) for (window, link) in zip(windows, links) { let panes = snapshot.panes(of: window) let ids = panes.map { $0.id.rawValue }.joined(separator: " ") print(" window \(link.index):\(window.name): \(ids)") } }
let home = right.windowID guard let window = snapshot.windows.first(where: { $0.id == home }), let owner = snapshot.sessions(of: window).first else { throw QuickstartError.missing } print("\(right.id.rawValue) is in window \(window.name)" + " of session \(owner.name)") }
enum QuickstartError: Error { case missing case outputTimedOut }}tmux before the first call: no server is running.
tmux after Server.init: no server is running; the call sent no command.
tmux after Server.newSession: added session demo.
tmux after Server.snapshot: unchanged.
tmux after Snapshot.windows(of:): unchanged, the call sent no command.
tmux after Snapshot.panes(of:): unchanged, the call sent no command.
tmux after Server.rename: renamed window 0:sh to 0:editor.
tmux after Server.split: added pane %1 to window 0:editor.
tmux after Server.newWindow: added window 1:logs.
tmux after Server.run: sent keys to pane %1.
tmux after RegexPattern.init: unchanged, the call sent no command.
$ printf 'hello from %s\n' tmux hello from tmux $
tmux after Server.waitForOutput: read pane %1.
$ printf 'hello from %s\n' tmux hello from tmux $
tmux after Server.select(Pane): selected pane %1 in window 0:editor.
$ printf 'hello from %s\n' tmux hello from tmux $
tmux after Server.select(WindowLink): 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 Snapshot.windows(of:): unchanged, the call sent no command.
$ printf 'hello from %s\n' tmux hello from tmux $
tmux after Snapshot.windowLinks(of:): unchanged, the call sent no command.
$ printf 'hello from %s\n' tmux hello from tmux $
tmux after Snapshot.panes(of:): unchanged, the call sent no command.
$ printf 'hello from %s\n' tmux hello from tmux $
tmux after Snapshot.panes(of:): unchanged, the call sent no command.
$ printf 'hello from %s\n' tmux hello from tmux $
tmux after Snapshot.windows: unchanged, the call sent no command.
$ printf 'hello from %s\n' tmux hello from tmux $
tmux after Snapshot.sessions(of:): unchanged, the call sent no command.
tmux after Server.killServer: the server has exited.
No tmux server is running yet.
Server.init returned Server { "socketName": "libtmux-home-00000000-0000-0000-0000-000000000000"}The call sent no tmux command.
Server.newSession returned Session { "id": "$0", "name": "demo"}run-shell -C libtmux-version-6691bf5607ee461f9bcef6f3090768be-#{version} error connecting to /tmp/tmux-1000/libtmux-home-00000000-0000-0000-0000-000000000000 (No such file or directory) new-session -d -P -F #{session_id}␞#{session_name}␞#{session_windows}␞#{session_attached}␞#{session_created}␞#{socket_path}␞#{pid}␞#{start_time} -s demo /bin/sh $0␞demo␞1␞0␞1793889970␞/tmp/tmux-1000/libtmux-home-00000000-0000-0000-0000-000000000000␞3367525␞1793889970 Before these, the library asked tmux about itself 1 time (its version, its daemon, how a control client reads escapes).
Server.snapshot returned Snapshot { "sessions": 1, "windows": 1, "panes": 1}run-shell -C libtmux-version-421257856dca4a6a859a9b665cb52dba-#{version} unknown command: libtmux-version-421257856dca4a6a859a9b665cb52dba-3.8a run-shell -C libtmux-version-a3bd5014baf1406aa91ff5d081083dcb-#{pid},#{start_time},#{q:socket_path} unknown command: libtmux-version-a3bd5014baf1406aa91ff5d081083dcb-3367525,1793889970,/tmp/tmux-1000/libtmux-home-00000000-0000-0000-0000-000000000000 list-sessions -F #{session_id}␞#{session_name}␞#{session_windows}␞#{session_attached}␞#{session_created}␞#{socket_path}␞#{pid}␞#{start_time} $0␞demo␞1␞0␞1793889970␞/tmp/tmux-1000/libtmux-home-00000000-0000-0000-0000-000000000000␞3367525␞1793889970 list-windows -a -F #{window_id}␞#{window_name}␞#{window_index}␞#{window_panes}␞#{window_active}␞#{window_width}␞#{window_height}␞#{session_id}␞#{socket_path}␞#{pid}␞#{start_time} @0␞sh␞0␞1␞1␞80␞24␞$0␞/tmp/tmux-1000/libtmux-home-00000000-0000-0000-0000-000000000000␞3367525␞1793889970 list-panes -a -F #{pane_id}␞#{pane_index}␞#{pane_width}␞#{pane_height}␞#{pane_active}␞#{pane_dead}␞#{pane_input_off}␞#{pane_in_mode}␞#{pane_synchronized}␞#{pane_current_command}␞#{pane_current_path}␞#{pane_at_top}␞#{pane_at_bottom}␞#{pane_at_left}␞#{pane_at_right}␞#{window_id}␞#{socket_path}␞#{pid}␞#{start_time} %0␞0␞80␞24␞1␞0␞0␞0␞0␞sh␞/tmp/marked␞1␞1␞1␞1␞@0␞/tmp/tmux-1000/libtmux-home-00000000-0000-0000-0000-000000000000␞3367525␞1793889970 list-clients -F #{client_name}␞#{client_tty}␞#{client_pid}␞#{client_width}␞#{client_height}␞#{client_control_mode}␞#{session_id}␞#{pane_id}␞#{window_zoomed_flag}␞#{client_flags}␞#{socket_path}␞#{pid}␞#{start_time} no output run-shell -C libtmux-version-4b34e8f5afeb440ba72abd2466d048c0-#{pid},#{start_time},#{q:socket_path} unknown command: libtmux-version-4b34e8f5afeb440ba72abd2466d048c0-3367525,1793889970,/tmp/tmux-1000/libtmux-home-00000000-0000-0000-0000-000000000000 Snapshot.windows(of:) returned Window { "id": "@0", "name": "sh"}The call sent no tmux command.
Snapshot.panes(of:) returned Pane { "id": "%0"}The call sent no tmux command.
Server.rename returned Void nullrename-window -t @0 -- editor no output Server.split returned Pane { "id": "%1"}split-window -d -P -F #{pane_id} -t %0 -h /bin/sh %1 list-panes -a -f #{==:#{pane_id},%1} -F #{pane_id}␞#{pane_index}␞#{pane_width}␞#{pane_height}␞#{pane_active}␞#{pane_dead}␞#{pane_input_off}␞#{pane_in_mode}␞#{pane_synchronized}␞#{pane_current_command}␞#{pane_current_path}␞#{pane_at_top}␞#{pane_at_bottom}␞#{pane_at_left}␞#{pane_at_right}␞#{window_id}␞#{socket_path}␞#{pid}␞#{start_time} %1␞1␞39␞24␞0␞0␞0␞0␞0␞sh␞/tmp/marked␞1␞1␞0␞1␞@0␞/tmp/tmux-1000/libtmux-home-00000000-0000-0000-0000-000000000000␞3367525␞1793889970 Server.newWindow returned WindowAppearance { "id": "@1", "index": 1, "name": "logs"}new-window -d -P -F #{window_id}␞#{window_name}␞#{window_index}␞#{window_panes}␞#{window_active}␞#{window_width}␞#{window_height}␞#{session_id}␞#{socket_path}␞#{pid}␞#{start_time} -t $0 -n logs /bin/sh @1␞logs␞1␞1␞0␞80␞24␞$0␞/tmp/tmux-1000/libtmux-home-00000000-0000-0000-0000-000000000000␞3367525␞1793889970 Server.run returned Void nullsend-keys -t %1 -- 'printf '\''hello from %s\n'\'' tmux' Enter no output RegexPattern.init returned RegexPattern { "source": "^hello from tmux$"}The call sent no tmux command.
Server.waitForOutput returned OutputWait { "outcome": "matched", "matched": "^hello from tmux$", "tail": [ "$ printf 'hello from %s\\n' tmux", "hello from tmux", "$" ]}display-message -p -t %1 #{pane_id}␞#{history_size}␞#{cursor_y}␞#{pane_pid}␞#{pane_height}␞#{history_bytes}␞#{history_limit}␞#{pane_width}␞#{alternate_on} %1␞0␞2␞3367770␞24␞1295␞2000␞39␞0 capture-pane -p -t %1 -S 0 -E 2 $ printf 'hello from %s\n' tmux
hello from tmux
$ Server.select(Pane) returned Void nullselect-pane -t %1 no output Server.select(WindowLink) returned Void nullselect-window -t $0:1 no output Server.snapshot returned Snapshot { "sessions": 1, "windows": 2, "panes": 3}run-shell -C libtmux-version-9ef137956f844270bad84806a2c2dc7e-#{pid},#{start_time},#{q:socket_path} unknown command: libtmux-version-9ef137956f844270bad84806a2c2dc7e-3367525,1793889970,/tmp/tmux-1000/libtmux-home-00000000-0000-0000-0000-000000000000 list-sessions -F #{session_id}␞#{session_name}␞#{session_windows}␞#{session_attached}␞#{session_created}␞#{socket_path}␞#{pid}␞#{start_time} $0␞demo␞2␞0␞1793889970␞/tmp/tmux-1000/libtmux-home-00000000-0000-0000-0000-000000000000␞3367525␞1793889970 list-windows -a -F #{window_id}␞#{window_name}␞#{window_index}␞#{window_panes}␞#{window_active}␞#{window_width}␞#{window_height}␞#{session_id}␞#{socket_path}␞#{pid}␞#{start_time} @0␞editor␞0␞2␞0␞80␞24␞$0␞/tmp/tmux-1000/libtmux-home-00000000-0000-0000-0000-000000000000␞3367525␞1793889970
@1␞logs␞1␞1␞1␞80␞24␞$0␞/tmp/tmux-1000/libtmux-home-00000000-0000-0000-0000-000000000000␞3367525␞1793889970 list-panes -a -F #{pane_id}␞#{pane_index}␞#{pane_width}␞#{pane_height}␞#{pane_active}␞#{pane_dead}␞#{pane_input_off}␞#{pane_in_mode}␞#{pane_synchronized}␞#{pane_current_command}␞#{pane_current_path}␞#{pane_at_top}␞#{pane_at_bottom}␞#{pane_at_left}␞#{pane_at_right}␞#{window_id}␞#{socket_path}␞#{pid}␞#{start_time} %0␞0␞40␞24␞0␞0␞0␞0␞0␞sh␞/tmp/marked␞1␞1␞1␞0␞@0␞/tmp/tmux-1000/libtmux-home-00000000-0000-0000-0000-000000000000␞3367525␞1793889970
%1␞1␞39␞24␞1␞0␞0␞0␞0␞sh␞/tmp/marked␞1␞1␞0␞1␞@0␞/tmp/tmux-1000/libtmux-home-00000000-0000-0000-0000-000000000000␞3367525␞1793889970
%2␞0␞80␞24␞1␞0␞0␞0␞0␞sh␞/tmp/marked␞1␞… list-clients -F #{client_name}␞#{client_tty}␞#{client_pid}␞#{client_width}␞#{client_height}␞#{client_control_mode}␞#{session_id}␞#{pane_id}␞#{window_zoomed_flag}␞#{client_flags}␞#{socket_path}␞#{pid}␞#{start_time} no output run-shell -C libtmux-version-ead3bee558414981b0b13c584c0854a7-#{pid},#{start_time},#{q:socket_path} unknown command: libtmux-version-ead3bee558414981b0b13c584c0854a7-3367525,1793889970,/tmp/tmux-1000/libtmux-home-00000000-0000-0000-0000-000000000000 Snapshot.windows(of:) returned [Window] [ "@0", "@1"]The call sent no tmux command.
Snapshot.windowLinks(of:) returned [WindowLink] [ "$0:0", "$0:1"]The call sent no tmux command.
Snapshot.panes(of:) returned [Pane] [ "%0", "%1"]The call sent no tmux command.
Snapshot.panes(of:) returned [Pane] [ "%2"]The call sent no tmux command.
Snapshot.windows returned Window { "id": "@0", "name": "editor"}The call sent no tmux command.
Snapshot.sessions(of:) returned Session { "id": "$0", "name": "demo"}The call sent no tmux command.
Server.killServer returned Void nullkill-server no output Swift 6.2+, tmux on Linux/macOS
Save the program above as Sources/Main.swift 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.
// swift-tools-version: 6.2import PackageDescription
let package = Package( name: "ApiExample", platforms: [.macOS(.v13)], dependencies: [ .package( url: "https://github.com/libtmux/libtmux-swift.git", from: "0.1.1" ) ], targets: [ .executableTarget( name: "ApiExample", dependencies: [ .product(name: "LibTmux", package: "libtmux-swift"), ], path: "Sources" ) ])# Save the files above at their displayed relative paths.swift build --jobs 2 --product ApiExampleunset TMUX TMUX_PANEexport ENV=/dev/null BASH_ENV=/dev/null SHELL=/bin/sh.build/debug/ApiExamplesession demo window 0:editor: %0 %1 window 1:logs: %2%1 is in window editor of session demolibtmux-swiftA range from 0.1.0 up to the next major version. Any 0.1.N release may change the API, so pin `exact:` instead to avoid a break.
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", "ref": "tmux1_AQ3atHtng1Jj30-gqW-Fv541MVcZ4sFXqPNXZIudQNAT", "isAttached": false, "windowCount": 1, "createdAt": 1793757185}agentList the panes in the new session.
{ "panes": [ { "ref": "tmux1_BA3atHtng1Jj30-gqW-Fv56j-w_GfT5lw2c-1M9eytN5", "isAtLeft": true, "isActive": true, "width": 80, "height": 24, "isAtBottom": true, "isSynchronized": false, "windowID": "@0", "isAtTop": true, "isDead": false, "id": "%0", "modeCount": 0, "…": "4 more" } ]}agentSplit the pane the list returned (%0) in two.
{ "id": "%1", "isSynchronized": false, "currentPath": "/home/user/project", "isAtTop": true, "currentCommand": "sh", "height": 24, "isActive": false, "ref": "tmux1_BA3atHtng1Jj30-gqW-Fv57PdeYPGTOQg9noVSe2N4-7", "isAtLeft": false, "isAtBottom": true, "index": 1, "isDead": false, "…": "4 more"}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\":40,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%0\"},{\"t\":\"p\",\"w\":39,\"h\":24,\"x\":41,\"y\":0,\"i\":1,\"I\":\"%1\"}]}}" }}agentRun the tests in the pane the list returned (%0).
{ "droppedLines": 0, "effectiveTimeout": 30, "output": [ ".. [100%]", "2 passed in 0.00s" ], "paneRef": "tmux1_BA3atHtng1Jj30-gqW-Fv56j-w_GfT5lw2c-1M9eytN5", "seconds": 0.346968068, "pane": "%0", "exitStatus": 0, "timedOut": false, "linesMissed": false}agentShow the log in the new pane the split returned (%1).
{ "seconds": 0.087398972, "exitStatus": 0, "paneRef": "tmux1_BA3atHtng1Jj30-gqW-Fv57PdeYPGTOQg9noVSe2N4-7", "pane": "%1", "effectiveTimeout": 30, "linesMissed": false, "output": [ "2026-01-01 checks started", "2026-01-01 checks finished" ], "droppedLines": 0, "timedOut": false}agentRemove the session once the result is read.
{ "deleted": true, "sessionId": "$0"}agent in %0 it printed 2 passed in 0.00s
; in %1 it printed 2026-01-01 checks finished
.
libtmux-mcpChoose your client and configuration scope, then run the command or paste the configuration.
Build or install the server first:
$ swift build --product libtmux-mcpThen register:
$ claude mcp add tmux -- /absolute/path/to/.build/debug/libtmux-mcpNothing publishes this server as a binary yet. The server takes no flags — which tmux it talks to is environment, so the client config is where you say so.
Config file: ~/.claude.json (this project)
Build or install the server first:
$ swift build --product libtmux-mcpThen register:
$ claude mcp add tmux --scope user -- /absolute/path/to/.build/debug/libtmux-mcpNothing publishes this server as a binary yet. The server takes no flags — which tmux it talks to is environment, so the client config is where you say so.
Config file: ~/.claude.json (all projects)
Build or install the server first:
$ swift build --product libtmux-mcpThen register:
Nothing publishes this server as a binary yet. The server takes no flags — which tmux it talks to is environment, so the client config is where you say so.
Config file: .mcp.json (in repo, version-controlled)
Build or install the server first:
$ swift build --product libtmux-mcpThen use this config:
Nothing publishes this server as a binary yet. The server takes no flags — which tmux it talks to is environment, so the client config is where you say so.
Config file: claude_desktop_config.json
Build or install the server first:
$ swift build --product libtmux-mcpThen register:
$ codex mcp add tmux -- /absolute/path/to/.build/debug/libtmux-mcpNothing publishes this server as a binary yet. The server takes no flags — which tmux it talks to is environment, so the client config is where you say so.
Config file: ~/.codex/config.toml
Build or install the server first:
$ swift build --product libtmux-mcpThen 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 server takes no flags — which tmux it talks to is environment, so the client config is where you say so.
Config file: .codex/config.toml (in repo)
Build or install the server first:
$ swift build --product libtmux-mcpThen register:
$ gemini mcp add --scope user tmux /absolute/path/to/.build/debug/libtmux-mcpNothing publishes this server as a binary yet. The server takes no flags — which tmux it talks to is environment, so the client config is where you say so.
Config file: ~/.gemini/settings.json
Build or install the server first:
$ swift build --product libtmux-mcpThen register:
$ gemini mcp add --scope project tmux /absolute/path/to/.build/debug/libtmux-mcpNothing publishes this server as a binary yet. The server takes no flags — which tmux it talks to is environment, so the client config is where you say so.
Config file: .gemini/settings.json (in repo)
Build or install the server first:
$ swift build --product libtmux-mcpThen use this config:
Nothing publishes this server as a binary yet. The server takes no flags — which tmux it talks to is environment, so the client config is where you say so.
Config file: .cursor/mcp.json (in repo)
Build or install the server first:
$ swift build --product libtmux-mcpThen use this config:
Nothing publishes this server as a binary yet. The server takes no flags — which tmux it talks to is environment, so the client config is where you say so.
Config file: ~/.cursor/mcp.json
Build or install the server first:
$ swift build --product libtmux-mcpThen register:
$ grok mcp add --scope user tmux -- /absolute/path/to/.build/debug/libtmux-mcpNothing publishes this server as a binary yet. The server takes no flags — which tmux it talks to is environment, so the client config is where you say so.
Config file: ~/.grok/config.toml
Build or install the server first:
$ swift build --product libtmux-mcpThen register:
Nothing publishes this server as a binary yet. The server takes no flags — which tmux it talks to is environment, so the client config is where you say so.
Config file: ./.grok/config.toml (in repo)
Build or install the server first:
$ swift build --product libtmux-mcpThen use this config:
Nothing publishes this server as a binary yet. The server takes no flags — which tmux it talks to is environment, so the client config is where you say so.
Config file: ~/.gemini/config/mcp_config.json
Build or install the server first:
$ swift build --product libtmux-mcpThen register:
$ opencode mcp add tmux -- /absolute/path/to/.build/debug/libtmux-mcpNothing publishes this server as a binary yet. The server takes no flags — which tmux it talks to is environment, so the client config is where you say so.
Config file: ~/.config/opencode/opencode.jsonc
public func useEmbeddedTools(on server: Server) async throws(ToolError) -> Int { let tools = TmuxTools(server: server) for definition in tools.visibleDefinitions { print(definition.name, definition.summary) } let result = try await tools.call(ToolCall(name: "list_panes")) return result.structured["panes"]?.arrayValue?.count ?? 0}
Excerpt of Examples/Sources/ExampleCode/MCPEmbedding.swift,
which swift test --package-path Examples runs in the repository's CI
(.github/workflows/ci.yml).
tmux-workspaceThe workspace package is separate from the core library.
Run from a libtmux-swift checkout with Swift 6.2 or newer on Linux, or Xcode Swift 6.3 or newer on macOS. The command is .build/debug/tmux-workspace.
public func describeAWorkspaceInSwift() -> Workspace { let workspace = Workspace( sessionName: "work", windows: [ WindowPlan( windowName: "editor", layout: "even-horizontal", panes: [PanePlan(), PanePlan()] ), WindowPlan( windowName: "logs", panes: [PanePlan(shellCommands: ["tail -f /tmp/build.log"])] ), ] ) return workspace}
Excerpt of Examples/Sources/ExampleCode/Workspaces.swift,
which swift test --package-path Examples runs in the repository's CI
(.github/workflows/ci.yml).
Subject-by-subject, with Swift in every code block.
Task guides for Swift.
Complete programs, sourced from the code each port tests.
The domain model every port shares.
Reference preview