Rust MCP examples
tmux-mcp 0.1.2 · Source
List sessions through MCP
Run an embedded client and server against a private tmux daemon, then close owned resources.
Connect an MCP client
Install the executable and configure a client to launch it.
The session example includes the complete Cargo project, program, setup commands, and expected output. It creates its own tmux server. The connection guide configures an existing MCP client to launch the executable instead.
List sessions¶
Send this params object through a connected client’s MCP tools/call method:
{ "name": "list_sessions", "arguments": {}}Check whether the result reports a tool error before reading its structured content. Use the returned IDs to choose a window or pane. The list_sessions reference describes the result.
Internals¶
The complete example embeds both protocol endpoints in one Rust process. They exchange JSON-RPC over an in-memory stream and perform normal tool discovery. An installed MCP client is not needed to run it.
Choose tools in Rust¶
The example supplies the inspect selection to the embedded server. It checks
that discovery contains the session-listing tool and excludes pane input.
The selection topic describes other combinations.
Run the program¶
Follow the complete setup in a fresh directory. The program prints both session names, closes the protocol endpoints, stops its tmux daemon, and verifies that the socket has closed. Operation and cleanup errors both produce a failing exit status.