AlexanderVTr
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"file-organizer": {
"description": "File organization MCP server",
"enabled": true,
"port": 3001,
"url": "http://localhost:3001"
}
}
}
服务介绍
Cursor MCP 文件组织器
一个使用 Cursor IDE 通过 Model Context Protocol (MCP) 服务器来组织下载文件夹中文件的工具。
功能
- 自动按类型整理下载文件夹中的文件
- 支持多种文件类别:
- 图像 (jpg, jpeg, png, gif, webp, svg 等)
- 文档 (pdf, doc, docx, txt 等)
- 压缩包 (zip, rar, 7z, tar 等)
- 代码文件 (js, ts, py, java 等)
- 媒体文件 (mp4, mp3, wav 等)
- 设计文件 (psd, ai, sketch 等)
- 数据库 (sql, sqlite 等)
- 字体 (ttf, otf, woff 等)
- 可配置的组织规则
- 实时文件系统监控
- 支持 SSE(服务器发送事件)以实现实时更新
先决条件
- Node.js (v14 或更高版本)
- TypeScript
- Cursor IDE
安装
-
克隆仓库:
bash
git clone https://github.com/AlexanderVTr/cursor-mcp-file-organizer.git
cd cursor-mcp-file-organizer -
安装依赖项:
bash
npm install -
构建项目:
bash
npm run build
配置
-
配置 Cursor IDE 的 MCP 设置:
json
{
"mcpServers": {
"file-organizer": {
"url": "http://localhost:3001",
"port": 3001,
"enabled": true,
"description": "文件组织 MCP 服务器"
}
}
} -
在
mcp-config.json中自定义组织规则:json
{
"version": "1.0",
"rules": {
"downloads": {
"path": "~/Downloads",
"organizeBy": {
"images": {
"extensions": [".jpg", ".jpeg", ".png", ".gif", ".webp", ".svg"],
"destination": "~/Downloads/Pictures"
}
// ...其他类别
}
}
}
}
使用
-
启动服务器:
bash
npm start -
使用 Cursor IDE 发送命令:
typescript
// 整理文件示例命令
{
command: "organizeFiles",
args: {
path: "~/Downloads"
}
}
可用命令
listDir: 列出目录内容readFile: 读取文件内容writeFile: 将内容写入文件moveFile: 将文件移动到新位置createDir: 创建目录organizeFiles: 按类型整理文件
开发
bash
以开发模式运行并启用热重载
npm run dev
构建项目
npm run build
启动服务器
npm start
项目结构
cursor-mcp-file-organizer/
├── src/
│ ├── server.ts # 主服务器实现
│ └── organizer.ts # 文件组织逻辑
├── dist/ # 编译后的 JavaScript
├── package.json # 依赖项和脚本
├── tsconfig.json # TypeScript 配置
└── mcp-config.json # 组织规则
贡献
- 分叉仓库
- 创建你的功能分支 (
git checkout -b feature/amazing-feature) - 提交更改 (
git commit -m 'Add some amazing feature') - 推送到分支 (
git push origin feature/amazing-feature) - 打开拉取请求
许可证
此项目根据 MIT 许可证发布 - 详情请参阅 LICENSE 文件。
致谢
- Cursor IDE 团队提供的 MCP 协议
- Node.js 社区提供的优秀工具和库