ssh_exec
Execute commands on remote SSH servers through the mcpHydroSSH server to manage and control systems directly from your workflow.
Instructions
Execute a command on an SSH server
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| command | Yes | Command to execute | |
| connectionId | No | Connection ID (optional, uses most recent if not provided) | |
| timeout | No | Command timeout in milliseconds (optional) | |
| cwd | No | Working directory (optional) |
Implementation Reference
- src/index.ts:349-375 (handler)Handler for the ssh_exec tool which executes commands using the sshManager.
case 'ssh_exec': { const command = args.command as string; const connectionId = args.connectionId as string | undefined; const timeout = args.timeout as number | undefined; const cwd = args.cwd as string | undefined; try { const result = await sshManager.exec(command, connectionId, { timeout, cwd }); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; } catch (err: unknown) { return { content: [ { type: 'text', text: JSON.stringify({ error: err instanceof Error ? err.message : String(err) }, null, 2), }, ], isError: true, }; } } - src/index.ts:81-105 (schema)Schema definition for the ssh_exec tool.
name: 'ssh_exec', description: 'Execute a command on an SSH server', inputSchema: { type: 'object', properties: { command: { type: 'string', description: 'Command to execute', }, connectionId: { type: 'string', description: 'Connection ID (optional, uses most recent if not provided)', }, timeout: { type: 'number', description: 'Command timeout in milliseconds (optional)', }, cwd: { type: 'string', description: 'Working directory (optional)', }, }, required: ['command'], }, },