Get the FREE Ultimate OpenClaw Setup Guide →

ssh

MCP server from vilasone455/ssh-mcp-server

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio vilasone455-ssh-mcp-server node /path/to/ssh-mcp-server/dist/index.js \
  --env MACHINES_PATH="/path/to/your/machines.json"

How to use

This SSH MCP Server exposes SSH control as MCP tools, allowing a large language model or MCP client to discover, connect to, and execute commands on remote machines via SSH. The server offers tools for listing available SSH targets, establishing and managing SSH sessions, and executing commands securely (with an option for read-only or safer executions). Available tools include get_available_connections (lists known machines), create_connection (opens a new SSH session and returns a connection_id), get_connections (lists active sessions), execute_command (runs a shell command with no restrictions), secure_execute_command (blocks potentially destructive actions), and close_connection (terminates an active session). The client example demonstrates how to wire the server into a Claude Desktop-like workflow by providing the server command, path to the built dist script, and an environment variable pointing to your machines.json configuration.

To use, start the MCP server through the configured command, then issue natural-language prompts like: "Open an SSH session to Todo server and run uptime" or "What is the status of all active SSH connections?" The MCP client will translate these prompts into the appropriate tool calls, manage connections, and present the command output back to you.

How to install

Prerequisites:

  • Node.js (recommended LTS) and npm/yarn installed
  • TypeScript project (this repository) with dependencies
  • Access to a machines.json file describing SSH targets

Installation steps:

  1. Clone the repository git clone https://github.com/vilasone455/ssh-mcp-server.git cd ssh-mcp-server

  2. Install dependencies npm install

    or yarn install

  3. Build the TypeScript project (produces dist/index.js) npm run build

    or if the project uses tsc directly: npm run compile

  4. Prepare your machines configuration Create a machines.json describing your SSH targets, e.g.: (example) [ {"machine_id": "todo-server-01", "label": "Todo server", "os": "ubuntu", "source": "digitalocean", "ssh": {"host": "192.168.1.11", "port": 22, "username": "user", "password": "your_password_here"}}, {"machine_id": "build-agent-01", "label": "CI Build Agent (Key Auth)", "os": "ubuntu", "source": "aws", "ssh": {"host": "192.168.1.12", "port": 22, "username": "ubuntu", "keyPath": "/home/ubuntu/.ssh/id_rsa"}} ]

  5. Run the server using the provided MCP configuration (example shown in mcp_config):

    • Ensure MACHINES_PATH points to your machines.json file
    • Start the server (as configured in your MCP client): node dist/index.js
  6. Connect via MCP client Use your MCP client configuration to point to the server (see mcp_config example).

Additional notes

Tips and common considerations:

  • Keep MACHINES_PATH secure and restrict access to the machines.json to trusted environments.
  • Use secure_execute_command for safer interactions; consider enabling read-only mode for limited contexts.
  • Ensure SSH targets are reachable from the server host and that SSH keys or passwords are correctly configured.
  • If you modify machines.json, reload or restart the MCP server so the changes take effect.
  • Monitor for connection limits or session cleanup to avoid resource leaks.
  • The server is designed to work with the MCP SDK; verify compatibility with your MCP client version when upgrading.

Related MCP Servers

Sponsor this space

Reach thousands of developers