ssh_view_config
View complete SSH configuration, including all servers and settings, to verify or understand your remote access setup.
Instructions
View the full SSH configuration including servers and settings
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:53-61 (registration)Registration of 'ssh_view_config' tool: defines name, description, and empty inputSchema (no params required).
{ name: 'ssh_view_config', description: 'View the full SSH configuration including servers and settings', inputSchema: { type: 'object', properties: {}, required: [], }, }, - src/index.ts:275-297 (handler)Handler for 'ssh_view_config': sanitizes config by filtering sensitive fields (password, privateKeyPath) from servers, returns servers list (id, name, host, port, username, authMethod) plus settings as JSON.
case 'ssh_view_config': { // Filter out sensitive information (passwords and private key paths) const sanitizedConfig = { servers: config.servers.map(s => ({ id: s.id, name: s.name, host: s.host, port: s.port, username: s.username, authMethod: s.authMethod, // Exclude: password, privateKeyPath for security })), settings: config.settings, }; return { content: [ { type: 'text', text: JSON.stringify(sanitizedConfig, null, 2), }, ], }; } - src/config.ts:86-110 (helper)loadConfig() helper: reads and validates the config file from ~/.hydrossh/config.json using Zod schemas.
export function loadConfig(): Config { const configPath = getConfigPath(); if (!fs.existsSync(configPath)) { throw new Error( `Config file not found: ${configPath}\n` + `Run the server again to auto-create, or manually:\n` + ` mkdir -p ~/.hydrossh && cp <mcp-dir>/example-config.json ~/.hydrossh/config.json` ); } const raw = fs.readFileSync(configPath, 'utf-8'); let parsed: any; try { parsed = JSON.parse(raw); } catch (err) { throw new Error( `Invalid JSON in config file: ${configPath}\n` + `Details: ${err instanceof Error ? err.message : String(err)}` ); } const validated = ConfigSchema.parse(parsed); return validated as Config; } - src/config.ts:127-129 (helper)getConfigSettings() helper: extracts the settings section from the config object.
export function getConfigSettings(config: Config) { return config.settings; } - src/types.ts:4-28 (schema)Type definitions for Config (servers array + settings) and ServerConfig used by the handler to structure the output.
export interface ServerConfig { id: string; name: string; host: string; port: number; username: string; authMethod: 'agent' | 'key' | 'password'; privateKeyPath?: string; password?: string; connectTimeout?: number; keepaliveInterval?: number; } // 全局配置 export interface Config { servers: ServerConfig[]; settings: { defaultConnectTimeout: number; defaultKeepaliveInterval: number; // 新增:默认心跳间隔 commandTimeout: number; maxConnections: number; autoReconnect: boolean; logCommands: boolean; }; }