mcp-ssh-pty
v1.3.1
Published
MCP Server for SSH remote command execution with PTY shell support
Maintainers
Readme
mcp-ssh-pty
MCP Server for SSH remote command execution with PTY shell support.
Installation
npm install -g mcp-ssh-ptyAdd to Claude Code
claude mcp add --transport stdio ssh -- npx -y mcp-ssh-ptyCLI Commands
List servers
mcp-ssh-pty list # Auto-detect config level
mcp-ssh-pty list --local # Project level only
mcp-ssh-pty list --global # User level only
mcp-ssh-pty list --all # Show both levelsAdd server
# Interactive mode
mcp-ssh-pty add
# Save to project level
mcp-ssh-pty add my-server -l -H 192.168.1.100 -u root -k ~/.ssh/id_rsa
# Save to user level
mcp-ssh-pty add my-server -g -H 192.168.1.100 -u root -p mypasswordRemove server
mcp-ssh-pty remove my-server
mcp-ssh-pty remove --local # From project level
mcp-ssh-pty remove --global # From user levelTest connection
mcp-ssh-pty test my-serverInteractive configuration
mcp-ssh-pty configConfiguration
Config file locations
| Level | Path | Priority |
|-------|------|----------|
| Project | ./.claude/ssh-servers.json | High |
| User | ~/.claude/ssh-servers.json | Low |
| Custom | SSH_MCP_CONFIG_PATH env | Highest |
Config format
{
"servers": [
{
"name": "my-server",
"host": "192.168.1.100",
"port": 22,
"username": "root",
"privateKeyPath": "~/.ssh/id_rsa"
}
]
}MCP Usage
List Servers
ssh({ action: "list" })Returns:
[
{ "name": "local", "connected": false, "type": "built-in" },
{ "name": "my-server", "connected": false, "type": "configured" }
]Connect
ssh({ action: "connect", server: "local" }) # Local shell
ssh({ action: "connect", server: "my-server" }) # Remote SSHCommand Execution
ssh({ command: "ls -la" })
ssh({ command: "whoami" })Interactive Programs
ssh({ command: "mysql -u root -p" })
ssh({ command: "password123" })
ssh({ command: "SHOW DATABASES;" })Read Buffer
ssh({ read: true }) # Last 20 lines
ssh({ read: true, lines: -1 }) # All
ssh({ read: true, lines: 100 }) # 100 linesSignal Control
ssh({ command: "tail -f /var/log/syslog" })
ssh({ read: true })
ssh({ signal: "SIGINT" }) # Ctrl+CDisconnect
ssh({ action: "disconnect" })Status
ssh({ action: "status" })Built-in Servers
| Name | Description |
|------|-------------|
| local | Local shell (uses system default shell) |
License
MIT
