Skip to main content
Glama
bvisible

MCP SSH Manager

ssh_db_dump

Dump MySQL, PostgreSQL, or MongoDB databases to files on remote servers through SSH connections. Specify database type, name, and output path to create backups.

Instructions

Dump database to file (MySQL, PostgreSQL, MongoDB)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
serverYesServer name
typeYesDatabase type
databaseYesDatabase name
outputFileYesOutput file path (will be created on remote server)
dbUserNoDatabase user
dbPasswordNoDatabase password
dbHostNoDatabase host (default: localhost)
dbPortNoDatabase port
compressNoCompress output with gzip (default: true)
tablesNoSpecific tables to dump (MySQL/PostgreSQL only)

Implementation Reference

  • Registration of the ssh_db_dump tool as part of the database tool group in the TOOL_GROUPS export.
    database: [
      'ssh_db_dump',
      'ssh_db_import',
      'ssh_db_list',
      'ssh_db_query'
    ],
  • Helper function to build MySQL database dump command, core logic for ssh_db_dump when type=mysql.
    export function buildMySQLDumpCommand(options) {
      const {
        database,
        user,
        password,
        host = 'localhost',
        port = 3306,
        outputFile,
        compress = true,
        tables = null
      } = options;
    
      let command = 'mysqldump';
    
      if (user) command += ` -u${user}`;
      if (password) command += ` -p'${password}'`;
      if (host) command += ` -h ${host}`;
      if (port) command += ` -P ${port}`;
    
      command += ' --single-transaction --routines --triggers';
      command += ` ${database}`;
    
      if (tables && Array.isArray(tables)) {
        command += ` ${tables.join(' ')}`;
      }
    
      if (compress) {
        command += ` | gzip > "${outputFile}"`;
      } else {
        command += ` > "${outputFile}"`;
      }
    
      return command;
    }
  • Helper function to build PostgreSQL database dump command, core logic for ssh_db_dump when type=postgresql.
    export function buildPostgreSQLDumpCommand(options) {
      const {
        database,
        user,
        password,
        host = 'localhost',
        port = 5432,
        outputFile,
        compress = true,
        tables = null
      } = options;
    
      let command = '';
      if (password) {
        command = `PGPASSWORD='${password}' `;
      }
    
      command += 'pg_dump';
      if (user) command += ` -U ${user}`;
      if (host) command += ` -h ${host}`;
      if (port) command += ` -p ${port}`;
      command += ' --format=custom --clean --if-exists';
    
      if (tables && Array.isArray(tables)) {
        for (const table of tables) {
          command += ` -t ${table}`;
        }
      }
    
      command += ` ${database}`;
    
      if (compress) {
        command += ` | gzip > "${outputFile}"`;
      } else {
        command += ` > "${outputFile}"`;
      }
    
      return command;
    }
  • Helper function to build MongoDB database dump command, core logic for ssh_db_dump when type=mongodb.
    export function buildMongoDBDumpCommand(options) {
      const {
        database,
        user,
        password,
        host = 'localhost',
        port = 27017,
        outputDir,
        compress = true,
        collections = null
      } = options;
    
      let command = 'mongodump';
      if (host) command += ` --host ${host}`;
      if (port) command += ` --port ${port}`;
      if (user) command += ` --username ${user}`;
      if (password) command += ` --password '${password}'`;
      if (database) command += ` --db ${database}`;
    
      if (collections && Array.isArray(collections)) {
        for (const collection of collections) {
          command += ` --collection ${collection}`;
        }
      }
    
      command += ` --out "${outputDir}"`;
    
      if (compress) {
        command += ` && tar -czf "${outputDir}.tar.gz" -C "$(dirname ${outputDir})" "$(basename ${outputDir})"`;
        command += ` && rm -rf "${outputDir}"`;
      }
    
      return command;
    }
  • Constants for supported database types and default ports used by ssh_db_dump tool.
    export const DB_TYPES = {
      MYSQL: 'mysql',
      POSTGRESQL: 'postgresql',
      MONGODB: 'mongodb'
    };
    
    // Default ports
    export const DB_PORTS = {
      mysql: 3306,
      postgresql: 5432,
      mongodb: 27017
    };
    
    /**
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the action ('dump database to file') but lacks behavioral details: it doesn't mention that this creates files on a remote server (implied by 'ssh' context but not explicit), whether it overwrites existing files, requires specific permissions, has performance impacts, or what happens on failure. For a mutation tool with zero annotation coverage, this is insufficient.

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 a single, efficient sentence with zero waste. It's front-loaded with the core action and includes essential context (database types). Every word earns its place without redundancy.

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?

Given the complexity (10 parameters, mutation operation, no output schema, and no annotations), the description is incomplete. It doesn't address behavioral aspects like remote file creation, error handling, or output format, leaving gaps for an AI agent to infer. For a tool with significant parameters and mutation intent, more context is needed.

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?

Schema description coverage is 100%, so the schema already documents all 10 parameters thoroughly (e.g., server name, database type, output file path). The description adds minimal value beyond the schema—it mentions database types but doesn't explain parameter interactions or constraints (e.g., 'tables' only for MySQL/PostgreSQL). Baseline 3 is appropriate when schema does the heavy lifting.

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 clearly states the verb ('dump') and resource ('database to file'), specifying the supported database types (MySQL, PostgreSQL, MongoDB). It distinguishes from siblings like ssh_db_import (which imports) and ssh_db_query (which queries), but doesn't explicitly differentiate from ssh_backup_create (which might overlap conceptually).

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?

No guidance on when to use this tool versus alternatives like ssh_backup_create or ssh_db_import. The description implies it's for database dumps but doesn't specify prerequisites (e.g., SSH access, database connectivity) or exclusions (e.g., not for real-time queries).

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