cmuxlayer
Terminal multiplexer MCP server for orchestrating parallel AI agents. Manages workspaces, panes, surfaces with send_input/read_screen/spawn_agent/stop_agent tools. Supports Claude Code, Codex, Gemini, Cursor CLI agents with lifecycle management, browser automation, and agent status push via Claude --channels.
README
cmuxlayer
Terminal multiplexer MCP — multi-agent workspace orchestration for cmux.
<p align="center"> <img src="./assets/cmuxlayer-logo-split-pane-grid.svg" alt="cmuxlayer Split Pane Grid logo" width="96" height="96" /> </p>
233 tests · 1,423x socket speedup · Native MCP in cmux Swift fork · 10 MCP tools · Agent lifecycle engine
cmuxlayer gives AI agents programmatic control over terminal workspaces via MCP. Spawn split panes, send commands, read screen output, manage agent lifecycles — all through typed MCP tools that any MCP-compatible AI client can use.
read_screen returns raw terminal text alongside structured parsed agent metadata for common CLI agents including Claude, Codex, and Gemini. That makes status checks, done-signal detection, token counting, and model extraction available directly through MCP without forcing each client to re-parse terminal output.
Quick Start
git clone https://github.com/EtanHey/cmuxlayer.git && cd cmuxlayer
bun install
bun run build
Add to your editor's MCP config:
{
"mcpServers": {
"cmux": {
"command": "node",
"args": ["/path/to/cmuxlayer/dist/index.js"]
}
}
}
Requires cmux to be installed and running.
Claude Channels Preview
Set CMUXLAYER_ENABLE_CLAUDE_CHANNELS=1 in the server environment and launch Claude Code with --channels <server-name> plus --dangerously-load-development-channels <server-name> during preview. With that enabled, cmuxlayer advertises experimental["claude/channel"] and emits one-way notifications/claude/channel updates when tracked agents are spawned, finish, or error.
See docs/claude-channels-mobile.md for the notification format, OpenClaw pairing patterns worth stealing, and the remaining gaps for a real cmux mobile client.
MCP Tools (10)
| Tool | Description |
|---|---|
list_surfaces |
List all surfaces across workspaces |
new_split |
Create a new split pane (terminal or browser) |
send_input |
Send text to a terminal surface (with optional enter/rename) |
send_key |
Send a key press to a surface |
read_screen |
Read raw screen text plus parsed agent state from a surface |
rename_tab |
Rename a surface tab (with optional prefix preservation) |
set_status |
Set sidebar status key-value pair |
set_progress |
Set sidebar progress indicator (0.0-1.0) |
close_surface |
Close a surface |
browser_surface |
Interact with browser surfaces |
Architecture
AI Agent ─── MCP ───> cmuxlayer
├── Persistent socket connection (1,423x faster than CLI)
├── Agent lifecycle engine (spawn, monitor, teardown)
├── Mode policy (autonomous vs manual control)
├── Event log + state manager
└── Pattern registry for naming conventions
Key Components
| File | Role |
|---|---|
cmux-socket-client.ts |
Persistent Unix socket connection to cmux (1,423x speedup over CLI) |
cmux-client.ts |
CLI wrapper fallback |
server.ts |
MCP tool registration and handlers |
agent-engine.ts |
Agent lifecycle — spawn, monitor, quality tracking |
agent-registry.ts |
Registry of active agents across surfaces |
naming.ts |
Surface naming rules (launcher prefix preservation) |
mode-policy.ts |
Mode enforcement (autonomous = full access, manual = read-only) |
state-manager.ts |
Sidebar state synchronization |
event-log.ts |
Audit trail for all agent actions |
pattern-registry.ts |
Reusable patterns for common workflows |
Mode Model
Two axes per surface:
- control:
autonomous(full access) ormanual(read-only for mutating tools) - intent:
chatoraudit
Set via set_status with reserved keys mode.control / mode.intent.
Socket Performance
cmuxlayer connects to cmux via a persistent Unix socket instead of spawning CLI subprocesses:
| Method | Latency | Throughput |
|---|---|---|
| CLI subprocess | ~142ms | Baseline |
| Persistent socket | ~0.1ms | 1,423x faster |
The socket client auto-reconnects on disconnect and falls back to CLI if the socket is unavailable.
Upstream Contributions
cmuxlayer development has contributed back to cmux:
| PR | Status | What |
|---|---|---|
| #1522 | Open | Fix: background workspace PTY initialization |
| #1562 | Open | Fix: thread starvation in MCP server |
Testing
bun run test # 230 tests via vitest
bun run typecheck # Type checking
Development
bun install
bun run dev # Run with tsx (hot reload)
bun run build # Compile TypeScript
bun run start # Run compiled output
Contributing
See CONTRIBUTING.md for development setup and PR guidelines.
License
Apache 2.0 — see LICENSE.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。