Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

Edit this page on GitHub

github.com/libtmux/libtmux-go/mcp · Source

Connect the server using the setup guide, then call list_sessions from your MCP client.

List sessionsLink to section

This is the params object for an MCP tools/call request. Send it through the connected client:

{
"name": "list_sessions",
"arguments": {}
}

Use the returned session IDs when choosing a window or pane. The tool reference describes this port’s result and optional arguments.

InternalsLink to section

The following examples are for applications that embed or extend the server. Installing and connecting an MCP client does not require this code.

The Go agent-workflow example connects an MCP client and server in memory. It discovers caller context, splits a pane, runs a bounded command, inspects topology, and collects the command result.

Run the agent workflowLink to section

From the Go repository with its dependencies and tmux installed, create a disposable server using a socket name reserved for this example:

Terminal window
$ tmux -L libtmux-go-docs-example new-session -d -s example

Run the example:

Terminal window
$ go -C mcp run ./examples/agent-workflow \
-socket-name libtmux-go-docs-example

It selects inspect,execute toolsets when the environment has not selected a surface. An inherited inspection-only selection will not permit its writes.

The output identifies the created pane, then reports exit status and the final layout. The example reads structuredContent through the MCP client rather than calling private tool handlers.

Clean upLink to section

After inspecting the result, end only the disposable server created above:

Terminal window
$ tmux -L libtmux-go-docs-example kill-server

The complete source owns and closes its client and managed server instance. Its README describes the expected workflow. These commands execute real tmux operations; viewing this page does not run them.

For workspace configuration without MCP, see Workspace builder examples.

Esc

Type to search.