
tmux-mcp
io.github.fr1sk由 GitHub 账号 fr1sk 发布v0.3.3更新于 Oct 24, 2026
MCP server for tmux — browse sessions, capture output, send commands.
概览
本地 MCP 服务器,让 AI 助手浏览 tmux 会话、窗口和窗格,读取终端输出,并发送命令或按键序列。
- 可以做什么
- 列出会话、窗口和窗格及其状态、尺寸和运行中的命令,并可重命名以便准确定位。捕获任意窗格的可见输出和回滚内容,最多 5000 行。向窗格发送 shell 命令或 Ctrl-C、Escape 等原始按键,并在可配置的等待后读取结果。创建会话、窗口和拆分窗格,可指定工作目录和初始命令。终止会话、窗口或单个窗格。
- 适用场景
- 适合在 tmux 中工作时使用:让助手查看正在运行的开发服务器、日志、测试运行或编译错误,并在可见、可审计的终端会话中执行命令,而不是在不可见的 shell 中。
- 运行要求
- 作为本地进程从 npm 安装运行,需要 Node.js 18 或更高版本,且 tmux 位于 PATH 中。可选环境变量 TMUX_MCP_ALWAYS_USE 和 TMUX_MCP_DEFAULT_SESSION 用于控制是否将命令路由到指定会话。无需账号或 API 密钥。
安装
在 SourceWeft 中
- 打开 控制台中的 tmux-mcp,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
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
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.
Returns: window index, name, pane count, whether it's the active window.
list_panes
Lists panes inside a session or window.
Returns: pane index, title, dimensions (e.g. 220x50), whether it's active, running command.
capture_pane
Captures the current terminal output of a pane.
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.
Returns: confirmation + pane output after the command ran.
new_session
Creates a new detached tmux session.
new_window
Creates a new window inside an existing session.
split_pane
Splits a pane into two.
kill_session
Kills a session and all its windows and panes. Destructive — cannot be undone.
kill_window
Kills a window and all its panes. Destructive.
kill_pane
Kills a single pane and its running process. Destructive.
rename_session
rename_window
Target format
All tools use tmux's standard session:window.pane notation:
Use list_sessions → list_windows → list_panes to discover the right target before calling capture_pane or send_keys.
Install
Configure
OpenCode (~/.config/opencode/opencode.json)
Claude Code (~/.claude/settings.json)
Cursor / Windsurf (mcp.json)
Usage examples
Environment variables
Set these in your MCP client config under environment to control agent behavior.
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):
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
来源:README.md,提交 22389f3
工具
0版本历史
1- v0.3.3最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分