MCP server exposing SSH control for Linux and Windows servers via Model Context Protocol. Securely execute remote shell commands with password or SSH key authentication.
Add to Claude Desktop config.json
{
"mcpServers": {
"tufantunc-ssh-mcp": {
"command": "node",
"args": [
"~/.mcp/ssh-mcp/index.js"
]
}
}
} Get the source and run locally
git clone https://github.com/tufantunc/ssh-mcp.git ~/.mcp/ssh-mcp
cd ~/.mcp/ssh-mcp SSH MCP Server is a local Model Context Protocol (MCP) server that exposes SSH control for Linux and Windows systems, enabling LLMs and other MCP clients to execute shell commands securely via SSH.
exec: Execute a shell command on the remote server
command (required): Shell command to execute on the remote SSH serverdescription (optional): Optional description of what this command will do (appended as a comment)sudo-exec: Execute a shell command with sudo elevation
command (required): Shell command to execute as root using sudodescription (optional): Optional description of what this command will do (appended as a comment)--sudoPassword to be set for password-protected sudo--disableSudo flag at startup if sudo access is not needed or not available--suPassword instead which establishes a root shell--disableSudo--timeout (in milliseconds)--maxChars1000--maxChars=none or any <= 0 value (e.g. --maxChars=0)git clone https://github.com/tufantunc/ssh-mcp.git
cd ssh-mcp
npm install
You can configure your IDE or LLM like Cursor, Windsurf, Claude Desktop to use this MCP Server.
Required Parameters:
host: Hostname or IP of the Linux or Windows serveruser: SSH usernameOptional Parameters:
port: SSH port (default: 22)password: SSH password (or use key for key-based auth)key: Path to private SSH keysudoPassword: Password for sudo elevation (when executing commands with sudo)suPassword: Password for su elevation (when you need a persistent root shell)timeout: Command execution timeout in milliseconds (default: 60000ms = 1 minute)maxChars: Maximum allowed characters for the command input (default: 1000). Use none or 0 to disable the limit.disableSudo: Flag to disable the sudo-exec tool completely. Useful when sudo access is not needed or not available.{
"mcpServers": {
"ssh-mcp": {
"command": "npx",
"args": [
"ssh-mcp",
"-y",
"--",
"--host=1.2.3.4",
"--port=22",
"--user=root",
"--password=pass",
"--key=path/to/key",
"--timeout=30000",
"--maxChars=none"
]
}
}
}
You can add this MCP server to Claude Code using the claude mcp add command. This is the recommended method for Claude Code.
Basic Installation:
claude mcp add --transport stdio ssh-mcp -- npx -y ssh-mcp -- --host=YOUR_HOST --user=YOUR_USER --password=YOUR_PASSWORD
Installation Examples:
With Password Authentication:
claude mcp add --transport stdio ssh-mcp -- npx -y ssh-mcp -- --host=192.168.1.100 --port=22 --user=admin --password=your_password
With SSH Key Authentication:
claude mcp add --transport stdio ssh-mcp -- npx -y ssh-mcp -- --host=example.com --user=root --key=/path/to/private/key
With Custom Timeout and No Character Limit:
claude mcp add --transport stdio ssh-mcp -- npx -y ssh-mcp -- --host=192.168.1.100 --user=admin --password=your_password --timeout=120000 --maxChars=none
With Sudo and Su Support:
claude mcp add --transport stdio ssh-mcp -- npx -y ssh-mcp -- --host=192.168.1.100 --user=admin --password=your_password --sudoPassword=sudo_pass --suPassword=root_pass
Installation Scopes:
You can specify the scope when adding the server:
Local scope (default): For personal use in the current project
claude mcp add --transport stdio ssh-mcp --scope local -- npx -y ssh-mcp -- --host=YOUR_HOST --user=YOUR_USER --password=YOUR_PASSWORD
Project scope: Share with your team via .mcp.json file
claude mcp add --transport stdio ssh-mcp --scope project -- npx -y ssh-mcp -- --host=YOUR_HOST --user=YOUR_USER --password=YOUR_PASSWORD
User scope: Available across all your projects
claude mcp add --transport stdio ssh-mcp --scope user -- npx -y ssh-mcp -- --host=YOUR_HOST --user=YOUR_USER --password=YOUR_PASSWORD
Verify Installation:
After adding the server, restart Claude Code and ask Cascade to execute a command:
"Can you run 'ls -la' on the remote server?"
For more information about MCP in Claude Code, see the official documentation.
You can use the MCP Inspector for visual debugging of this MCP Server.
npm run inspect
SSH MCP Server is provided under the MIT License. Use at your own risk. This project is not affiliated with or endorsed by any SSH or MCP provider.
We welcome contributions! Please see our Contributing Guidelines for more information.
This project follows a Code of Conduct to ensure a welcoming environment for everyone.
If you find SSH MCP Server helpful, consider starring the repository or contributing! Pull requests and feedback are welcome.
A swiss-army-knife that can manage/execute programs and read/write/search/edit code and text files.
A MCP Server that enhance your IDE with AI-powered assistance for Intlayer i18n / CMS tool: smart CLI access, access to the docs.
A Model Context Protocol server that provides access to iTerm. You can run commands and ask questions about what you see in the iTerm terminal.
Run any command with run_command and run_script tools.
A secure shell command execution server implementing the Model Context Protocol (MCP)
Command line interface with secure execution and customizable security policies