PTY Shell Sessions
๐๏ธ ๐ ๐ ๐ง - Interactive PTY sessions for AI agents โ local shells, SSH with persistent sessions (ai-tmux daemo
What is PTY Shell Sessions?
PTY Shell Sessions is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to ๐๏ธ ๐ ๐ ๐ง - interactive pty sessions for ai agents โ local shells, ssh with persistent sessions (ai-tmux daemo
๐๏ธ ๐ ๐ ๐ง - Interactive PTY sessions for AI agents โ local shells, SSH with persistent sessions (ai-tmux daemo
This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- MCP protocol support
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx ptyConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use PTY Shell Sessions
pty-mcp is an MCP server written in Haskell that provides AI agents with interactive PTY (pseudo-terminal) sessions, supporting local shells, remote SSH connections, and serial port devices. Unlike simple command execution, it maintains persistent sessions with full terminal emulation, supports pattern-based output waiting (wait_for), control key sequences, and optional session auditing. This enables AI agents to reliably run long-running processes, interact with interactive programs like database CLIs, and maintain SSH sessions that survive network interruptions.
Prerequisites
- macOS or Linux (PTY support required)
- Claude Code or another MCP-compatible client that supports plugins
- SSH config at ~/.ssh/config for remote host connections
- Go 1.21+ if building from source, or use the install script for pre-built binaries
- No external API keys required
Install via the install script (recommended)
Run the official install script to download and install the pre-built pty-mcp binary to /usr/local/bin.
curl -fsSL https://raw.githubusercontent.com/raychao-oao/pty-mcp/main/install.sh | shRegister with Claude Code
Add pty-mcp as an MCP server in Claude Code using the installed binary path.
claude mcp add pty-mcp -- /usr/local/bin/pty-mcpAlternatively, install from source via Go
If you prefer to build from source or want the latest commit, install using go install and register the binary.
go install github.com/raychao-oao/pty-mcp@latest
claude mcp add pty-mcp -- $(go env GOPATH)/bin/pty-mcpConfigure SSH hosts (for remote sessions)
Add your remote hosts to ~/.ssh/config so pty-mcp can use aliases, key paths, and ports automatically when creating SSH sessions.
# Example ~/.ssh/config entry
Host myserver
HostName 192.168.1.100
User deploy
IdentityFile ~/.ssh/id_ed25519Restart Claude Code and verify
Restart Claude Code to load the newly registered MCP server, then ask it to list available sessions to confirm pty-mcp is active.
PTY Shell Sessions Examples
Client configuration
Claude Desktop configuration for pty-mcp using the installed binary. Adjust the path if installed elsewhere.
{
"mcpServers": {
"pty-mcp": {
"command": "/usr/local/bin/pty-mcp",
"args": []
}
}
}Prompts to try
Example prompts that leverage pty-mcp's interactive session capabilities.
- "Open a local terminal session and run docker-compose up, then wait for 'ready' in the output"
- "SSH into myserver, run make build, and detach when it's complete"
- "Create a local session, start a Python REPL, and evaluate: 2 ** 10"
- "Ping myserver and wait until it responds โ it may take up to 5 minutes to reboot"
- "List all active PTY sessions"Troubleshooting PTY Shell Sessions
install.sh fails with permission denied
The install script writes to /usr/local/bin which may require sudo. Try: curl -fsSL https://raw.githubusercontent.com/raychao-oao/pty-mcp/main/install.sh | sudo sh
SSH session creation fails with host not found
Ensure the host is defined in ~/.ssh/config or provide the full hostname. Test connectivity manually with ssh user@hostname before using pty-mcp. Verify your SSH key is loaded with ssh-add.
read_output times out waiting for a pattern
Increase the timeout parameter in the read_output call. Also verify the wait_for pattern matches the actual output โ use a simpler substring rather than a complex regex. Check if the program uses stderr instead of stdout.
Frequently Asked Questions about PTY Shell Sessions
What is PTY Shell Sessions?
PTY Shell Sessions is a Model Context Protocol (MCP) server that ๐๏ธ ๐ ๐ ๐ง - interactive pty sessions for ai agents โ local shells, ssh with persistent sessions (ai-tmux daemo It connects AI assistants to external tools and data sources through a standardized interface.
How do I install PTY Shell Sessions?
Follow the installation instructions on the PTY Shell Sessions GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with PTY Shell Sessions?
PTY Shell Sessions works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is PTY Shell Sessions free to use?
Yes, PTY Shell Sessions is open source and available under the MIT License license. You can use it freely in both personal and commercial projects.
PTY Shell Sessions Alternatives โ Similar Developer Tools Servers
Looking for alternatives to PTY Shell Sessions? Here are other popular developer tools servers you can use with Claude, Cursor, and VS Code.
Ecc
โ 188.2kThe agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Javaguide
โ 155.8kJava ้ข่ฏ & ๅ็ซฏ้็จ้ข่ฏๆๅ๏ผ่ฆ็่ฎก็ฎๆบๅบ็กใๆฐๆฎๅบใๅๅธๅผใ้ซๅนถๅใ็ณป็ป่ฎพ่ฎกไธ AI ๅบ็จๅผๅ
Gemini CLI
โ 104.5kA secure MCP server that wraps the Google Gemini CLI, allowing clients to query Gemini models using local OAuth sessions without requiring an API key. It provides tools for model interaction and diagnostics with built-in protection against command in
Awesome MCP Servers
โ 87.3kโญ Curated list of Model Context Protocol (MCP) servers - tools that extend Claude Desktop, Cursor, Windsurf, and other MCP clients with custom capabilities.
MCP Servers
โ 86.0kModel Context Protocol Servers
CC Switch
โ 77.5kA cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Gemini CLI & Hermes Agent. Only official website: ccswitch.io
Browse More Developer Tools MCP Servers
Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up PTY Shell Sessions in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use PTY Shell Sessions?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.