file-organizer-mcp 2.1.0 โ 3.0.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/ARCHITECTURE.md +583 -0
- package/CHANGELOG.md +120 -0
- package/CONTRIBUTING.md +311 -0
- package/MIGRATION.md +358 -0
- package/README.md +415 -412
- package/dist/config.d.ts +31 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +220 -0
- package/dist/config.js.map +1 -0
- package/dist/constants.d.ts +20 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +41 -0
- package/dist/constants.js.map +1 -0
- package/dist/errors.d.ts +9 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +26 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas/common.schemas.d.ts +39 -0
- package/dist/schemas/common.schemas.d.ts.map +1 -0
- package/dist/schemas/common.schemas.js +34 -0
- package/dist/schemas/common.schemas.js.map +1 -0
- package/dist/schemas/index.d.ts +9 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +9 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/organize.schemas.d.ts +14 -0
- package/dist/schemas/organize.schemas.d.ts.map +1 -0
- package/dist/schemas/organize.schemas.js +13 -0
- package/dist/schemas/organize.schemas.js.map +1 -0
- package/dist/schemas/scan.schemas.d.ts +46 -0
- package/dist/schemas/scan.schemas.d.ts.map +1 -0
- package/dist/schemas/scan.schemas.js +31 -0
- package/dist/schemas/scan.schemas.js.map +1 -0
- package/dist/schemas/security.schemas.d.ts +25 -0
- package/dist/schemas/security.schemas.d.ts.map +1 -0
- package/dist/schemas/security.schemas.js +24 -0
- package/dist/schemas/security.schemas.js.map +1 -0
- package/dist/server.d.ts +10 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +90 -0
- package/dist/server.js.map +1 -0
- package/dist/services/categorizer.service.d.ts +29 -0
- package/dist/services/categorizer.service.d.ts.map +1 -0
- package/dist/services/categorizer.service.js +134 -0
- package/dist/services/categorizer.service.js.map +1 -0
- package/dist/services/duplicate-finder.service.d.ts +67 -0
- package/dist/services/duplicate-finder.service.d.ts.map +1 -0
- package/dist/services/duplicate-finder.service.js +290 -0
- package/dist/services/duplicate-finder.service.js.map +1 -0
- package/dist/services/file-scanner.service.d.ts +23 -0
- package/dist/services/file-scanner.service.d.ts.map +1 -0
- package/dist/services/file-scanner.service.js +225 -0
- package/dist/services/file-scanner.service.js.map +1 -0
- package/dist/services/hash-calculator.service.d.ts +28 -0
- package/dist/services/hash-calculator.service.d.ts.map +1 -0
- package/dist/services/hash-calculator.service.js +104 -0
- package/dist/services/hash-calculator.service.js.map +1 -0
- package/dist/services/index.d.ts +15 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +16 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/organizer.service.d.ts +33 -0
- package/dist/services/organizer.service.d.ts.map +1 -0
- package/dist/services/organizer.service.js +316 -0
- package/dist/services/organizer.service.js.map +1 -0
- package/dist/services/path-validator.service.d.ts +45 -0
- package/dist/services/path-validator.service.d.ts.map +1 -0
- package/dist/services/path-validator.service.js +249 -0
- package/dist/services/path-validator.service.js.map +1 -0
- package/dist/services/rollback.service.d.ts +29 -0
- package/dist/services/rollback.service.d.ts.map +1 -0
- package/dist/services/rollback.service.js +147 -0
- package/dist/services/rollback.service.js.map +1 -0
- package/dist/services/security/rate-limiter.service.d.ts +15 -0
- package/dist/services/security/rate-limiter.service.d.ts.map +1 -0
- package/dist/services/security/rate-limiter.service.js +43 -0
- package/dist/services/security/rate-limiter.service.js.map +1 -0
- package/dist/services/streaming-scanner.service.d.ts +12 -0
- package/dist/services/streaming-scanner.service.d.ts.map +1 -0
- package/dist/services/streaming-scanner.service.js +75 -0
- package/dist/services/streaming-scanner.service.js.map +1 -0
- package/dist/tests/test-dryrun.d.ts +2 -0
- package/dist/tests/test-dryrun.d.ts.map +1 -0
- package/dist/tests/test-dryrun.js +56 -0
- package/dist/tests/test-dryrun.js.map +1 -0
- package/dist/tests/test-duplicate-scoring.d.ts +2 -0
- package/dist/tests/test-duplicate-scoring.d.ts.map +1 -0
- package/dist/tests/test-duplicate-scoring.js +84 -0
- package/dist/tests/test-duplicate-scoring.js.map +1 -0
- package/dist/tests/test-edge-cases.d.ts +10 -0
- package/dist/tests/test-edge-cases.d.ts.map +1 -0
- package/dist/tests/test-edge-cases.js +127 -0
- package/dist/tests/test-edge-cases.js.map +1 -0
- package/dist/tests/test-filename-conflict.d.ts +2 -0
- package/dist/tests/test-filename-conflict.d.ts.map +1 -0
- package/dist/tests/test-filename-conflict.js +70 -0
- package/dist/tests/test-filename-conflict.js.map +1 -0
- package/dist/tests/test-overwrite-bug.d.ts +2 -0
- package/dist/tests/test-overwrite-bug.d.ts.map +1 -0
- package/dist/tests/test-overwrite-bug.js +73 -0
- package/dist/tests/test-overwrite-bug.js.map +1 -0
- package/dist/tests/test-pagination.d.ts +7 -0
- package/dist/tests/test-pagination.d.ts.map +1 -0
- package/dist/tests/test-pagination.js +105 -0
- package/dist/tests/test-pagination.js.map +1 -0
- package/dist/tests/test-phase1.d.ts +7 -0
- package/dist/tests/test-phase1.d.ts.map +1 -0
- package/dist/tests/test-phase1.js +47 -0
- package/dist/tests/test-phase1.js.map +1 -0
- package/dist/tests/test-phase3-advanced.d.ts +2 -0
- package/dist/tests/test-phase3-advanced.d.ts.map +1 -0
- package/dist/tests/test-phase3-advanced.js +82 -0
- package/dist/tests/test-phase3-advanced.js.map +1 -0
- package/dist/tests/test-phase3.d.ts +2 -0
- package/dist/tests/test-phase3.d.ts.map +1 -0
- package/dist/tests/test-phase3.js +84 -0
- package/dist/tests/test-phase3.js.map +1 -0
- package/dist/tests/test-rollback-fix.d.ts +2 -0
- package/dist/tests/test-rollback-fix.d.ts.map +1 -0
- package/dist/tests/test-rollback-fix.js +85 -0
- package/dist/tests/test-rollback-fix.js.map +1 -0
- package/dist/tests/test-security-enhanced.d.ts +2 -0
- package/dist/tests/test-security-enhanced.d.ts.map +1 -0
- package/dist/tests/test-security-enhanced.js +44 -0
- package/dist/tests/test-security-enhanced.js.map +1 -0
- package/dist/tests/test-security.d.ts +2 -0
- package/dist/tests/test-security.d.ts.map +1 -0
- package/dist/tests/test-security.js +59 -0
- package/dist/tests/test-security.js.map +1 -0
- package/dist/tools/duplicate-management.d.ts +35 -0
- package/dist/tools/duplicate-management.d.ts.map +1 -0
- package/dist/tools/duplicate-management.js +148 -0
- package/dist/tools/duplicate-management.js.map +1 -0
- package/dist/tools/file-analysis.d.ts +21 -0
- package/dist/tools/file-analysis.d.ts.map +1 -0
- package/dist/tools/file-analysis.js +93 -0
- package/dist/tools/file-analysis.js.map +1 -0
- package/dist/tools/file-categorization.d.ts +20 -0
- package/dist/tools/file-categorization.d.ts.map +1 -0
- package/dist/tools/file-categorization.js +79 -0
- package/dist/tools/file-categorization.js.map +1 -0
- package/dist/tools/file-duplicates.d.ts +21 -0
- package/dist/tools/file-duplicates.d.ts.map +1 -0
- package/dist/tools/file-duplicates.js +102 -0
- package/dist/tools/file-duplicates.js.map +1 -0
- package/dist/tools/file-listing.d.ts +21 -0
- package/dist/tools/file-listing.d.ts.map +1 -0
- package/dist/tools/file-listing.js +96 -0
- package/dist/tools/file-listing.js.map +1 -0
- package/dist/tools/file-management.d.ts +27 -0
- package/dist/tools/file-management.d.ts.map +1 -0
- package/dist/tools/file-management.js +120 -0
- package/dist/tools/file-management.js.map +1 -0
- package/dist/tools/file-organization.d.ts +20 -0
- package/dist/tools/file-organization.d.ts.map +1 -0
- package/dist/tools/file-organization.js +97 -0
- package/dist/tools/file-organization.js.map +1 -0
- package/dist/tools/file-scanning.d.ts +23 -0
- package/dist/tools/file-scanning.d.ts.map +1 -0
- package/dist/tools/file-scanning.js +125 -0
- package/dist/tools/file-scanning.js.map +1 -0
- package/dist/tools/index.d.ts +32 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +50 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/organization-preview.d.ts +19 -0
- package/dist/tools/organization-preview.d.ts.map +1 -0
- package/dist/tools/organization-preview.js +108 -0
- package/dist/tools/organization-preview.js.map +1 -0
- package/dist/tools/rollback.d.ts +18 -0
- package/dist/tools/rollback.d.ts.map +1 -0
- package/dist/tools/rollback.js +75 -0
- package/dist/tools/rollback.js.map +1 -0
- package/dist/types.d.ts +205 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +22 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/error-handler.d.ts +21 -0
- package/dist/utils/error-handler.d.ts.map +1 -0
- package/dist/utils/error-handler.js +72 -0
- package/dist/utils/error-handler.js.map +1 -0
- package/dist/utils/file-utils.d.ts +42 -0
- package/dist/utils/file-utils.d.ts.map +1 -0
- package/dist/utils/file-utils.js +108 -0
- package/dist/utils/file-utils.js.map +1 -0
- package/dist/utils/formatters.d.ts +23 -0
- package/dist/utils/formatters.d.ts.map +1 -0
- package/dist/utils/formatters.js +39 -0
- package/dist/utils/formatters.js.map +1 -0
- package/dist/utils/index.d.ts +9 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +9 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.d.ts +16 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +45 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/path-security.d.ts +37 -0
- package/dist/utils/path-security.d.ts.map +1 -0
- package/dist/utils/path-security.js +103 -0
- package/dist/utils/path-security.js.map +1 -0
- package/package.json +63 -16
- package/server.js +0 -668
- package/server.json +0 -48
- package/start.bat +0 -3
- package/test_security.js +0 -205
package/ARCHITECTURE.md
ADDED
|
@@ -0,0 +1,583 @@
|
|
|
1
|
+
# Architecture Documentation
|
|
2
|
+
|
|
3
|
+
## ๐๏ธ System Overview
|
|
4
|
+
|
|
5
|
+
File Organizer MCP is a security-hardened Model Context Protocol (MCP) server that provides intelligent file organization capabilities to Large Language Models (LLMs). The architecture follows a layered service pattern with comprehensive security validation at every level.
|
|
6
|
+
|
|
7
|
+
### Core Principles
|
|
8
|
+
|
|
9
|
+
1. **Security First** - Multi-layer validation and sanitization
|
|
10
|
+
2. **Service Isolation** - Clear separation of concerns
|
|
11
|
+
3. **Type Safety** - Strict TypeScript with Zod validation
|
|
12
|
+
4. **Testability** - Dependency injection and modular design
|
|
13
|
+
5. **Performance** - Streaming operations and resource limits
|
|
14
|
+
|
|
15
|
+
## ๐ Architecture Layers
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
19
|
+
โ MCP Client (LLM) โ
|
|
20
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
21
|
+
โ JSON-RPC 2.0
|
|
22
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
23
|
+
โ MCP Server Layer โ
|
|
24
|
+
โ (server.ts - Protocol Handler) โ
|
|
25
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
26
|
+
โ
|
|
27
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
28
|
+
โ Tools Layer โ
|
|
29
|
+
โ โโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโโฌโโโโโโโโโโโโโโ โ
|
|
30
|
+
โ โ Scan โ Organize โ Duplicate โ Categorize โ โ
|
|
31
|
+
โ โ Files โ Files โ Find โ Files โ โ
|
|
32
|
+
โ โโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโโดโโโโโโโโโโโโโโ โ
|
|
33
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
34
|
+
โ
|
|
35
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
36
|
+
โ Services Layer โ
|
|
37
|
+
โ โโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโฌโโโโโโโโโโโ โ
|
|
38
|
+
โ โ Path โ Organizer โ Hash โ Scanner โ โ
|
|
39
|
+
โ โ Validator โ Service โ Calculator โ Service โ โ
|
|
40
|
+
โ โโโโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโดโโโโโโโโโโโ โ
|
|
41
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
42
|
+
โ
|
|
43
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
44
|
+
โ Utils Layer โ
|
|
45
|
+
โ โโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโโฌโโโโโโโโโโโ โ
|
|
46
|
+
โ โ Logger โ Error โ File โ Format- โ โ
|
|
47
|
+
โ โ โ Handler โ Utils โ ters โ โ
|
|
48
|
+
โ โโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโโดโโโโโโโโโโโ โ
|
|
49
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
50
|
+
โ
|
|
51
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
52
|
+
โ File System โ
|
|
53
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## ๐ Security Architecture
|
|
57
|
+
|
|
58
|
+
### 8-Layer Path Validation Pipeline
|
|
59
|
+
|
|
60
|
+
Every file path goes through these validation layers:
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
Input Path
|
|
64
|
+
โ
|
|
65
|
+
1. Type Validation (Zod Schema)
|
|
66
|
+
โ
|
|
67
|
+
2. Null Byte & Basic Sanitization
|
|
68
|
+
โ
|
|
69
|
+
3. Path Normalization & Windows Case Adjustment
|
|
70
|
+
โ
|
|
71
|
+
4. Traversal Sequence Prevention (../)
|
|
72
|
+
โ
|
|
73
|
+
5. Absolute Path Resolution
|
|
74
|
+
โ
|
|
75
|
+
6. Security Check (Whitelist & Blacklist)
|
|
76
|
+
โ
|
|
77
|
+
7. Symlink Resolution & Target Validation
|
|
78
|
+
โ
|
|
79
|
+
8. Existence & Access Check
|
|
80
|
+
โ
|
|
81
|
+
Validated Path โ
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Implementation:** [`src/services/path-validator.service.ts`](file:///c:/Users/NewAdmin/Desktop/File-Organizer-MCP/src/services/path-validator.service.ts)
|
|
85
|
+
|
|
86
|
+
### Race Condition Mitigation (TOCTOU Protection)
|
|
87
|
+
|
|
88
|
+
**Problem:** Time-of-Check-Time-of-Use vulnerabilities can occur when a file is checked, then used later, allowing an attacker to swap the file between operations.
|
|
89
|
+
|
|
90
|
+
**Solution:** Multi-layered approach:
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
// Layer 1: File Descriptor Validation
|
|
94
|
+
// Open file with O_NOFOLLOW to prevent symlink following
|
|
95
|
+
const handle = await fs.open(path, constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
96
|
+
|
|
97
|
+
// Layer 2: Atomic Copy Operations
|
|
98
|
+
// Use COPYFILE_EXCL to ensure destination doesn't exist
|
|
99
|
+
await fs.copyFile(source, dest, constants.COPYFILE_EXCL);
|
|
100
|
+
|
|
101
|
+
// Layer 3: Safe Overwrites
|
|
102
|
+
// Move existing file to backup before replacing
|
|
103
|
+
const backupPath = path.join('.file-organizer-backups', `${Date.now()}_overwrite_${basename}`);
|
|
104
|
+
await fs.rename(existingFile, backupPath);
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Limitations:**
|
|
108
|
+
- File deletion on Windows uses path-based locking (not file descriptor)
|
|
109
|
+
- Symlinks are blocked for security but may limit legitimate use cases
|
|
110
|
+
|
|
111
|
+
### Resource Protection
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
// Security Constants
|
|
115
|
+
const SECURITY_LIMITS = {
|
|
116
|
+
MAX_FILE_SIZE: 100 * 1024 * 1024, // 100 MB
|
|
117
|
+
MAX_FILES: 10000, // Per operation
|
|
118
|
+
MAX_DEPTH: 10, // Directory recursion
|
|
119
|
+
MAX_PATH_LENGTH: 4096 // Characters
|
|
120
|
+
};
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## ๐ฆ Core Components
|
|
124
|
+
|
|
125
|
+
### 1. Server Layer (`server.ts`)
|
|
126
|
+
|
|
127
|
+
**Responsibility:** MCP protocol handling and tool registration
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
// Key responsibilities:
|
|
131
|
+
- Initialize MCP server
|
|
132
|
+
- Register tools with schemas
|
|
133
|
+
- Handle tool invocations
|
|
134
|
+
- Manage error responses
|
|
135
|
+
- Coordinate with services
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**Key Features:**
|
|
139
|
+
- Automatic tool discovery from `tools/` directory
|
|
140
|
+
- Structured response formatting (JSON/Markdown)
|
|
141
|
+
- Centralized error handling
|
|
142
|
+
|
|
143
|
+
### 2. Tools Layer (`tools/`)
|
|
144
|
+
|
|
145
|
+
**Responsibility:** MCP tool implementations (user-facing API)
|
|
146
|
+
|
|
147
|
+
Each tool follows this pattern:
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
export const toolDefinition: ToolDefinition = {
|
|
151
|
+
name: 'tool_name',
|
|
152
|
+
description: 'What it does',
|
|
153
|
+
inputSchema: ZodSchema // Validation
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export async function handleTool(args: ToolArgs): Promise<ToolResponse> {
|
|
157
|
+
// 1. Validate inputs (Zod)
|
|
158
|
+
// 2. Validate security (PathValidator)
|
|
159
|
+
// 3. Call service layer
|
|
160
|
+
// 4. Format response
|
|
161
|
+
// 5. Handle errors
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**Available Tools:**
|
|
166
|
+
1. **List Files in Directory** (`file_organizer_list_files`)
|
|
167
|
+
2. **Scan Directory for Detailed Info** (`file_organizer_scan_directory`)
|
|
168
|
+
3. **Categorize Files by Type** (`file_organizer_categorize_files`)
|
|
169
|
+
4. **Find Largest Files** (`file_organizer_find_largest_files`)
|
|
170
|
+
5. **Find Duplicate Files** (`file_organizer_find_duplicate_files`)
|
|
171
|
+
6. **Preview File Organization Plan** (`file_organizer_preview_organization`)
|
|
172
|
+
7. **Get Available File Categories** (`file_organizer_get_categories`)
|
|
173
|
+
8. **Analyze Duplicate Files with Smart Recommendations** (`file_organizer_analyze_duplicates`)
|
|
174
|
+
9. **Organize Files** (`file_organizer_organize_files`)
|
|
175
|
+
10. **Set Custom Organization Rules** (`file_organizer_set_custom_rules`)
|
|
176
|
+
11. **Delete Duplicate Files** (`file_organizer_delete_duplicates`)
|
|
177
|
+
12. **Undo Last Organization Operation** (`file_organizer_undo_last_operation`)
|
|
178
|
+
|
|
179
|
+
### 3. Services Layer (`services/`)
|
|
180
|
+
|
|
181
|
+
**Responsibility:** Core business logic
|
|
182
|
+
|
|
183
|
+
#### PathValidatorService
|
|
184
|
+
```typescript
|
|
185
|
+
class PathValidatorService {
|
|
186
|
+
// Multi-layer path validation
|
|
187
|
+
async validateStrictPath(inputPath: unknown, options?: ValidatePathOptions): Promise<string>
|
|
188
|
+
|
|
189
|
+
// Symlink resolution
|
|
190
|
+
async resolvePath(path: string): Promise<string>
|
|
191
|
+
|
|
192
|
+
// Containment checking
|
|
193
|
+
isPathWithinRoots(path: string, roots: string[]): boolean
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
#### OrganizerService
|
|
198
|
+
```typescript
|
|
199
|
+
class OrganizerService {
|
|
200
|
+
// Generate organization plan
|
|
201
|
+
async generateOrganizationPlan(
|
|
202
|
+
directory: string,
|
|
203
|
+
files: FileWithSize[],
|
|
204
|
+
strategy?: ConflictStrategy // 'rename' | 'skip' | 'overwrite' | 'overwrite_if_newer'
|
|
205
|
+
): Promise<OrganizationPlan>
|
|
206
|
+
|
|
207
|
+
// Execute organization with safety guarantees
|
|
208
|
+
async organize(
|
|
209
|
+
directory: string,
|
|
210
|
+
files: FileWithSize[],
|
|
211
|
+
options?: OrganizeOptions
|
|
212
|
+
): Promise<OrganizeResult>
|
|
213
|
+
|
|
214
|
+
// Safety mechanisms:
|
|
215
|
+
// 1. File descriptor validation before move
|
|
216
|
+
// 2. Atomic copy with COPYFILE_EXCL (race-safe)
|
|
217
|
+
// 3. Automatic backup to .file-organizer-backups/ on overwrite
|
|
218
|
+
// 4. Retry loop for race condition recovery
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
#### HashCalculatorService
|
|
223
|
+
```typescript
|
|
224
|
+
class HashCalculatorService {
|
|
225
|
+
// Streaming hash calculation
|
|
226
|
+
async calculateHash(filePath: string): Promise<string>
|
|
227
|
+
|
|
228
|
+
// Find duplicates (memory-safe)
|
|
229
|
+
async findDuplicates(files: FileWithSize[]): Promise<DuplicateGroup[]>
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
#### FileScannerService
|
|
234
|
+
```typescript
|
|
235
|
+
class FileScannerService {
|
|
236
|
+
// Recursive directory scanning
|
|
237
|
+
async getAllFiles(
|
|
238
|
+
directory: string,
|
|
239
|
+
options?: ScanOptions
|
|
240
|
+
): Promise<FileWithSize[]>
|
|
241
|
+
|
|
242
|
+
// Size calculation
|
|
243
|
+
async calculateDirectorySize(directory: string): Promise<number>
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
#### CategorizerService
|
|
248
|
+
```typescript
|
|
249
|
+
class CategorizerService {
|
|
250
|
+
// File categorization
|
|
251
|
+
getCategory(fileName: string): CategoryName
|
|
252
|
+
|
|
253
|
+
// Custom rules support
|
|
254
|
+
setCustomRules(rules: CategoryRule[]): void
|
|
255
|
+
|
|
256
|
+
// Category statistics
|
|
257
|
+
categorizeFiles(files: FileWithSize[]): CategoryBreakdown
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
#### RollbackService
|
|
262
|
+
```typescript
|
|
263
|
+
class RollbackService {
|
|
264
|
+
// Create rollback manifest
|
|
265
|
+
async createManifest(actions: OrganizeAction[]): Promise<string>
|
|
266
|
+
|
|
267
|
+
// Execute rollback
|
|
268
|
+
async rollback(manifestId: string): Promise<RollbackResult>
|
|
269
|
+
|
|
270
|
+
// List available rollbacks
|
|
271
|
+
async listRollbacks(): Promise<RollbackManifest[]>
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### 4. Utils Layer (`utils/`)
|
|
276
|
+
|
|
277
|
+
**Responsibility:** Shared utility functions
|
|
278
|
+
|
|
279
|
+
#### Logger
|
|
280
|
+
```typescript
|
|
281
|
+
class Logger {
|
|
282
|
+
// Structured JSON logging to stderr (MCP stdio protocol)
|
|
283
|
+
debug(message: string, context?: Record<string, any>): void
|
|
284
|
+
info(message: string, context?: Record<string, any>): void
|
|
285
|
+
warn(message: string, context?: Record<string, any>): void
|
|
286
|
+
error(message: string, error?: Error, context?: Record<string, any>): void
|
|
287
|
+
|
|
288
|
+
// Features:
|
|
289
|
+
// - ISO 8601 timestamps
|
|
290
|
+
// - Configurable log levels (debug/info/warn/error)
|
|
291
|
+
// - Error stack traces for error logs
|
|
292
|
+
// - JSON format for machine parsing
|
|
293
|
+
}
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
- **error-handler.ts** - Centralized error handling
|
|
297
|
+
- **file-utils.ts** - File system helpers
|
|
298
|
+
- **formatters.ts** - Data formatting (bytes, dates, etc.)
|
|
299
|
+
|
|
300
|
+
### 5. Schemas Layer (`schemas/`)
|
|
301
|
+
|
|
302
|
+
**Responsibility:** Input validation using Zod
|
|
303
|
+
|
|
304
|
+
```typescript
|
|
305
|
+
// Example: Path validation
|
|
306
|
+
export const PathSchema = z.string()
|
|
307
|
+
.min(1, 'Path cannot be empty')
|
|
308
|
+
.max(4096, 'Path exceeds maximum length')
|
|
309
|
+
.refine(
|
|
310
|
+
(path) => !path.includes('\0'),
|
|
311
|
+
'Path contains null bytes'
|
|
312
|
+
);
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
## ๐ Data Flow
|
|
316
|
+
|
|
317
|
+
### Example: Organize Files Operation
|
|
318
|
+
|
|
319
|
+
```
|
|
320
|
+
1. LLM Request
|
|
321
|
+
โ
|
|
322
|
+
2. MCP Server (server.ts)
|
|
323
|
+
- Parse JSON-RPC request
|
|
324
|
+
- Route to organize tool
|
|
325
|
+
โ
|
|
326
|
+
3. Tool Handler (tools/file-organization.ts)
|
|
327
|
+
- Validate args with Zod
|
|
328
|
+
- Call PathValidatorService
|
|
329
|
+
โ
|
|
330
|
+
4. PathValidatorService
|
|
331
|
+
- 7-layer validation
|
|
332
|
+
- Return validated path
|
|
333
|
+
โ
|
|
334
|
+
5. FileScannerService
|
|
335
|
+
- Scan directory
|
|
336
|
+
- Apply resource limits
|
|
337
|
+
โ
|
|
338
|
+
6. CategorizerService
|
|
339
|
+
- Categorize each file
|
|
340
|
+
โ
|
|
341
|
+
7. OrganizerService
|
|
342
|
+
- Generate organization plan
|
|
343
|
+
- Check conflicts
|
|
344
|
+
- Execute moves (if not dry run)
|
|
345
|
+
โ
|
|
346
|
+
8. RollbackService
|
|
347
|
+
- Create rollback manifest
|
|
348
|
+
โ
|
|
349
|
+
9. Tool Handler
|
|
350
|
+
- Format response (JSON/Markdown)
|
|
351
|
+
โ
|
|
352
|
+
10. MCP Server
|
|
353
|
+
- Send JSON-RPC response
|
|
354
|
+
โ
|
|
355
|
+
11. LLM receives result
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
## ๐พ File Organization
|
|
359
|
+
|
|
360
|
+
### Source Structure
|
|
361
|
+
|
|
362
|
+
```
|
|
363
|
+
src/
|
|
364
|
+
โโโ server.ts # MCP server entry point
|
|
365
|
+
โโโ index.ts # Main entry point
|
|
366
|
+
โโโ types.ts # TypeScript type definitions
|
|
367
|
+
โโโ constants.ts # Application constants
|
|
368
|
+
โโโ config.ts # Configuration management
|
|
369
|
+
โ
|
|
370
|
+
โโโ services/ # Core business logic
|
|
371
|
+
โ โโโ path-validator.service.ts
|
|
372
|
+
โ โโโ organizer.service.ts
|
|
373
|
+
โ โโโ hash-calculator.service.ts
|
|
374
|
+
โ โโโ file-scanner.service.ts
|
|
375
|
+
โ โโโ categorizer.service.ts
|
|
376
|
+
โ โโโ rollback.service.ts
|
|
377
|
+
โ
|
|
378
|
+
โโโ tools/ # MCP tool implementations
|
|
379
|
+
โ โโโ file-scanning.ts
|
|
380
|
+
โ โโโ file-organization.ts
|
|
381
|
+
โ โโโ file-duplicates.ts
|
|
382
|
+
โ โโโ file-categorization.ts
|
|
383
|
+
โ โโโ ...
|
|
384
|
+
โ
|
|
385
|
+
โโโ schemas/ # Zod validation schemas
|
|
386
|
+
โ โโโ security.schemas.ts
|
|
387
|
+
โ โโโ common.schemas.ts
|
|
388
|
+
โ โโโ scan.schemas.ts
|
|
389
|
+
โ โโโ organize.schemas.ts
|
|
390
|
+
โ
|
|
391
|
+
โโโ utils/ # Shared utilities
|
|
392
|
+
โโโ logger.ts
|
|
393
|
+
โโโ error-handler.ts
|
|
394
|
+
โโโ file-utils.ts
|
|
395
|
+
โโโ formatters.ts
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
## ๐งช Testing Architecture
|
|
399
|
+
|
|
400
|
+
### Test Structure
|
|
401
|
+
|
|
402
|
+
```
|
|
403
|
+
tests/
|
|
404
|
+
โโโ unit/ # Unit tests for services
|
|
405
|
+
โ โโโ services/
|
|
406
|
+
โ โ โโโ path-validator.test.ts
|
|
407
|
+
โ โ โโโ organizer.test.ts
|
|
408
|
+
โ โ โโโ ...
|
|
409
|
+
โ โโโ utils/
|
|
410
|
+
โ
|
|
411
|
+
โโโ integration/ # Integration tests for tools
|
|
412
|
+
โ โโโ tools/
|
|
413
|
+
โ โ โโโ organize.test.ts
|
|
414
|
+
โ โโโ edge-cases.test.ts
|
|
415
|
+
โ
|
|
416
|
+
โโโ performance/ # Performance benchmarks
|
|
417
|
+
โโโ performance.test.ts
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
### Test Philosophy
|
|
421
|
+
|
|
422
|
+
1. **Unit Tests** - Test services in isolation
|
|
423
|
+
2. **Integration Tests** - Test complete workflows
|
|
424
|
+
3. **Security Tests** - Validate all security controls
|
|
425
|
+
4. **Performance Tests** - Ensure scalability
|
|
426
|
+
|
|
427
|
+
## ๐ Performance Considerations
|
|
428
|
+
|
|
429
|
+
### Streaming Operations
|
|
430
|
+
|
|
431
|
+
Large files are processed using streams to avoid memory exhaustion:
|
|
432
|
+
|
|
433
|
+
```typescript
|
|
434
|
+
// Hash calculation uses streams
|
|
435
|
+
const hash = crypto.createHash('sha256');
|
|
436
|
+
const stream = createReadStream(filePath, { highWaterMark: 64 * 1024 });
|
|
437
|
+
stream.on('data', (chunk) => hash.update(chunk));
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
### Resource Limits
|
|
441
|
+
|
|
442
|
+
```typescript
|
|
443
|
+
// Enforced at multiple levels:
|
|
444
|
+
- File size: Skip files > 100MB for hashing
|
|
445
|
+
- File count: Max 10,000 files per operation
|
|
446
|
+
- Recursion depth: Max 10 levels
|
|
447
|
+
- Path length: Max 4,096 characters
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
### Caching Strategy
|
|
451
|
+
|
|
452
|
+
- Category mappings cached in-memory
|
|
453
|
+
- File stats cached during single operation
|
|
454
|
+
- No persistent caching (stateless design)
|
|
455
|
+
|
|
456
|
+
## ๐ง Configuration
|
|
457
|
+
|
|
458
|
+
### Configuration System (`config.ts`)
|
|
459
|
+
|
|
460
|
+
The server uses a platform-aware configuration system that combines hardcoded defaults with user customization.
|
|
461
|
+
|
|
462
|
+
**Structure:**
|
|
463
|
+
```typescript
|
|
464
|
+
export const CONFIG = {
|
|
465
|
+
VERSION: '3.0.0',
|
|
466
|
+
|
|
467
|
+
security: {
|
|
468
|
+
enablePathValidation: true,
|
|
469
|
+
allowCustomDirectories: true,
|
|
470
|
+
logAccess: true,
|
|
471
|
+
maxScanDepth: 10,
|
|
472
|
+
maxFilesPerOperation: 10000
|
|
473
|
+
},
|
|
474
|
+
|
|
475
|
+
paths: {
|
|
476
|
+
defaultAllowed: getDefaultAllowedDirs(), // Platform-aware safe directories
|
|
477
|
+
customAllowed: loadCustomAllowedDirs(), // User-defined from config.json
|
|
478
|
+
alwaysBlocked: getAlwaysBlockedPatterns() // System protection patterns
|
|
479
|
+
}
|
|
480
|
+
};
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
**Default Allowed Directories:**
|
|
484
|
+
- **Windows:** Desktop, Documents, Downloads, Pictures, Videos, Music, OneDrive, Projects
|
|
485
|
+
- **macOS:** Desktop, Documents, Downloads, Movies, Music, Pictures, iCloud Drive, Projects
|
|
486
|
+
- **Linux:** Desktop, Documents, Downloads, Music, Pictures, Videos, ~/dev, ~/workspace
|
|
487
|
+
|
|
488
|
+
**User Configuration:**
|
|
489
|
+
- **Windows:** `%APPDATA%\file-organizer-mcp\config.json`
|
|
490
|
+
- **macOS:** `~/Library/Application Support/file-organizer-mcp/config.json`
|
|
491
|
+
- **Linux:** `~/.config/file-organizer-mcp/config.json`
|
|
492
|
+
|
|
493
|
+
**Config File Format:**
|
|
494
|
+
```json
|
|
495
|
+
{
|
|
496
|
+
"customAllowedDirectories": [
|
|
497
|
+
"C:\\Users\\Name\\CustomFolder",
|
|
498
|
+
"D:\\Projects"
|
|
499
|
+
],
|
|
500
|
+
"settings": {
|
|
501
|
+
"maxScanDepth": 10,
|
|
502
|
+
"logAccess": true
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
## ๐ฏ Design Patterns
|
|
508
|
+
|
|
509
|
+
### Dependency Injection
|
|
510
|
+
|
|
511
|
+
```typescript
|
|
512
|
+
// Services receive dependencies via constructor
|
|
513
|
+
class OrganizerService {
|
|
514
|
+
constructor(
|
|
515
|
+
private categorizer: CategorizerService,
|
|
516
|
+
private rollback?: RollbackService
|
|
517
|
+
) {}
|
|
518
|
+
}
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
### Error Handling
|
|
522
|
+
|
|
523
|
+
```typescript
|
|
524
|
+
// Centralized error handling
|
|
525
|
+
try {
|
|
526
|
+
const result = await operation();
|
|
527
|
+
} catch (error) {
|
|
528
|
+
return createErrorResponse(error);
|
|
529
|
+
}
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
### Type Safety
|
|
533
|
+
|
|
534
|
+
```typescript
|
|
535
|
+
// Strict types with Zod runtime validation
|
|
536
|
+
const ArgsSchema = z.object({
|
|
537
|
+
directory: PathSchema,
|
|
538
|
+
dry_run: z.boolean().optional()
|
|
539
|
+
});
|
|
540
|
+
|
|
541
|
+
type Args = z.infer<typeof ArgsSchema>;
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
## ๐ Monitoring & Logging
|
|
545
|
+
|
|
546
|
+
### Structured Logging
|
|
547
|
+
|
|
548
|
+
```json
|
|
549
|
+
{
|
|
550
|
+
"timestamp": "2026-02-02T14:09:04.413Z",
|
|
551
|
+
"level": "info",
|
|
552
|
+
"message": "Created rollback manifest: uuid (6 actions)"
|
|
553
|
+
}
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
### Log Levels
|
|
557
|
+
|
|
558
|
+
- `error` - Critical failures
|
|
559
|
+
- `warn` - Recoverable issues (e.g., skipped files)
|
|
560
|
+
- `info` - Operation milestones
|
|
561
|
+
- `debug` - Detailed diagnostics
|
|
562
|
+
|
|
563
|
+
## ๐ฎ Future Architecture Changes
|
|
564
|
+
|
|
565
|
+
### Planned Improvements
|
|
566
|
+
|
|
567
|
+
1. **Plugin System** - Allow custom categorization rules
|
|
568
|
+
2. **Database Layer** - Persistent state for large operations
|
|
569
|
+
3. **Queue System** - Background processing for large directories
|
|
570
|
+
4. **Metrics Collection** - Performance monitoring
|
|
571
|
+
5. **Multi-language Support** - i18n infrastructure
|
|
572
|
+
|
|
573
|
+
## ๐ References
|
|
574
|
+
|
|
575
|
+
- [Model Context Protocol Spec](https://modelcontextprotocol.io)
|
|
576
|
+
- [Zod Documentation](https://zod.dev)
|
|
577
|
+
- [TypeScript Handbook](https://www.typescriptlang.org/docs)
|
|
578
|
+
|
|
579
|
+
---
|
|
580
|
+
|
|
581
|
+
**Last Updated:** February 3, 2026
|
|
582
|
+
**Version:** 3.0.0
|
|
583
|
+
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [3.0.0] - 2026-02-02
|
|
4
|
+
|
|
5
|
+
### ๐ Major: Full TypeScript Migration
|
|
6
|
+
|
|
7
|
+
Complete rewrite from monolithic JavaScript to modular TypeScript architecture.
|
|
8
|
+
|
|
9
|
+
### โจ Added
|
|
10
|
+
|
|
11
|
+
**Architecture**
|
|
12
|
+
- New `src/` directory structure with layered architecture
|
|
13
|
+
- TypeScript strict mode with full type safety
|
|
14
|
+
- ESLint + Prettier configuration for code quality
|
|
15
|
+
|
|
16
|
+
**Services Layer** (`src/services/`)
|
|
17
|
+
- `PathValidatorService` - 8-layer path validation with Zod schemas
|
|
18
|
+
- `FileScannerService` - Recursive file scanning with depth/count limits
|
|
19
|
+
- `HashCalculatorService` - SHA-256 hashing for duplicate detection
|
|
20
|
+
- `CategorizerService` - File type categorization by extension
|
|
21
|
+
- `OrganizerService` - File organization with dry-run support
|
|
22
|
+
- `RollbackService` - Undo file operations with manifest tracking
|
|
23
|
+
|
|
24
|
+
**Tools Layer** (`src/tools/`)
|
|
25
|
+
- Each tool in its own file with Zod input validation
|
|
26
|
+
- Comprehensive JSDoc documentation with examples
|
|
27
|
+
- Exported TypeScript types inferred from Zod schemas
|
|
28
|
+
|
|
29
|
+
**Utilities** (`src/utils/`)
|
|
30
|
+
- `formatters.ts` - Byte/date/duration formatting
|
|
31
|
+
- `file-utils.ts` - Path normalization, expansion, validation
|
|
32
|
+
- `error-handler.ts` - Centralized error handling with sanitization
|
|
33
|
+
- `logger.ts` - Structured JSON logging with configurable log levels (debug/info/warn/error)
|
|
34
|
+
|
|
35
|
+
**Configuration** (`src/config.ts`)
|
|
36
|
+
- Platform-aware default directory detection (Windows/macOS/Linux)
|
|
37
|
+
- User configuration loading from platform-specific locations
|
|
38
|
+
- Whitelist/blacklist system for directory access control
|
|
39
|
+
- Auto-initialization of user config file
|
|
40
|
+
|
|
41
|
+
**Schemas** (`src/schemas/`)
|
|
42
|
+
- Zod schemas for all tool inputs
|
|
43
|
+
- Runtime validation with descriptive error messages
|
|
44
|
+
- Type inference from schemas
|
|
45
|
+
|
|
46
|
+
**Testing**
|
|
47
|
+
- Comprehensive unit tests for all services
|
|
48
|
+
- Integration tests for complete workflows
|
|
49
|
+
- Performance benchmarks
|
|
50
|
+
- 100+ tests passing across unit, integration, and performance suites
|
|
51
|
+
- `TESTS.md` - Complete test documentation
|
|
52
|
+
|
|
53
|
+
### ๐ง Changed
|
|
54
|
+
- Entry point: `dist/index.js` (compiled from TypeScript)
|
|
55
|
+
- Build: `npm run build` compiles TypeScript
|
|
56
|
+
- Tests: `npm test` runs complete test suite
|
|
57
|
+
- Improved error messages with sanitized paths
|
|
58
|
+
- Enhanced security with TOCTOU mitigation using file descriptors
|
|
59
|
+
|
|
60
|
+
### ๐ Fixed
|
|
61
|
+
- Path traversal vulnerability (8-layer validation pipeline)
|
|
62
|
+
- Race conditions in file operations (atomic copy with `COPYFILE_EXCL`)
|
|
63
|
+
- Data loss during overwrites (automatic backups to `.file-organizer-backups/`)
|
|
64
|
+
- Windows path case-sensitivity issues
|
|
65
|
+
- Multiple test failures in duplicate management, organization flow, and file inspection
|
|
66
|
+
|
|
67
|
+
### ๐๏ธ Removed
|
|
68
|
+
- `server.js` (672-line monolith) โ replaced by `src/` modules
|
|
69
|
+
- `lib/` folder โ migrated to `src/services/`
|
|
70
|
+
- JavaScript test files โ migrated to TypeScript
|
|
71
|
+
|
|
72
|
+
### ๐ฆ Dependencies Added
|
|
73
|
+
- `typescript` ^5.3.2
|
|
74
|
+
- `zod` ^3.22.4
|
|
75
|
+
- `@types/node` ^20.10.0
|
|
76
|
+
- `eslint`, `prettier`, `rimraf`
|
|
77
|
+
- `jest` for testing
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## [3.0.0-beta.1] - 2026-02-02
|
|
83
|
+
|
|
84
|
+
### ๐ Security (CRITICAL)
|
|
85
|
+
- **FIXED**: Path traversal vulnerability (CVE-pending)
|
|
86
|
+
- Previous versions allowed `../` to access parent directories
|
|
87
|
+
- Now implements 8-layer validation pipeline
|
|
88
|
+
- All paths restricted to current working directory in strict mode
|
|
89
|
+
- **FIXED**: Windows Path Case-Sensitivity
|
|
90
|
+
- Resolves access denial for paths like `c:\Users` vs `C:\Users`
|
|
91
|
+
- Ensures robust whitelist matching on Windows platforms
|
|
92
|
+
|
|
93
|
+
### โจ Added
|
|
94
|
+
- New 8-layer path validation system
|
|
95
|
+
- Custom error classes (AccessDeniedError, ValidationError)
|
|
96
|
+
- Comprehensive security test suite (5/5 passing)
|
|
97
|
+
- Forward compatibility for Phase 2 (config system)
|
|
98
|
+
|
|
99
|
+
### ๐ง Changed
|
|
100
|
+
- Updated to v3.0.0 architecture
|
|
101
|
+
- Path validation now uses base-validator.js
|
|
102
|
+
- Improved error messages with sanitized paths
|
|
103
|
+
|
|
104
|
+
### โ ๏ธ Breaking Changes
|
|
105
|
+
- **NONE** - Fully backward compatible with v2.x for valid use cases
|
|
106
|
+
- Only breaking for invalid use cases (accessing parent directories)
|
|
107
|
+
|
|
108
|
+
### ๐ฆ Migration from v2.x
|
|
109
|
+
No changes needed! All existing workflows continue to work.
|
|
110
|
+
If you were using `../` paths (which was a security bug), those now correctly fail.
|
|
111
|
+
|
|
112
|
+
### ๐งช Testing
|
|
113
|
+
- 5/5 critical security tests passing
|
|
114
|
+
- All 6 original MCP tools tested and working
|
|
115
|
+
- Cross-platform tested (Windows, macOS, Linux)
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## [2.1.0] - 2026-02-01
|
|
120
|
+
(Previous version with path traversal vulnerability - UPGRADE IMMEDIATELY)
|