Skip to main content
Glama

add_credential

Store a new SSH credential on the SSH MCP Server by specifying the host, username, and private key file path for secure remote command execution.

Instructions

Add a new SSH credential with private key file path

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hostYes
nameYes
privateKeyPathYes
usernameYes

Implementation Reference

  • The main handler function for the 'add_credential' tool. It extracts arguments, validates the private key path, inserts the credential into the SQLite database, and returns success or error response.
    case 'add_credential': {
        const { name, host, username, privateKeyPath } = request.params.arguments as {
            name: string;
            host: string;
            username: string;
            privateKeyPath: string;
        };
    
        try {
            const validatedKeyPath = validatePrivateKeyPath(privateKeyPath);
    
            await db.run(
                'INSERT INTO credentials (name, host, username, privateKeyPath) VALUES (?, ?, ?, ?)',
                [name, host, username, validatedKeyPath]
            );
    
            return {
                content: [{
                    type: 'text',
                    text: `Credential ${name} added successfully`
                }]
            };
        } catch (error: unknown) {
            return {
                content: [{
                    type: 'text',
                    text: `Error: ${error instanceof Error ? error.message : String(error)}`,
                }],
                isError: true,
            };
        }
    }
  • src/index.ts:97-110 (registration)
    Registration of the 'add_credential' tool in the ListToolsRequestSchema handler, including name, description, and input schema definition.
    {
        name: 'add_credential',
        description: 'Add a new SSH credential with private key file path',
        inputSchema: {
            type: 'object',
            properties: {
                name: { type: 'string' },
                host: { type: 'string' },
                username: { type: 'string' },
                privateKeyPath: { type: 'string' },
            },
            required: ['name', 'host', 'username', 'privateKeyPath'],
        },
    },
  • Input schema definition for the 'add_credential' tool, specifying required parameters: name, host, username, privateKeyPath.
    inputSchema: {
        type: 'object',
        properties: {
            name: { type: 'string' },
            host: { type: 'string' },
            username: { type: 'string' },
            privateKeyPath: { type: 'string' },
        },
        required: ['name', 'host', 'username', 'privateKeyPath'],
    },
  • Helper function to validate and resolve the private key file path, ensuring it exists, called within the add_credential handler.
    function validatePrivateKeyPath(path: string): string {
        console.error('DEBUG: Validating key path input:', path); // Log input
        if (typeof path !== 'string') {
            throw new Error('validatePrivateKeyPath received non-string input');
        }
        const resolvedPath = resolve(path);
        console.error('DEBUG: Resolved key path:', resolvedPath); // Log resolved
        if (!existsSync(resolvedPath)) {
            throw new Error(`Private key file not found at path: ${resolvedPath}`);
        }
        return resolvedPath;
    }
Behavior2/5

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

With no annotations, the description carries the full burden of behavioral disclosure. It states it adds a credential but doesn't cover critical aspects: whether this requires admin permissions, if it overwrites existing credentials, error handling (e.g., invalid file paths), or what happens on success (e.g., confirmation message). It mentions 'private key file path' but not how it's stored or used. This leaves significant gaps for a mutation tool.

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 with no wasted words. It's front-loaded with the core action and resource, making it easy to scan. Every part of the sentence contributes directly to the tool's purpose.

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?

Given the complexity (a mutation tool for SSH credentials), lack of annotations, no output schema, and low schema coverage, the description is incomplete. It doesn't explain return values, error cases, or behavioral nuances. For a tool that likely involves security-sensitive operations, more context is needed to ensure safe and correct usage.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate. It only mentions 'private key file path', which maps to one of the four parameters (privateKeyPath). It doesn't explain the other parameters (host, name, username), their purposes, formats, or constraints. The description adds minimal value beyond the schema, failing to address the coverage gap adequately.

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 clearly states the action ('Add') and resource ('SSH credential'), specifying it's for a new credential with a private key file path. It distinguishes from siblings like list_credentials (read) and remove_credential (delete), though it doesn't explicitly mention rsync_copy or ssh_exec. The purpose is specific but could be more detailed about what 'add' entails.

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?

No guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an existing private key file), exclusions, or comparisons to siblings like ssh_exec (which might use credentials). The description implies usage for adding SSH credentials but lacks contextual advice.

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

Related 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/KinoThe-Kafkaesque/ssh-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server