MCP Server for SSH remote command execution with PTY shell support
npm install mcp-ssh-ptyMCP Server for SSH remote command execution with PTY shell support.
``bash`
npm install -g mcp-ssh-pty
`bash`
claude mcp add --transport stdio ssh -- npx -y mcp-ssh-pty
`bash`
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 levels
`bashInteractive mode
mcp-ssh-pty add
$3
`bash
mcp-ssh-pty remove my-server
mcp-ssh-pty remove --local # From project level
mcp-ssh-pty remove --global # From user level
`$3
`bash
mcp-ssh-pty test my-server
`$3
`bash
mcp-ssh-pty config
`Configuration
$3
| Level | Path | Priority |
|-------|------|----------|
| Project |
./.linMCP/ssh-servers.json | High |
| User | ~/.linMCP/ssh-servers.json | Low |
| Custom | SSH_MCP_CONFIG_PATH env | Highest |$3
`json
{
"servers": [
{
"name": "my-server",
"host": "192.168.1.100",
"port": 22,
"username": "root",
"privateKeyPath": "~/.ssh/id_rsa"
}
]
}
`MCP Usage
$3
`
ssh({ action: "list" })
`Returns:
`json
[
{ "name": "local", "connected": false, "type": "built-in" },
{ "name": "my-server", "connected": false, "type": "configured" }
]
`$3
`
ssh({ action: "connect", server: "local" }) # Local shell
ssh({ action: "connect", server: "my-server" }) # Remote SSH
`$3
`
ssh({ command: "ls -la" })
ssh({ command: "whoami" })
`$3
`
ssh({ command: "mysql -u root -p" })
ssh({ command: "password123" })
ssh({ command: "SHOW DATABASES;" })
`$3
`
ssh({ read: true }) # Last 20 lines
ssh({ read: true, lines: -1 }) # All
ssh({ read: true, lines: 100 }) # 100 lines
`$3
`
ssh({ command: "tail -f /var/log/syslog" })
ssh({ read: true })
ssh({ signal: "SIGINT" }) # Ctrl+C
`$3
`
ssh({ action: "disconnect" })
`$3
`
ssh({ action: "status" })
`Built-in Servers
| Name | Description |
|------|-------------|
|
local` | Local shell (uses system default shell) |MIT