Skip to main content
Glama
SSH MCP Server

SSH MCP Server

by quiloos39

SSH Execute

ssh_execute

Execute shell commands on a connected remote server over SSH and return stdout, stderr, and exit code. Establish the connection first with ssh_connect.

Instructions

Execute a command on a connected remote server via SSH. Returns stdout, stderr, and exit code. The connection must have been established first with ssh_connect. Output is capped at 1MB per stream to prevent memory issues.

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": {
      "connectionId": "<connectionId>",
      "command": "<command>"
    },
    "name": "ssh_execute"
  }
}

Input Schema

NameRequiredDescriptionDefault
cwdNoWorking directory — the command will be wrapped as: cd <cwd> && <command>
commandYesShell command to execute on the remote server
timeoutNoCommand timeout in milliseconds (default 30000). The command will be killed if it exceeds this.
connectionIdYesThe connection ID returned by ssh_connect (defaults to the host value used during connect)
errOnNonZeroNoIf true, non-zero exit codes are marked as MCP errors. Default false — only connection/execution failures are errors. Useful because many commands (grep, diff) return non-zero for normal results.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.3/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it discloses the return shape (stdout, stderr, exit code), a concrete resource limit (1MB per stream cap), and the prerequisite connection state. It stops short of flagging that this runs arbitrary, potentially mutating remote commands, or of saying what happens when the connection is stale or the SSH session drops.

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?

Four short sentences in a deliberate order: what it does, what it returns, what must precede it, and the safety limit. Nothing is redundant and the most decision-relevant information is front-loaded.

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?

There is no output schema, so the description correctly supplies the return values itself, along with the truncation cap and the prerequisite state. Combined with a fully documented schema, an agent has everything needed to call this correctly.

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 each of the five parameters is documented in-schema, including the cwd wrapping behavior, timeout default, and errOnNonZero semantics. The description adds no parameter-level meaning beyond reinforcing the connectionId prerequisite, so the baseline 3 applies.

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 ("Execute a command on a connected remote server via SSH"), and the word "connected" plus the ssh_connect prerequisite distinguishes it cleanly from ssh_connect, ssh_disconnect, and ssh_list_connections.

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?

Explicitly names the prerequisite ordering ("The connection must have been established first with ssh_connect"), which is the main usage constraint an agent could get wrong. There is no explicit when-not guidance or named alternative for cases like running a local command, but the sibling set makes the boundary obvious.

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