@lgariv/ssh-mcp
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

SSH MCP Server

A Model Context Protocol (MCP) server that enables SSH connectivity and remote command execution. Designed to run locally on your machine to access LAN servers and other local network resources.

Features

Provides two tools over MCP:

  • ssh_test_connection: Tests connectivity to the configured host and returns hostname.
  • ssh_run: Executes a command remotely and returns stdout, stderr, and exit code.

Key Design

This MCP runs locally on your machine, allowing it to:

  • Access servers on your local network (LAN)
  • Connect to private IP addresses (10.x.x.x, 192.168.x.x, etc.)
  • Work with hosts behind NAT/firewall
  • Maintain secure connections without exposing credentials to cloud services

Installation Methods

Method 1: Via Smithery (Recommended - No Installation Required)

This method runs the MCP locally on your machine without needing to clone or install anything:

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

Benefits:

  • Runs locally on your machine
  • Can access LAN servers and private IPs
  • No installation or cloning required
  • Always uses the latest version

Method 2: Local Installation

For development or if you prefer a local installation:

  1. Install globally via npm:
npm install -g @lgariv/ssh-mcp
  1. Add to your MCP client config:
{
  "mcpServers": {
    "ssh-mcp": {
      "command": "ssh-mcp",
      "env": {
        "SSH_HOST": "10.0.0.116",
        "SSH_PORT": "22",
        "SSH_USERNAME": "ubuntu",
        "SSH_PASSWORD": "your-password"
      }
    }
  }
}

Method 3: From Source

  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": ["./dist/index.js"],
      "env": {
        "SSH_HOST": "192.168.1.1",
        "SSH_PORT": "22",
        "SSH_USERNAME": "admin",
        "SSH_PASSWORD": "your-password"
      }
    }
  }
}

Configuration

Environment variables required:

  • SSH_HOST: Target SSH server IP/hostname (can be local LAN IP)
  • SSH_PORT: SSH port (optional, defaults to "22")
  • SSH_USERNAME: SSH username for authentication
  • SSH_PASSWORD: SSH password for authentication

Use Cases

  • Local Network Access: Connect to servers on your LAN (192.168.x.x, 10.x.x.x)
  • Home Lab Management: Manage Raspberry Pis, NAS devices, local servers
  • Development Environments: Access local VMs and containers
  • IoT Device Control: Connect to local IoT devices and embedded systems
  • Secure Operations: Keep SSH credentials local, never sent to cloud services

Development

# Install dependencies
npm install

# Run in development mode
npm run dev

# Build for production
npm run build

# Test locally
npm start

Security Notes

  • Credentials are stored in your local MCP configuration
  • The MCP server runs entirely on your machine
  • No data or credentials are sent to external services
  • Ensure your MCP configuration file has appropriate permissions

License

ISC

Readme

Keywords

Package Sidebar

Install

npm i @lgariv/ssh-mcp

Weekly Downloads

7

Version

1.0.1

License

ISC

Unpacked Size

24.6 kB

Total Files

12

Last publish

Collaborators

  • lgariv