Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT and other tools is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AI Fire in da houseCheck it out free

ssh-mcp-server

MCP.Pizza Chef: classfang

ssh-mcp-server is a secure SSH-based MCP server that enables AI assistants and MCP-compatible applications to execute remote SSH commands safely. It supports multiple authentication methods, including password and private key with passphrase, and enforces command security through flexible blacklists and whitelists. This server standardizes remote SSH interactions under the MCP protocol, allowing seamless, controlled, and credential-safe remote server management by AI models.

Use This MCP server To

Execute remote server commands via MCP protocol securely Control allowed SSH commands with blacklist and whitelist Integrate remote SSH operations into AI workflows Enable AI assistants to manage servers without exposing credentials Standardize SSH command execution for AI applications

README

πŸ” ssh-mcp-server

SSH-based MCP (Model Context Protocol) server that allows remote execution of SSH commands via the MCP protocol.

English Document | δΈ­ζ–‡ζ–‡ζ‘£

πŸ“ Project Overview

ssh-mcp-server is a bridging tool that enables AI assistants and other applications supporting the MCP protocol to execute remote SSH commands through a standardized interface. This allows AI assistants to safely operate remote servers, execute commands, and retrieve results without directly exposing SSH credentials to AI models.

✨ Key Features

  • πŸ”’ Secure Connections: Supports multiple secure SSH connection methods, including password authentication and private key authentication (with passphrase support)
  • πŸ›‘οΈ Command Security Control: Precisely control the range of allowed commands through flexible blacklist and whitelist mechanisms to prevent dangerous operations
  • πŸ”„ Standardized Interface: Complies with MCP protocol specifications for seamless integration with AI assistants supporting the protocol
  • πŸ“‚ File Transfer: Supports bidirectional file transfers, uploading local files to servers or downloading files from servers
  • πŸ”‘ Credential Isolation: SSH credentials are managed entirely locally and never exposed to AI models, enhancing security
  • πŸš€ Ready to Use: Can be run directly using NPX without global installation, making it convenient and quick to deploy

πŸ“¦ Open Source Repository

GitHub: https://github.com/classfang/ssh-mcp-server

NPM: https://www.npmjs.com/package/@fangjunjie/ssh-mcp-server

πŸ› οΈ Tools List

Tool Name Description
execute-command Command Execution Tool Execute SSH commands on remote servers and get results
upload File Upload Tool Upload local files to specified locations on remote servers
download File Download Tool Download files from remote servers to local specified locations

πŸ“š Usage

πŸ”§ MCP Configuration Examples

βš™οΈ Command Line Options

Options:
  -h, --host          SSH server host address
  -p, --port          SSH server port
  -u, --username      SSH username
  -w, --password      SSH password
  -k, --privateKey    SSH private key file path
  -P, --passphrase    Private key passphrase (if any)
  -W, --whitelist     Command whitelist, comma-separated regular expressions
  -B, --blacklist     Command blacklist, comma-separated regular expressions

πŸ”‘ Using Password

{
  "mcpServers": {
    "ssh-mpc-server": {
      "command": "npx",
      "args": [
        "-y",
        "@fangjunjie/ssh-mcp-server",
        "--host 192.168.1.1",
        "--port 22",
        "--username root",
        "--password pwd123456"
      ]
    }
  }
}

πŸ” Using Private Key

{
  "mcpServers": {
    "ssh-mpc-server": {
      "command": "npx",
      "args": [
        "-y",
        "@fangjunjie/ssh-mcp-server",
        "--host 192.168.1.1",
        "--port 22",
        "--username root",
        "--privateKey ~/.ssh/id_rsa"
      ]
    }
  }
}

πŸ” Using Private Key with Passphrase

{
  "mcpServers": {
    "ssh-mpc-server": {
      "command": "npx",
      "args": [
        "-y",
        "@fangjunjie/ssh-mcp-server",
        "--host 192.168.1.1",
        "--port 22",
        "--username root",
        "--privateKey ~/.ssh/id_rsa",
        "--passphrase pwd123456"
      ]
    }
  }
}

πŸ“ Using Command Whitelist and Blacklist

Use the --whitelist and --blacklist parameters to restrict the range of executable commands. Multiple patterns are separated by commas. Each pattern is a regular expression used to match commands.

Example: Using Command Whitelist

{
  "mcpServers": {
    "ssh-mpc-server": {
      "command": "npx",
      "args": [
        "-y",
        "@fangjunjie/ssh-mcp-server",
        "--host 192.168.1.1",
        "--port 22",
        "--username root",
        "--password pwd123456",
        "--whitelist ^ls( .*)?,^cat .*,^df.*"
      ]
    }
  }
}

Example: Using Command Blacklist

{
  "mcpServers": {
    "ssh-mpc-server": {
      "command": "npx",
      "args": [
        "-y",
        "@fangjunjie/ssh-mcp-server",
        "--host 192.168.1.1",
        "--port 22",
        "--username root",
        "--password pwd123456",
        "--blacklist ^rm .*,^shutdown.*,^reboot.*"
      ]
    }
  }
}

Note: If both whitelist and blacklist are specified, the system will first check whether the command is in the whitelist, and then check whether it is in the blacklist. The command must pass both checks to be executed.

ssh-mcp-server FAQ

How does ssh-mcp-server ensure secure SSH connections?
It supports password and private key authentication with passphrase, ensuring encrypted and secure connections.
Can I restrict which SSH commands are executable?
Yes, ssh-mcp-server provides flexible blacklist and whitelist mechanisms to control allowed commands.
How does ssh-mcp-server protect SSH credentials from AI models?
Credentials are managed server-side and never exposed directly to AI models, ensuring security.
Is ssh-mcp-server compatible with multiple AI assistant platforms?
Yes, it complies with MCP protocol standards, enabling integration with various AI assistants supporting MCP, including OpenAI, Claude, and Gemini.
What authentication methods are supported?
Password authentication and private key authentication with passphrase support are both supported.
How does ssh-mcp-server integrate with the MCP ecosystem?
It acts as an MCP server exposing SSH command execution as a standardized MCP interface for clients.
Can ssh-mcp-server handle multiple simultaneous SSH connections?
Yes, it supports multiple secure SSH connections concurrently for scalable remote management.