Skip to main content
Glama
GUEPARD98

SSH-PowerShell MCP Server

by GUEPARD98

ssh_scan

Scan a network to discover available SSH hosts for secure remote administration and system management tasks.

Instructions

Escanear red para encontrar hosts SSH disponibles

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
networkYesRed a escanear (ej: 192.168.1.0/24)

Implementation Reference

  • Handler implementation for the ssh_scan tool. Scans target network/host for open SSH port 22 using nmap (if available) or PowerShell Test-NetConnection fallback. Returns scan results.
    case 'ssh_scan':
      log('info', `🔍 Escaneando red: ${args.target}`);
      
      // Validar formato de red/host
      if (!args.target || !/^[\d\w\.\-\/]+$/.test(args.target)) {
        throw new Error('Formato de target inválido. Use formato IP (192.168.1.1) o CIDR (192.168.1.0/24)');
      }
      
      // Usar nmap si está disponible, sino usar ping básico
      let scanCommand;
      try {
        // Verificar si nmap está disponible
        await executePowerShell('nmap --version', 5000);
        scanCommand = `nmap -p 22 --open ${args.target}`;
      } catch (e) {
        // Fallback a escaneo básico con ping
        log('warn', 'nmap no disponible, usando escaneo básico');
        if (args.target.includes('/')) {
          throw new Error('Escaneo de rango CIDR requiere nmap. Instale nmap o especifique un host individual.');
        }
        scanCommand = `Test-NetConnection -ComputerName ${args.target} -Port 22 -WarningAction SilentlyContinue | Select-Object ComputerName, TcpTestSucceeded, RemotePort`;
      }
      
      const scanResult = await executePowerShell(scanCommand, args.timeout);
      
      return {
        content: [
          {
            type: 'text',
            text: `🔍 Escaneo SSH de ${args.target}:\n\n${scanResult.output}`
          }
        ],
        isError: false,
        metadata: {
          tool: 'ssh_scan',
          target: args.target,
          exitCode: scanResult.exitCode,
          executionTime: scanResult.executionTime,
          rateLimitInfo: {
            remainingRequests: rateLimiter.getRemainingRequests()
          },
          timestamp: new Date().toISOString()
        }
      };
  • src/index.js:450-467 (registration)
    Registration of the ssh_scan tool in the ListToolsRequestSchema handler, defining its name, description, and input schema.
    {
      name: 'ssh_scan',
      description: 'Escanear red para encontrar hosts SSH disponibles',
      inputSchema: {
        type: 'object',
        properties: {
          target: {
            type: 'string',
            description: 'Red a escanear (ej: 192.168.1.0/24) o host individual'
          },
          timeout: {
            type: 'number',
            description: 'Timeout en milisegundos (opcional)'
          }
        },
        required: ['target']
      }
    },
  • Input schema definition for ssh_scan tool.
    properties: {
      target: {
        type: 'string',
        description: 'Red a escanear (ej: 192.168.1.0/24) o host individual'
      },
      timeout: {
        type: 'number',
        description: 'Timeout en milisegundos (opcional)'
      }
    },
    required: ['target']

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/GUEPARD98/MCP-POWERSHELL'

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