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 "Install 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-mcplist 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
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Flicense-qualityDmaintenanceAn MCP server that gives AI assistants the ability to create, manage, and control terminal sessions through a safe, isolated tmux environment.Last updated1
- Flicense-qualityDmaintenanceMCP server for tmux operations that provides comprehensive control over tmux sessions, windows, and panes.Last updated1
- AlicenseAqualityCmaintenanceMCP server for terminal control enabling AI to manage terminal sessions via iTerm2 or tmux, with features like screen reading, keyboard/mouse input, and background execution.Last updated94321MIT
- AlicenseBqualityAmaintenanceA 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.Last updated711MIT
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
MCP server for Gainium — manage trading bots, deals, and balances via AI assistants
MCP server for AI dialogue using various LLM models via AceDataCloud
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/fr1sk/tmux-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server