One persistent tmux-backed terminal for AI agents. ssh, docker exec, and REPLs nest inside a single authenticated session (no re-auth per command). Token-reduced reads, 4-layer completion detection, and a human can co-drive via the shared tmux socket. Install: npx -y aiterm-mcp
Overview
aiterm-mcp
Give an AI one persistent terminal as a stdio MCP server. It holds one local PTY; ssh, docker exec, and REPLs are just text you send into it — so the AI stops reconnecting for every command. Reads come back token-reduced.
Why
Over SSH, one-command-at-a-time means re-authenticating every call, short-lived sessions piling up, and fail2ban locking you out of your own box. aiterm holds one authenticated session, so that never happens.
Install (Claude Code)
claude mcp add --scope user --transport stdio aiterm -- npx -y aiterm-mcp
Any MCP client: run npx -y aiterm-mcp over stdio. Needs Node ≥ 18 and tmux.
What you get
- One persistent tmux-backed terminal (survives restarts)
- SSH / containers / REPLs nest with one
pty_send— authenticate once, one session - Token-reduced reads (per-command reducers for git / grep / pytest)
- 4-layer completion detection (exit /
until/ quiescence / timeout) - A human can co-drive via the shared tmux socket
Six tools: pty_open / pty_send / pty_read / pty_key / pty_close / pty_list.
MIT · Linux / WSL2 / macOS / native Windows.
Server Config
{
"mcpServers": {
"aiterm": {
"command": "npx",
"args": [
"-y",
"aiterm-mcp"
]
}
}
}