ssh_list_credentials
Retrieve all stored SSH credentials from the SSH MCP Server to manage authentication details for remote server connections.
Instructions
List all saved SSH credentials
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "ssh_list_credentials"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:1127-1153 (handler)The handler function for 'ssh_list_credentials' tool. It parses empty args, iterates over the credentialStore Map, creates a sanitized list of credentials (hiding passwords/private keys), formats as text response listing credential IDs, hosts, users, auth type, and last used time.
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:388-396 (registration)Registration of the 'ssh_list_credentials' tool in the ListToolsRequest handler response. Defines the tool name, description, and empty input schema.
{ name: 'ssh_list_credentials', description: 'List all saved SSH credentials', inputSchema: { type: 'object', properties: {}, required: [] }, }, - src/index.ts:507-508 (registration)Registration of the handler in the CallToolRequest switch statement.
case 'ssh_list_credentials': return await this.handleListCredentials(args); - src/index.ts:137-137 (schema)Zod schema for input validation of ssh_list_credentials tool (empty object as no parameters required).
const ListCredentialsSchema = z.object({}); - src/index.ts:46-46 (helper)In-memory Map storing SSH credentials used by the list_credentials handler.
const credentialStore = new Map<string, StoredCredential>();