PTY Debug MCP Server
Enables Claude Code to control vim, allowing automated editing, testing, and navigation within the Vim editor.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@PTY Debug MCP ServerSpawn a vim session, type 'Hello World', and save."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
PTY Debug MCP Server
MCP server for debugging PTY/TTY/TUI programs. Enables Claude Code to spawn, interact with, and capture screen output from any terminal-based program.
Use Case: TUI Debugging
This MCP server allows Claude Code to control Claude Code itself, vim, top, and other TUI programs. This enables:
Automated TUI testing
Debugging terminal applications
Screen scraping from interactive programs
CI/CD integration for TUI apps
Demo: Claude Code controlling Claude Code
1. spawn_session({ command: "claude" })
2. send_input({ specialKey: "shift+tab" }) // cycle modes
3. send_input({ input: "what is 1+1?" })
4. send_input({ specialKey: "enter" })
5. get_snapshot() // see Claude's responseDemo: Claude Code controlling vim
1. spawn_session({ command: "vim", args: ["test.txt"] })
2. send_input({ input: "i" }) // enter INSERT mode
3. send_input({ input: "Hello World!" }) // type text
4. send_input({ specialKey: "escape" }) // exit INSERT mode
5. send_input({ input: ":wq" }) // save command
6. send_input({ specialKey: "enter" }) // executeRelated MCP server: MCP TUI Test
Installation
Claude Code
claude mcp add pty-debug -- npx -y @so2liu/pty-mcp-server@latestClaude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"pty-debug": {
"command": "npx",
"args": ["-y", "@so2liu/pty-mcp-server@latest"]
}
}
}VS Code / Copilot
Add to VS Code settings or .vscode/mcp.json:
{
"mcpServers": {
"pty-debug": {
"command": "npx",
"args": ["-y", "@so2liu/pty-mcp-server@latest"]
}
}
}Cursor
Add to ~/.cursor/mcp.json:
{
"mcpServers": {
"pty-debug": {
"command": "npx",
"args": ["-y", "@so2liu/pty-mcp-server@latest"]
}
}
}Cline
Add to Cline MCP settings:
{
"mcpServers": {
"pty-debug": {
"command": "npx",
"args": ["-y", "@so2liu/pty-mcp-server@latest"]
}
}
}Gemini CLI
gemini mcp add pty-debug -- npx -y @so2liu/pty-mcp-server@latestCodex CLI
codex mcp add pty-debug -- npx -y @so2liu/pty-mcp-server@latestMCP Tools
Tool | Description |
| Start a TUI program in a PTY |
| Send text or special keys |
| Capture current screen state |
| Change terminal dimensions |
| List active sessions |
| Terminate a session |
Special Keys
Supports all common shortcuts:
Basic:
enter,tab,shift+tab,escape,backspace,deleteArrows:
up,down,left,rightWith modifiers:
shift+up,ctrl+right,alt+left, etc.Control:
ctrl+atoctrl+zAlt:
alt+atoalt+zFunction:
f1tof12Navigation:
home,end,pageup,pagedown
Screen Snapshot Format
-------------------------------------------------------------------------------------
1 |Processes: 643 total, 3 running, 640 sleeping 17:57:23 |
2 |Load Avg: 2.38, 2.75, 2.88 CPU usage: 13.13% user, 4.49% sys |
3 |... |
-------------------------------------------------------------------------------------Development
# Install dependencies
bun install
# Development mode
bun run dev
# Build
bun run build
# Lint
bun run lintTech Stack
Node.js (runtime)
TypeScript
node-pty (PTY spawning)
@xterm/headless (terminal emulation)
@modelcontextprotocol/sdk (MCP server)
Publishing
Releases are automatically published to npm via GitHub Actions.
Setup (one-time)
Create npm granular token at https://www.npmjs.com/settings/tokens/granular-access-tokens/new
Expiration: 90 days
Packages:
@so2liu/pty-mcp-serverPermissions: Read and write
Add
NPM_TOKENsecret at https://github.com/so2liu/pty-mcp/settings/secrets/actionsSet calendar reminder to rotate token every 90 days
Release new version
Update version in
package.jsonCreate a GitHub release with tag (e.g.,
v1.0.1)GitHub Actions will automatically publish to npm
License
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
remote debug iOS/Android/Unity/Godot/Flutter/RN/Web on real-device.ui-tree/screenshots/taps,tests.
Drive real devices from your AI Coding tool. Embed a client SDK (Unity, Godot, Flutter, iOS/macOS, Android, React Native, Web) in your app, then capture screenshots, traverse the UI tree, inject taps and key events, and run automated test tasks on the physical device over a secure relay.
- TabfleetOAuthcom.tabfleet
Launch, inspect, control, and share isolated cloud browsers for your agents.
Automate cloud Chrome—navigate, click, type, screenshot, run code, record screen video
Related MCP Servers
- 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.4 npm1MIT
- AlicenseNot gradedqualityFmaintenanceEnables AI assistants to test Terminal User Interface (TUI) applications by launching, interacting with, and verifying programmatic output and behavior.16MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to spawn and interact with real terminal sessions, capturing screenshots of rendered TUI output and sharing live sessions for debugging.2 npm1MIT
- AlicenseAqualityAmaintenanceEnables interaction with long-running interactive programs such as SSH, GDB, and REPLs. Provides tools to start, monitor, control, read/write I/O for these processes.131MIT