MCPconceptAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

MCP: API Reference

io.github.libtmux.mcp.Main

class io.github.libtmux.mcp.Main

Runs the tmux MCP server over stdin and stdout.

Description#

An MCP client launches this as a subprocess and speaks JSON-RPC over its standard streams, so nothing may write to stdout but the protocol. Diagnostics go to stderr, which the client is free to log or discard.

Which tmux server to expose is chosen the same way the library chooses it: a socket path, a socket name, or tmux's own default. LIBTMUX_SOCKET_PATH and LIBTMUX_SOCKET stand in for the flags when none is given, and with neither set tmux picks the server itself, which is the one in TMUX when the launcher runs inside a pane.

The unordered toolset and named-tool environment variables resolve one immutable surface before tmux is opened. A tool outside it is neither listed nor callable.

A tmux older than 3.3a, or one that reports no release, is refused at startup: one line on stderr naming the version required and what to do, and a non-zero exit, with no stack trace.

Examples#

libtmux-mcp --socket /run/user/1000/tmux/default
libtmux-mcp --socket-name work --tmux /usr/local/bin/tmux

Members3#

Common operations1#

  • main method Serves a tmux server over stdin and stdout until the client closes them.

Other members2#

  • run method The process, with its streams passed in; returns the exit status rather than exiting.
  • configure method
Esc

Type to search.

Reference previewOpen reference