Skip to main content
Glama
YawLabs

SSH MCP Server

by YawLabs

ssh_exec

Run shell commands on a remote host over SSH, set environment variables per call, and capture stdout, stderr, and exit code.

Instructions

Execute a command on a remote host via SSH. The command is interpreted by the remote login shell — pipes, redirects, globs, and other shell metacharacters work as expected. Returns stdout, stderr, and exit code. Use env to set environment variables for this call without modifying the command string. Subject to SSH_MCP_COMMAND_WHITELIST / SSH_MCP_COMMAND_BLACKLIST if configured (policy is checked against the env-prefixed command).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
envNoEnvironment variables to set for this command. Injected as a `KEY='value' ...` prefix; works on any sshd regardless of AcceptEnv config. VALUES are POSIX-single-quoted, so any byte is safe in a value. KEYS cannot be quoted (a shell assignment prefix requires a bare name), so each key must match /^[A-Za-z_][A-Za-z0-9_]*$/ (the POSIX name grammar) — a key outside that grammar is rejected and the call fails before anything is sent to a host. Command policy is checked against the PREFIXED command, so a `^`-anchored whitelist pattern stops matching once this is set.
hostYesSSH hostname or IP address
portNoSSH port (default: 22)
commandYesShell command to execute on the remote host (interpreted by the remote login shell)
timeoutNoCommand timeout in milliseconds (default: 30000). Also the longest the call waits for a free connection-pool slot (SSH_MCP_MAX_POOL_SIZE, default 100) before the command starts; the wait and the command are bounded separately.
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.
usernameNoSSH username (default: current user)
privateKeyPathNoPath to SSH private key

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.17.0
    • changedInput schema / properties / env / description
      Previous value: -"Environment variables to set for this command. Injected as a `KEY='value' ...` prefix; works on any sshd regardless of AcceptEnv config. Values are POSIX-single-quoted, so any byte is safe."New value: +"Environment variables to set for this command. Injected as a `KEY='value' ...` prefix; works on any sshd regardless of AcceptEnv config. VALUES are POSIX-single-quoted, so any byte is safe in a value. KEYS cannot be quoted (a shell assignment prefix requires a bare name), so each key must match /^[A-Za-z_][A-Za-z0-9_]*$/ (the POSIX name grammar) — a key outside that grammar is rejected and the call fails before anything is sent to a host. Command policy is checked against the PREFIXED command, so a `^`-anchored whitelist pattern stops matching once this is set."
    • changedInput schema / properties / timeout / description
      Previous value: -"Command timeout in milliseconds (default: 30000)"New value: +"Command timeout in milliseconds (default: 30000). Also the longest the call waits for a free connection-pool slot (SSH_MCP_MAX_POOL_SIZE, default 100) before the command starts; the wait and the command are bounded separately."
  2. Changed1 schema field changedv0.11.0
    • addedInput schema / properties / env
      Added value: +{
      +  "additionalProperties": {
      +    "type": "string"
      +  },
      +  "description": "Environment variables to set for this command. Injected as a `KEY='value' ...` prefix; works on any sshd regardless of AcceptEnv config. Values are POSIX-single-quoted, so any byte is safe.",
      +  "propertyNames": {
      +    "type": "string"
      +  },
      +  "type": "object"
      +}
  3. Changed9 schema fields changedv0.9.1
    • removedInput schema / additionalProperties
      Removed value: -false
    • changedInput schema / properties / command / description
      Previous value: -"Shell command to execute on the remote host"New value: +"Shell command to execute on the remote host (interpreted by the remote login shell)"
    • changedInput schema / properties / password / description
      Previous value: -"SSH password (prefer keys)"New value: +"SSH 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."
    • addedInput schema / properties / port / maximum
      Added value: +65535
    • addedInput schema / properties / port / minimum
      Added value: +1
    • changedInput schema / properties / port / type
      Previous value: -"number"New value: +"integer"
    • addedInput schema / properties / timeout / exclusiveMinimum
      Added value: +0
    • addedInput schema / properties / timeout / maximum
      Added value: +9007199254740991
    • changedInput schema / properties / timeout / type
      Previous value: -"number"New value: +"integer"
  4. First observedv0.2.0

TDQS

A4.3/5.0
Behavior5/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It transparently explains that the command is interpreted by the remote login shell, metacharacters work as expected, returns stdout/stderr/exit code, applies whitelist/blacklist policy, and discloses that passwords pass as plaintext and may be logged. It also notes the timeout bounds the connection-pool wait. This is thorough and goes beyond what a schema could convey.

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 concise and front-loaded, starting with the core purpose in the first sentence. Each subsequent sentence adds a distinct, necessary detail—shell interpretation, return values, env usage, and policy checking—without redundancy or fluff. The structure is logical and easy to scan.

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

Completeness5/5

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

Given the tool's complexity (8 parameters, nested env object, no output schema), the description covers all critical operational aspects: what the command does, how the shell interprets it, what is returned, policy enforcement, timeout behavior, and security warnings. The rich schema complements it well, and nothing essential for an agent to call this correctly is missing.

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?

The schema description coverage is 100%, so the schema already documents every parameter in detail (including env quoting, timeout semantics, and password warnings). The tool description adds minimal parameter-level value beyond a mention of `env` usage, which is already covered in the schema. Per the baseline rule for high coverage, a score of 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 'Execute a command on a remote host via SSH,' identifying a specific verb and resource. It also distinguishes itself from file-oriented siblings by explicitly covering generic shell execution, making its purpose unambiguous.

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

Usage Guidelines3/5

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

The description does not explicitly state when to use this tool versus alternatives. While it is obvious that this is the general-purpose execution tool among siblings like ssh_read_file and ssh_write_file, there is no explicit 'when to use' or 'when not to use' guidance. The only usage hint is the mention of `env` for setting environment variables, which is more parameter guidance than tool selection guidance.

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