Skip to main content
Glama
bvisible

MCP SSH Manager

ssh_execute

Execute commands on remote SSH servers through the MCP SSH Manager by specifying server configurations and command parameters.

Instructions

Execute command on remote SSH server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
serverYesServer name from configuration
commandYesCommand to execute
cwdNoWorking directory (optional, uses default if configured)
timeoutNoCommand timeout in milliseconds (default: 30000)

Implementation Reference

  • TOOL_GROUPS.core includes 'ssh_execute' as part of essential SSH operations. This central registry defines all tools and their groups, used for dynamic registration, validation, and conditional enabling in the MCP server.
    export const TOOL_GROUPS = {
      // Core group (5 tools) - Essential SSH operations
      core: [
        'ssh_list_servers',
        'ssh_execute',
        'ssh_upload',
        'ssh_download',
        'ssh_sync'
      ],
  • The execCommand method of SSHManager executes arbitrary commands over SSH. It handles connection check, working directory changes, timeouts with forceful termination, captures stdout/stderr/exit code/signal. This is the primary execution logic for the 'ssh_execute' MCP tool.
    async execCommand(command, options = {}) {
      if (!this.connected) {
        throw new Error('Not connected to SSH server');
      }
    
      const { timeout = 30000, cwd, rawCommand = false } = options;
      const fullCommand = (cwd && !rawCommand) ? `cd ${cwd} && ${command}` : command;
    
      return new Promise((resolve, reject) => {
        let stdout = '';
        let stderr = '';
        let completed = false;
        let stream = null;
        let timeoutId = null;
    
        // Setup timeout first
        if (timeout > 0) {
          timeoutId = setTimeout(() => {
            if (!completed) {
              completed = true;
    
              // Try multiple ways to kill the stream
              if (stream) {
                try {
                  stream.write('\x03'); // Send Ctrl+C
                  stream.end();
                  stream.destroy();
                } catch (e) {
                  // Ignore errors
                }
              }
    
              // Kill the entire client connection as last resort
              try {
                this.client.end();
                this.connected = false;
              } catch (e) {
                // Ignore errors
              }
    
              reject(new Error(`Command timeout after ${timeout}ms: ${command.substring(0, 100)}...`));
            }
          }, timeout);
        }
    
        this.client.exec(fullCommand, (err, streamObj) => {
          if (err) {
            completed = true;
            if (timeoutId) clearTimeout(timeoutId);
            reject(err);
            return;
          }
    
          stream = streamObj;
    
          stream.on('close', (code, signal) => {
            if (!completed) {
              completed = true;
              if (timeoutId) clearTimeout(timeoutId);
              resolve({
                stdout,
                stderr,
                code: code || 0,
                signal
              });
            }
          });
    
          stream.on('data', (data) => {
            stdout += data.toString();
          });
    
          stream.stderr.on('data', (data) => {
            stderr += data.toString();
          });
    
          stream.on('error', (err) => {
            if (!completed) {
              completed = true;
              if (timeoutId) clearTimeout(timeoutId);
              reject(err);
            }
          });
        });
      });
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While 'Execute command' implies a potentially destructive operation, the description doesn't mention security implications, authentication requirements, error handling, or what happens when commands fail. For a tool that executes arbitrary commands on remote servers, this lack of behavioral context is a significant gap.

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 maximally concise with a single clear sentence that states the core functionality. There's no wasted language or unnecessary elaboration, making it easy to parse and understand at a glance.

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

Completeness2/5

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

For a tool that executes commands on remote servers with no annotations and no output schema, the description is insufficient. It doesn't explain what the tool returns (stdout? stderr? exit code?), doesn't mention security or permission requirements, and doesn't help distinguish it from numerous sibling tools with similar purposes. The context demands more comprehensive guidance.

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 description provides no parameter information beyond what's already in the schema, which has 100% coverage. The schema already documents all 4 parameters with clear descriptions, so the description adds no additional semantic value. This meets the baseline expectation when schema coverage is complete.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Execute command on remote SSH server' clearly states the action (execute) and target (remote SSH server), making the purpose immediately understandable. However, it doesn't differentiate this tool from similar siblings like ssh_execute_group or ssh_execute_sudo, which likely have overlapping functionality but different execution contexts.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. With multiple sibling tools like ssh_execute_group, ssh_execute_sudo, ssh_command_alias, and ssh_session_send that might handle command execution in different ways, the agent receives no help in selecting the appropriate tool for a given scenario.

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/bvisible/mcp-ssh-manager'

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