PTY Shell Sessions

v0.2.3โ€ขDeveloper Toolsโ€ขstable

๐ŸŽ๏ธ ๐Ÿ  ๐ŸŽ ๐Ÿง - Interactive PTY sessions for AI agents โ€” local shells, SSH with persistent sessions (ai-tmux daemo

aibashcabalclean-architectureghc
Share:
38
Stars
0
Downloads
0
Weekly
0/5

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

Interactive shell sessions
SSH persistent connections
Terminal emulation
raychao-oao

Maintainer

LicenseMIT License
Languagehaskell
Versionv0.2.3
UpdatedMay 21, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx pty

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

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
1

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 | sh
2

Register 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-mcp
3

Alternatively, 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-mcp
4

Configure 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_ed25519
5

Restart 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.

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.

Quick Config Preview

{ "mcpServers": { "pty": { "command": "npx", "args": ["-y", "pty"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide โ†’

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.

33,000+ ServersFree & Open SourceStep-by-Step Guides