Skip to main content
Glama
SSH MCP Server
by lgariv

SSH MCP Server

A Model Context Protocol (MCP) server that enables SSH connectivity and remote command execution. This server can run locally to access private networks or via Smithery for public servers.

Features

  • ssh_test_connection: Tests connectivity to the configured host and returns hostname

  • ssh_run: Executes commands remotely and returns stdout, stderr, and exit code

Related MCP server: SSH MCP Server

Installation Methods

Method 1: From Source (For Development)

Best for developers who want to modify the code or contribute to the project.

  1. Clone and build:

git clone https://github.com/lgariv/ssh-mcp
cd ssh-mcp
npm install
npm run build
  1. Add to your MCP client config:

{
  "mcpServers": {
    "ssh-mcp": {
      "command": "node",
      "args": ["path/to/ssh-mcp/dist/index.js"],
      "env": {
        "SSH_HOST": "192.168.1.100",
        "SSH_PORT": "22",
        "SSH_USERNAME": "ubuntu",
        "SSH_PASSWORD": "your-password"
      }
    }
  }
}

Best for accessing servers on your local network (LAN) or private IPs. Runs on your machine.

Add to your MCP client config:

{
  "mcpServers": {
    "ssh-mcp": {
      "command": "npx",
      "args": ["-y", "@lgariv/ssh-mcp@latest"],
      "env": {
        "SSH_HOST": "10.0.0.116",
        "SSH_PORT": "22",
        "SSH_USERNAME": "admin",
        "SSH_PASSWORD": "your-password"
      }
    }
  }
}

Benefits:

  • No installation required

  • Always uses the latest version

  • Can access local network resources (192.168.x.x, 10.x.x.x, etc.)

  • Credentials stay on your machine

Method 3: Via Smithery (For Public Servers Only)

Best for accessing publicly accessible SSH servers. Runs on Smithery's infrastructure.

⚠️ Important: This method only works with publicly accessible servers. It cannot access private IPs or LAN resources.

Add to your MCP client config:

{
  "mcpServers": {
    "ssh-mcp": {
      "type": "http",
      "url": "https://server.smithery.ai/lgariv/ssh-mcp/mcp",
      "config": {
        "sshHost": "public.example.com",
        "sshPort": 22,
        "sshUsername": "ubuntu",
        "sshPassword": "your-password"
      }
    }
  }
}

Configuration

All methods require these environment variables or config parameters:

Parameter

Description

Default

SSH_HOST / sshHost

Target SSH server IP/hostname

Required

SSH_PORT / sshPort

SSH port number

22

SSH_USERNAME / sshUsername

SSH username

Required

SSH_PASSWORD / sshPassword

SSH password

Required

Use Cases by Method

Use Case

Recommended Method

Local home lab servers

Method 2 (NPM)

Raspberry Pi on LAN

Method 2 (NPM)

Local VMs or containers

Method 2 (NPM)

Development and testing

Method 1 (Source)

Cloud VPS with public IP

Method 3 (Smithery)

Public web servers

Method 3 (Smithery)

Security Notes

  • Methods 1 & 2: Credentials are stored locally in your MCP configuration

  • Method 3: Credentials are sent to Smithery's servers (use only with public servers)

  • Always use strong passwords and consider SSH keys for production use

  • Ensure your MCP configuration file has appropriate permissions

Development

# Install dependencies
npm install

# Run in development mode
npm run dev

# Build for production
npm run build

# Run built version
npm start

License

ISC

Author

lgariv

Available Tools

2 tools
ssh_runRun Remote CommandB

Runs a non-interactive command remotely over SSH and returns stdout, stderr, and exit code

Inputs: command (required).

ssh_test_connectionTest SSH ConnectionB

Attempts to connect to the configured SSH host and returns the remote hostname

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 2 tools

    Disambiguation5/5

    The two tools have completely distinct purposes: ssh_run executes commands and returns results, while ssh_test_connection only tests connectivity and returns hostname. There is no overlap or ambiguity between them.

    Naming Consistency5/5

    Both tools follow a consistent 'ssh_' prefix pattern with clear verb_noun naming (ssh_run and ssh_test_connection). The naming is predictable and follows the same convention throughout.

    Tool Count2/5

    With only 2 tools, this server feels severely under-scoped for SSH operations. While the tools cover basic connectivity and command execution, there are many obvious missing SSH functionalities like file transfer, session management, or interactive operations.

    Completeness2/5

    For an SSH server, the surface is significantly incomplete. There's no file transfer (scp/sftp), no interactive shell capability, no key management, no port forwarding, and no session persistence. Agents will hit dead ends trying to perform common SSH tasks beyond basic command execution.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables secure SSH connections to multiple remote servers with support for command execution, file transfers (SFTP), directory listing, and both password and key-based authentication.
      7
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables remote server management through SSH and SFTP, supporting command execution, file transfers, and interactive shell sessions. It allows for multiple concurrent connections using either password or SSH key authentication.
      11
      21 npm
      5
      MIT
    • F
      license
      B
      quality
      D
      maintenance
      Enables secure SSH connections to remote servers for executing shell commands and managing active sessions. It supports authentication via passwords or private keys and provides optional host-based access control.
      4
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables remote server management via SSH, including command execution, file transfer (SFTP), and interactive shell sessions, with support for multiple hosts.
      -