Skip to main content
Glama
ssh-sftp-mcp

ssh-sftp-mcp

by endjoker

Connect via SSH

ssh_connect

Creates a reusable SSH connection to a specified host using key, agent, or environment-variable password auth, returning a connection ID for subsequent remote commands and SFTP transfers.

Instructions

Connects to any host supplied by the caller (no application-level allowlist) and returns a connectionId; later exec/SFTP calls reuse the same SSH session. Auth supports a private key path, SSH Agent, or a password held in a local environment variable; passwords never appear in tool arguments. The host key must already exist in known_hosts; unknown or changed keys are always rejected (first-use keys are never trusted automatically). This tool lets the server process connect to any address reachable on the network (including localhost and private networks); the actual scope is bounded by the host firewall.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "host": "<host>",
      "username": "<username>",
      "auth": "<auth>"
    },
    "name": "ssh_connect"
  }
}

Input Schema

NameRequiredDescriptionDefault
authYes
hostYesTarget hostname, IPv4, or IPv6 (IPv6 may be written as [::1])
portNo
usernameYes
connectTimeoutMsNo

Output Schema

NameRequiredDescriptionDefault
hostYes
portYes
stateYes
reusedYes
authTypeYes
usernameYes
connectionIdYes
serverFingerprintYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior5/5

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

Goes well beyond the annotations (readOnly=false, openWorld=true, destructive=false) by disclosing the host-key policy (must already be in known_hosts, first-use keys never trusted), the absence of an application-level allowlist, the three auth modes, the rule that passwords never appear in tool arguments, and the real network reach being firewall-bounded.

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?

Front-loads the core behavior and connectionId return, then layers security constraints. Dense but nearly every clause carries actionable information; the trailing sentence on network reach is long but justified by the openWorldHint implications.

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

Completeness4/5

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

An output schema exists, so return-value detail is unnecessary, and the annotations cover safety. What remains is fully addressed — auth options, credential handling, host-key verification, and session reuse — with only minor gaps such as timeout behavior and connection lifetime limits.

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

Parameters4/5

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

Schema description coverage is only 20%, so the description must carry weight — and it does for the hard part, explaining the auth variants (key path, SSH Agent, password via environment variable) and the no-plaintext-credential constraint. It adds little for host, port, username, or connectTimeoutMs, but those are largely self-evident.

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?

States a specific verb and resource ('Connects to any host... returns a connectionId') and immediately explains the lifecycle relationship to exec/SFTP calls, which separates it cleanly from ssh_disconnect, ssh_connection_list, and the exec/SFTP siblings.

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

Usage Guidelines4/5

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

Establishes the workflow: call this first to obtain a connectionId that later exec/SFTP calls reuse. It does not explicitly state when to prefer a fresh connection versus reusing an existing one, or when to call ssh_connection_list instead, so it stops short of full alternative routing.

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