ssh_resolve_host
Resolve SSH host aliases from ~/.ssh/config to obtain connection parameters for remote server automation.
Instructions
Resolves a host alias from ~/.ssh/config to connection parameters
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hostAlias | Yes | Host alias from SSH config |
Implementation Reference
- src/mcp.ts:575-580 (handler)The MCP tool handler for 'ssh_resolve_host' which invokes resolveSSHHost.
case 'ssh_resolve_host': { const { hostAlias } = z.object({ hostAlias: z.string() }).parse(args); const resolved = await resolveSSHHost(hostAlias); logger.info('Host resolved', { hostAlias, resolved: resolved.host }); return { content: [{ type: 'text', text: JSON.stringify(resolved, null, 2) }] }; } - src/ssh-config.ts:232-241 (helper)The core helper function that resolves an SSH host alias using the parser.
export async function resolveSSHHost(hostAlias: string): Promise<{ host: string; username?: string; port?: number; privateKeyPath?: string; proxyJump?: string; }> { const parser = await getSSHConfigParser(); return parser.resolveHost(hostAlias); } - src/mcp.ts:366-376 (registration)Definition and registration of the 'ssh_resolve_host' tool in the MCP server.
{ name: 'ssh_resolve_host', description: 'Resolves a host alias from ~/.ssh/config to connection parameters', inputSchema: { type: 'object', properties: { hostAlias: { type: 'string', description: 'Host alias from SSH config' } }, required: ['hostAlias'] } }