MCP Server for FTP Access
用于 FTP 访问的 MCP 服务器
此模型上下文协议 (MCP) 服务器提供了与 FTP 服务器交互的工具。它允许 Claude.app 在 FTP 服务器上列出目录、下载和上传文件、创建目录以及删除文件/目录。
功能
列出目录内容:查看 FTP 服务器上的文件和文件夹
下载文件:从 FTP 服务器检索文件内容
上传文件:创建新文件或更新现有文件
创建目录:在 FTP 服务器上创建新文件夹
删除文件/目录:移除文件或目录
Related MCP server: MCP SSH Server
安装
通过 Smithery 安装
要通过 Smithery 自动为 Claude Desktop 安装 mcp-server-ftp:
npx -y @smithery/cli install @alxspiker/mcp-server-ftp --client claude先决条件
Node.js 16 或更高版本
Claude for Desktop(或其他兼容 MCP 的客户端)
从源码构建
Linux/macOS
# Clone the repository
git clone https://github.com/alxspiker/mcp-server-ftp.git
cd mcp-server-ftp
# Install dependencies
npm install
# Build the project
npm run buildWindows
# Clone the repository
git clone https://github.com/alxspiker/mcp-server-ftp.git
cd mcp-server-ftp
# Run the Windows build helper script
build-windows.batbuild-windows.bat 脚本负责在 Windows 系统上安装依赖项并进行构建,如果 TypeScript 编译器出现问题,它还提供回退选项。
配置
要将此服务器与 Claude for Desktop 一起使用,请将其添加到您的配置文件中:
MacOS/Linux
编辑 ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"ftp-server": {
"command": "node",
"args": ["/absolute/path/to/mcp-server-ftp/build/index.js"],
"env": {
"FTP_HOST": "ftp.example.com",
"FTP_PORT": "21",
"FTP_USER": "your-username",
"FTP_PASSWORD": "your-password",
"FTP_SECURE": "false"
}
}
}
}Windows
编辑 %APPDATA%\Claude\claude_desktop_config.json:
{
"mcpServers": {
"ftp-server": {
"command": "node",
"args": ["C:\\path\\to\\mcp-server-ftp\\build\\index.js"],
"env": {
"FTP_HOST": "ftp.example.com",
"FTP_PORT": "21",
"FTP_USER": "your-username",
"FTP_PASSWORD": "your-password",
"FTP_SECURE": "false"
}
}
}
}Windows 构建问题排查
如果您在 Windows 上遇到构建问题:
使用提供的
build-windows.bat脚本,它处理了常见的构建问题确保已正确安装 Node.js 和 npm
尝试直接运行 TypeScript 编译器:
npx tsc如果仍然有问题,您可以通过运行以下命令使用
build目录中的预编译文件:node path\to\mcp-server-ftp\build\index.js
配置选项
环境变量 | 描述 | 默认值 |
| FTP 服务器主机名或 IP 地址 | localhost |
| FTP 服务器端口 | 21 |
| FTP 用户名(支持加密) | anonymous |
| FTP 密码(支持加密) | (空字符串) |
| 使用安全 FTP (FTPS),当 | false |
| 使用的协议: | ftp |
| SFTP 的 SSH 私钥路径 (例如 | (自动检测) |
| SSH 私钥的密码短语(支持加密) | (空字符串) |
| 用于解密凭据的 64 字符十六进制 AES-256 密钥 | (已禁用) |
SSH / SFTP 支持
除了普通的 FTP 和 FTPS 外,该服务器还支持 SFTP(SSH 文件传输协议),它通过加密的 SSH 连接运行,与 FTPS 无关。
设置 FTP_PROTOCOL=sftp 可将服务器切换到 SFTP 模式。默认端口将更改为 22。
身份验证
SFTP 支持两种自动选择的身份验证方法:
私钥 — 如果找到密钥(见下文),则将其用于身份验证。如果密钥受密码短语保护,则使用
FTP_PASSPHRASE解密密钥。密码 — 如果未找到密钥,则使用
FTP_PASSWORD进行密码身份验证。
密钥发现
服务器按以下顺序查找私钥:
FTP_PRIVATE_KEY_PATH中的路径(如果已设置)~/.ssh/id_ed25519~/.ssh/id_rsa~/.ssh/id_ecdsa
配置示例
{
"mcpServers": {
"ftp-server": {
"command": "node",
"args": ["/absolute/path/to/mcp-server-ftp/build/index.js"],
"env": {
"FTP_HOST": "sftp.example.com",
"FTP_PORT": "22",
"FTP_PROTOCOL": "sftp",
"FTP_USER": "your-username",
"FTP_PRIVATE_KEY_PATH": "~/.ssh/id_ed25519",
"FTP_PASSPHRASE": "your-key-passphrase"
}
}
}
}FTP_PASSPHRASE 和 FTP_USER 都支持 enc: 加密格式 — 请参阅 凭据加密。
凭据加密
在 Claude 配置文件中存储明文密码存在安全风险。服务器支持对 FTP_USER 和 FTP_PASSWORD 进行 AES-256-GCM 加密,因此配置文件中仅包含密文。
1. 生成加密密钥
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"请妥善保管此密钥 — 像对待主密码一样对待它。
2. 加密凭据值
npm run build
FTP_ENCRYPTION_KEY=<your-64-char-hex-key> npm run encrypt-env -- <plaintext-value>输出是一个格式为 enc:<iv_hex>:<tag_hex>:<ciphertext_hex> 的自包含加密字符串。
3. 在配置中使用加密值
将 FTP_ENCRYPTION_KEY 与加密后的凭据一起设置。不以 enc: 开头的值将被视为明文,因此您可以选择性地进行加密。
{
"mcpServers": {
"ftp-server": {
"command": "node",
"args": ["/absolute/path/to/mcp-server-ftp/build/index.js"],
"env": {
"FTP_HOST": "ftp.example.com",
"FTP_PORT": "21",
"FTP_USER": "enc:aabbcc...:ddeeff...:112233...",
"FTP_PASSWORD": "enc:aabbcc...:ddeeff...:112233...",
"FTP_SECURE": "false",
"FTP_ENCRYPTION_KEY": "<your-64-char-hex-key>"
}
}
}
}使用方法
配置并重启 Claude for Desktop 后,您可以使用自然语言执行 FTP 操作:
"列出我 FTP 服务器上 /public 目录中的文件"
"从 FTP 服务器下载文件 /data/report.txt"
"将此文本作为名为 notes.txt 的文件上传到 FTP 服务器"
"在 FTP 服务器上创建一个名为 'backups' 的新目录"
"从 FTP 服务器删除文件 obsolete.txt"
"从 FTP 服务器移除空目录 /old-project"
可用工具
工具名称 | 描述 |
| 列出 FTP 目录的内容 |
| 从 FTP 服务器下载文件 |
| 上传文件到 FTP 服务器 |
| 在 FTP 服务器上创建新目录 |
| 从 FTP 服务器删除文件 |
| 从 FTP 服务器删除目录 |
安全注意事项
使用 凭据加密 功能,避免在配置文件中存储明文密码。
尽可能优先使用 SFTP (
FTP_PROTOCOL=sftp) 而非普通 FTP 或 FTPS — 它使用 SSH 且不需要证书管理。如果您的服务器支持 FTPS 但无法使用 SFTP,请考虑通过设置
FTP_SECURE=true来使用 FTPS(安全 FTP)。服务器会在您系统的临时目录中为上传和下载创建临时文件。
许可证
MIT
Available Tools
11 toolsappend-fileAppend to FileA
Append content to the end of a file on the FTP server (creates the file if it does not exist). Pass encoding "base64" for binary content.
Inputs: content (required), remotePath (required), encoding. Returns: remotePath, appendedBytes
create-directoryCreate DirectoryBIdempotent
Create a new directory on the FTP server
Inputs: remotePath (required). Returns: created, remotePath
delete-directoryDelete DirectoryCDestructiveIdempotent
Delete a directory from the FTP server
Inputs: remotePath (required). Returns: deleted, remotePath
delete-fileDelete FileBDestructiveIdempotent
Delete a file from the FTP server
Inputs: remotePath (required). Returns: deleted, remotePath
download-fileDownload FileARead-only
Download a file from the FTP server. Text files are returned as-is; binary files are returned base64-encoded.
Inputs: remotePath (required). Returns: content, encoding, remotePath
download-to-localDownload To Local FileADestructiveIdempotent
Download a file from the FTP server straight to a path on this computer, streamed, without returning its contents. Only paths inside the directories listed in FTP_LOCAL_ROOTS can be written.
Inputs: localPath (required), remotePath (required), overwrite. Returns: bytes, sha256, localPath, remotePath
edit-fileEdit FileADestructive
Edit a text file on the FTP server by replacing an exact string, without re-uploading the whole file content. oldText must match exactly (including whitespace) and be unique in the file unless replaceAll is set.
Inputs: newText (required), oldText (required), remotePath (required), replaceAll. Returns: fileSize, remotePath, replacements
list-directoryList DirectoryBRead-only
List contents of an FTP directory
Inputs: remotePath (required). Returns: path, entries, fileCount, totalCount, +1 more
rename-fileRename / MoveBDestructive
Rename or move a file or directory on the FTP server
Inputs: toPath (required), fromPath (required). Returns: toPath, renamed, fromPath
upload-fileUpload FileADestructiveIdempotent
Upload a file to the FTP server. Pass encoding "base64" to upload binary content.
Inputs: content (required), remotePath (required), encoding. Returns: remotePath, bytesWritten
upload-local-fileUpload Local FileADestructiveIdempotent
Upload a file from this computer to the FTP server by path, streamed, so file size is not limited by the request. Only files inside the directories listed in FTP_LOCAL_ROOTS can be uploaded.
Inputs: localPath (required), remotePath (required). Returns: sha256, localPath, remotePath, remoteSize, +1 more
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 11 tools
Most tools target distinct FTP actions, but upload-file/upload-local-file and download-file/download-to-local overlap conceptually. Their descriptions clarify the differences (streaming, local path restrictions, returned content), so an agent can distinguish them with some care.
Names follow a mostly consistent hyphenated verb-noun pattern such as rename-file, create-directory, delete-file, and list-directory. Minor deviations like upload-local-file and download-to-local are still readable and do not mix naming conventions.
The 11 tools are well-scoped for an FTP access server, covering distinct file and directory operations without obvious bloat. Each tool has a clear role in the surface.
The set covers the core FTP lifecycle: list, create/delete directories, upload/download, append, edit, rename, and delete files. Minor gaps such as stat/permission changes or copy operations exist, but agents can work around them.
Maintenance
Related MCP Connectors
Work on your own computers from Claude or ChatGPT: run commands, edit and search files.
Give Claude only the Google Drive files you choose. Every action logged.
Use your Mac, Windows or Linux computer from ChatGPT, Claude or Codex: files, commands, documents.
Connect Claude to your Platform7n workspaces: chat, links, work and decks. One-click OAuth.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables SSH remote access to servers through Claude, allowing users to execute commands, transfer files via SFTP, and manage multiple remote connections using natural language.129MIT
- AlicenseNot gradedqualityNot gradedmaintenanceConnects Claude to remote servers via SSH to execute commands, manage files, and browse directories. It allows users to add, edit, and switch between multiple server configurations through natural language conversations.-
- AlicenseAqualityDmaintenanceEnables Claude to connect to servers via SSH, execute commands, transfer files, and manage connections through natural language.911 npm1MIT
- AlicenseAqualityDmaintenanceEnables FTP file operations such as upload, download, list, and delete directly from Claude Desktop or Claude CLI.15MIT