agent-mux
MCP server that manages interactive CLI agent pools using tmux, enabling creation, control, and communication with agents like Claude and Codex.
README
I have a new version which name is Hydra,more powerful,see detail in https://github.com/JinchengGao-Infty/Hydra?tab=readme-ov-file
Agent Mux
Agent Mux is a tmux-backed agent pool plus a small MCP (Model Context Protocol) server. It manages “projects” as tmux sessions, and spawns each interactive agent as a tmux window so you can:
- Create/list/switch/close projects (tmux sessions)
- Spawn/list/attach/interrupt/kill agents (tmux windows)
- Send text to an agent (type + Enter)
- Read output from an agent (via
tmux capture-pane)
This repo keeps the agent-mux implementation under lib/agent-mux/, and exposes it as MCP tools via
servers/agent-mux-server.mjs.
Why tmux?
tmux provides durable sessions you can inspect manually, and a simple way to capture rendered terminal output—making it a practical substrate for orchestrating interactive CLI agents.
Features
- Dedicated tmux socket: uses
tmux -L ccx ...so it won’t interfere with your default tmux - One project = one session, one agent = one window (single pane)
- Persistent registry under
.ccx/projects/<project>/agents.json - Per-agent log file via
pipe-paneto.ccx/projects/<project>/logs/<agent>.log - Conservative name validation for projects and agents
Requirements
- Node.js 18+ (ESM)
tmuxinPATH- Optional agent CLIs (only needed if you use default commands):
claude(default args:--dangerously-skip-permissions)codex(default args:--yolo)gemini(default args:--yolo)
Installation
From the repo root:
npm install
Quick start (manual tmux)
After you create a project and spawn agents, you can inspect the tmux session:
tmux -L ccx attach -t <project>
# Detach without closing: Ctrl-b d
# Switch windows: Ctrl-b 0/1/2/...
Quick start (MCP server)
Run the MCP server (stdio):
node servers/agent-mux-server.mjs
Then register it in your MCP client as a stdio server. Example (client formats vary):
{
"mcpServers": {
"agent-mux": {
"command": "node",
"args": ["servers/agent-mux-server.mjs"]
}
}
}
Usage examples
Via MCP tools
Typical flow:
- Create/select a project
create_project({ "name": "my-project", "cwd": "/path/to/workdir" })switch_project({ "name": "my-project" })
- Spawn an agent
spawn_agent({ "type": "codex", "name": "codex-1" })
- Talk to it
send_to_agent({ "name": "codex-1", "text": "hello" })
- Read output
read_agent_output({ "name": "codex-1", "lines": 50 })
As a library (Node.js)
import { AgentMux } from "./lib/agent-mux/index.mjs";
const mux = new AgentMux({ projectRoot: process.cwd(), tmuxSocketName: "ccx" });
mux.create_project("my-project", process.cwd());
mux.spawn_agent("codex", "codex-1");
mux.send_to_agent("codex-1", "hello");
const { output } = mux.read_agent_output("codex-1", 50);
console.log(output);
MCP tools
The MCP server exposes these tools (names match the AgentMux methods):
Project management
create_project({ name, cwd? })list_projects({})switch_project({ name })close_project({ name })
Agent management
spawn_agent({ type, name, options? })list_agents({ project? })attach_agent({ name })interrupt_agent({ name })kill_agent({ name })
Agent I/O
send_to_agent({ name, text })read_agent_output({ name, lines? })send_to_window({ window, text })
API (library)
Naming rules
Project names and agent names must match:
^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$
new AgentMux(options?)
options.projectRoot(string): base dir used for registry/log storage; defaultprocess.cwd()options.tmuxSocketName(string): tmux socket name fortmux -L; defaultccxoptions.tmuxBinary(string): tmux binary; defaulttmux
Project management
create_project(name, cwd?)→{ project, cwd, created, storageDir }list_projects()→Array<{ project, cwd, sessionExists, hasRegistry, current }>switch_project(name)→{ project, switched, clients }close_project(name)→{ project, killed, clearedCurrent }
Agent management
spawn_agent(type, name, options?)→ agent entry (tmux window + registry + log path)type: one ofclaude/codex/geminioptions.cwd(string): agent working dir (defaults to project cwd)options.command/options.cmd(string): override executed commandoptions.args(string[]): extra args appended to defaults (or used with custom command)
list_agents(project?)→{ project, agents: [...entries with alive:boolean] }attach_agent(name)→{ project, agent, attached, clients }interrupt_agent(name)→{ project, agent, interrupted }(sendsCtrl+C)kill_agent(name)→{ project, agent, killed }
Agent I/O
send_to_agent(name, text)→{ project, agent, sent, bytes }send_to_window(window, text)→{ project, window, sent, bytes }read_agent_output(name, lines=200)→{ project, agent, lines, output }
Storage layout
By default, Agent Mux stores state under projectRoot/.ccx/projects/:
.ccx/projects/<project>/
project.json
agents.json
logs/<agent>.log
.ccx/projects/current.json
If .ccx/ is not writable, it falls back to ${os.tmpdir()}/ccx-agent-mux/projects/.
License (MIT)
MIT License
Copyright (c) 2026 Agent Mux Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。