mcpField
M
MCP SSH Server

MCP SSH Server

本地服务
github.com/shaike1开发工具5899 周前更新

关于 MCP SSH Server

MCP SSH Server 为 MCP 客户端提供基于 SSH 的远程命令和文件操作,支持密码或密钥认证、目录管理、传输进度跟踪和日志记录。

主要功能

  1. 01密码和密钥认证
  2. 02远程命令执行
  3. 03文件上传和下载
  4. 04目录操作
  5. 05传输进度跟踪与日志记录

适用场景

  1. 01在远程主机上运行命令
  2. 02在本地与远程系统间传输文件
  3. 03查看远程目录和连接状态

MCP 相关

它向 MCP 客户端提供 SSH 连接、命令、文件和目录操作。认证支持密码和密钥。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

暂未收录安装方式

我们还没有获取到这个服务的安装包或远程地址,请按项目 README 中的说明安装。

代码仓库

工具

还没有获取到工具列表

本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。

详细介绍

MCP SSH 服务

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

功能

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

安装

  1. 安装软件包:
npm install mcp-ssh
  1. 添加到 Claude 桌面应用配置(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"
      }
    }
  }
}

使用方法

密码认证
$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"
密钥认证
$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"
执行命令
$execBody = @{
    id = "test"
    command = "ls -la"
} | ConvertTo-Json

Invoke-RestMethod -Uri "http://localhost:8889/exec" -Method Post -Body $execBody -ContentType "application/json"
文件操作
# 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"
目录操作
# 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

开发

  1. 克隆代码库:
git clone https://github.com/shaike1/mcp-server-ssh.git
cd mcp-server-ssh
  1. 安装依赖项:
npm install
  1. 构建:
npm run build
  1. 启动服务:
npm start

环境变量

  • SSH_PORT:服务端口(默认值:8889)
  • SSH_LOG_LEVEL:日志级别(默认值:info)

贡献

  1. Fork 代码库
  2. 创建功能分支(git checkout -b feature/amazing-feature)
  3. 提交更改(git commit -m 'Add some amazing feature')
  4. 推送到分支(git push origin feature/amazing-feature)
  5. 创建 Pull Request

许可证

MIT

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。