Get the FREE Ultimate OpenClaw Setup Guide →

mcp-ssh

MCP server from mfangtao/mcp-ssh-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 mfangtao-mcp-ssh-server node dist/server.js \
  --env PORT="Port to run the MCP server on (default 3000)"

How to use

mcp-ssh is an MCP server that exposes SSH remote command execution over MCP. It uses SSH2 to connect to target hosts and runs commands remotely, returning stdout, stderr and exit codes to the MCP client. Clients can invoke the execute_ssh_command tool via MCP to perform secured remote commands, with authentication supported by password or private key methods. The server is built with TypeScript for type safety and leverages the MCP SDK for a consistent protocol surface.

To use, run the server locally or in your environment, then connect with an MCP client and call the execute_ssh_command tool, supplying the SSH connection details and the command you want to run. The client should provide connection host, port, username, and either a password or a privateKey to authenticate. Example usage from an MCP client: create a request to the execute_ssh_command tool with a connection object (host, port, username, and credentials) and the command string you want to execute (for example, ls -la). The server will return the command output along with any errors and the exit code.

How to install

Prerequisites:

  • Node.js >= 16
  • npm or yarn
  • Git

Manual installation steps:

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

  2. Install dependencies npm install

  3. Build the project (TypeScript to JavaScript) npm run build

  4. Start the server npm start

Optional Smithery installation (automatic): npx -y @smithery/cli install @mfangtao/mcp-ssh-server --client claude

Notes:

  • Ensure environment variables (like PORT) are set if you override defaults.
  • If you customize host binding or TLS, configure accordingly in your deployment setup.

Additional notes

Tips and common considerations:

  • Ensure SSH authentication methods are properly configured on target hosts (password or privateKey). If using privateKey, ensure the key is accessible by the server and has appropriate permissions.
  • When deploying in production, consider restricting access to MCP clients and using TLS where possible.
  • If you run into build issues, verify TypeScript version compatibility and ensure all dependencies (@types/*) align with Node.js version.
  • The server exposes an execute_ssh_command tool via MCP; you can extend or customize tooling by integrating additional SSH commands as needed.
  • Environment variable PORT can be used to change the listening port without editing code.

Related MCP Servers

Sponsor this space

Reach thousands of developers