ssh_update_server
Modify SSH server configurations in mcpHydroSSH by updating connection details like hostname, authentication method, and credentials for existing servers.
Instructions
Update an existing server config
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| serverId | Yes | Server ID to update | |
| name | No | Server display name | |
| host | No | Server hostname or IP | |
| port | No | SSH port (default: 22) | |
| username | No | SSH username | |
| authMethod | No | Authentication method (default: "key") | |
| privateKeyPath | No | Path to private key (required for "key" auth) | |
| password | No | Password (required for "password" auth) |
Implementation Reference
- src/index.ts:496-533 (handler)Handler logic for the ssh_update_server tool.
case 'ssh_update_server': { const serverId = args.serverId as string; const updates: Partial<ServerConfig> = {}; if (args.name !== undefined) {updates.name = args.name;} if (args.host !== undefined) {updates.host = args.host;} if (args.port !== undefined) {updates.port = args.port;} if (args.username !== undefined) {updates.username = args.username;} if (args.authMethod !== undefined) {updates.authMethod = args.authMethod;} if (args.privateKeyPath !== undefined) {updates.privateKeyPath = args.privateKeyPath;} if (args.password !== undefined) {updates.password = args.password;} try { updateServer(serverId, updates); // Update in-memory config const server = config.servers.find(s => s.id === serverId); if (server) { Object.assign(server, updates); } return { content: [ { type: 'text', text: JSON.stringify({ success: true, message: `Server "${serverId}" updated` }, 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:207-248 (schema)Tool definition and input schema for ssh_update_server.
name: 'ssh_update_server', description: 'Update an existing server config', inputSchema: { type: 'object', properties: { serverId: { type: 'string', description: 'Server ID to update', }, name: { type: 'string', description: 'Server display name', }, host: { type: 'string', description: 'Server hostname or IP', }, port: { type: 'number', description: 'SSH port (default: 22)', }, username: { type: 'string', description: 'SSH username', }, authMethod: { type: 'string', enum: ['agent', 'key', 'password'], description: 'Authentication method (default: "key")', }, privateKeyPath: { type: 'string', description: 'Path to private key (required for "key" auth)', }, password: { type: 'string', description: 'Password (required for "password" auth)', }, }, required: ['serverId'], }, },