tmux MCP, built in C#
tmux terminal control for AI agents, built on libtmux for C# and MCP C# SDK. This server maps tmux's object hierarchy — sessions, windows, panes — into MCP tools grouped by the operation they request. The server enforces the selected groups at the MCP tool boundary.
tmux through MCP
tmux before the first call.
tmux after create_session.
tmux after split_window.
tmux after list_windows: unchanged, the call only reads.
$ pytest -q .. [100%] 2 passed in 0.01s
tmux after run_shell_command.
$ pytest -q .. [100%] 2 passed in 0.01s
$ 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.
Result
{ "changed": "Created session $0.", "paneId": "%0", "windowId": "@0", "sessionId": "$0"}AgentSplit the pane the create result returned (%0) in two.
Result
{ "changed": "Split %0; the new pane is %1.", "paneId": "%1", "windowId": "@0", "sessionId": "$0"}AgentRead the window's layout.
Result
{ "result": [ { "windowId": "@0", "sessionId": "$0", "index": 0, "name": "sh", "width": 80, "height": 24, "active": true, "paneCount": 2, "layout": "8205,80x24,0,0{40x24,0,0,0,39x24,41,0,1}" } ]}AgentRun the tests in the pane the create result returned (%0).
Result
{ "paneId": "%0", "exitStatus": 0, "timedOut": false, "output": { "lines": [ ".. [100%]", "2 passed in 0.01s" ], "truncated": false, "droppedLines": 0, "droppedBytes": 0 }, "elapsedSeconds": 0.48, "effectiveTimeoutSeconds": 30, "linesMissed": false, "anchorLost": false, "started": true, "paneExited": false}AgentShow the log in the new pane the split returned (%1).
Result
{ "paneId": "%1", "exitStatus": 0, "timedOut": false, "output": { "lines": [ "2026-01-01 checks started", "2026-01-01 checks finished" ], "truncated": false, "droppedLines": 0, "droppedBytes": 0 }, "elapsedSeconds": 0.025, "effectiveTimeoutSeconds": 30, "linesMissed": false, "anchorLost": false, "started": true, "paneExited": false}AgentRemove the session once the result is read.
Result
{ "changed": "Killed session $0.", "paneId": null, "windowId": null, "sessionId": "$0"}pytest printed 2 passed and checks.log ends with checks finished. I removed the checks session.
Install
Choose your client and configuration scope, then run the command or paste the configuration.
$ claude mcp add tmux -- dnx LibTmux.Mcp --yes$ claude mcp add tmux --scope user -- dnx LibTmux.Mcp --yes$ claude mcp add tmux --scope project -- dnx LibTmux.Mcp --yes$ dotnet tool install --global LibTmux.Mcp$ claude mcp add tmux -- libtmux-mcp$ dotnet tool install --global LibTmux.Mcp$ claude mcp add tmux --scope user -- libtmux-mcp$ dotnet tool install --global LibTmux.Mcp$ claude mcp add tmux --scope project -- libtmux-mcp{
"mcpServers": {
"tmux": {
"command": "dnx",
"args": ["LibTmux.Mcp", "--yes"]
}
}
}$ dotnet tool install --global LibTmux.Mcp{
"mcpServers": {
"tmux": {
"command": "libtmux-mcp"
}
}
}$ codex mcp add tmux -- dnx LibTmux.Mcp --yes[mcp_servers.tmux]
command = "dnx"
args = ["LibTmux.Mcp", "--yes"]$ dotnet tool install --global LibTmux.Mcp$ codex mcp add tmux -- libtmux-mcp$ dotnet tool install --global LibTmux.Mcp[mcp_servers.tmux]
command = "libtmux-mcp"$ gemini mcp add --scope user tmux dnx -- LibTmux.Mcp --yes$ gemini mcp add --scope project tmux dnx -- LibTmux.Mcp --yes$ dotnet tool install --global LibTmux.Mcp$ gemini mcp add --scope user tmux libtmux-mcp$ dotnet tool install --global LibTmux.Mcp$ gemini mcp add --scope project tmux libtmux-mcp{
"mcpServers": {
"tmux": {
"command": "dnx",
"args": ["LibTmux.Mcp", "--yes"]
}
}
}{
"mcpServers": {
"tmux": {
"command": "dnx",
"args": ["LibTmux.Mcp", "--yes"]
}
}
}$ dotnet tool install --global LibTmux.Mcp{
"mcpServers": {
"tmux": {
"command": "libtmux-mcp"
}
}
}$ dotnet tool install --global LibTmux.Mcp{
"mcpServers": {
"tmux": {
"command": "libtmux-mcp"
}
}
}$ grok mcp add --scope user tmux -- dnx LibTmux.Mcp --yes$ grok mcp add --scope project tmux -- dnx LibTmux.Mcp --yes$ dotnet tool install --global LibTmux.Mcp$ grok mcp add --scope user tmux -- libtmux-mcp$ dotnet tool install --global LibTmux.Mcp$ grok mcp add --scope project tmux -- libtmux-mcp{
"mcpServers": {
"tmux": {
"command": "dnx",
"args": ["LibTmux.Mcp", "--yes"]
}
}
}$ dotnet tool install --global LibTmux.Mcp{
"mcpServers": {
"tmux": {
"command": "libtmux-mcp"
}
}
}$ opencode mcp add tmux -- dnx LibTmux.Mcp --yes$ dotnet tool install --global LibTmux.Mcp$ opencode mcp add tmux -- libtmux-mcpWrites ~/.claude.json (this project).
Runs the server from NuGet without installing it; needs the .NET 10 SDK. Write LibTmux.Mcp@<version> to pin a version.
Writes ~/.claude.json (all projects).
Runs the server from NuGet without installing it; needs the .NET 10 SDK. Write LibTmux.Mcp@<version> to pin a version.
Writes .mcp.json (in repo, version-controlled).
Runs the server from NuGet without installing it; needs the .NET 10 SDK. Write LibTmux.Mcp@<version> to pin a version.
Writes ~/.claude.json (this project).
Installs the libtmux-mcp tool from NuGet.
Writes ~/.claude.json (all projects).
Installs the libtmux-mcp tool from NuGet.
Writes .mcp.json (in repo, version-controlled).
Installs the libtmux-mcp tool from NuGet.
Runs the server from NuGet without installing it; needs the .NET 10 SDK. Write LibTmux.Mcp@<version> to pin a version.
Installs the libtmux-mcp tool from NuGet.
Writes ~/.codex/config.toml.
Runs the server from NuGet without installing it; needs the .NET 10 SDK. Write LibTmux.Mcp@<version> to pin a version.
Codex's CLI doesn't support project scope yet — paste this into .codex/config.toml at the repo root.
Runs the server from NuGet without installing it; needs the .NET 10 SDK. Write LibTmux.Mcp@<version> to pin a version.
Writes ~/.codex/config.toml.
Installs the libtmux-mcp tool from NuGet.
Codex's CLI doesn't support project scope yet — paste this into .codex/config.toml at the repo root.
Installs the libtmux-mcp tool from NuGet.
Writes ~/.gemini/settings.json.
Runs the server from NuGet without installing it; needs the .NET 10 SDK. Write LibTmux.Mcp@<version> to pin a version.
Writes .gemini/settings.json (in repo).
Runs the server from NuGet without installing it; needs the .NET 10 SDK. Write LibTmux.Mcp@<version> to pin a version.
Writes ~/.gemini/settings.json.
Installs the libtmux-mcp tool from NuGet.
Writes .gemini/settings.json (in repo).
Installs the libtmux-mcp tool from NuGet.
Runs the server from NuGet without installing it; needs the .NET 10 SDK. Write LibTmux.Mcp@<version> to pin a version.
Runs the server from NuGet without installing it; needs the .NET 10 SDK. Write LibTmux.Mcp@<version> to pin a version.
Installs the libtmux-mcp tool from NuGet.
Installs the libtmux-mcp tool from NuGet.
Writes ~/.grok/config.toml.
Runs the server from NuGet without installing it; needs the .NET 10 SDK. Write LibTmux.Mcp@<version> to pin a version.
Writes ./.grok/config.toml (in repo).
Runs the server from NuGet without installing it; needs the .NET 10 SDK. Write LibTmux.Mcp@<version> to pin a version.
Writes ~/.grok/config.toml.
Installs the libtmux-mcp tool from NuGet.
Writes ./.grok/config.toml (in repo).
Installs the libtmux-mcp tool from NuGet.
Runs the server from NuGet without installing it; needs the .NET 10 SDK. Write LibTmux.Mcp@<version> to pin a version.
Installs the libtmux-mcp tool from NuGet.
Writes ~/.config/opencode/opencode.jsonc.
Runs the server from NuGet without installing it; needs the .NET 10 SDK. Write LibTmux.Mcp@<version> to pin a version.
Writes ~/.config/opencode/opencode.jsonc.
Installs the libtmux-mcp tool from NuGet.
LibTmux.Mcp is a .NET tool package whose executable is
libtmux-mcp. It serves tmux tools and a static capability resource over standard
input and output.
The tool targets .NET 8 and .NET 10 and requires a POSIX host with tmux.
Its registered operations include capture_pane, run_shell_command,
and capture_since.
Tools
Every MCP operation, with its arguments and results.
Guides
Install the tool, choose a socket, and verify the client's connection.
Topics
Tool selection, command waits, capture limits, and cancellation.
Examples
Complete clients for session inspection and bounded command execution.
Language API
Embedding and implementation types.
Toolsets
Use LIBTMUX_TOOLSETS=inspect for discovery and terminal reads.
Additional toolsets enable changes, execution, and teardown. The
tool-selection topic explains exact-name filters,
defaults, and the capability resource. The complete examples
include project files and cleanup for their owned tmux servers.
Workspace Manager is the separately packaged
LibTmux.Workspace library. The MCP catalog does not include a workspace-file operation.
Tools by tier
The C# server groups its tools by what they request. A tier badge tells you how far a call reaches before you approve it. Set LIBTMUX_TOOLSETS to a comma-separated list of tiers, such as inspect,manage, to offer only those tools.
Inspect
Request tmux state and terminal output.
-
call_read_tools_batchInspect Execute up to 16 declared inspect operations serially. -
capture_paneInspect Read the text a pane is showing, and optionally its scrollback. -
capture_sinceInspect Read only what a pane has printed since the last call. -
find_pane_by_positionInspect Find the pane sitting at an index within a window. -
get_pane_infoInspect Read one pane's size, title, running command, working directory, process ID, history size and limit, and whether it is active, dead, zoomed, in a mode or the pane this server runs in. -
get_server_infoInspect Read the tmux server's version and how many sessions, windows and panes it holds. -
get_session_infoInspect Read one session's name, ID, window count and whether a client is attached, without listing every session. -
get_tmux_variablesInspect Expand named tmux format variables for a pane, such as session_name or window_width. -
get_window_infoInspect Read one window's name, index, size, layout, pane count and whether it is its session's current window, without listing every window. -
list_panesInspect List tmux panes, optionally within one session or window. -
list_sessionsInspect List the tmux sessions. -
list_windowsInspect List tmux windows, optionally within one session. -
search_panesInspect Find which panes are showing text matching a regular expression. -
show_environmentInspect Read the tmux environment. -
show_hooksInspect Read the hooks tmux will run on its own events. -
show_optionInspect Read tmux options at the server, session, window or pane level. -
snapshot_paneInspect Read a pane's visible content together with its cursor position, size and running command, in one call. -
wait_for_textInspect Wait until a pane prints something matching one of these patterns, then return.
Manage
Change tmux structure or presentation.
-
move_windowManage Move a window to another index, or into another session. -
rename_sessionManage Rename a tmux session. -
rename_windowManage Rename a tmux window. -
resize_paneManage Resize a pane, or zoom it to fill its window. -
resize_windowManage Resize a window to a width and height in cells. -
select_layoutManage Arrange a window's panes with a named layout — even-horizontal, even-vertical, main-horizontal, main-vertical, tiled — or a layout string read from list_windows. -
select_paneManage Make a pane the active one in its window. -
select_windowManage Make a window the current one in its session. -
set_history_limitManage Set how many scrollback lines tmux keeps. -
set_mouse_enabledManage Turn tmux mouse support on or off. -
set_pane_titleManage Set a pane's title. -
signal_channelManage Signal a tmux wait-for channel, releasing whatever waits on it. -
swap_paneManage Swap two panes' positions. -
wait_for_channelManage Block until something signals a tmux wait-for channel with 'tmux wait-for -S <channel>'. Use when you composed a shell command that signals it.
Execute
Start or drive pane processes, or store state that can control later execution.
-
create_sessionExecute Create a detached tmux session and return its ids. -
create_windowExecute Create a window in a tmux session and return its ids. -
paste_textExecute Paste a block of text into exactly one pane through a tmux buffer. -
respawn_paneExecute Only restarts a pane whose command has ALREADY EXITED. -
run_shell_commandExecute Run a shell command in a pane with your user's permissions. -
send_keysExecute Send raw keystrokes to a pane and return immediately. -
send_keys_batchExecute Send several keystrokes to one pane in order, in a single call. -
set_synchronize_panesExecute Turn synchronize-panes on or off for a window. -
split_windowExecute Split a pane and return the NEW pane's id.
Teardown
Delete tmux objects or retained scrollback. Not reversible.
-
clear_pane_scrollbackTeardown Delete a pane's scrollback history, keeping what the screen shows. -
kill_paneTeardown Close a pane and end its program. -
kill_sessionTeardown Close a session with all its windows and panes. -
kill_windowTeardown Close a window and every pane in it.
Browse every tool, with its arguments, result and protocol data.