MCP SSH Server

MCP SSH Server

Enables seamless SSH operations including secure connections, file transfers, interactive shell sessions, and Docker container management on remote servers. Supports both password and SSH key authentication with credential management and connection pooling.

Category
访问服务器

README

MCP SSH Server

<div align="center"> <a href="README.md">🇺🇸 English</a> | <a href="README-id.md">🇮🇩 Bahasa Indonesia</a> </div>

🚀 Overview

MCP SSH Server is a powerful Model Context Protocol (MCP) server that enables seamless SSH operations, file transfers, and remote server management. This server provides comprehensive SSH functionality including secure connections, file operations, interactive shell sessions, credential management, and Docker deployment capabilities.

✨ Features

  • 🔐 Secure SSH Connections: Support for both password and SSH key authentication
  • 📁 File Operations: Copy files between local and remote servers with directory creation
  • 💻 Interactive Shell Sessions: Full terminal emulation with PTY support
  • 🔑 Credential Management: Save and reuse SSH credentials securely
  • 🐳 Docker Integration: Deploy and manage Docker containers remotely
  • 📂 Working Directory Context: Maintain working directory state per connection
  • 🔍 File System Operations: List files, get file info, and navigate directories
  • ⚡ Connection Pooling: Efficient connection management and reuse

📋 Prerequisites

  • Node.js 18+
  • TypeScript 5.3+
  • SSH access to target servers
  • Claude Desktop or compatible MCP client

🛠️ Installation

  1. Clone the repository:

    git clone <repository-url>
    cd mcp-ssh-server
    
  2. Install dependencies:

    npm install
    
  3. Build the project:

    npm run build
    
  4. Configure Claude Desktop:

    Add to your Claude Desktop configuration file:

    Windows: %APPDATA%/Claude/claude_desktop_config.json

    {
      "mcpServers": {
        "ssh-server": {
          "command": "node",
          "args": ["C:/path/to/mcp-ssh-server/dist/index.js"],
          "env": {}
        }
      }
    }
    

    macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

    {
      "mcpServers": {
        "ssh-server": {
          "command": "node",
          "args": ["/Users/username/path/to/mcp-ssh-server/dist/index.js"],
          "env": {}
        }
      }
    }
    

🎯 Available Tools

Connection Management

  • ssh_connect - Establish SSH connection
  • ssh_disconnect - Close SSH connection
  • ssh_connect_with_credential - Connect using saved credentials

Command Execution

  • ssh_execute - Execute commands on remote server
  • ssh_start_interactive_shell - Start interactive shell session
  • ssh_send_input - Send input to interactive shell
  • ssh_read_output - Read output from interactive shell
  • ssh_close_interactive_shell - Close interactive shell session

File Operations

  • ssh_copy_file - Copy files between servers
  • ssh_list_files - List directory contents
  • ssh_file_info - Get file information

Credential Management

  • ssh_save_credential - Save SSH credentials
  • ssh_list_credentials - List saved credentials
  • ssh_delete_credential - Delete saved credentials

Working Directory

  • ssh_set_working_directory - Set current working directory
  • ssh_get_working_directory - Get current working directory

Docker Operations

  • ssh_docker_deploy - Deploy Docker containers
  • ssh_docker_status - Check Docker container status

📖 Usage Examples

Basic SSH Connection

{
  "tool": "ssh_connect",
  "arguments": {
    "host": "192.168.1.100",
    "username": "user",
    "password": "password",
    "connectionId": "server1"
  }
}

SSH Key Authentication

{
  "tool": "ssh_connect",
  "arguments": {
    "host": "192.168.1.100",
    "username": "user",
    "privateKeyPath": "/path/to/private/key",
    "connectionId": "server1"
  }
}

File Transfer (Local to Remote)

{
  "tool": "ssh_copy_file",
  "arguments": {
    "sourceConnectionId": "local",
    "sourcePath": "/local/file.txt",
    "targetConnectionId": "server1",
    "targetPath": "/remote/file.txt"
  }
}

Execute Command

{
  "tool": "ssh_execute",
  "arguments": {
    "connectionId": "server1",
    "command": "ls -la /home/user"
  }
}

Docker Deployment

{
  "tool": "ssh_docker_deploy",
  "arguments": {
    "connectionId": "server1",
    "workingDirectory": "/app",
    "deploymentType": "compose"
  }
}

Save Credentials

{
  "tool": "ssh_save_credential",
  "arguments": {
    "credentialId": "my-server",
    "host": "192.168.1.100",
    "username": "user",
    "privateKeyPath": "/path/to/key"
  }
}

🔧 Development

# Development mode
npm run dev

# Type checking
npm run type-check

# Build
npm run build

# Start production
npm start

🔒 Security Considerations

  • Store private keys 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

🐛 Troubleshooting

Claude Desktop Integration Issues:

  1. Verify the absolute path in claude_desktop_config.json is correct
  2. Ensure the server was built successfully (npm run build)
  3. Check that dist/index.js exists in your project directory
  4. Restart Claude Desktop completely

SSH Connection Failures:

  1. Verify SSH server is accessible from your machine
  2. Test SSH connection manually: ssh username@hostname
  3. Check SSH key permissions: chmod 600 ~/.ssh/id_rsa
  4. Ensure SSH key is in the correct format (OpenSSH)

📄 License

MIT License - see LICENSE file for details.

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.


<div align="center"> <p>Made with ❤️ for seamless SSH operations</p> <p><a href="README-id.md">🇮🇩 Baca dalam Bahasa Indonesia</a></p> </div>

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选