Skip to main content
Glama

build status GitHub Tag License Last Commit node version npm Version npm Downloads

🗂️🗃️ftpmcp🗃️

一个专注于 FTP 和 FTPS 文件操作的 Model Context Protocol 服务器。 它刻意不实现 SFTP:基于 SSH 的传输应该由 SSH MCP 承担,而不是在此处重复凭据和传输逻辑。

功能

  • 纯 FTP、显式 FTPS 和隐式 FTPS

  • Hold在一个 MCP 进程中支持任意数量的命名 FTP 主机

  • 远程操作限制在每台主机的 root 内

  • 本地上传和下载限制在每台主机的 local_root 内,并包含符号链接检查

  • 只读模式和单独受保护的删除

  • 结构化的 MCP 结果和错误

  • 工具响应中不包含任何凭据值

Related MCP server: filemanager-mcp-server

安装

npm install -g @vielhuber/ftpmcp

配置

{
    "hosts": [
        {
            "host": "website",
            "hostname": "ftp.example.com",
            "protocol": "ftps",
            "port": 21,
            "username": "user",
            "password": "your_password",
            "root": "/public_html",
            "local_root": "/host/data",
            "read_only": false,
            "allow_delete": false,
            "tls_reject_unauthorized": true,
            "timeout": 30000
        }
    ]
}

将文件传给服务器:

export FTP_CONFIG_FILE=/path/to/ftp-hosts.json

protocol 接受 ftp、ftps 和 ftps-implicit。只要服务器支持 FTPS,都应优先使用 FTPS。普通 FTP 会在没有传输加密的情况下发送凭据和内容。

root 是该主机上所有工具路径的可见远程根。请将 FTP 账户本身配置为与服务器端 chroot 等效的配置。FTP 无法可靠地阻止服务器提供的符号链接指向仅由客户端路径限制的边界之外。

local_root 限制本地上传和下载。该目录下的相对路径和绝对路径均被接受。

read_only: true 会阻止上传、目录创建、重命名和删除。删除操作还额外需要 allow_delete: true。

除了 list_hosts 之外,所有操作都需要选定的 host 别名。

MCP 客户端

{
    "mcpServers": {
        "ftp": {
            "command": "ftpmcp",
            "env": {
                "FTP_CONFIG_FILE": "/path/to/ftp-hosts.json"
            }
        }
    }
}

工具

工具

用途

list_hosts

列出所有已配置的主机,但不包含凭据

test_connection

验证所配置的连接和登录

list_directory

列出一个远程目录

download_file

将远程文件下载到所选主机的 local_root 之下

upload_file

上传本地文件,默认不覆盖

create_directory

创建远程目录

rename_path

重命名或移动远程文件或目录

delete_file

在启用删除时删除一个文件

delete_directory

在启用删除时删除空目录或显式递归目录

开发

npm install
npm test
npm run format:check

许可证

MIT

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    MCP server for performing filesystem operations, enabling file management and manipulation through natural language.
    MIT
  • A
    license
    C
    quality
    C
    maintenance
    A file management MCP server enabling complete file and directory operations, including advanced editing, templates, and batch processing through natural language.
    19
    19 npm
    3
    ISC
  • A
    license
    A
    quality
    A
    maintenance
    An MCP server that enables AI coding agents to deploy files to FTP/FTPS/SFTP servers, with path jail, read-only mode, and dry-run capabilities.
    10
    MIT
  • A
    license
    B
    quality
    A
    maintenance
    A secure file management MCP server enabling file operations like listing, reading, creating, renaming, moving, copying, deleting, and searching within a restricted workspace.
    10
    MIT