SSH MCP Server
Enables SSH operations including connecting to remote servers, executing commands, and transferring files between local and remote systems. Supports multiple SSH connections with both password and private key authentication methods.
README
SSH MCP Server
A Model Context Protocol (MCP) server that provides SSH functionality including file copying between servers, command execution, and file management.
Features
- 🔐 SSH Connection Management: Connect to multiple SSH servers with connection pooling
- 📁 File Operations: Copy files between local and remote servers, or between remote servers
- 🖥️ Command Execution: Execute commands on remote servers
- 📋 File Listing: List files and directories on local or remote systems
- ℹ️ File Information: Get detailed file information (size, permissions, timestamps)
- 🔑 Authentication: Support for password and private key authentication
Installation
npm install
npm run build
Usage
Claude Desktop Integration
To use this SSH MCP server with Claude Desktop, you need to configure it in your Claude Desktop settings.
1. Build the Server
npm install
npm run build
2. Configure Claude Desktop
Add the following configuration to your Claude Desktop MCP settings file:
On macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"ssh-server": {
"command": "node",
"args": ["/absolute/path/to/mcp-ssh/dist/index.js"],
"env": {}
}
}
}
Important: Replace /absolute/path/to/mcp-ssh/ with the actual absolute path to your mcp-ssh project directory.
3. Restart Claude Desktop
After adding the configuration, restart Claude Desktop completely for the changes to take effect.
4. Verify Installation
Once restarted, you should see the SSH tools available in Claude Desktop. You can test by asking Claude to:
- "Connect to an SSH server"
- "List available SSH tools"
- "Copy a file between servers"
Development Mode
npm run dev
Production
npm run build
npm start
Quick Start
New to SSH MCP Server? Check out our How to Use Authentication Guide for simple, step-by-step instructions on connecting to your servers using natural language with Claude Desktop.
Available Tools
1. ssh_connect
Connect to an SSH server.
Parameters:
host(string): SSH server hostname or IP addressport(number, default: 22): SSH port numberusername(string): SSH usernamepassword(string, optional): SSH passwordprivateKeyPath(string, optional): Path to private key filepassphrase(string, optional): Passphrase for private keyconnectionId(string): Unique identifier for this connection
Authentication Methods:
- Password Authentication:
{
"host": "192.168.1.100",
"username": "your_username",
"password": "your_password",
"connectionId": "server1"
}
- SSH Key Authentication:
{
"host": "192.168.1.100",
"username": "your_username",
"privateKeyPath": "/path/to/private/key",
"passphrase": "optional_passphrase",
"connectionId": "server1"
}
2. ssh_disconnect
Disconnect from an SSH server.
Parameters:
connectionId(string): Connection ID to disconnect
3. ssh_execute
Execute a command on a remote SSH server.
Parameters:
connectionId(string): SSH connection IDcommand(string): Command to executecwd(string, optional): Working directory for command execution
Example:
{
"connectionId": "server1",
"command": "ls -la /home/user",
"cwd": "/home/user"
}
4. ssh_copy_file
Copy files between local and remote servers or between remote servers.
Parameters:
sourceConnectionId(string): Source SSH connection ID (use "local" for local files)sourcePath(string): Source file pathtargetConnectionId(string): Target SSH connection ID (use "local" for local files)targetPath(string): Target file pathcreateDirectories(boolean, default: true): Create target directories if they don't exist
Examples:
Local to Remote:
{
"sourceConnectionId": "local",
"sourcePath": "/local/file.txt",
"targetConnectionId": "server1",
"targetPath": "/remote/file.txt"
}
Remote to Local:
{
"sourceConnectionId": "server1",
"sourcePath": "/remote/file.txt",
"targetConnectionId": "local",
"targetPath": "/local/file.txt"
}
Remote to Remote:
{
"sourceConnectionId": "server1",
"sourcePath": "/path/on/server1/file.txt",
"targetConnectionId": "server2",
"targetPath": "/path/on/server2/file.txt"
}
5. ssh_list_files
List files and directories on local or remote server.
Parameters:
connectionId(string): SSH connection ID (use "local" for local files)remotePath(string): Directory path to listshowHidden(boolean, default: false): Show hidden files
6. ssh_file_info
Get file information (size, permissions, etc.).
Parameters:
connectionId(string): SSH connection ID (use "local" for local files)filePath(string): File path to get info for
Troubleshooting
Claude Desktop Integration Issues
Server not appearing in Claude Desktop:
- Verify the absolute path in
claude_desktop_config.jsonis correct - Ensure the server was built successfully (
npm run build) - Check that
dist/index.jsexists in your project directory - Restart Claude Desktop completely (quit and reopen)
- Check Claude Desktop logs for error messages
Permission errors:
- Ensure Node.js has permission to read the project directory
- On macOS, you may need to grant Claude Desktop full disk access in System Preferences > Security & Privacy
SSH connection failures:
- Verify SSH server is accessible from your machine
- Test SSH connection manually:
ssh username@hostname - Check SSH key permissions (should be 600):
chmod 600 ~/.ssh/id_rsa - Ensure SSH key is in the correct format (OpenSSH)
File transfer issues:
- Check file paths are absolute and correct
- Verify write permissions on target directories
- Ensure sufficient disk space on target system
Getting Help
If you encounter issues:
- Check the Claude Desktop console/logs for error messages
- Verify your configuration matches the examples exactly
- Test SSH connections manually before using the MCP server
Security Considerations
- Private keys should be stored securely with appropriate file permissions (600)
- Use SSH key authentication instead of passwords when possible
- Consider using SSH agent forwarding for additional security
- The server maintains connection pools - ensure proper cleanup on shutdown
Error Handling
The server provides detailed error messages for:
- Connection failures
- Authentication errors
- File operation errors
- Invalid parameters
- Missing connections
Connection Management
- Connections are pooled and reused for efficiency
- Each connection has a unique ID for reference
- Connections are automatically cleaned up on server shutdown
- Use
ssh_disconnectto manually close connections
Temporary Files
For remote-to-remote file transfers, temporary files are created in /tmp/ and automatically cleaned up after transfer completion or on error.
Dependencies
@modelcontextprotocol/sdk: MCP SDK for server implementationnode-ssh: SSH client for Node.jsssh2: Low-level SSH2 clientzod: Runtime type validation
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。