Connect an MCP adapter
Needs libtmux for Haskell unreleased Install
Keep the Haskell application’s withOwnedServer
callback running while the agent inspects it. Get the absolute socket from
(serverInfo snapshot).socketPath after capture. For a borrowed daemon,
use the socket your application passed to serverConfig.
Configure your MCP client with the same socket. The libtmux-mcp adapter
owns the stdio connection. The Haskell scope owns the daemon and its cleanup.
{ "mcpServers": { "application-tmux": { "command": "uvx", "args": ["libtmux-mcp==0.1.0a22"], "env": { "LIBTMUX_SOCKET_PATH": "/absolute/path/to/private/socket", "LIBTMUX_TOOLSETS": "inspect" } } }}If the application uses a specific tmux executable, pass its absolute path
as LIBTMUX_TMUX_BIN too. See the adapter release
and the MCP client setup guide.
Discover the application pane
- Refresh the client’s tool list. It should include
list_sessions,list_panesandcapture_pane. - Call
list_sessionsand keep the returnedsession_idof the session you need, such as$0. - Call
list_paneswith thatsession_id. Pass the selectedpane_id, such as%0, tocapture_panewhen you need the visible text.
The adapter returns native IDs. Within Haskell, use the SessionRef or
PaneRef from a fresh capture on the same Server. See targeting and
recovery.
Run a command in an owned pane
For a pane running an interactive POSIX shell on your private daemon, set
LIBTMUX_TOOLSETS to inspect,execute and refresh the tool list. Use
send_keys for interactive input and run_command for command completion.
For example, call run_command with the pane ID you discovered.
{ "pane_id": "%0", "command": "printf 'agent-%s\\n' operated; exit 7", "timeout": 0.8}The result contains agent-operated in output, exit_status of 7,
and timed_out of false. Keep daemon retirement with withOwnedServer.
Adapter tool registration
Work on the Haskell application
For a Haskell code change, start with the working examples, check
serverCapabilities for release-specific operations,
and use the API reference for exact types and recovery behavior.