
用于交互式终端会话的 MCP 服务器 — 本地 shell, SSH, 串口, 和持久性远程会话
概览
MCP(模式上下文协议)服务器,提供AI代理交互终端会话——本地贝壳,SSH,串接端口,和在断开后幸存的持久远程会话. 为谁想要AI帮助真正的服务器和设备管理而建造,而不仅仅是代码生成. AI特工在非交互贝壳中运行命令. 它们不能: - SSH 进入服务器并与运行的进程交互 - 通过串行控制台连接路由器或开关 - 在特定事件发生时监视日志和反应 - 将会话状态跨越多个命令 - 等待服务器在备份时重启并检测 pty-mcp通过在MCP上提供真实的PTY会话来解决所有这些. 没有pty-mcp,AI代理商诉诸睡眠 30 QQ检查 状态循环——正在燃烧的CPU周期和API呼叫等待事情发生. 在等待时, 代理方会屏蔽服务器侧到事件发生 。 选票少,精力少,对北极熊来说更好.
概述(AI 翻译)
MCP(模式上下文协议)服务器,提供AI代理交互终端会话——本地贝壳,SSH,串接端口,和在断开后幸存的持久远程会话.
由sysadmins和网络工程师所建,他们希望AI帮助真正的服务器和设备管理,而不仅仅是代码生成.
为什么
AI特工在非交互贝壳中运行命令. 他们不能:
- SSH进入服务器并与运行的流程互动
- 通过串行控制台连接路由器或开关
- 监测日志,在发生特定事件时作出反应
- 跨越多个命令保持会话状态
- 等待一个服务器重启并检测它备份时
pty-mcp通过在MCP上提供真实的PTY会话来解决所有这些.
没有pty-mcp,AI代理商会诉诸sleep 30 && check_status循环——正在燃烧的CPU循环和API呼叫等待事情发生. 使用 wait_for,代理屏蔽服务器侧直到事件发生. 选票少,精力少,对北极熊来说更好. 🐻❄️
□ 使用大小写
** 公务员行政管理**
** 网络设备管理**
** 监测记录和警报**
** 长期运行的任务在断开时幸存**
□ 特性
- 特点* * 描述* *
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
pty-mcp
An MCP (Model Context Protocol) server that gives AI agents interactive terminal sessions — local shells, SSH, serial ports, and persistent remote sessions that survive disconnects.
Built for sysadmins and network engineers who want AI to help with real server and device management, not just code generation.
Why
AI agents run commands in non-interactive shells. They can’t:
- SSH into a server and interact with running processes
- Connect to routers or switches via serial console
- Monitor logs and react when a specific event occurs
- Keep session state across multiple commands
- Wait for a server to reboot and detect when it’s back up
pty-mcp solves all of these by providing real PTY sessions over MCP.
Without pty-mcp, AI agents resort to sleep 30 && check_status loops — burning CPU cycles and API calls waiting for things to happen. With wait_for, the agent blocks server-side until the event occurs. Less polling, less energy, better for polar bears. 🐻❄️
Use Cases
Server administration
# Reboot a server and wait until it's back online
create_local_session("ping myserver")
read_output(wait_for: "bytes from", timeout: 300)
→ blocks until server responds after reboot (~80s, one tool call)
Network device management
# Connect to a router via serial console
create_serial_session(port: "/dev/ttyUSB0", baud: 9600)
send_input("show interfaces status")
read_output(wait_for: "\\$")
Log monitoring and alerting
# Watch logs and act when something happens
create_ssh_session(host: "prod", user: "admin")
send_input("tail -f /var/log/app.log")
read_output(wait_for: "ERROR|CRITICAL", timeout: 3600)
→ returns the error line + context when it appears
Long-running tasks that survive disconnects
create_ssh_session(host: "server", user: "admin", persistent: true)
send_input("apt upgrade -y")
detach_session() → close Claude Code, task continues
# Reconnect later to check result
Features
| Feature | Description |
|---|---|
| Local terminal | Interactive bash/python/node sessions on local machine |
| SSH sessions | Connect to remote hosts with key/password auth, SSH config support |
| Serial port | Connect to devices via serial (IoT, embedded, network gear) |
| Persistent sessions | Sessions survive SSH disconnects via ai-tmux daemon |
| Attach/Detach | Detach from a running session, reconnect later |
| Control keys | Send ctrl+c, ctrl+d, arrow keys, tab, escape |
| Settle detection | Waits for output to settle before returning (smart timeout) |
| Pattern matching | wait_for blocks until a regex pattern appears in output (v0.2.0) |
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →