Skip to main content
Glama
d3v1an
by d3v1an

ssh_connect

Connect to an SSH server using a configured profile for remote administration, command execution, and file transfers with security safeguards.

Instructions

Conecta a un servidor SSH usando un perfil configurado

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
profileYesNombre del perfil del servidor (ej: produccion, staging)

Implementation Reference

  • The handler logic for "ssh_connect" which initiates an SSH connection to a specified profile.
    private async handleConnect(args: any): Promise<CallToolResult> {
      if (this.sshClient) {
        throw new Error(
          `Ya hay una conexión activa al perfil "${this.currentProfile}". Desconecta primero con ssh_disconnect.`
        );
      }
    
      const profileName = args.profile as string;
      const profile = getProfile(profileName);
    
      return new Promise<CallToolResult>((resolve, reject) => {
        const client = new Client();
    
        client.on("ready", () => {
          this.sshClient = client;
          this.currentProfile = profileName;
          this.connectedAt = new Date();
          this.commandHistory = [];
          this.recordCounter = 0;
    
          this.audit("ssh_connect", `profile=${profileName}`, "ok");
    
          resolve({
            content: [
              {
                type: "text",
                text: `Conectado a "${profileName}" (${profile.username}@${profile.host}:${profile.port})`,
              },
            ],
          });
        });
    
        client.on("error", (err) => {
          this.audit("ssh_connect", `profile=${profileName}`, "error");
          reject(new Error(`Error conectando a "${profileName}": ${err.message}`));
        });
    
        client.connect({
          host: profile.host,
          port: profile.port,
          username: profile.username,
          password: profile.password,
        });
      });
    }
  • src/tools.ts:12-25 (registration)
    Definition and registration of the "ssh_connect" tool, including its schema.
    {
      name: "ssh_connect",
      description: "Conecta a un servidor SSH usando un perfil configurado",
      inputSchema: {
        type: "object",
        properties: {
          profile: {
            type: "string",
            description: "Nombre del perfil del servidor (ej: produccion, staging)",
          },
        },
        required: ["profile"],
      },
    },

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

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