Skip to main content
Glama

ssh_list_credentials

View all stored SSH credentials for managing secure remote server connections and authentication methods.

Instructions

List all saved SSH credentials

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function that parses empty input schema, retrieves all stored credentials from the in-memory Map, formats a safe list (hiding sensitive data like passwords/keys), and returns a text response listing available credentials with metadata.
    private async handleListCredentials(args: unknown) {
      ListCredentialsSchema.parse(args);
      
      const credentials = Array.from(credentialStore.entries()).map(([id, cred]) => ({
        credentialId: id,
        host: cred.host,
        port: cred.port,
        username: cred.username,
        hasPassword: !!cred.password,
        hasPrivateKey: !!cred.privateKeyPath,
        createdAt: cred.createdAt,
        lastUsed: cred.lastUsed
      }));
    
      return {
        content: [
          {
            type: 'text',
            text: credentials.length > 0 
              ? `Saved credentials:\n${credentials.map(c => 
                  `- ${c.credentialId}: ${c.username}@${c.host}:${c.port} (${c.hasPassword ? 'password' : 'key'}) - Last used: ${c.lastUsed}`
                ).join('\n')}`
              : 'No saved credentials found',
          },
        ],
      };
    }
  • Zod schema for tool input validation. Defines an empty object since the tool requires no parameters.
    const ListCredentialsSchema = z.object({});
  • src/index.ts:388-396 (registration)
    Tool metadata registration in the ListToolsRequestHandler response. Specifies the tool name, description, and JSON input schema advertised to clients.
    {
      name: 'ssh_list_credentials',
      description: 'List all saved SSH credentials',
      inputSchema: {
        type: 'object',
        properties: {},
        required: []
      },
    },
  • src/index.ts:507-508 (registration)
    Dispatch registration in the CallToolRequestHandler switch statement, mapping tool name to the handler method.
    case 'ssh_list_credentials':
      return await this.handleListCredentials(args);
  • In-memory Map storing SSH credentials by ID, used by the handler to list credentials. Defined globally in the module.
    const credentialStore = new Map<string, StoredCredential>();

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/mahathirmuh/mcp-ssh-server'

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