本项目是一个模型上下文协议(MCP)服务器,可借助 Cursor IDE 对 Downloads 文件夹中的文件进行高效组织与管理,有效提升文件管理效率。
git clone https://github.com/AlexanderVTr/cursor-mcp-file-organizer.git
cd cursor-mcp-file-organizer
npm install
npm run build
{
"mcpServers": {
"file-organizer": {
"url": "http://localhost:3001",
"port": 3001,
"enabled": true,
"description": "文件整理 MCP 服务器"
}
}
}
mcp-config.json
:{
"version": "1.0",
"rules": {
"downloads": {
"path": "~/Downloads",
"organizeBy": {
"images": {
"extensions": [".jpg", ".jpeg", ".png", ".gif", ".webp", ".svg"],
"destination": "~/Downloads/Pictures"
}
// 其他类别继续添加
}
}
}
}
npm start
// 示例命令用于整理文件
{
command: "organizeFiles",
args: {
path: "~/Downloads"
}
}
# 启动服务器
npm start
// 使用 Cursor IDE 发送命令进行文件整理
{
command: "organizeFiles",
args: {
path: "~/Downloads"
}
}
listDir
:列出目录内容readFile
:读取文件内容writeFile
:写入文件内容moveFile
:移动文件到新位置createDir
:创建目录organizeFiles
:按类型整理文件# 以开发模式运行并启用热重载
npm run dev
# 构建项目
npm run build
# 启动服务器
npm start
cursor-mcp-file-organizer/
├── src/
│ ├── server.ts # 主服务器实现文件
│ └── organizer.ts # 文件整理逻辑文件
├── dist/ # 编译后的 JavaScript 文件夹
├── package.json # 项目依赖和脚本信息
├── mcp-config.json # 整理规则配置文件
└── README.md # 项目说明文档
欢迎社区贡献!请参考 CONTRIBUTING.md 参与项目。
本项目遵循 MIT License。