Skip to main content
Glama
mcp-ssh-persistent

mcp-ssh-persistent

by vivusk

ssh_exec

Run a one-off command on a configured remote server over SSH in a fresh, stateless session and return stdout, stderr, and exit status.

Instructions

Run a command on a server via an exec channel (stateless, fresh environment per call; connects lazily). Returns stdout, a "--- stderr ---" section only when stderr is non-empty, and [exit: N]. Output is capped (head+tail kept). Exit 1 is not flagged as an error. Use ssh_stream_* for stateful/interactive work.

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": {
      "server": "<server>",
      "command": "<command>"
    },
    "name": "ssh_exec"
  }
}

Input Schema

NameRequiredDescriptionDefault
ptyNoAllocate a PTY (default false; stderr is merged into stdout when true)
sudoNoRun as root via sudo using the password stored in the OS credential store (Windows Credential Manager / macOS Keychain / Linux Secret Service) for the server user from config (never pass a password yourself). Runs bash -c on the remote (bash required); command stdin is EOF; not allowed for root users or with pty:true.
serverYesServer alias from config.json (case-insensitive). Known aliases: (none configured)
commandYesCommand to execute
timeoutNoTimeout in ms (default 30000)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.2.0

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations at all, the description carries the full burden and does substantial work: statelessness, lazy connection, exact output framing (stdout, conditional stderr section, [exit: N]), output capping with head+tail retention, and the non-obvious rule that exit 1 is not an error. What it omits is the risk profile: it can mutate the remote host, and it says nothing about what happens on timeout (partial output or error).

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?

A single dense paragraph, front-loaded with purpose, then execution model, then return format, then the alternative. Every clause carries information an agent would otherwise have to discover by trial; there is no filler.

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 a 5-parameter tool with no output schema, the description covers the return shape and capping behavior that the schema cannot express, which is exactly the right allocation of effort. The remaining gap is timeout behavior and mutation risk, both of which matter for an execution tool with no annotations.

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%, including detailed notes on pty, sudo, and timeout, so the schema already does the heavy lifting. The description adds only the stderr-merging consequence indirectly (the stderr section is suppressed when stderr is empty, which interacts with pty), so 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?

"Run a command on a server via an exec channel" names a specific verb and resource, and the parenthetical clarifies the execution model (stateless, fresh environment, lazy connect). The closing sentence explicitly separates it from the ssh_stream_* family, so an agent can distinguish it from siblings without opening any 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?

It gives a clear routing rule: use ssh_stream_* for stateful/interactive work, implying this tool is for one-shot commands. It does not mention the related ssh_sudo_auth or credential flow, and gives no explicit when-not-to-use conditions, so it stops short of full alternative coverage.

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