SSH MCP Server

$git clone https://github.com/tufantunc/ssh-mcp.git && cd ssh-mcp && npm install
README.md

Securely execute shell commands on remote Linux and Windows systems via SSH

SSH MCP Server

SSH MCP Server is a local Model Context Protocol (MCP) server that exposes SSH control for Linux and Windows systems, enabling LLMs and other MCP clients to execute shell commands securely via SSH.

Contents

Quick Start

  • Install SSH MCP Server
  • Configure SSH MCP Server
  • Set up your MCP Client (e.g. Claude Desktop, Cursor, etc)
  • Execute remote shell commands on your Linux or Windows server via natural language

Features

  • MCP-compliant server exposing SSH capabilities
  • Execute shell commands on remote Linux and Windows systems
  • Secure authentication via password or SSH key
  • Built with TypeScript and the official MCP SDK
  • Configurable timeout protection with automatic process abortion
  • Graceful timeout handling - attempts to kill hanging processes before closing connections

Tools

  • exec: Execute a shell command on the remote server

    • Parameters:
      • command (required): Shell command to execute on the remote SSH server
      • description (optional): Optional description of what this command will do (appended as a comment)
    • Timeout Configuration:
  • sudo-exec: Execute a shell command with sudo elevation

    • Parameters:
      • command (required): Shell command to execute as root using sudo
      • description (optional): Optional description of what this command will do (appended as a comment)
    • Notes:
      • Requires --sudoPassword to be set for password-protected sudo
      • Can be disabled by passing the --disableSudo flag at startup if sudo access is not needed or not available
      • For persistent root access, consider using --suPassword instead which establishes a root shell
      • Tool will not be available at all if server is started with --disableSudo
    • Timeout Configuration:
      • Timeout is configured via command line argument --timeout (in milliseconds)
      • Default timeout: 60000ms (1 minute)
      • When a command times out, the server automatically attempts to abort the running process before closing the connection
    • Max Command Length Configuration:
      • Max command characters are configured via --maxChars
      • Default: 1000
      • No-limit mode: set --maxChars=none or any <= 0 value (e.g. --maxChars=0)

Installation

  1. Clone the repository:
    git clone https://github.com/tufantunc/ssh-mcp.git
    cd ssh-mcp
    
  2. Install dependencies:
    npm install
    

Client Setup

You can configure your IDE or LLM like Cursor, Windsurf, Claude Desktop to use this MCP Server.

Required Parameters:

  • host: Hostname or IP of the Linux or Windows server
  • user: SSH username

Optional Parameters:

  • port: SSH port (default: 22)
  • password: SSH password (or use key for key-based auth)
  • key: Path to private SSH key
  • sudoPassword: Password for sudo elevation (when executing commands with sudo)
  • suPassword: Password for su elevation (when you need a persistent root shell)
  • timeout: Command execution timeout in milliseconds (default: 60000ms = 1 minute)
  • maxChars: Maximum allowed characters for the command input (default: 1000). Use none or 0 to disable the limit.
  • disableSudo: Flag to disable the sudo-exec tool completely. Useful when sudo access is not needed or not available.
{
    "mcpServers": {
        "ssh-mcp": {
            "command": "npx",
            "args": [
                "ssh-mcp",
                "-y",
                "--",
                "--host=1.2.3.4",
                "--port=22",
                "--user=root",
                "--password=pass",
                "--key=path/to/key",
                "--timeout=30000",
                "--maxChars

Tools (2)

execExecute a shell command on the remote server
sudo-execExecute a shell command with sudo elevation

Environment Variables

hostrequiredHostname or IP of the Linux or Windows server
userrequiredSSH username
portSSH port (default: 22)
passwordSSH password
keyPath to private SSH key
sudoPasswordPassword for sudo elevation

Configuration

claude_desktop_config.json
{
    "mcpServers": {
        "ssh-mcp": {
            "command": "npx",
            "args": [
                "ssh-mcp",
                "-y",
                "--",
                "--host=1.2.3.4",
                "--port=22",
                "--user=root",
                "--password=pass",
                "--key=path/to/key",
                "--timeout=30000",
                "--maxChars=1000"
            ]
        }
    }
}

Try it

Check the disk usage on my remote Linux server.
List all running Docker containers on the remote host using sudo.
Check the system logs for any errors in the last 10 minutes.
Restart the nginx service on the remote server.
Find all files larger than 100MB in the /var/log directory.

Frequently Asked Questions

What are the key features of SSH MCP Server?

Execute shell commands on remote Linux and Windows systems. Secure authentication via password or SSH key. Configurable timeout protection with automatic process abortion. Sudo elevation support for administrative tasks. Configurable maximum command length limits.

What can I use SSH MCP Server for?

Remote server monitoring and health checks via natural language. Automated administrative tasks requiring sudo elevation. Managing remote Windows or Linux environments without leaving the LLM interface. Troubleshooting remote system issues by inspecting logs and processes.

How do I install SSH MCP Server?

Install SSH MCP Server by running: git clone https://github.com/tufantunc/ssh-mcp.git && cd ssh-mcp && npm install

What MCP clients work with SSH MCP Server?

SSH MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Use SSH MCP Server with Conare

Manage MCP servers visually, upload persistent context, and never start from zero with Claude Code & Codex.

Try Free