ssh_connect
Add an SSH host at runtime and open the connection, returning an alias to use with other tools like ssh_exec. Provide credentials via password or key file, or rely on SSH agent.
Instructions
Add a new SSH host at runtime and open the connection. Call this first before using ssh_exec / ssh_spawn / ssh_upload / ssh_download on a new server.
Returns an alias (e.g. 'h-3f8a1b2c') that you pass as the 'host' argument to all other tools. If you supply your own alias it will be used instead.
Auth: provide exactly one of password or key_path. If neither is given, paramiko tries the SSH agent and default key files (~/.ssh/id_*).
Calling ssh_connect again with the same alias updates the credentials and reconnects.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| host | Yes | IP address or hostname of the remote server. | |
| user | No | SSH username. Default ``root``. | root |
| password | No | SSH password (plain text). Mutually exclusive with ``key_path``. Passing it here is safe — the value is never logged (only the byte count appears in DEBUG logs), and it lives only in the server process's memory for the duration of the connection. | |
| key_path | No | Path to a private key file on the LOCAL machine running the MCP server. Mutually exclusive with ``password``. | |
| port | No | SSH port. Default 22. | |
| alias | No | Optional short name for this host. When omitted, a stable alias is auto-generated from (host, port, user) so the same credentials always produce the same alias. Callers can pass a memorable name like ``"prod"`` or ``"mybox"`` to make subsequent tool calls more readable. | |
| insecure_auto_add | No | Accept unknown host keys automatically (paramiko AutoAddPolicy). Default True because this tool is typically called in interactive sessions where the user is actively choosing a target — production pinned deployments should use a TOML config with a known_hosts path instead. Set to False to require the host key to already be in the system known_hosts. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||