termmirror
termmirror
一个 MCP 服务器,让 AI 智能体获得真正的交互式终端会话——同时提供一个实时网页视图,人类可以观看这些会话并在其中输入。
大多数智能体工具只能运行会自动退出的命令。任何会提示输入、重绘画面或等待按键的程序都无法企及:安装程序、带有密码质询的 ssh、pdb、vim、软件包管理器的配置界面——以及另一个智能体的 CLI。termmirror 保持真正的 PTY 会话开启,让智能体可以像人一样操作它们,一次一个按键,同时人类可以在旁观看,并在需要时介入。

一个智能体通过 termmirror 驱动 Claude Code 会话——它接受了信任提示,问了一个问题,并从屏幕上读到了答案。浏览器视图是实时的,在其中的输入会直接进入同一个终端。

同样的工具下的全屏 TUI:智能体打开了 vim,移动到文件末尾,进入插入模式,并输入了一行。
功能
真正的 PTY 会话。 由
node-pty提供支持,并带有一个持有屏幕状态的无头终端模拟器。不依赖tmux或其他外部依赖。为 TUI 而生。 备用屏幕检测、控制键和导航键的按键编码,以及可将软换行还原的回滚功能。
可靠的等待。
wait会在程序作出响应并且稳定下来后返回,因此你读到的屏幕反映的是你的输入,而不是输入之前的状态。实时网页视图。 任何会话在运行过程中都可以在浏览器中观看。在页面中键入会直接进入 PTY,因此人类可以接管并交还控制权。
智能体到智能体。 其设计使得一个智能体可以通过多轮对话驱动另一个智能体的 CLI。
Related MCP server: ddx-term-mcp
系统要求
Node.js 20 或更高版本
macOS 或 Linux
安装
git clone https://github.com/Ar9av/termmirror.git
cd termmirror
npm install && npm run build向 Claude Code 注册服务器:
claude mcp add termmirror -- node /absolute/path/to/termmirror/dist/src/index.js任何 MCP 客户端都可以使用;服务器通过 stdio 通信。
用法
三个工具,按以下顺序使用:
send_input → wait → read_screenread_screen 返回当前屏幕的样子——一张屏幕截图,而不是所有打印内容的日志。wait 才是让它值得一读的原因:它会阻塞,直到程序作出响应并安静下来,因此你看到的是按键之后的状态。
工具
工具 | 描述 |
| 启动一个会话(默认为 |
| 向会话输入文本,可选择按 Enter 提交。 |
| 发送 |
| 以纯文本形式返回可见屏幕; |
| 等待会话响应并稳定( |
| 列出所有会话(存活或已退出)及其观看 URL。 |
| 更改终端尺寸。 |
| 终止会话。 |
等待
idle 是默认选项,也是大多数情况下的正确选择。交互式程序在运行时会持续重绘,当轮到您时便静默,因此静默是一个可靠的完成信号——包括对于那些没有可匹配提示的旋转指示器和 TUI 也是如此。对于较慢的操作,请增大 timeout。
no_output 结果表示自您输入以来没有任何返回:程序要么正在忙碌而保持静默,要么输入从未被记录。
当预期文本已知时,请使用 pattern。它会匹配整个屏幕,包括您自己回显的输入,因此请等待程序打印的内容,而不是您刚刚输入的标记。
观看会话
第一个会话会在 7878 端口启动一个本地 Web 服务器。打开 create_session 返回的 URL 即可实时观看该会话。在页面中键入会直接写入 PTY,这样人类就可以输入密码或回答不应由智能体处理的提示,然后交还控制权——无需交接协议,只是从另一端使用同一个终端。
变量 | 作用 |
| 网页视图的端口(默认 |
| 设置为 |
示例
node examples/drive-claude.mjs "what is 2+2? reply with just the number"一个智能体启动 claude,接受其信任提示,问了一个问题,并从屏幕上读出了答案——这些工具与 MCP 接口暴露的工具相同,只是逐项写出。
开发
npm run build # compile TypeScript to dist/
npm test # build, then run the test suite该测试套件涵盖了服务器其余部分所依赖的等待语义、按键编码、回滚、网页视图的实时流和接管输入,以及通过真实 MCP 协议进行的端到端运行。
关于名称的说明
这个包名为 termmirror,有两个 m。alias/termirror/ 是一个依赖它的存根包,因此单个 m 的拼写也能解析到正确的位置。
许可证
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceProvides AI agents with fully interactive terminal sessions, including TUI support, keyboard control, and screen capture across Windows, Linux, and Mac.MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to execute commands in a shared tmux session that is simultaneously visible to a human via a web-based terminal UI.1MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to interact with interactive CLI processes via a real PTY, allowing them to send keystrokes, read screen output, and handle interactive prompts.61MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to spawn and interact with real terminal sessions, capturing screenshots of rendered TUI output and sharing live sessions for debugging.31MIT
Related MCP Connectors
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Let AI operate servers without SSH. Choose actions, approve risky changes, and audit every step.
Turns any agent into a full agentic application — branded, interactive screens generated at runtime.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Ar9av/termmirror'
If you have feedback or need assistance with the MCP directory API, please join our Discord server