SSH/SFTP MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@SSH/SFTP MCP Server check disk usage on the production server and show the largest directories"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
SSH/SFTP MCP Server
English | 中文
A Model Context Protocol (MCP) server that enables AI assistants like Claude to execute SSH commands and perform SFTP file operations on remote servers.
Features
Server Configuration Management - Define servers in config files or environment variables
Connection Testing - Test server connectivity before establishing sessions
SSH Command Execution - Run commands remotely with optional sudo support
SFTP File Operations - Upload, download, list, create, and delete files/directories
Session Management - Auto-cleanup of idle sessions, connection pooling
Multiple Auth Methods - Password and private key authentication
Related MCP server: ssh-mcp-server
Installation
Using npx (Recommended)
npx ssh-client-mcpUsing npm
npm install -g ssh-client-mcpFrom Source
git clone https://github.com/veithly/ssh-client-mcp.git
cd ssh-client-mcp
npm install
npm run buildQuick Start
Configure Claude Desktop
Add to your Claude Desktop configuration file:
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
Option 1: CLI Arguments (Recommended)
Configure server directly via command line arguments:
{
"mcpServers": {
"ssh": {
"command": "npx",
"args": [
"ssh-client-mcp",
"--host", "192.168.1.100",
"--user", "admin",
"--password", "your-password"
]
}
}
}With private key authentication:
{
"mcpServers": {
"ssh": {
"command": "npx",
"args": [
"ssh-client-mcp",
"--host", "192.168.1.100",
"--user", "admin",
"--key", "~/.ssh/id_rsa"
]
}
}
}With private key + passphrase:
{
"mcpServers": {
"ssh": {
"command": "npx",
"args": [
"ssh-client-mcp",
"--host", "192.168.1.100",
"--user", "admin",
"--key", "~/.ssh/id_rsa",
"--passphrase", "your-key-passphrase"
]
}
}
}Available CLI Arguments:
Argument | Short | Description |
|
| Server hostname or IP |
|
| SSH port (default: 22) |
|
| SSH username |
| SSH password | |
|
| Path to private key file |
| Passphrase for private key | |
| Server ID (default: "cli") | |
| Server display name |
Option 2: Config File
Create a servers.json file in the working directory:
{
"servers": [
{
"id": "my-server",
"name": "My Server",
"host": "192.168.1.100",
"port": 22,
"username": "admin",
"password": "your-password"
}
],
"defaultServer": "my-server"
}Option 3: Environment Variables
SSH_SERVER_DEV_HOST=192.168.1.100
SSH_SERVER_DEV_PORT=22
SSH_SERVER_DEV_USERNAME=admin
SSH_SERVER_DEV_PASSWORD=your-password
SSH_SERVER_DEV_NAME=Development ServerThen restart Claude Desktop to load the MCP server.
Available Tools (18 total)
Server Management
Tool | Description |
| List all configured servers |
| Get details of a specific server |
| Test connection to a server |
| Test all configured servers |
| Connect using server ID from config |
Connection Management
Tool | Description |
| Establish SSH connection with credentials |
| Close an SSH session |
| List all active SSH sessions |
Command Execution
Tool | Description |
| Execute a command on the remote server |
| Execute a command with sudo privileges |
File Operations (SFTP)
Tool | Description |
| Upload a local file to the remote server |
| Download a file from the remote server |
| List contents of a remote directory |
| Create a directory on the remote server |
| Remove a file or directory |
| Get file/directory information |
| Read contents of a remote file |
| Write content to a remote file |
Usage Examples
List Configured Servers
Tool: ssh_list_servers
Arguments: {}Test Connection
Tool: ssh_test_connection
Arguments: {
"serverId": "my-server"
}Connect to Server
Tool: ssh_connect_by_id
Arguments: {
"serverId": "my-server"
}Execute Command
Tool: ssh_exec
Arguments: {
"sessionId": "<session-id>",
"command": "ls -la /home"
}Upload File
Tool: sftp_upload
Arguments: {
"sessionId": "<session-id>",
"localPath": "/local/path/file.txt",
"remotePath": "/remote/path/file.txt"
}Download File
Tool: sftp_download
Arguments: {
"sessionId": "<session-id>",
"remotePath": "/remote/path/file.txt",
"localPath": "/local/path/file.txt"
}Configuration Options
Environment Variables
Variable | Description | Default |
| Session timeout in milliseconds |
|
| Maximum concurrent sessions |
|
| Connection timeout in milliseconds |
|
| Default server ID | - |
Server Configuration Fields
Field | Type | Required | Description |
| string | Yes | Unique server identifier |
| string | Yes | Display name |
| string | Yes | Hostname or IP address |
| number | No | SSH port (default: 22) |
| string | Yes | SSH username |
| string | No* | SSH password |
| string | No* | Path to private key file |
| string | No | Passphrase for private key |
| string | No | Server description |
| string[] | No | Tags for filtering |
*Either password or privateKeyPath must be provided.
Security Considerations
Sessions auto-expire after 30 minutes of inactivity
Maximum session limit prevents resource exhaustion
Credentials are not stored persistently
Sudo passwords are not logged
Use SSH keys instead of passwords when possible
Development
# Clone the repository
git clone https://github.com/veithly/ssh-client-mcp.git
cd ssh-client-mcp
# Install dependencies
npm install
# Build
npm run build
# Watch mode
npm run dev
# Clean build
npm run cleanProject Structure
ssh-client-mcp/
├── src/
│ ├── index.ts # MCP server entry point
│ ├── types.ts # Type definitions
│ ├── SessionManager.ts # SSH session lifecycle
│ ├── SSHExecutor.ts # Command execution
│ ├── SFTPOperations.ts # SFTP file operations
│ ├── ConnectionTester.ts # Connection testing
│ ├── config/
│ │ ├── ConfigManager.ts # Configuration management
│ │ ├── types.ts # Config types
│ │ └── index.ts # Config exports
│ └── tools/
│ ├── connection.ts # Connection tools
│ ├── command.ts # Command tools
│ ├── file.ts # File tools
│ ├── server.ts # Server management tools
│ └── index.ts # Tool exports
├── servers.example.json # Example server config
├── .env.example # Example environment config
├── package.json
├── tsconfig.json
└── README.mdContributing
Contributions are welcome! Please feel free to submit a Pull Request.
Fork the repository
Create your feature branch (
git checkout -b feature/AmazingFeature)Commit your changes (
git commit -m 'Add some AmazingFeature')Push to the branch (
git push origin feature/AmazingFeature)Open a Pull Request
License
MIT © 2024
Acknowledgments
Model Context Protocol - The MCP SDK
ssh2 - SSH2 client library for Node.js
Made for Claude AI
Available Tools
18 toolssftp_downloadB
Download a file from the remote server to local via SFTP.
Inputs: localPath (required), sessionId (required), remotePath (required), overwrite.
sftp_lsB
List contents of a remote directory.
Inputs: path (required), sessionId (required).
sftp_mkdirC
Create a directory on the remote server.
Inputs: path (required), sessionId (required), recursive.
sftp_readB
Read contents of a remote file.
Inputs: path (required), sessionId (required), encoding.
sftp_rmC
Remove a file or directory on the remote server.
Inputs: path (required), sessionId (required), recursive.
sftp_statA
Get file or directory information (size, permissions, timestamps).
Inputs: path (required), sessionId (required).
sftp_uploadB
Upload a local file to the remote server via SFTP.
Inputs: localPath (required), sessionId (required), remotePath (required), overwrite.
sftp_writeC
Write content to a remote file.
Inputs: path (required), content (required), sessionId (required), encoding.
ssh_connectB
Establish an SSH connection to a remote server. Returns a session ID for subsequent operations.
Inputs: host (required), username (required), port, timeout, +3 more.
ssh_connect_by_idC
Connect to a server using its configuration ID. Credentials are loaded from config.
Inputs: serverId (required), passwordOverride.
ssh_disconnectA
Close an SSH session and release resources.
Inputs: sessionId (required).
ssh_execB
Execute a command on the remote server via SSH. Returns stdout, stderr, and exit code.
Inputs: command (required), sessionId (required), timeout.
ssh_get_serverB
Get details of a specific configured server by ID.
Inputs: serverId (required).
ssh_list_serversA
List all configured SSH servers. Servers can be defined in servers.json or via environment variables.
Inputs: tag.
ssh_list_sessionsA
List all active SSH sessions with their status and statistics.
Inputs: no named parameters.
ssh_sudo_execA
Execute a command with sudo privileges on the remote server.
Inputs: command (required), sessionId (required), timeout, sudoPassword.
ssh_test_all_connectionsA
Test connections to all configured servers and report status.
Inputs: parallel.
ssh_test_connectionA
Test SSH/SFTP connection to a configured server without creating a session.
Inputs: serverId (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 18 tools
Most tools have clearly distinct purposes: connection management, command execution, and SFTP file operations are separated by both name and description. A few pairs could be confused at a glance, especially ssh_connect vs ssh_connect_by_id and sftp_read/upload vs sftp_write/download, but descriptions clarify the boundaries.
Names consistently use snake_case with ssh_ or sftp_ prefixes and an action-oriented suffix. Minor deviations exist, such as sftp_ls, sftp_rm, ssh_disconnect without an object, and the _by_id suffix on ssh_connect_by_id, but the pattern remains predictable.
18 tools is reasonable for a server combining SSH session management with SFTP file operations. A few tools are somewhat redundant or auxiliary, such as ssh_test_connection, ssh_test_all_connections, and ssh_connect_by_id, but each still maps to a plausible workflow rather than feeling padded.
The surface covers connection testing, session lifecycle, command execution including sudo, and core SFTP operations for listing, reading, writing, uploading, downloading, creating, deleting, and inspecting files. Minor gaps remain, such as rename/move, chmod, or directory removal semantics beyond sftp_rm, but core workflows are well supported.
Maintenance
Related MCP Connectors
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
- DNS-DATA RemoteDeprecatedcom.dns-data
Connect AI assistants to authorized Windows and macOS devices for files, commands, and management.
Connect AI assistants to explicitly paired computers, servers, and VMs for permitted remote actions.
Remote Desktop Commander: use files, terminal and processes on your own computers from any AI app.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI assistants to securely connect to and manage remote servers via SSH, supporting command execution, file transfers via SFTP, and multi-server management with both password and SSH key authentication.948 npm2MIT
- AlicenseAqualityDmaintenanceEnables AI assistants to securely execute remote SSH commands, perform file transfers, and monitor system status through a standardized interface. It features robust security controls including command whitelisting, blacklisting, and credential isolation to prevent unauthorized operations.1020 npmMIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to execute commands and transfer files on remote servers over SSH connections.1MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to securely execute commands, transfer files, and manage port forwarding on remote servers via SSH.114 npm38Apache 2.0