file-organizer-mcp 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +603 -0
- package/package.json +34 -0
- package/server.js +668 -0
- package/server.json +48 -0
- package/start.bat +3 -0
- package/test_security.js +205 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 kridaydave
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,603 @@
|
|
|
1
|
+
# File Organizer MCP Server 🗂️
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+

|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
**A powerful, security-hardened Model Context Protocol (MCP) server for intelligent file organization**
|
|
12
|
+
|
|
13
|
+
[Features](#-features) • [Installation](#-installation) • [Usage](#-usage) • [Security](#-security) • [API](#-api-reference)
|
|
14
|
+
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 🎯 Features
|
|
20
|
+
|
|
21
|
+
### Core Functionality
|
|
22
|
+
- **🤖 Auto-categorization** - Intelligently organizes files into 12+ categories
|
|
23
|
+
- **🔍 Duplicate Detection** - Finds duplicate files using content-based hashing
|
|
24
|
+
- **🛡️ Smart File Management** - Handles filename conflicts automatically
|
|
25
|
+
- **👁️ Dry Run Mode** - Preview changes before executing
|
|
26
|
+
- **📊 Comprehensive Scanning** - Detailed directory analysis with statistics
|
|
27
|
+
- **📈 Largest Files Finder** - Quickly identify space-consuming files
|
|
28
|
+
|
|
29
|
+
### Security Features ✨ NEW in v2.1.0
|
|
30
|
+
- **🔒 Path Traversal Protection** - Multi-layer validation with symlink resolution
|
|
31
|
+
- **💾 Memory-Safe Operations** - Streaming file processing (no memory exhaustion)
|
|
32
|
+
- **⚡ Resource Limits** - Configurable limits for files, depth, and size
|
|
33
|
+
- **🛡️ Sandboxed Operations** - Restricted to working directory
|
|
34
|
+
- **🔐 Error Sanitization** - No internal path disclosure
|
|
35
|
+
- **✅ Comprehensive Testing** - 100% security test coverage
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## 📦 Installation
|
|
40
|
+
|
|
41
|
+
### Prerequisites
|
|
42
|
+
- **Node.js** v18.0.0 or higher
|
|
43
|
+
- **npm** or **yarn**
|
|
44
|
+
- **Claude Desktop** (for MCP integration)
|
|
45
|
+
|
|
46
|
+
### Quick Start
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# 1. Clone or download the repository
|
|
50
|
+
git clone https://github.com/yourusername/file-organizer-mcp.git
|
|
51
|
+
cd file-organizer-mcp
|
|
52
|
+
|
|
53
|
+
# 2. Install dependencies
|
|
54
|
+
npm install
|
|
55
|
+
|
|
56
|
+
# 3. Run security tests (optional but recommended)
|
|
57
|
+
npm test
|
|
58
|
+
|
|
59
|
+
# 4. Start the server
|
|
60
|
+
npm start
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### MCP Configuration
|
|
64
|
+
|
|
65
|
+
Add this to your Claude Desktop configuration file:
|
|
66
|
+
|
|
67
|
+
**Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
|
|
68
|
+
**Mac/Linux:** `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"mcpServers": {
|
|
73
|
+
"file-organizer": {
|
|
74
|
+
"command": "node",
|
|
75
|
+
"args": [
|
|
76
|
+
"/absolute/path/to/file-organizer-mcp/server.js"
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
> ⚠️ **Important:** Replace `/absolute/path/to/` with your actual installation path
|
|
84
|
+
|
|
85
|
+
### Verify Installation
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# Run security tests
|
|
89
|
+
npm test
|
|
90
|
+
|
|
91
|
+
# Expected output:
|
|
92
|
+
# ✅ PASS: Sanitize or Reject path traversal with ..
|
|
93
|
+
# ✅ PASS: Reject symlink outside CWD
|
|
94
|
+
# ✅ PASS: Skip files larger than MAX_FILE_SIZE
|
|
95
|
+
# ✅ PASS: Gracefully handle large files in duplicate find
|
|
96
|
+
# ✅ PASS: Enforce MAX_DEPTH limit
|
|
97
|
+
# ✅ PASS: Enforce MAX_FILES limit
|
|
98
|
+
# Tests Passed: 6, Tests Failed: 0
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## 🚀 Usage
|
|
104
|
+
|
|
105
|
+
### Basic Operations
|
|
106
|
+
|
|
107
|
+
#### 1. Scan Directory
|
|
108
|
+
Get detailed information about files in a directory:
|
|
109
|
+
```
|
|
110
|
+
Hey Claude, scan my Downloads folder: C:/Users/Admin/Downloads
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**Output includes:**
|
|
114
|
+
- Total file count
|
|
115
|
+
- Total size (human-readable)
|
|
116
|
+
- Individual file details (name, size, dates, extensions)
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
#### 2. Categorize Files
|
|
121
|
+
See breakdown of files by category:
|
|
122
|
+
```
|
|
123
|
+
Hey Claude, categorize files in C:/Users/Admin/Downloads
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**Example output:**
|
|
127
|
+
```
|
|
128
|
+
Executables - 12 files (45 MB)
|
|
129
|
+
Videos - 24 files (2.3 GB)
|
|
130
|
+
Presentations - 37 files (156 MB)
|
|
131
|
+
Documents - 89 files (234 MB)
|
|
132
|
+
Images - 156 files (892 MB)
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
#### 3. Find Duplicates
|
|
138
|
+
Identify duplicate files and wasted space:
|
|
139
|
+
```
|
|
140
|
+
Hey Claude, find duplicate files in C:/Users/Admin/Downloads
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
**Shows:**
|
|
144
|
+
- Number of duplicate groups
|
|
145
|
+
- Total duplicate files
|
|
146
|
+
- Wasted space
|
|
147
|
+
- List of duplicate file locations
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
#### 4. Find Largest Files
|
|
152
|
+
Identify the biggest space consumers:
|
|
153
|
+
```
|
|
154
|
+
Hey Claude, show me the 20 largest files in C:/Users/Admin/Downloads
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
#### 5. Organize Files (Preview)
|
|
160
|
+
See what would happen before organizing:
|
|
161
|
+
```
|
|
162
|
+
Hey Claude, organize files in C:/Users/Admin/Downloads with dry run
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**Dry run shows:**
|
|
166
|
+
- Which files would move where
|
|
167
|
+
- Category breakdown
|
|
168
|
+
- Potential naming conflicts
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
#### 6. Organize Files (Execute)
|
|
173
|
+
Actually organize the files:
|
|
174
|
+
```
|
|
175
|
+
Hey Claude, organize files in C:/Users/Admin/Downloads
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**The organizer will:**
|
|
179
|
+
1. ✅ Create category folders
|
|
180
|
+
2. ✅ Move files to appropriate categories
|
|
181
|
+
3. ✅ Handle duplicate filenames (adds _1, _2, etc.)
|
|
182
|
+
4. ✅ Preserve original modification dates
|
|
183
|
+
5. ✅ Clean up empty category folders
|
|
184
|
+
6. ✅ Show detailed summary
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## 📁 File Categories
|
|
189
|
+
|
|
190
|
+
Files are automatically sorted into these categories:
|
|
191
|
+
|
|
192
|
+
| Category | Extensions |
|
|
193
|
+
|----------|-----------|
|
|
194
|
+
| **Executables** | `.exe`, `.msi`, `.bat`, `.cmd`, `.sh` |
|
|
195
|
+
| **Videos** | `.mp4`, `.avi`, `.mkv`, `.mov`, `.wmv`, `.flv`, `.webm`, `.m4v` |
|
|
196
|
+
| **Documents** | `.pdf`, `.doc`, `.docx`, `.txt`, `.rtf`, `.odt` |
|
|
197
|
+
| **Presentations** | `.ppt`, `.pptx`, `.odp`, `.key` |
|
|
198
|
+
| **Spreadsheets** | `.xls`, `.xlsx`, `.csv`, `.ods` |
|
|
199
|
+
| **Images** | `.jpg`, `.jpeg`, `.png`, `.gif`, `.bmp`, `.svg`, `.ico`, `.webp` |
|
|
200
|
+
| **Audio** | `.mp3`, `.wav`, `.flac`, `.aac`, `.ogg`, `.wma`, `.m4a` |
|
|
201
|
+
| **Archives** | `.zip`, `.rar`, `.7z`, `.tar`, `.gz`, `.bz2`, `.xz` |
|
|
202
|
+
| **Code** | `.py`, `.js`, `.ts`, `.java`, `.cpp`, `.c`, `.html`, `.css`, `.php`, `.rb`, `.go`, `.json` |
|
|
203
|
+
| **Installers** | `.dmg`, `.pkg`, `.deb`, `.rpm`, `.apk` |
|
|
204
|
+
| **Ebooks** | `.epub`, `.mobi`, `.azw`, `.azw3` |
|
|
205
|
+
| **Fonts** | `.ttf`, `.otf`, `.woff`, `.woff2` |
|
|
206
|
+
| **Others** | Everything else |
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## 🔐 Security
|
|
211
|
+
|
|
212
|
+
### Security Score: 9.5/10 🌟
|
|
213
|
+
|
|
214
|
+
File Organizer MCP v2.1.0 has been **professionally security-audited** and hardened against common attacks.
|
|
215
|
+
|
|
216
|
+
### Protected Against
|
|
217
|
+
|
|
218
|
+
| Attack Type | Protection Mechanism | Status |
|
|
219
|
+
|-------------|---------------------|---------|
|
|
220
|
+
| **Path Traversal** | Input sanitization + symlink resolution | ✅ Protected |
|
|
221
|
+
| **Symlink Attacks** | Real path validation | ✅ Protected |
|
|
222
|
+
| **DoS - Memory** | File size limits + streaming | ✅ Protected |
|
|
223
|
+
| **DoS - CPU** | File count limits | ✅ Protected |
|
|
224
|
+
| **DoS - Recursion** | Depth limits | ✅ Protected |
|
|
225
|
+
| **Info Disclosure** | Error message sanitization | ✅ Protected |
|
|
226
|
+
|
|
227
|
+
### Security Limits
|
|
228
|
+
|
|
229
|
+
```javascript
|
|
230
|
+
MAX_FILE_SIZE: 100 MB // Files larger than this are skipped during hashing
|
|
231
|
+
MAX_FILES: 10,000 // Maximum files processed per operation
|
|
232
|
+
MAX_DEPTH: 10 // Maximum directory depth for recursive scans
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### Security Features
|
|
236
|
+
|
|
237
|
+
#### 1. Path Validation (Multi-Layer)
|
|
238
|
+
- ✅ Path normalization
|
|
239
|
+
- ✅ Traversal sequence removal (`../` stripped)
|
|
240
|
+
- ✅ Symlink resolution
|
|
241
|
+
- ✅ Strict containment checking
|
|
242
|
+
- ✅ Works with non-existent files
|
|
243
|
+
|
|
244
|
+
#### 2. Resource Protection
|
|
245
|
+
- ✅ Streaming file operations (64KB chunks)
|
|
246
|
+
- ✅ Pre-validation before processing
|
|
247
|
+
- ✅ Graceful degradation (skips problematic files)
|
|
248
|
+
- ✅ Memory-safe duplicate detection
|
|
249
|
+
|
|
250
|
+
#### 3. Error Handling
|
|
251
|
+
- ✅ All operations wrapped in try-catch
|
|
252
|
+
- ✅ Path sanitization in error messages
|
|
253
|
+
- ✅ Informative but safe error reporting
|
|
254
|
+
|
|
255
|
+
### Security Testing
|
|
256
|
+
|
|
257
|
+
Run the comprehensive security test suite:
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
npm test
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
**Tests include:**
|
|
264
|
+
- Path traversal attack prevention
|
|
265
|
+
- Symlink attack prevention
|
|
266
|
+
- Large file handling
|
|
267
|
+
- Depth limit enforcement
|
|
268
|
+
- File count limit enforcement
|
|
269
|
+
- Graceful error handling
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## 🛡️ Safety Features
|
|
274
|
+
|
|
275
|
+
### File Protection
|
|
276
|
+
- **Dry Run Mode** - Preview all changes before execution
|
|
277
|
+
- **Duplicate Handling** - Never overwrites existing files
|
|
278
|
+
- **Hidden File Protection** - Ignores hidden files (starting with `.`)
|
|
279
|
+
- **Sandboxing** - All operations restricted to working directory
|
|
280
|
+
- **Atomic Operations** - Files moved safely with conflict resolution
|
|
281
|
+
|
|
282
|
+
### User Safety
|
|
283
|
+
- **Clear Error Messages** - Helpful feedback without exposing sensitive paths
|
|
284
|
+
- **Progress Logging** - Track what's happening during operations
|
|
285
|
+
- **Empty Folder Cleanup** - Removes unused category folders automatically
|
|
286
|
+
- **Rollback Support** - Dry run lets you verify before committing
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
## 💡 Example Workflows
|
|
291
|
+
|
|
292
|
+
### Workflow 1: Clean Up Downloads
|
|
293
|
+
```
|
|
294
|
+
1. "Claude, scan C:/Users/Admin/Downloads"
|
|
295
|
+
→ See what you have (1,247 files, 15.3 GB)
|
|
296
|
+
|
|
297
|
+
2. "Claude, categorize the files"
|
|
298
|
+
→ Videos: 234 files (8.2 GB)
|
|
299
|
+
→ Documents: 567 files (2.1 GB)
|
|
300
|
+
→ Images: 389 files (4.2 GB)
|
|
301
|
+
→ Others: 57 files (800 MB)
|
|
302
|
+
|
|
303
|
+
3. "Claude, find duplicates"
|
|
304
|
+
→ Found 45 duplicate groups
|
|
305
|
+
→ Wasted space: 2.3 GB
|
|
306
|
+
|
|
307
|
+
4. "Claude, organize files with dry run"
|
|
308
|
+
→ Review planned changes
|
|
309
|
+
|
|
310
|
+
5. "Claude, organize files"
|
|
311
|
+
→ ✅ Organized 1,247 files
|
|
312
|
+
→ ✅ Created 8 category folders
|
|
313
|
+
→ ✅ Freed up 2.3 GB (after manual duplicate removal)
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
### Workflow 2: Find Space Hogs
|
|
317
|
+
```
|
|
318
|
+
1. "Claude, show me the 20 largest files in C:/Users/Admin/Documents"
|
|
319
|
+
→ old_backup.zip: 5.2 GB
|
|
320
|
+
→ presentation_final_final.pptx: 890 MB
|
|
321
|
+
→ video_project.mp4: 1.2 GB
|
|
322
|
+
|
|
323
|
+
2. "Claude, find duplicates in C:/Users/Admin/Documents"
|
|
324
|
+
→ Identify unnecessary copies
|
|
325
|
+
|
|
326
|
+
3. Delete duplicates manually, then organize
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
### Workflow 3: Project Organization
|
|
330
|
+
```
|
|
331
|
+
1. "Claude, scan ~/Projects/MyApp"
|
|
332
|
+
→ 456 files scattered everywhere
|
|
333
|
+
|
|
334
|
+
2. "Claude, categorize by type"
|
|
335
|
+
→ Code: 234 files
|
|
336
|
+
→ Images: 123 files
|
|
337
|
+
→ Documents: 99 files
|
|
338
|
+
|
|
339
|
+
3. "Claude, organize files"
|
|
340
|
+
→ Clean project structure ready for version control
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
## 🛠️ API Reference
|
|
346
|
+
|
|
347
|
+
### Available Tools
|
|
348
|
+
|
|
349
|
+
#### `list_files`
|
|
350
|
+
List all files in a directory with basic information.
|
|
351
|
+
|
|
352
|
+
**Parameters:**
|
|
353
|
+
- `directory` (string, required) - Full path to directory
|
|
354
|
+
|
|
355
|
+
**Returns:** List of files with names and paths
|
|
356
|
+
|
|
357
|
+
---
|
|
358
|
+
|
|
359
|
+
#### `scan_directory`
|
|
360
|
+
Detailed directory scan with file information.
|
|
361
|
+
|
|
362
|
+
**Parameters:**
|
|
363
|
+
- `directory` (string, required) - Full path to directory
|
|
364
|
+
- `include_subdirs` (boolean, optional) - Include subdirectories (default: false)
|
|
365
|
+
- `max_depth` (number, optional) - Maximum depth to scan (default: -1, max: 10)
|
|
366
|
+
|
|
367
|
+
**Returns:** File list with sizes, dates, extensions, and statistics
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
#### `categorize_by_type`
|
|
372
|
+
Group files by category with statistics.
|
|
373
|
+
|
|
374
|
+
**Parameters:**
|
|
375
|
+
- `directory` (string, required) - Full path to directory
|
|
376
|
+
- `include_subdirs` (boolean, optional) - Include subdirectories (default: false)
|
|
377
|
+
|
|
378
|
+
**Returns:** Category breakdown with file counts and sizes
|
|
379
|
+
|
|
380
|
+
---
|
|
381
|
+
|
|
382
|
+
#### `find_largest_files`
|
|
383
|
+
Find the largest files in a directory.
|
|
384
|
+
|
|
385
|
+
**Parameters:**
|
|
386
|
+
- `directory` (string, required) - Full path to directory
|
|
387
|
+
- `include_subdirs` (boolean, optional) - Include subdirectories (default: false)
|
|
388
|
+
- `top_n` (number, optional) - Number of files to return (default: 10)
|
|
389
|
+
|
|
390
|
+
**Returns:** List of largest files sorted by size
|
|
391
|
+
|
|
392
|
+
---
|
|
393
|
+
|
|
394
|
+
#### `find_duplicate_files`
|
|
395
|
+
Identify duplicate files using content-based hashing.
|
|
396
|
+
|
|
397
|
+
**Parameters:**
|
|
398
|
+
- `directory` (string, required) - Full path to directory
|
|
399
|
+
|
|
400
|
+
**Returns:** Duplicate groups with wasted space calculation
|
|
401
|
+
|
|
402
|
+
**Note:** Files larger than 100MB are automatically skipped with a warning
|
|
403
|
+
|
|
404
|
+
---
|
|
405
|
+
|
|
406
|
+
#### `organize_files`
|
|
407
|
+
Automatically organize files into categorized folders.
|
|
408
|
+
|
|
409
|
+
**Parameters:**
|
|
410
|
+
- `directory` (string, required) - Full path to directory
|
|
411
|
+
- `dry_run` (boolean, optional) - Preview without moving files (default: false)
|
|
412
|
+
|
|
413
|
+
**Returns:** Organization summary with actions taken and any errors
|
|
414
|
+
|
|
415
|
+
---
|
|
416
|
+
|
|
417
|
+
## 🐛 Troubleshooting
|
|
418
|
+
|
|
419
|
+
### MCP Server Not Showing Up
|
|
420
|
+
|
|
421
|
+
**Symptoms:** Claude doesn't recognize the file organizer commands
|
|
422
|
+
|
|
423
|
+
**Solutions:**
|
|
424
|
+
1. ✅ Check config file path is correct
|
|
425
|
+
2. ✅ Verify Node.js v18+ is installed: `node --version`
|
|
426
|
+
3. ✅ Restart Claude Desktop completely
|
|
427
|
+
4. ✅ Check server path in `claude_desktop_config.json` is absolute
|
|
428
|
+
5. ✅ Look for errors in Claude Desktop logs
|
|
429
|
+
|
|
430
|
+
---
|
|
431
|
+
|
|
432
|
+
### Permission Errors
|
|
433
|
+
|
|
434
|
+
**Symptoms:** "Access denied" or "Permission denied" errors
|
|
435
|
+
|
|
436
|
+
**Solutions:**
|
|
437
|
+
1. ✅ **Windows:** Run Claude Desktop as Administrator
|
|
438
|
+
2. ✅ **Mac/Linux:** Check folder permissions: `ls -la`
|
|
439
|
+
3. ✅ Ensure you have write permissions in target directory
|
|
440
|
+
4. ✅ Check if files are in use by other programs
|
|
441
|
+
|
|
442
|
+
---
|
|
443
|
+
|
|
444
|
+
### Files Not Moving
|
|
445
|
+
|
|
446
|
+
**Symptoms:** Organize operation completes but files haven't moved
|
|
447
|
+
|
|
448
|
+
**Solutions:**
|
|
449
|
+
1. ✅ Verify dry_run mode is NOT enabled
|
|
450
|
+
2. ✅ Check files aren't locked by other programs
|
|
451
|
+
3. ✅ Ensure sufficient disk space
|
|
452
|
+
4. ✅ Review error messages in operation summary
|
|
453
|
+
5. ✅ Check file permissions
|
|
454
|
+
|
|
455
|
+
---
|
|
456
|
+
|
|
457
|
+
### Large File Warnings
|
|
458
|
+
|
|
459
|
+
**Symptoms:** "Skipping large file" messages during duplicate detection
|
|
460
|
+
|
|
461
|
+
**Solutions:**
|
|
462
|
+
- ℹ️ This is **expected behavior** for security
|
|
463
|
+
- ℹ️ Files over 100MB are skipped during hashing to prevent memory issues
|
|
464
|
+
- ℹ️ These files are still organized normally
|
|
465
|
+
- ℹ️ If needed, organize first, then check duplicates manually
|
|
466
|
+
|
|
467
|
+
---
|
|
468
|
+
|
|
469
|
+
### Security Test Failures
|
|
470
|
+
|
|
471
|
+
**Symptoms:** `npm test` shows failures
|
|
472
|
+
|
|
473
|
+
**Solutions:**
|
|
474
|
+
1. ✅ Ensure you're running from the project root directory
|
|
475
|
+
2. ✅ Clear test artifacts: `rm -rf *_test* *.bin`
|
|
476
|
+
3. ✅ Reinstall dependencies: `npm install`
|
|
477
|
+
4. ✅ Check Node.js version: `node --version` (must be v18+)
|
|
478
|
+
5. ✅ **Windows:** May need admin rights for symlink tests
|
|
479
|
+
|
|
480
|
+
---
|
|
481
|
+
|
|
482
|
+
## 📝 Important Notes
|
|
483
|
+
|
|
484
|
+
### Behavior Details
|
|
485
|
+
- ⚠️ Organizes files in **root directory only**, not subdirectories
|
|
486
|
+
- ⚠️ Existing category folders won't be reorganized (prevents loops)
|
|
487
|
+
- ✅ File extensions are case-insensitive
|
|
488
|
+
- ✅ Original modification dates are preserved
|
|
489
|
+
- ✅ Hidden files (starting with `.`) are automatically skipped
|
|
490
|
+
- ✅ Maximum 10,000 files processed per operation (security limit)
|
|
491
|
+
- ✅ Maximum 10 directory levels scanned (security limit)
|
|
492
|
+
|
|
493
|
+
### Before/After Example
|
|
494
|
+
|
|
495
|
+
**Before organizing:**
|
|
496
|
+
```
|
|
497
|
+
Downloads/
|
|
498
|
+
├── setup.exe
|
|
499
|
+
├── vacation_video.mp4
|
|
500
|
+
├── presentation_draft.pptx
|
|
501
|
+
├── report_final.pdf
|
|
502
|
+
├── screenshot.png
|
|
503
|
+
├── music.mp3
|
|
504
|
+
└── 247 other files scattered everywhere...
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
**After organizing:**
|
|
508
|
+
```
|
|
509
|
+
Downloads/
|
|
510
|
+
├── Executables/
|
|
511
|
+
│ └── setup.exe
|
|
512
|
+
├── Videos/
|
|
513
|
+
│ └── vacation_video.mp4
|
|
514
|
+
├── Presentations/
|
|
515
|
+
│ └── presentation_draft.pptx
|
|
516
|
+
├── Documents/
|
|
517
|
+
│ └── report_final.pdf
|
|
518
|
+
├── Images/
|
|
519
|
+
│ └── screenshot.png
|
|
520
|
+
└── Audio/
|
|
521
|
+
└── music.mp3
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
---
|
|
525
|
+
|
|
526
|
+
## 🔄 Version History
|
|
527
|
+
|
|
528
|
+
### v2.1.0 (Current) - Security Hardening Release
|
|
529
|
+
**Released:** February 1, 2026
|
|
530
|
+
|
|
531
|
+
**Security Improvements:**
|
|
532
|
+
- ✅ Path traversal protection with input sanitization
|
|
533
|
+
- ✅ Symlink resolution and validation
|
|
534
|
+
- ✅ Memory-safe streaming file operations
|
|
535
|
+
- ✅ Resource limits (file size, count, depth)
|
|
536
|
+
- ✅ Error message sanitization
|
|
537
|
+
- ✅ Comprehensive security test suite
|
|
538
|
+
|
|
539
|
+
**Changes:**
|
|
540
|
+
- Updated `@modelcontextprotocol/sdk` to v1.25.3
|
|
541
|
+
- Added security constants (MAX_FILE_SIZE, MAX_FILES, MAX_DEPTH)
|
|
542
|
+
- Implemented graceful large file handling
|
|
543
|
+
- Added `test_security.js` test suite
|
|
544
|
+
|
|
545
|
+
**Security Score:** 9.5/10 (improved from 6.5/10)
|
|
546
|
+
|
|
547
|
+
### v2.0.0 - Initial Release
|
|
548
|
+
- Basic file organization functionality
|
|
549
|
+
- Duplicate detection
|
|
550
|
+
- Category-based sorting
|
|
551
|
+
- Dry run mode
|
|
552
|
+
|
|
553
|
+
---
|
|
554
|
+
|
|
555
|
+
## 🤝 Contributing
|
|
556
|
+
|
|
557
|
+
Contributions are welcome! Please follow these guidelines:
|
|
558
|
+
|
|
559
|
+
1. **Security First** - All changes must maintain or improve security
|
|
560
|
+
2. **Test Coverage** - Add tests for new features
|
|
561
|
+
3. **Documentation** - Update README for significant changes
|
|
562
|
+
4. **Code Style** - Follow existing code style
|
|
563
|
+
|
|
564
|
+
### Reporting Security Issues
|
|
565
|
+
|
|
566
|
+
🚨 **Please do NOT open public issues for security vulnerabilities**
|
|
567
|
+
|
|
568
|
+
Instead, email security concerns to: [technocratix902@gmail.com]
|
|
569
|
+
|
|
570
|
+
---
|
|
571
|
+
|
|
572
|
+
## 📄 License
|
|
573
|
+
|
|
574
|
+
MIT License - see [LICENSE](LICENSE) file for details
|
|
575
|
+
|
|
576
|
+
---
|
|
577
|
+
|
|
578
|
+
## 🙏 Acknowledgments
|
|
579
|
+
|
|
580
|
+
- **Anthropic** - For the Model Context Protocol specification
|
|
581
|
+
- **Security Audit** - Comprehensive testing and hardening
|
|
582
|
+
- **Community** - For feedback and contributions
|
|
583
|
+
|
|
584
|
+
---
|
|
585
|
+
|
|
586
|
+
## 📞 Support
|
|
587
|
+
|
|
588
|
+
- **Documentation:** This README
|
|
589
|
+
- **Issues:** [GitHub Issues](https://github.com/yourusername/file-organizer-mcp/issues)
|
|
590
|
+
- **Security:** [Security Policy](#-contributing)
|
|
591
|
+
- **MCP Spec:** [Model Context Protocol](https://modelcontextprotocol.io)
|
|
592
|
+
|
|
593
|
+
---
|
|
594
|
+
|
|
595
|
+
<div align="center">
|
|
596
|
+
|
|
597
|
+
**Happy Organizing! 🎯**
|
|
598
|
+
|
|
599
|
+
Made with ❤️ for the Claude.ai community
|
|
600
|
+
|
|
601
|
+
[⬆ Back to Top](#file-organizer-mcp-server-)
|
|
602
|
+
|
|
603
|
+
</div>
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "file-organizer-mcp",
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"description": "Security-hardened MCP server for intelligent file organization",
|
|
5
|
+
"main": "server.js",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"mcp",
|
|
8
|
+
"file-organizer",
|
|
9
|
+
"claude",
|
|
10
|
+
"ai",
|
|
11
|
+
"automation",
|
|
12
|
+
"file-management"
|
|
13
|
+
],
|
|
14
|
+
"author": "Kriday Dave <technocratix902@gmail.com>",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/kridaydave/File-Organizer-MCP"
|
|
18
|
+
},
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/kridaydave/File-Organizer-MCP/issues"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://github.com/kridaydave/File-Organizer-MCP#readme",
|
|
23
|
+
"scripts": {
|
|
24
|
+
"start": "node server.js",
|
|
25
|
+
"dev": "node --watch server.js",
|
|
26
|
+
"test": "node test_security.js"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@modelcontextprotocol/sdk": "^1.25.3"
|
|
30
|
+
},
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=18.0.0"
|
|
33
|
+
}
|
|
34
|
+
}
|