Skip to main content
Glama

ssh_save_credential

Store SSH credentials securely for repeated use, enabling quick authentication to remote servers without re-entering login details each time.

Instructions

Save SSH credentials for reuse

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
credentialIdYesUnique identifier for this credential
hostYesSSH server hostname or IP address
portNoSSH port number
usernameYesSSH username
passwordNoSSH password (if not using key)
privateKeyPathNoPath to private key file
passphraseNoPassphrase for private key

Implementation Reference

  • The main handler function that parses input using SaveCredentialSchema, validates uniqueness and auth method, stores the credential in the in-memory credentialStore map, and returns a success message.
    private async handleSaveCredential(args: unknown) {
      const params = SaveCredentialSchema.parse(args);
      
      if (credentialStore.has(params.credentialId)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          `Credential ID '${params.credentialId}' already exists`
        );
      }
    
      if (!params.password && !params.privateKeyPath) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Either password or privateKeyPath must be provided'
        );
      }
    
      const credential: StoredCredential = {
        host: params.host,
        port: params.port || 22,
        username: params.username,
        password: params.password,
        privateKeyPath: params.privateKeyPath,
        passphrase: params.passphrase,
        createdAt: new Date().toISOString(),
        lastUsed: new Date().toISOString()
      };
    
      credentialStore.set(params.credentialId, credential);
    
      return {
        content: [
          {
            type: 'text',
            text: `Credential '${params.credentialId}' saved successfully for ${params.username}@${params.host}:${params.port || 22}`,
          },
        ],
      };
    }
  • Zod schema defining the input parameters for the ssh_save_credential tool, including credentialId, host, port, username, and optional auth fields.
    const SaveCredentialSchema = z.object({
      credentialId: z.string().describe('Unique identifier for this credential'),
      host: z.string().describe('SSH server hostname or IP address'),
      port: z.number().default(22).describe('SSH port number'),
      username: z.string().describe('SSH username'),
      password: z.string().optional().describe('SSH password (if not using key)'),
      privateKeyPath: z.string().optional().describe('Path to private key file'),
      passphrase: z.string().optional().describe('Passphrase for private key')
    });
  • src/index.ts:372-386 (registration)
    Tool registration in the ListTools response, defining name, description, and inputSchema matching the Zod schema.
    name: 'ssh_save_credential',
    description: 'Save SSH credentials for reuse',
    inputSchema: {
      type: 'object',
      properties: {
        credentialId: { type: 'string', description: 'Unique identifier for this credential' },
        host: { type: 'string', description: 'SSH server hostname or IP address' },
        port: { type: 'number', default: 22, description: 'SSH port number' },
        username: { type: 'string', description: 'SSH username' },
        password: { type: 'string', description: 'SSH password (if not using key)' },
        privateKeyPath: { type: 'string', description: 'Path to private key file' },
        passphrase: { type: 'string', description: 'Passphrase for private key' }
      },
      required: ['credentialId', 'host', 'username']
    },
  • src/index.ts:505-506 (registration)
    Dispatch in the CallToolRequest handler switch statement that routes to the handleSaveCredential function.
    case 'ssh_save_credential':
      return await this.handleSaveCredential(args);
  • In-memory Map storing credentials by ID, used by the handler to persist SSH credentials.
    // In-memory credential store (could be extended to file-based storage)
    const credentialStore = new Map<string, StoredCredential>();
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. 'Save SSH credentials for reuse' implies persistence and security implications, but doesn't disclose where credentials are stored (local vs remote), encryption methods, access controls, expiration policies, or error handling. For a credential management tool with zero annotation coverage, this is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose. It's appropriately sized and front-loaded with zero wasted words, making it easy for an AI agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a credential storage tool with 7 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what happens after saving (e.g., how credentials are retrieved/used), security implications, storage location, or success/failure responses. The context demands more completeness for safe and effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, providing complete parameter documentation. The description adds no parameter-specific information beyond what's in the schema. According to scoring rules, when schema coverage is high (>80%), the baseline is 3 even with no param info in description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Save SSH credentials for reuse' clearly states the action (save) and resource (SSH credentials) with the purpose of enabling reuse. It distinguishes from siblings like 'ssh_delete_credential' (deletion) and 'ssh_list_credentials' (listing), but doesn't explicitly differentiate from 'ssh_connect_with_credential' which uses saved credentials.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing credentials first), when not to use it (e.g., for temporary connections), or how it relates to siblings like 'ssh_connect' (direct connection) or 'ssh_connect_with_credential' (using saved credentials).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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