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
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:1127-1153 (handler)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', }, ], }; }
- src/index.ts:137-138 (schema)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);
- src/index.ts:46-47 (helper)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>();