SaveForMeDearAI
](https://badge.fury.io/js/saveformedearai) ](https://www.npmjs.com/package/saveformedearai)  ](https://github.com/bramato/saveForMeDearAi/stargazers)  
*用于管理S3存储上文件的模型上下文协议(MCP)服务器,支持AWS S3和DigitalOcean Spaces。*
特性
- 🚀 上传公共和私人文件 带有元数据
- 📋 列出文件 带有描述和信息
- 🔗 即时URL访问 -上传响应中直接返回的URL
- 🌍 全局和本地配置 对于项目
- ⚡ 多提供商支持 (AWS S3、DigitalOcean Spaces、S3兼容)
- 🎯 Claude代码集成 通过MCP
安装
全球安装
npm install -g saveformedearai从源安装
git clone https://github.com/bramato/saveForMeDearAi.git
cd saveForMeDearAi
npm install
npm run build
npm install -g .配置
快速设置(2步)
- 安装并配置:
npm install -g saveformedearai
saveformedearai setup- 添加到Claude MCP配置:
{
"mcpServers": {
"saveformedearai": {
"command": "saveformedearai"
}
}
}可用命令
# Configure S3 drive (global)
saveformedearai setup
# Initialize local project
saveformedearai init
# Start MCP server (automatic when called by Claude)
saveformedearai配置结构
全局配置
保存在 ~/.saveformedearai/config.json:
{
"defaultDrive": "my-aws-drive",
"drives": {
"my-aws-drive": {
"endpoint": "https://s3.amazonaws.com",
"region": "us-east-1",
"accessKeyId": "YOUR_ACCESS_KEY",
"secretAccessKey": "YOUR_SECRET_KEY",
"bucketName": "my-bucket"
}
}
}本地配置
保存在 .claude/saveformedearai.json:
{
"driveName": "my-project-drive",
"projectDirectory": "my-project",
"s3Config": {
"endpoint": "https://nyc3.digitaloceanspaces.com",
"region": "nyc3",
"accessKeyId": "YOUR_DO_KEY",
"secretAccessKey": "YOUR_DO_SECRET",
"bucketName": "my-space"
}
}可用的MCP工具
1. save_public_file
将文件另存为公共文件并返回永久URL。
{
"filePath": "/path/to/file.jpg",
"filename": "optional-custom-name.jpg", // optional
"description": "File description" // optional
}答复:
{
"success": true,
"url": "https://bucket.endpoint.com/file.jpg",
"key": "file.jpg",
"urlType": "permanent",
"isPublic": true,
"message": "File uploaded successfully as public file. URL: https://bucket.endpoint.com/file.jpg",
"driveName": "my-drive"
}2. save_private_file
将文件另存为私有。
{
"filePath": "/path/to/private-file.pdf",
"filename": "document.pdf",
"description": "Private document"
}答复:
{
"success": true,
"key": "document.pdf",
"url": "https://presigned-url...",
"temporaryUrl": "https://presigned-url...",
"urlType": "temporary",
"expiresIn": 3600,
"expirationDate": "2024-01-15T11:30:00Z",
"message": "File uploaded successfully as private file. Temporary URL provided (expires in 1 hour).",
"driveName": "my-drive"
}3. list_files
列出所有包含元数据的文件。
{
"prefix": "images/" // optional, filter by prefix
}答复:
{
"success": true,
"files": [
{
"filename": "image.jpg",
"description": "Sample photo",
"uploadDate": "2024-01-15T10:30:00Z",
"isPublic": true,
"size": 1024000,
"contentType": "image/jpeg",
"sizeFormatted": "1.02 MB"
}
],
"count": 1,
"driveName": "my-drive"
}4. get_file_url
获取文件的URL(永久用于公共,临时用于私人)。
{
"filename": "document.pdf",
"expiresIn": 3600 // optional, seconds (max 7 days)
}对公共文件的响应:
{
"success": true,
"url": "https://bucket.endpoint.com/document.pdf",
"urlType": "permanent",
"isPublic": true,
"filename": "document.pdf"
}对私人文件的响应:
{
"success": true,
"url": "https://presigned-url...",
"urlType": "temporary",
"isPublic": false,
"expiresIn": 3600,
"expirationDate": "2024-01-15T11:30:00Z"
}提供商支持
AWS S3
Endpoint: https://s3.amazonaws.com
Force Path Style: false数字海洋空间
Endpoint: https://[region].digitaloceanspaces.com
Force Path Style: falseS3兼容(Minio等)
Endpoint: https://your-endpoint.com
Force Path Style: true (typically)发展
# Clone repository
git clone https://github.com/bramato/saveForMeDearAi.git
cd saveForMeDearAi
# Install dependencies
npm install
# Build
npm run build
# Development with watch
npm run dev
# Test locally
npm start故障排除
错误“找不到配置”
跑 saveformedearai setup 配置S3驱动器。
S3连接错误
验证:
- 正确的凭据
- 提供程序的正确终结点
- Bucket存在且可访问
- 足够的权限(bucket的读/写)
文件未找到
使用 list_files 验证bucket中的文件名。
许可证
麻省理工学院
贡献
欢迎投稿!请打开问题或拉取请求。
🎵 支持开发者
喜欢用冷冰冰的氛围编码吗? 通过收听我的开发者相册来支持此项目:
“代码冷却:放松的循环” 🎧
*为您的编码会话提供完美的背景音乐*
  
*每个流都有助于支持像这样的免费工具的开发! 🙏*
