Get the FREE Ultimate OpenClaw Setup Guide →

ssh

A Model Context Protocol (MCP) server that provides SSH-based remote management tools for Linux servers, acting as proxy

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio giuliolibrando-ssh-mcp-server python -m ssh_mcp_server.server \
  --env SSH_HOST="Target server hostname or IP" \
  --env SSH_PORT="SSH port (default 22)" \
  --env SSH_USER="SSH username" \
  --env SERVER_HOST="MCP server bind address" \
  --env SERVER_PORT="MCP server port" \
  --env SSH_KEY_FILE="Path to SSH private key (if using key-based auth)" \
  --env SSH_PASSWORD="SSH password (if using password auth)"

How to use

This SSH MCP Server provides a set of MCP tools to manage remote Linux servers over SSH. It supports operations such as executing commands locally on the remote host, reading and writing files, listing directories, managing services (start/stop/restart/status), inspecting processes, and gathering network and log information. The included tools allow you to test connectivity, retrieve system information, perform privileged actions with optional sudo, and analyze logs from remote machines. You can integrate this server with AnythingLLM or other MCP clients to issue structured commands against a configured SSH endpoint.

To use the server, configure your SSH connection via environment variables (SSH_HOST, SSH_USER, SSH_PASSWORD or SSH_KEY_FILE, and SSH_PORT). Run the MCP server, then connect with your MCP client to the provided URL (default port 8000). Use the API tools such as test_ssh_connection, execute_command, read_file, list_directory, get_service_status, start_service, stop_service, restart_service, list_processes, kill_process, check_port, get_network_connections, tail_log, and search_log to manage and monitor the remote host.

How to install

Prerequisites:

  • Python 3.8+ installed on the host
  • Access to the remote Linux host via SSH
  • pip installed on the host running the MCP server

Docker (recommended):

  1. Copy the environment template and configure credentials:
cp env.example .env
# Edit .env with your SSH server details
  1. Build and run with Docker Compose:
docker compose up -d

Manual installation:

  1. Install dependencies:
pip install -r requirements.txt
  1. Set environment variables (example):
export SSH_HOST=your-server.example.com
export SSH_USER=root
export SSH_PASSWORD=your_password
# OR
export SSH_KEY_FILE=/path/to/private/key
  1. Run the server:
python -m ssh_mcp_server.server

AnythingLLM Integration:

  • Add the following configuration to your anythingllm_mcp_servers.json (example):
{
  "mcpServers": {
    "ssh-mcp-server": {
      "name": "SSH MCP Server",
      "type": "streamable",
      "url": "http://ssh-mcp-server:8000/mcp",
      "auth_token": null,
      "enabled": true
    }
  }
}

Additional notes

Environment variables are critical for the SSH connection. Use SSH key-based authentication when possible for better security. If you encounter authentication issues, verify SSH_HOST, SSH_USER, and the appropriate SSH_PASSWORD or SSH_KEY_FILE. Ensure the SSH user has necessary permissions for the requested operations (especially for service management and sudo commands). The MCP server listens on SERVER_PORT (default 8000); adjust your firewall rules accordingly. For long-running commands, consider increasing request timeouts in your MCP client to prevent timeouts. If you enable sudo operations, ensure the user has the necessary sudo privileges and that NOPASSWD is configured if you want password-less sudo for automated tasks.

Related MCP Servers

Sponsor this space

Reach thousands of developers