Skip to main content
Glama

ssh_exec

Run remote commands over SSH with full shell support, env variable injection, timeout control, and policy enforcement. Returns stdout, stderr, and exit code for automation and diagnostics.

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.
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)
usernameNoSSH username (default: current user)
credential_idNoAlias of an SSH password configured only on the MCP server (for example, ssh1 resolves to SSH_CREDENTIAL_SSH1). Never pass a real password here.
privateKeyPathNoPath to SSH private key
Behavior4/5

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

No annotations are provided, so the description carries the burden. It discloses policy checks (whitelist/blacklist) and warns against passing real passwords for credential_id. It does not explicitly mention potential side effects of command execution, but that is inherent to the tool's purpose.

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 well-structured and concise, covering the main purpose, shell interpretation, return values, environment handling, and policy checks in a clear sequence without unnecessary fluff.

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 complexity of command execution, the description covers essential aspects: return format, policy restrictions, environment handling, and security warnings. It does not need to explain timeouts or username since those are in the schema. The absence of an output schema is compensated by stating what is returned.

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 coverage is 100% with detailed descriptions for each parameter. The tool description adds a helpful note about using env without modifying the command string, but this is largely redundant with the schema. Baseline for high coverage is 4.

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 the tool executes a command on a remote host via SSH, distinguishing it from file-oriented siblings. It specifies shell interpretation and return of stdout/stderr/exit code, making the 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 Guidelines4/5

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

While the description clarifies that this tool executes commands (as opposed to file operations like ssh_read_file), it does not explicitly mention when to prefer this over other command-related siblings like ssh_multi_exec. The guidance is implicit rather than explicit.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/txcxgzs/ssh-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server