Skip to main content
Glama

ssh_delete_credential

Remove a saved SSH credential from the MCP SSH Server to manage authentication profiles and maintain security by deleting unused or outdated access credentials.

Instructions

Delete a saved SSH credential

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
credentialIdYesCredential ID to delete

Implementation Reference

  • Handler function that parses input using DeleteCredentialSchema, checks if credential exists in the store, deletes it from the Map, and returns success message with details.
    private async handleDeleteCredential(args: unknown) {
      const params = DeleteCredentialSchema.parse(args);
      
      if (!credentialStore.has(params.credentialId)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          `Credential ID '${params.credentialId}' not found`
        );
      }
    
      const credential = credentialStore.get(params.credentialId)!;
      credentialStore.delete(params.credentialId);
    
      return {
        content: [
          {
            type: 'text',
            text: `Credential '${params.credentialId}' (${credential.username}@${credential.host}) deleted successfully`,
          },
        ],
      };
    }
  • Zod schema for validating input parameters: requires 'credentialId' string.
    const DeleteCredentialSchema = z.object({
      credentialId: z.string().describe('Credential ID to delete')
    });
  • src/index.ts:397-407 (registration)
    Tool registration in ListTools response: defines name, description, and inputSchema matching the DeleteCredentialSchema.
    {
      name: 'ssh_delete_credential',
      description: 'Delete a saved SSH credential',
      inputSchema: {
        type: 'object',
        properties: {
          credentialId: { type: 'string', description: 'Credential ID to delete' }
        },
        required: ['credentialId']
      },
    },
  • src/index.ts:509-510 (registration)
    Switch case in CallToolRequest handler that routes to the handleDeleteCredential function.
    case 'ssh_delete_credential':
      return await this.handleDeleteCredential(args);
  • In-memory Map storing SSH credentials by ID, used by the delete handler.
    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