SM

shaike1/mcp-server-ssh

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

58 stars 16 forks 质量 56 趋势 0

shaike1/mcp-server-ssh 是从 https://github.com/shaike1/mcp-server-ssh. 导入的 MCP 服务器候选

概览

shaike1/mcp-server-ssh 是从 https://github.com/shaike1/mcp-server-ssh. 导入的 MCP 服务器候选

概述(AI 翻译)

一个强大的 SSH 服务器实现,用于模型上下文协议(MCP)。该服务器通过 SSH 协议实现安全的远程命令执行和文件操作,支持基于密码和密钥的认证。

特色

  • ✨ 安全SSH连接管理
  • 🔑 基于密码和密钥的认证
  • 💻 远程命令执行
  • 📁 文件操作(上传/下载)
  • 📊 文件传输的进度跟踪
  • 🔐 权限管理
  • 📂 目录操作
  • 🚀 批量文件传输
  • 📝 详细测井

安装

  1. 安装该软件包:

  2. 添加到你的Claude桌面配置(claude_desktop_config.json):

用途

密码认证

密钥认证

执行命令

文件操作

目录运营

发展

  1. 克隆仓库:

  2. 安装依赖:

  3. 构建:

  4. 启动服务器:

环境变量

  • SSH_PORT:服务器端口(默认:8889)
  • SSH_LOG_LEVEL:日志级别(默认:信息)

贡献

  1. 分支仓库
  2. 创建你的特征分支([git checkout -b feature/amazing-feature)
  3. 提交你的更改 (git commit -m 'Add some amazing feature')

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

MCP SSH Server

A powerful SSH server implementation for Model Context Protocol (MCP). This server enables secure remote command execution and file operations through SSH protocol, supporting both password and key-based authentication.

Features

  • ✨ Secure SSH connection management
  • 🔑 Password and key-based authentication
  • 💻 Remote command execution
  • 📁 File operations (upload/download)
  • 📊 Progress tracking for file transfers
  • 🔐 Permission management
  • 📂 Directory operations
  • 🚀 Bulk file transfers
  • 📝 Detailed logging

Installation

  1. Install the package:
npm install mcp-ssh
  1. Add to your Claude desktop config (claude_desktop_config.json):
{
  "mcpServers": {
    "ssh": {
      "command": "node",
      "args": ["%APPDATA%/npm/node_modules/mcp-ssh/dist/server.js"],
      "env": {
        "SSH_PORT": "8889",
        "SSH_LOG_LEVEL": "info"
      }
    }
  }
}

Usage

Password Authentication

$body = @{
    id = "test"
    host = "example.com"
    port = 22
    username = "user"
    password = "pass123"
} | ConvertTo-Json

Invoke-RestMethod -Uri "http://localhost:8889/connect" -Method Post -Body $body -ContentType "application/json"

Key Authentication

$body = @{
    id = "test"
    host = "example.com"
    port = 22
    username = "user"
    privateKey = Get-Content ~/.ssh/id_rsa | Out-String
    passphrase = "optional-key-passphrase"  # if your key is protected
} | ConvertTo-Json

Invoke-RestMethod -Uri "http://localhost:8889/connect" -Method Post -Body $body -ContentType "application/json"

Execute Commands

$execBody = @{
    id = "test"
    command = "ls -la"
} | ConvertTo-Json

Invoke-RestMethod -Uri "http://localhost:8889/exec" -Method Post -Body $execBody -ContentType "application/json"

File Operations

# Upload file
$uploadForm = @{
    file = Get-Item -Path "localfile.txt"
    remotePath = "/remote/path/file.txt"
}
Invoke-RestMethod -Uri "http://localhost:8889/upload/test" -Method Post -Form $uploadForm

# Download file
Invoke-RestMethod -Uri "http://localhost:8889/download/test?remotePath=/remote/path/file.txt" -Method Get -OutFile "downloaded.txt"

Directory Operations

# List directory
Invoke-RestMethod -Uri "http://localhost:8889/ls/test?path=/remote/path" -Method Get

# Get connection status
Invoke-RestMethod -Uri "http://localhost:8889/status/test" -Method Get

Development

  1. Clone the repository:
git clone https://github.com/shaike1/mcp-server-ssh.git
cd mcp-server-ssh
  1. Install dependencies:
npm install
  1. Build:
npm run build
  1. Start server:
npm start

Environment Variables

  • SSH_PORT: Server port (default: 8889)
  • SSH_LOG_LEVEL: Logging level (default: info)

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "ssh": { "command": "node", "args": ["%APPDATA%/npm/node_modules/mcp-ssh/dist/server.js"], "env": { "SSH_PORT": "8889", "SSH_LOG_LEVEL": "info" } } } }