tmux-mcp
Provides full visibility and control over tmux sessions, allowing AI agents to list sessions, windows, and panes, capture pane output, send commands and key sequences, create and manage sessions, windows, and panes, and kill sessions/windows/panes.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@tmux-mcp list my tmux sessions"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
tmux-mcp
MCP server that gives AI assistants full visibility into your tmux sessions — browse sessions, windows, and panes, read terminal output, and send commands.
Watch your AI agent work in real-time. Enable TMUX_MCP_ALWAYS_USE to force every shell command through a named tmux session instead of direct Bash — every command your AI runs appears live in your terminal, fully auditable.
Works with Claude Code, OpenCode, Cursor, Windsurf, and any MCP-compatible host.
What it can do
Read your terminal state
List every active tmux session with window count, creation time, and attached status
List windows inside a session — index, name, pane count, which one is active
List panes inside a window — size, running command, which one is active
See what's on screen
Capture the visible output of any pane — up to 5 000 lines of scrollback
Read logs, compiler errors, server output, test runs — anything in your terminal
Create and organise
Create sessions, windows, and panes with a working directory and an initial command
Split panes horizontally or vertically
Rename sessions and windows for reliable targeting
Clean up
Kill sessions, windows, or individual panes
Control panes
Send shell commands to any pane and immediately read the output
Send raw key sequences:
C-cto interrupt,Escapeto exit, arrow keys, etc.Configurable wait time before capturing so long-running commands have time to finish
Error-safe
Bad target? No tmux server? Returns a readable error message instead of crashing
Related MCP server: Ryan's Tmux MCP Server
Tools
list_sessions
Lists all active tmux sessions. No parameters.
Returns: session name, number of windows, creation time, attached/detached status.
list_windows
Lists windows inside a session.
Parameter | Type | Description |
| string | Session name (from |
Returns: window index, name, pane count, whether it's the active window.
list_panes
Lists panes inside a session or window.
Parameter | Type | Description |
| string | Session name ( |
Returns: pane index, title, dimensions (e.g. 220x50), whether it's active, running command.
capture_pane
Captures the current terminal output of a pane.
Parameter | Type | Default | Description |
| string | — | Pane target: |
| number |
| Lines of scrollback to include (max 5000) |
Returns: raw terminal text as it appears on screen.
Security note: pane output can contain environment variables, API keys, tokens, and credentials if they were printed to the terminal. Only use this server in trusted local environments.
send_keys
Sends a command or key sequence to a pane and captures the result.
Parameter | Type | Default | Description |
| string | — | Pane target: |
| string | — | Command or tmux key notation ( |
| boolean |
| Press Enter after the keys |
| number |
| Lines to capture after sending |
| number |
| Milliseconds to wait before capturing |
Returns: confirmation + pane output after the command ran.
new_session
Creates a new detached tmux session.
Parameter | Type | Description |
| string | Session name. Omit to let tmux auto-assign one. |
| string | Working directory for the session. |
| string | Shell command to run immediately in the first window. |
new_window
Creates a new window inside an existing session.
Parameter | Type | Description |
| string | Session to create the window in. |
| string | Window name. |
| string | Working directory for the new window. |
| string | Shell command to run immediately. |
split_pane
Splits a pane into two.
Parameter | Type | Default | Description |
| string | — | Pane or window to split: |
|
|
|
|
| string | — | Working directory for the new pane. |
| string | — | Shell command to run in the new pane. |
| number | — | Size of the new pane as a percentage (1–99). |
kill_session
Kills a session and all its windows and panes. Destructive — cannot be undone.
Parameter | Type | Description |
| string | Session name to kill. |
kill_window
Kills a window and all its panes. Destructive.
Parameter | Type | Description |
| string | Window target: |
kill_pane
Kills a single pane and its running process. Destructive.
Parameter | Type | Description |
| string | Pane target: |
rename_session
Parameter | Type | Description |
| string | Current session name. |
| string | New name. |
rename_window
Parameter | Type | Description |
| string | Window target: |
| string | New name. |
Target format
All tools use tmux's standard session:window.pane notation:
work → session named "work"
work:0 → window 0 of session "work"
work:0.0 → pane 0, window 0, session "work"
work:editor.1 → pane 1 of window named "editor" in session "work"Use list_sessions → list_windows → list_panes to discover the right target before calling capture_pane or send_keys.
Install
npm install -g @fr1sk/tmux-mcpConfigure
OpenCode (~/.config/opencode/opencode.json)
{
"mcp": {
"tmux": {
"type": "local",
"command": ["tmux-mcp"]
}
}
}Claude Code (~/.claude/settings.json)
{
"mcpServers": {
"tmux": {
"command": "tmux-mcp"
}
}
}Cursor / Windsurf (mcp.json)
{
"mcpServers": {
"tmux": {
"command": "tmux-mcp"
}
}
}Usage examples
What tmux sessions do I have running?Show me the output of my dev server — it's in the work sessionMy tests are failing, check what's in work:1.0Run git status in my work session and show me the outputSend Ctrl-C to work:0.0, the process is stuckTail the last 300 lines from the logs pane in my api sessionCreate a new session called 'dev' in ~/Projects/myapp and run npm run devSplit work:0.0 vertically and run npm test in the new paneRename session 'new' to 'api'Kill the old session named 'temp'Environment variables
Set these in your MCP client config under environment to control agent behavior.
Variable | Default | Description |
| — | Session name the agent routes commands to when |
|
| Set to |
When both are set, the get_config tool returns an instructions field the agent uses to automatically route every shell command through send_keys in the configured session.
Example (OpenCode):
{
"mcp": {
"tmux": {
"type": "local",
"command": ["tmux-mcp"],
"environment": {
"TMUX_MCP_ALWAYS_USE": "true",
"TMUX_MCP_DEFAULT_SESSION": "dev"
}
}
}
}Security
This server provides unrestricted local shell access through tmux:
capture_pane— returns raw terminal output, which may include environment variables, API keys, tokens, database passwords, and SSH private keys if they were printed to the terminal.send_keys— executes arbitrary shell commands in the target pane. Any command the AI sends runs in your shell with your permissions.commandparameter onnew_session,new_window, andsplit_pane— passed directly to tmux, which runs it via$SHELL -c. No validation or sandboxing.
Only use this server in trusted local development environments. Never expose it to network-accessible MCP hosts or untrusted AI assistants.
Requirements
Node.js 18+
tmux on
$PATH
Available Tools
14 toolscapture_paneA
Capture current output of a tmux pane. Target format: 'session:window.pane' (e.g. 'work:0.0'). Use list_sessions → list_windows → list_panes to build the target. WARNING: pane output may contain environment variables, API keys, tokens, and credentials — do not call if the pane may contain sensitive data unless the user has confirmed it is safe. AFTER displaying the output, always ask the user what to do next with these options: Refresh (call capture_pane again), Send command (ask what command then call send_keys), Switch pane (restart from list_sessions), Done (stop). Loop until the user picks Done.
Inputs: target (required), lines.
get_configA
Returns the current tmux-mcp configuration: whether tmux is installed, the default session name, and whether the agent is configured to always route shell commands through tmux. Call this at the start of any task to check how the agent should behave. If alwaysUseTmux is true, route all shell commands through send_keys in the configured session instead of direct Bash for the remainder of the task.
Inputs: no named parameters.
kill_paneA
Kill a tmux pane and terminate its running process. ALWAYS confirm with the user before calling — this is destructive and cannot be undone. Target format: 'session:window.pane'.
Inputs: target (required).
kill_sessionA
Kill a tmux session and all its windows and panes. ALWAYS confirm with the user before calling — this is destructive and cannot be undone.
Inputs: session (required).
kill_windowA
Kill a tmux window and all its panes. ALWAYS confirm with the user before calling — this is destructive and cannot be undone. Target format: 'session:window'.
Inputs: target (required).
list_panesA
List panes in a tmux target. Pass a session name ('work') or session:window ('work:0'). When only a session name is passed, lists all panes across all windows in that session. Returns pane index, size, active status, and running command. If there is only one pane, auto-select it without asking. If multiple, present them as choices and ask the user which pane to use.
Inputs: target (required).
list_sessionsA
List all active tmux sessions. Returns session name, window count, creation time, and attached status. WHEN TO CALL: Call this immediately whenever the user mentions tmux, asks to attach a session, wants to see terminal output, check logs, run a command in a pane, or interact with any running process. Do not answer from memory — always call this tool first to get live state. WORKFLOW: After getting sessions, ask the user which session, call list_windows, ask which window, call list_panes, ask which pane, then call capture_pane.
Inputs: no named parameters.
list_windowsA
List all windows in a tmux session. Returns window index, name, pane count, and active status. If there is only one window, auto-select it without asking. If multiple, ask the user which window to use.
Inputs: session (required).
new_sessionA
Create a new detached tmux session. Before calling, use list_sessions to check whether a session with the requested name already exists.
Inputs: cwd, name, command.
new_windowB
Create a new window in an existing tmux session.
Inputs: session (required), cwd, name, command.
rename_sessionB
Rename an existing tmux session.
Inputs: session (required), new_name (required).
rename_windowA
Rename a window in a tmux session. Target format: 'session:window'.
Inputs: target (required), new_name (required).
send_keysA
Send keys or a command to a tmux pane, then capture its output. Target format: 'session:window.pane'. Use enter=false for raw tmux key sequences like 'C-c', 'Escape', or arrow keys — these are not shell commands and must not have Enter appended. Use enter=true (default) for shell commands. Set wait_ms higher for long-running commands; 0 captures immediately before output appears. WARNING: this executes arbitrary commands in your shell — only use with trusted input.
Inputs: keys (required), target (required), enter, wait_ms, +1 more.
split_paneA
Split a tmux pane horizontally or vertically. 'horizontal' = left/right panes side by side. 'vertical' = top/bottom panes stacked. Target format: 'session:window.pane' or 'session:window'.
Inputs: target (required), cwd, size, command, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 14 tools
Each tool targets a distinct tmux resource (session, window, pane) or action (list, capture, send, create, kill, rename). No overlapping purposes; even similar operations are clearly separated by resource type.
All tool names follow a consistent verb_noun snake_case pattern (e.g., list_sessions, kill_pane, rename_window). Verbs are appropriate and uniform, with no mixed naming styles.
14 tools is well-scoped for a tmux server. It covers the core lifecycle of sessions, windows, and panes without excess or shortage.
The set covers essential operations: listing, creating, killing, renaming, capturing output, and sending keys. Minor gaps exist (e.g., no pane resizing or moving), but the core workflow is complete.
Maintenance
Related MCP Connectors
Remote MCP server exposing your Node Command fleet (files, shell, processes, browser) to AI hosts.
Talk to your public-facing AI from any MCP client — Claude, ChatGPT, Cursor, Cline, Windsurf.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP server that gives AI assistants the ability to create, manage, and control terminal sessions through a safe, isolated tmux environment.1ISC
- FlicenseNot gradedqualityDmaintenanceMCP server for tmux operations that provides comprehensive control over tmux sessions, windows, and panes.1-
- AlicenseBqualityBmaintenanceA comprehensive MCP server for driving tmux sessions, windows, panes, sending keystrokes, and reading pane output locally or over SSH, enabling real-time collaborative pairing with AI.7120 PyPI6MIT
- AlicenseAqualityCmaintenanceMCP server for tmux enabling AI assistants to manage tmux sessions, windows, panes, layouts, and execute commands securely through natural language. Supports multiple profiles including read-only and full tool sets.222MIT