Skip to main content
Glama
YawLabs

SSH MCP Server

by YawLabs

ssh_multi_exec

Execute a command across multiple remote hosts in parallel, controlling concurrency and per-host timeouts. Use it to replace repeated single-host SSH calls and get results per host in one pass.

Instructions

Execute a command on multiple remote hosts in parallel. Runs at most SSH_MCP_MAX_POOL_SIZE hosts at once (default 100) and works through a longer list as slots free up. timeout is per host: it bounds each host's command, not the whole call. Each parallel slot works through its share of the list one host at a time, so with the pool to itself a call can take up to about ceil(hosts / SSH_MCP_MAX_POOL_SIZE) x (timeout + connect time). The connection pool is shared with every other tool; when it is full this call waits for slots instead of failing, and gives up only when none of its own hosts holds a slot and a full timeout has passed with none of them starting or finishing. The hosts waiting at that point (up to one per parallel slot) and every host still queued then report Connection pool is full; the queued ones are never attempted. Rerun those hosts once the other calls finish, or raise SSH_MCP_MAX_POOL_SIZE. Returns results per host. Use this instead of calling ssh_exec multiple times — it's faster and shows results side by side. 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 once, against the env-prefixed command, before fan-out).

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.
portNoSSH port (default: 22)
hostsYesList of SSH hostnames or IPs
commandYesShell command to execute on all hosts
timeoutNoPer-host command timeout in milliseconds (default: 30000): bounds each host's command, not the whole call. Also the call's no-progress budget on a full pool (see the tool description).
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
    • 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 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.",
      +  "propertyNames": {
      +    "type": "string"
      +  },
      +  "type": "object"
      +}
    • changedInput schema / properties / timeout / description
      Previous value: -"Command timeout in milliseconds (default: 30000)"New value: +"Per-host command timeout in milliseconds (default: 30000): bounds each host's command, not the whole call. Also the call's no-progress budget on a full pool (see the tool description)."
  2. Addedv0.9.1

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 full burden falls on the description, and it delivers extensively: concurrency cap (SSH_MCP_MAX_POOL_SIZE, default 100), per-host timeout semantics, shared-pool waiting behavior, the exact give-up condition, the 'Connection pool is full' failure mode, and the policy check (checked once against the env-prefixed command before fan-out). This is unusually complete disclosure of scheduling, failure, and policy behavior.

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 long but every sentence carries real operational information needed to invoke this complex concurrent tool correctly; the purpose is front-loaded in the first sentence. It is structured as one dense paragraph, which hurts scannability — section breaks would improve it — but there is little waste given the genuine complexity being conveyed.

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?

For an 8-parameter concurrent tool with no annotations and no output schema, the description covers concurrency limits, pool contention, timeout semantics, env injection, and policy behavior remarkably well. The main gap is the return value: it only promises 'results per host' and the pool-full message, with no output schema to fill in the per-host result shape (exit code, stdout/stderr structure).

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% and the schema's own parameter descriptions are already rich (timeout is fully explained there, including its role as the no-progress budget; env is documented with quoting rules and key grammar). The tool description adds some value beyond the schema — notably that env lets you set variables 'without modifying the command string' and ties timeout into the concurrency model — but the schema already does most of the heavy lifting, so the baseline 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 opening sentence, 'Execute a command on multiple remote hosts in parallel,' states a specific verb, resource, and execution mode. The description also distinguishes it from its sibling, explicitly telling the agent to use this 'instead of calling ssh_exec multiple times,' so an agent can select it correctly without inspecting either schema.

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?

The description gives clear when-to-use guidance: 'Use this instead of calling ssh_exec multiple times — it's faster and shows results side by side,' and provides operational guidance for the pool-full failure case ('Rerun those hosts once the other calls finish, or raise SSH_MCP_MAX_POOL_SIZE'). However, it never states explicit when-not-to-use conditions or names other alternatives like ssh_diagnose, leaving a small gap.

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