Skip to main content
Glama

listKnownHosts

Retrieve a consolidated list of all known SSH hosts by prioritizing ~/.ssh/config entries and supplementing with ~/.ssh/known_hosts data for comprehensive host management.

Instructions

Returns a consolidated list of all known SSH hosts, prioritizing ~/.ssh/config entries first, then additional hosts from ~/.ssh/known_hosts

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that executes the 'listKnownHosts' tool logic, delegating to SSHConfigParser's getAllKnownHosts method.
    async listKnownHosts(): Promise<SSHHostInfo[]> { return await this.configParser.getAllKnownHosts(); }
  • Interface defining the structure of SSHHostInfo returned by the listKnownHosts tool.
    export interface SSHHostInfo { hostname: string; alias?: string; user?: string; port?: number; identityFile?: string; [key: string]: any; // For other configuration options }
  • Supporting method that implements the core logic for retrieving and consolidating known SSH hosts from both config and known_hosts files.
    async getAllKnownHosts(): Promise<SSHHostInfo[]> { const configHosts = await this.parseConfig(); const knownHostnames = await this.parseKnownHosts(); // Add hosts from known_hosts that aren't in the config for (const hostname of knownHostnames) { if (!configHosts.some(host => host.hostname === hostname || host.alias === hostname)) { configHosts.push({ hostname: hostname }); } } return configHosts; }

Other Tools

Related Tools

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