Skip to main content
Glama
YawLabs

SSH MCP Server

by YawLabs

ssh_upload

Upload a local file to a remote host via SFTP.

Instructions

Upload a local file to a remote host via SFTP.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hostYesSSH hostname or IP address
portNoSSH port (default: 22)
usernameNoSSH username (default: current user)
privateKeyPathNoPath to SSH private key
passwordNoSSH password. STRONGLY prefer key-based auth (privateKeyPath or ssh-agent). Passwords pass through MCP protocol frames as plaintext and may be logged by the transport or host process.
localPathYesPath to the local file to upload
remotePathYesAbsolute path on the remote host

Implementation Reference

  • Core handler that performs the actual SFTP file upload using ssh2's fastPut
    export async function uploadFile(client: Client, localPath: string, remotePath: string): Promise<void> {
      const sftp = await getSftp(client);
      try {
        await new Promise<void>((resolve, reject) => {
          sftp.fastPut(localPath, remotePath, (err) => {
            if (err) return reject(err);
            resolve();
          });
        });
      } finally {
        sftp.end();
      }
    }
  • src/tools.ts:90-104 (registration)
    Registers the 'ssh_upload' tool with MCP server, defining schema and handler logic
    server.tool(
      "ssh_upload",
      "Upload a local file to a remote host via SFTP.",
      {
        ...connectionParams,
        localPath: z.string().describe("Path to the local file to upload"),
        remotePath: z.string().describe("Absolute path on the remote host"),
      },
      async ({ localPath, remotePath, ...conn }) => {
        return connectionPool.withConnection(conn, async (client) => {
          await uploadFile(client, localPath, remotePath);
          return { content: [{ type: "text", text: `Uploaded ${localPath} → ${remotePath}` }] };
        });
      },
    );
  • Input schema for ssh_upload: connection params (host, port, username, privateKeyPath, password) plus localPath and remotePath
    {
      ...connectionParams,
      localPath: z.string().describe("Path to the local file to upload"),
      remotePath: z.string().describe("Absolute path on the remote host"),
    },
  • Helper that obtains an SFTP session from the SSH client connection
    function getSftp(client: Client): Promise<SFTPWrapper> {
      return new Promise((resolve, reject) => {
        client.sftp((err, sftp) => {
          if (err) return reject(err);
          resolve(sftp);
        });
      });
    }
  • src/server.ts:53-62 (registration)
    Re-exports uploadFile and registerTools from src/server.ts
      downloadFile,
      exec,
      formatDiagnostics,
      listDir,
      readFile,
      readKnownHostsKeys,
      resolveConfig,
      uploadFile,
      writeFile,
    } from "./ssh.js";
Behavior2/5

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

No annotations provided, and the description does not disclose behavioral traits like overwrite behavior, network requirements, or response format. The schema covers some authentication details but the tool description adds no behavioral context.

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

Conciseness4/5

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

The description is concise and front-loaded, but could include a bit more detail without becoming verbose. Still, it earns its place.

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 (7 parameters, no output schema, no annotations), the description is too minimal. It lacks information about output, error handling, and prerequisites.

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 coverage is 100% with detailed parameter descriptions. However, the tool description itself does not add extra meaning beyond the schema, so a baseline 3 is appropriate.

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

Purpose5/5

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

The description clearly states the action ('Upload') and the resource ('local file to remote host via SFTP'), distinguishing it from siblings like ssh_download or ssh_exec.

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 on when to use this tool vs alternatives such as ssh_download or other file transfer methods. Lacks context about preferred authentication methods.

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/YawLabs/ssh-mcp'

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