pty-mcp — Claude Code MCP server: interactive terminals and SSH
An MCP server that gives the agent interactive terminal sessions: local shell, SSH, serial ports, and remote sessions that survive disconnects.
Open on GitHubWhat pty-mcp does
The agent gets tools like create_local_session, create_ssh_session, create_serial_session, send_input, read_output, and wait_for. You can SSH into a server and issue commands, wait for an event in a log (the server blocks the call until the pattern appears in output — no polling loop), connect to a router over /dev/ttyUSB0, or start apt upgrade and detach — the session continues on the remote host via the ai-tmux daemon.
The server is written in Go, the binary is a few megabytes, runs on macOS, Linux, and WSL2. Persistent remote sessions require installing ai-tmux on the target host (via install.sh script or manual binary copy). Serial port access requires device permissions. The optional audit log records commands to a collector, scrubbing credentials before writing.
What it helps with
- SSH into a server and run an interactive command
- Watch a log and react when an ERROR line appears
- Connect to a router or switch over a serial port
- Start a long-running task on a remote host and detach before it finishes
- Reboot a server and wait until it responds to ping again
Example prompts for the agent
- SSH into
prod.example.comas useradminand runsystemctl status nginx - Open a local terminal, start
tail -f /var/log/app.log, and wait for a line containingCRITICAL - Connect to
/dev/ttyUSB0at 9600 baud and send the commandshow interfaces
How to install pty-mcp
Install
The MCP registry has no launch command for it: see the repository README
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about pty-mcp
How to install pty-mcp in Claude Code?
Run claude plugin marketplace add raychao-oao/pty-mcp, then claude plugin install pty-mcp@pty-mcp, and restart Claude Code twice — the first restart downloads the binary, the second activates the server.
What does pty-mcp do?
It gives the agent interactive terminal sessions: local shell, SSH, serial ports, and remote sessions that persist after disconnect. The agent can SSH into a server, send commands, wait for events in output, and manage long-running tasks.
Do I need to install anything on the remote host?
For persistent sessions (those that survive SSH disconnect), you need to install the ai-tmux daemon on the remote server. For regular SSH sessions, nothing extra is required.