MT

madappgang/tmux-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

23 stars 3 forks 质量 64 趋势 18

快速且快速的 tmux mcp 服务器

概览

面向代理的多分子复用MCP服务器——原生进程检测、智能触发器,以及一个句柄:时隙。 : 已安装 tmux,Go 1.26.1+ 或预构建的二进制文件。 添加到你的MCP客户端配置中(Claude代码用~/.claude/settings.json): 买个终端,在里面运行一些东西——不需要设置调用,也没有手柄需要携带: AI编码代理(Claude Code、Codex CLI、Gemini CLI、opencode)需要终端控制。现有MCP服务器将多工处理为愚蠢管道:发送命令,轮询输出,重复。 - 代理启动npm运行开发,需要知道服务器何时运行——而非何时产生输出。- 代理运行数据库迁移,需要检测psql何时存在——而非仅凭屏幕文本猜测。- 代理链式操作五次,且无法承担每步间的查找往返。- 代理在后台窗格中观察构建,同时进行其他工作。 这个项目直接解决了这四个问题。 快速且无依赖,但仅适用于它自身创建的无头终端。

概述(AI 翻译)

面向代理的多变形态MCP服务器——原生进程检测、智能触发器,以及 手柄:槽位。

快速开始

前提条件:已安装tmux、Go 1.26.1+或预建二进制。

添加到你的MCP客户端配置中(Claude代码的~/.claude/settings.json):

买个终端,在里面运行一些东西——不需要设置调用,也没有手柄需要携带:

为什么会有这样的存在

AI编码代理(Claude Code、Codex CLI、Gemini CLI、opencode)需要终端控制。 现有的MCP服务器把多工处理成一个愚蠢管道:发送命令,轮询输出,重复。

该模型分为四个方面:

  • 代理开始npm run dev,需要知道服务器何时准备好——而非何时 它能产生任何产出。
  • 代理运行数据库迁移,需要检测psql何时等待 password — 不是从屏幕文字猜测。
  • 代理连续五个操作,且无法在每步之间进行查找往返。
  • 代理在背景窗格中观察一个构建,同时进行其他工作。

这个项目直接解决了这四个问题。

比较

NICKGND/TMUX-MCP HT-MCP MCP-交互终端 TMUX-MCP(此)
语言 TypeScript Rust 节点。

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

tmux-mcp

Agent-oriented MCP server for tmux — native process detection, smart triggers, and one handle: the slot.

Quick start

Prerequisites: tmux installed, Go 1.26.1+ or a pre-built binary.

# Install via Go
go install github.com/MadAppGang/tmux-mcp/v2@latest

# Or build from source
git clone https://github.com/MadAppGang/tmux-mcp
cd tmux-mcp && go build -o tmux-mcp .

Add to your MCP client config (~/.claude/settings.json for Claude Code):

{
  "mcpServers": {
    "tmux": {
      "command": "tmux-mcp",
      "args": ["--shell-type", "zsh"]
    }
  }
}

Get a terminal and run something in it — no setup call, no handle to carry:

// A pane beside the agent is created on first use. Synchronous: blocks until
// the command finishes, and returns output plus the exit code.
{"tool": "execute-command", "params": {"command": "go build ./..."}}
// → {"slot": 1, "created": true, "output": "", "exitCode": 0, "timedOut": false}

// The same slot is the same pane next time.
{"tool": "capture-pane", "params": {}}
// → the pane's text, with structuredContent {"slot": 1}

Why this exists

AI coding agents (Claude Code, Codex CLI, Gemini CLI, opencode) need terminal control. Existing MCP servers treat tmux as a dumb pipe: send a command, poll for output, repeat.

That model breaks down in four ways:

  • An agent starts npm run dev and needs to know when the server is ready — not when it produced any output.
  • An agent runs a database migration and needs to detect when psql is waiting for a password — not guess from screen text.
  • An agent chains five operations and cannot afford a lookup round-trip between each step.
  • An agent watches a build in a background pane while doing other work.

This project solves those four problems directly.

Comparison

nickgnd/tmux-mcp ht-mcp mcp-interactive-terminal tmux-mcp (this)
Language TypeScript Rust Node.js Go
Tools 13 6 7 13
Dependencies Node.js / npx None Node.js + node-pty None (single binary)
Binary size ~node_modules ~4MB ~node_modules ~7MB
Async monitoring No No No Yes (blocking tools with progress notifications)
Process input detection No No Heuristic Native OS (kernel-level)
Structured JSON output Partial No No Yes (all tools)
Addressing pane IDs the agent must track one session one shell Stable slot numbers; no IDs anywhere
Invisible panes No Only invisible Only invisible Either, per slot (isolated)
Works beside the user No No No Yes — panes open in the window they are looking at
execute-command Polling N/A Heuristic Synchronous (tmux wait-for)

ht-mcp is fast and dependency-free but works only with headless terminals it creates itself. It cannot attach to existing sessions or manage pane layouts.

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "tmux": { "command": "tmux-mcp", "args": ["--shell-type", "zsh"] } } }