Skip to main content
Glama

ssh_list_hosts

View all configured SSH hosts in your server fleet to manage access and monitor infrastructure connections.

Instructions

List configured hosts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The primary handler function for the 'ssh_list_hosts' MCP tool. It lists all configured SSH hosts from the global Config instance and returns them in a JSON-compatible dictionary. Errors are caught and returned as sanitized strings. The @mcp.tool() decorator handles MCP registration.
    @mcp.tool() def ssh_list_hosts() -> ToolResult: """List configured hosts.""" try: hosts = config.list_hosts() return {"hosts": hosts} except Exception as e: error_str = str(e) log_json({"level": "error", "msg": "list_hosts_exception", "error": error_str}) return f"Error: {sanitize_error(error_str)}"
  • The @mcp.tool() decorator registers the ssh_list_hosts function as an MCP tool with FastMCP.
    @mcp.tool()
  • Imports helper utilities used by ssh_list_hosts: log_json for error logging and sanitize_error for safe error messages.
    from mcp_ssh.tools.utilities import ( ASYNC_TASKS, TASKS, hash_command, log_json, sanitize_error, )

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/samerfarida/mcp-ssh-orchestrator'

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