ssh_list_credentials
Retrieve all stored SSH credentials from the MCP SSH Server to manage authentication details for remote server connections.
Instructions
List all saved SSH credentials
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:1127-1153 (handler)The main handler function for the 'ssh_list_credentials' tool. It parses empty args with ListCredentialsSchema, retrieves all credentials from the in-memory credentialStore Map, maps them to a safe summary (hiding passwords/keys), and returns a formatted text list of available credentials or 'No saved credentials found'.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', }, ], }; }
- src/index.ts:137-137 (schema)Zod schema for validating input parameters of the 'ssh_list_credentials' tool, which takes no parameters (empty object). Used in the handler for parsing.const ListCredentialsSchema = z.object({});
- src/index.ts:389-396 (registration)Tool registration in the ListTools response. Defines the tool name, description, and empty input schema advertised to MCP clients.name: 'ssh_list_credentials', description: 'List all saved SSH credentials', inputSchema: { type: 'object', properties: {}, required: [] }, },
- src/index.ts:507-508 (registration)Dispatch case in the CallToolRequest handler switch statement that routes calls to the specific handler function.case 'ssh_list_credentials': return await this.handleListCredentials(args);
- src/index.ts:46-46 (helper)In-memory Map storing SSH credentials used by the handler (and related tools like save/delete/connect).const credentialStore = new Map<string, StoredCredential>();