README
🚀 Proton Drive MCP
Proton Drive MCP 是一个模型上下文协议(MCP)服务器,它能让 Claude Desktop、Cursor 等 AI 助手以及其他兼容 MCP 的客户端与你的 Proton Drive 文件进行交互。
🚀 快速开始
1. 通过 npm 安装(推荐)
npm install -g proton-drive-mcp
2. 从源代码安装
git clone https://github.com/anyrxo/proton-drive-mcp.git
cd proton-drive-mcp
npm install
npm run build
✨ 主要特性
- 📁 列出文件和文件夹:可列出 Proton Drive 中的文件和文件夹。
- 📄 直接读取文件内容:能直接读取文件内容。
- ✏️ 创建和写入文件:可在 Proton Drive 中创建和写入文件。
- 🗑️ 删除文件和文件夹:支持删除文件和文件夹。
- 📂 创建新文件夹:能创建新的文件夹。
- 🔄 跨平台支持:支持 Windows、macOS、Linux 等平台。
- 🔒 安全可靠:通过本地文件系统运行,无需凭证。
- 🚀 易于安装:只需通过
npm install并进行配置即可。
📋 前提条件
- Node.js 16 或更高版本。
- 已安装并同步 Proton Drive 桌面应用。
- 安装了 Claude Desktop、Cursor 或其他兼容 MCP 的客户端。
⚙️ 配置
查找 Proton Drive 路径
MCP 会尝试自动检测你的 Proton Drive 位置,你也可以手动设置:
- macOS:
~/Library/CloudStorage/ProtonDrive-[email]-folder - Windows:
C:\Users\[username]\Proton Drive - Linux:
~/ProtonDrive
Claude Desktop
将以下内容添加到你的 Claude Desktop 配置文件中:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"proton-drive": {
"command": "node",
"args": ["path/to/proton-drive-mcp/dist/index.js"]
}
}
}
Cursor
将以下内容添加到你的 Cursor 设置中:
{
"mcp.servers": {
"proton-drive": {
"command": "node",
"args": ["path/to/proton-drive-mcp/dist/index.js"]
}
}
}
自定义 Proton Drive 路径
如果你的 Proton Drive 位于非标准位置,可使用以下配置:
{
"mcpServers": {
"proton-drive": {
"command": "node",
"args": ["path/to/proton-drive-mcp/dist/index.js"],
"env": {
"PROTON_DRIVE_PATH": "/custom/path/to/ProtonDrive"
}
}
}
}
💻 使用示例
配置完成后,你可以向你的 AI 助手提出以下请求:
- "列出我 Proton Drive 中的所有文件"
- "创建一个名为 notes.txt 的新文件并添加一些内容"
- "读取 Documents/report.pdf 的内容"
- "创建一个名为 Projects 的新文件夹"
- "删除文件 old-notes.txt"
🛠️ 可用工具
MCP 提供了以下工具:
| 工具 | 描述 |
|------|-------------|
| check_mount | 验证 Proton Drive 是否可访问 |
| list_files | 列出目录内容 |
| read_file | 读取文件内容 |
| write_file | 创建或覆盖文件 |
| delete_file | 删除文件或文件夹 |
| create_folder | 创建新目录 |
🧪 测试
测试 MCP 是否正常工作:
# 检查是否检测到 Proton Drive
npm run test:connection
# 运行所有测试
npm test
🔧 故障排除
未找到 Proton Drive
- 确保 Proton Drive 桌面应用正在运行。
- 检查文件是否已同步。
- 手动设置
PROTON_DRIVE_PATH环境变量。
权限错误
- 确保 MCP 对 Proton Drive 文件夹具有读写权限。
- 在 macOS 上,你可能需要在系统偏好设置中授予权限。
工具未在 Claude/Cursor 中显示
- 配置完成后重启 AI 客户端。
- 检查日志中是否有错误消息。
- 验证 MCP 的路径是否正确。
📝 开发
# 安装依赖
npm install
# 在开发模式下运行
npm run dev
# 构建生产版本
npm run build
# 运行测试
npm test
🤝 贡献
欢迎贡献代码!请按照以下步骤操作:
- 分叉仓库。
- 创建一个功能分支。
- 进行更改。
- 如有必要,添加测试。
- 提交拉取请求。
📄 许可证
本项目采用 MIT 许可证,请参阅 LICENSE 文件获取详细信息。
🔒 安全
- 所有操作均在本地文件系统上执行。
- 无数据发送到外部服务器。
- 保留了 Proton 的端到端加密。
- 路径验证可防止目录遍历攻击。
🐛 已知问题
- 大文件(>10MB)读取可能需要一些时间。
- 目前不支持读取二进制文件。
- 文件名中的一些特殊字符可能会导致问题。
📮 支持
- 问题反馈:GitHub Issues
- 讨论交流:GitHub Discussions
为 Proton Drive 社区用心打造 ❤️
微信扫一扫