Skip to main content
Glama

getHostInfo

Retrieve SSH host configuration details to manage remote connections and access settings for secure server interactions.

Instructions

Returns all configuration details for an SSH host

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hostAliasYesAlias or hostname of the SSH host

Implementation Reference

  • The core handler function for the "getHostInfo" MCP tool. It parses the SSH configuration file and returns the matching host information (SSHHostInfo or null) based on the provided hostAlias.
    async getHostInfo(hostAlias: string): Promise<SSHHostInfo | null> { const hosts = await this.configParser.parseConfig(); return hosts.find(host => host.alias === hostAlias || host.hostname === hostAlias) || null; }
  • TypeScript interface defining the structure of SSH host information returned by the getHostInfo tool.
    export interface SSHHostInfo { hostname: string; alias?: string; user?: string; port?: number; identityFile?: string; [key: string]: any; // For other configuration options
  • Helper method called by getHostInfo to parse the entire SSH config file (~/.ssh/config) into an array of SSHHostInfo objects.
    async parseConfig(): Promise<SSHHostInfo[]> { try { const content = await readFile(this.configPath, 'utf-8'); const config = sshConfig.parse(content); return this.extractHostsFromConfig(config); } catch (error) { console.error('Error reading SSH config:', error); return []; } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/AiondaDotCom/mcp-ssh'

If you have feedback or need assistance with the MCP directory API, please join our Discord server