使用说明
Tmux MCP服务器
用于控制tmux会话、窗口和窗格的模型上下文协议(MCP)服务器。
特性
- 列出tmux会话、窗口和窗格
- 水平或垂直拆分窗格
- 向窗格发送命令
- 关闭并选择窗格
- 在新创建的窗格中执行命令
先决条件
安装
克隆此存储库:
git clone <repository-url>
cd tmuxmcp
用法
运行服务器
deno task start
或者直接:
deno run --allow-run=tmux --allow-env --allow-read main.ts
可用工具
list_sessions
列出所有tmux会话。
{}
list_windows
列出tmux会话中的窗口。
{
"session": "optional-session-name"
}
list_panes
列出tmux窗口或会话中的窗格。
{
"target": "optional-session:window"
}
split_pane
水平或垂直拆分tmux窗格。
{
"target": "optional-pane-id",
"direction": "horizontal | vertical",
"command": "optional-command-to-run"
}
例子:
{
"direction": "horizontal",
"command": "htop"
}
send_command
向tmux窗格发送命令。
{
"target": "optional-pane-id",
"command": "ls -la",
"enter": true
}
kill_pane
关闭一个tmux面板。
{
"target": "pane-id-or-index"
}
select_pane
选择一个tmux窗格。
{
"target": "pane-id-or-index"
}
工作流示例
-
列出当前会话:
{"tool": "list_sessions"} -
水平拆分当前窗格:
{ "tool": "split_pane", "direction": "horizontal" } -
向新窗格发送命令:
{ "tool": "send_command", "command": "npm run dev" }
Claude桌面配置
添加到您的Claude桌面配置(~/Library/Application Support/Claude/claude_desktop_config.json 在macOS上):
{
"mcpServers": {
"tmux": {
"command": "deno",
"args": ["run", "--allow-run=tmux", "--allow-env", "--allow-read", "jsr:@yumafuu/tmux-mcp"]
}
}
}
许可证
麻省理工学院