SSH MCP Server
MCP-compliant SSH server for secure command execution on Linux and Windows.
Key Features
Use Cases
README
SSH MCP Server
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.
Contents
Quick Start
- Install SSH MCP Server
- Configure SSH MCP Server
- Set up your MCP Client (e.g. Claude Desktop, Cursor, etc)
- Execute remote shell commands on your Linux or Windows server via natural language
Features
- MCP-compliant server exposing SSH capabilities
- Execute shell commands on remote Linux and Windows systems
- Secure authentication via password or SSH key
- Built with TypeScript and the official MCP SDK
- Configurable timeout protection with automatic process abortion
- Graceful timeout handling - attempts to kill hanging processes before closing connections
Tools
-
exec: Execute a shell command on the remote server- Parameters:
command(required): Shell command to execute on the remote SSH server
- Timeout Configuration:
- Parameters:
-
sudo-exec: Execute a shell command with sudo elevation- Parameters:
command(required): Shell command to execute as root using sudo
- Notes:
- Requires
--sudoPasswordto be set for password-protected sudo - Can be disabled by passing the
--disableSudoflag at startup if sudo access is not needed or not available - For persistent root access, consider using
--suPasswordinstead which establishes a root shell - Tool will not be available at all if server is started with
--disableSudo
- Requires
- Timeout Configuration:
- Timeout is configured via command line argument
--timeout(in milliseconds) - Default timeout: 60000ms (1 minute)
- When a command times out, the server automatically attempts to abort the running process before closing the connection
- Timeout is configured via command line argument
- Max Command Length Configuration:
- Max command characters are configured via
--maxChars - Default:
1000 - No-limit mode: set
--maxChars=noneor any<= 0value (e.g.--maxChars=0)
- Max command characters are configured via
- Parameters:
Installation
- Clone the repository:
bash
git clone https://github.com/tufantunc/ssh-mcp.git cd ssh-mcp - Install dependencies:
bash
npm install
Client Setup
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 username
Optional Parameters:
port: SSH port (default: 22)password: SSH password (or usekeyfor 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 thecommandinput (default: 1000). Usenoneor0to disable the limit.disableSudo: Flag to disable thesudo-exectool 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"
]
}
}
}
Claude Code
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
bashclaude 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.jsonfilebashclaude 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
bashclaude 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.
Testing
You can use the MCP Inspector for visual debugging of this MCP Server.
npm run inspect
Disclaimer
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.
Contributing
We welcome contributions! Please see our Contributing Guidelines for more information.
Code of Conduct
This project follows a Code of Conduct to ensure a welcoming environment for everyone.
Support
If you find SSH MCP Server helpful, consider starring the repository or contributing! Pull requests and feedback are welcome.
Star History
Repository Owner
User
Repository Details
Programming Languages
Tags
Join Our Newsletter
Stay updated with the latest AI tools, news, and offers by subscribing to our weekly newsletter.
Related MCPs
Discover similar Model Context Protocol servers
CMD MCP Server
Execute CMD commands via the Model Context Protocol with cross-platform and SSH support.
CMD MCP Server is an implementation of the Model Context Protocol (MCP) for executing CMD commands on Windows and Linux systems, with additional support for SSH connections. It enables seamless integration of command-line operations with MCP-compatible applications, leveraging the official MCP SDK. Written in TypeScript for cross-platform compatibility, it allows programmatic execution, configuration, and extension of CMD operations through standardized protocols. The server is designed for easy installation, robust configuration, and developer-friendly extension.
- ⭐ 22
- MCP
- PhialsBasement/CMD-MCP-Server
MCP Shell Server
A secure, configurable shell command execution server implementing the Model Context Protocol.
MCP Shell Server provides secure remote execution of whitelisted shell commands via the Model Context Protocol (MCP). It supports standard input, command output retrieval, and enforces strict safety checks on command operations. The tool allows configuration of allowed commands and execution timeouts, and can be integrated with platforms such as Claude.app and Smithery. With robust security assessments and flexible deployment methods, it facilitates controlled shell access for AI agents.
- ⭐ 153
- MCP
- tumf/mcp-shell-server
PiloTY
AI Pilot for PTY Operations via the Model Context Protocol
PiloTY is an MCP server that enables AI agents to control interactive terminals as if they were human users. It provides stateful, context-preserving terminal sessions that support interactive programs, SSH connections, and background process management. The system allows secure integration with AI platforms like Claude Code or Claude Desktop to translate natural language instructions into complex terminal workflows. Designed for extensibility and real-world development scenarios, PiloTY empowers agents to manage remote environments, debug interactively, and automate multi-step operations.
- ⭐ 12
- MCP
- yiwenlu66/PiloTY
Firefly MCP Server
Seamless resource discovery and codification for Cloud and SaaS with Model Context Protocol integration.
Firefly MCP Server is a TypeScript-based server implementing the Model Context Protocol to enable integration with the Firefly platform for discovering and managing resources across Cloud and SaaS accounts. It supports secure authentication, resource codification into infrastructure as code, and easy integration with tools such as Claude and Cursor. The server can be configured via environment variables or command line and communicates using standardized MCP interfaces. Its features facilitate automation and codification workflows for cloud resource management.
- ⭐ 15
- MCP
- gofireflyio/firefly-mcp
MCP Server for MySQL - Claude Code Edition
A Model Context Protocol MySQL server with SSH tunnels, optimized for Claude Code.
MCP Server for MySQL - Claude Code Edition provides an implementation of the Model Context Protocol for secure, context-driven access to MySQL databases. It enables AI tools, such as Claude Code, to access and manipulate database schemas and data through SSH tunnels, supporting multi-project setups and automated management. The server offers advanced configuration options and permission controls for safe interaction with remote databases.
- ⭐ 902
- MCP
- benborla/mcp-server-mysql
wcgw
Local shell and code agent server with deep AI integration for Model Context Protocol clients.
wcgw is an MCP server that empowers conversational AI models, such as Claude, with robust shell command execution and code editing capabilities on the user's local machine. It offers advanced tools for syntax-aware file editing, interactive shell command handling, and context management to optimize AI-driven workflows. Key protections are included to safeguard files, prevent accidental overwrites, and streamline large file handling, ensuring smooth automated code development and execution.
- ⭐ 616
- MCP
- rusiaaman/wcgw
Didn't find tool you were looking for?