Skip to main content
Glama
d3v1an
by d3v1an

ssh_read_file

Read the content of a file on a remote server via SSH to access configuration files, logs, or documents without direct server login.

Instructions

Lee el contenido de un archivo en el servidor remoto

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesRuta del archivo a leer en el servidor remoto

Implementation Reference

  • The handler function that executes the `ssh_read_file` logic by executing a `cat` command on the remote server via SSH.
    private async handleReadFile(args: any): Promise<CallToolResult> {
      this.requireConnection();
      const remotePath = args.path as string;
    
      try {
        const content = await this.execCommand(`cat ${escapeShellArg(remotePath)}`);
        this.audit("ssh_read_file", remotePath, "ok");
        this.recordOperation("ssh_read_file", { path: remotePath }, `(${content.length} bytes leídos)`, false);
        return {
          content: [{ type: "text", text: content }],
        };
      } catch (error) {
        this.audit("ssh_read_file", remotePath, "error");
        const msg = error instanceof Error ? error.message : String(error);
        throw new Error(`Error leyendo archivo "${remotePath}": ${msg}`);
      }
    }
  • Schema definition and registration for the `ssh_read_file` tool.
      name: "ssh_read_file",
      description: "Lee el contenido de un archivo en el servidor remoto",
      inputSchema: {
        type: "object",
        properties: {
          path: {
            type: "string",
            description: "Ruta del archivo a leer en el servidor remoto",
          },
        },
        required: ["path"],
      },
    },

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