mcpField
M
MCP SSH/SFTP 服务器

MCP SSH/SFTP 服务器

Local
github.com/naya-cat-1Developer Tools0Updated 23w ago

About MCP SSH/SFTP 服务器

A pair of MCP servers for SSH operations and SFTP file transfers, aimed at users who manage remote servers. It separates remote command execution from directory and file operations, and cleans up connections after use.

Key features

  1. 01Run remote SSH commands
  2. 02List remote directories
  3. 03Upload and download files
  4. 04Automatic SFTP connection retries
  5. 05Clean up resources after connections

Use cases

  1. 01Run remote maintenance commands over SSH
  2. 02Inspect files in a remote directory
  3. 03Transfer files between local and remote servers

MCP support

It exposes SSH command execution and SFTP directory listing, upload, and download tools to MCP clients.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

No install method listed yet

We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.

Repository

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

MCP SSH/SFTP 服务器

English | 简体中文

这是一个基于 Model Context Protocol (MCP) 实现的 SSH 和 SFTP 服务器集合,提供了远程服务器操作和文件传输的功能。

项目结构

.
├── ssh-server/    # SSH服务器实现
└── sftp-server/   # SFTP服务器实现

功能特性

SSH 服务器

SSH服务器提供远程命令执行功能,支持:

  • 连接到远程SSH服务器
  • 执行远程命令并获取结果
  • 自动断开连接和资源清理
SFTP 服务器

SFTP服务器提供文件传输相关功能,支持:

  • 列出远程目录内容
  • 上传本地文件到远程服务器
  • 从远程服务器下载文件
  • 自动重试连接机制
  • 详细的调试日志

可用工具

SSH 工具
execute_ssh_command

执行远程SSH命令

  • 参数:
    • host: SSH服务器地址
    • port: SSH端口
    • username: 用户名
    • password: 密码
    • command: 要执行的命令
SFTP 工具
list_directory

列出远程目录内容

  • 参数:
    • host: SFTP服务器地址
    • port: SFTP端口
    • username: 用户名
    • password: 密码
    • remotePath: 要列出内容的远程目录路径
upload_file

上传文件到远程服务器

  • 参数:
    • host: SFTP服务器地址
    • port: SFTP端口
    • username: 用户名
    • password: 密码
    • localPath: 本地文件路径
    • remotePath: 远程目标路径
download_file

从远程服务器下载文件

  • 参数:
    • host: SFTP服务器地址
    • port: SFTP端口
    • username: 用户名
    • password: 密码
    • remotePath: 远程文件路径
    • localPath: 本地保存路径

错误处理

两个服务器都实现了完善的错误处理机制:

  • 连接超时处理
  • 自动重试机制(SFTP服务器)
  • 详细的错误信息输出
  • 资源自动清理

配置说明

  1. 复制 servers.json.example 为 servers.json
  2. 在 servers.json 中配置你的服务器信息
  3. servers.json 已被 .gitignore 忽略,不会被提交到版本控制

配置示例:

{
  "my-server": {
    "host": "example.com",
    "port": 22,
    "username": "your-username",
    "password": "your-password",
    "description": "我的服务器"
  }
}

安全说明

  • servers.json 包含敏感信息,切勿提交到版本控制
  • 所有密码信息都只在内存中临时使用,不会被持久化存储
  • 每次操作后都会自动断开连接
  • 支持连接超时机制,避免资源占用
  • 建议使用私钥认证代替密码认证

调试功能

SFTP服务器提供了详细的调试日志输出,包括:

  • 连接状态日志
  • 操作执行过程日志
  • 错误详情日志

注意事项

  1. 使用前请确保有正确的服务器访问权限
  2. 建议在使用前测试连接参数
  3. 对于大文件传输,请注意网络状况和超时设置
  4. 所有密码信息请妥善保管,避免泄露

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.