ssh_exec
Run remote commands over SSH with full shell support, env variable injection, timeout control, and policy enforcement. Returns stdout, stderr, and exit code for automation and diagnostics.
Instructions
Execute a command on a remote host via SSH. The command is interpreted by the remote login shell — pipes, redirects, globs, and other shell metacharacters work as expected. Returns stdout, stderr, and exit code. Use env to set environment variables for this call without modifying the command string. Subject to SSH_MCP_COMMAND_WHITELIST / SSH_MCP_COMMAND_BLACKLIST if configured (policy is checked against the env-prefixed command).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| env | No | Environment variables to set for this command. Injected as a `KEY='value' ...` prefix; works on any sshd regardless of AcceptEnv config. Values are POSIX-single-quoted, so any byte is safe. | |
| host | Yes | SSH hostname or IP address | |
| port | No | SSH port (default: 22) | |
| command | Yes | Shell command to execute on the remote host (interpreted by the remote login shell) | |
| timeout | No | Command timeout in milliseconds (default: 30000) | |
| username | No | SSH username (default: current user) | |
| credential_id | No | Alias of an SSH password configured only on the MCP server (for example, ssh1 resolves to SSH_CREDENTIAL_SSH1). Never pass a real password here. | |
| privateKeyPath | No | Path to SSH private key |