# pty-mcp

An MCP server that gives the agent interactive terminal sessions: local shell, SSH, serial ports, and remote sessions that survive disconnects.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed · ★ 20
- Author: raychao-oao
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/raychao-oao/pty-mcp
- Updated: 2026-10-22
- HTML: https://affpapa.org/en/nevibecode/mcp/pty-mcp

## What it 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.

## Install

### Claude Code (native platform)

**Install**
- The MCP registry has no launch command for it: see the repository README

## When to use it
- 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
- SSH into `prod.example.com` as user `admin` and run `systemctl status nginx`
- Open a local terminal, start `tail -f /var/log/app.log`, and wait for a line containing `CRITICAL`
- Connect to `/dev/ttyUSB0` at 9600 baud and send the command `show interfaces`

## Similar
- [GitHub](https://affpapa.org/en/nevibecode/mcp/github.md) — MCP server · ★ 33918
- [Netdata](https://affpapa.org/en/nevibecode/mcp/netdata.md) — MCP server · ★ 81115
- [Oh My Posh Validator](https://affpapa.org/en/nevibecode/mcp/oh-my-posh-validator.md) — MCP server · ★ 23643
- [Keploy](https://affpapa.org/en/nevibecode/mcp/keploy.md) — MCP server · ★ 18727
- [Coder](https://affpapa.org/en/nevibecode/mcp/coder.md) — MCP server · ★ 17160
- [mcp](https://affpapa.org/en/nevibecode/mcp/kubeshark-mcp.md) — MCP server · ★ 12109

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
