ftp-mcp 1.2.2 → 1.3.1
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/README.md +2 -1
- package/index.js +371 -139
- package/package.json +122 -122
- package/snapshot-manager.js +24 -1
- package/sync-manifest.js +1 -1
package/package.json
CHANGED
|
@@ -1,122 +1,122 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "ftp-mcp",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Enterprise-grade MCP server providing heavily optimized FTP/SFTP operations with smart sync, patch/chunk streaming, caching, and explicit read-only security mappings for AI code assistants.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "index.js",
|
|
7
|
-
"bin": {
|
|
8
|
-
"ftp-mcp": "./index.js",
|
|
9
|
-
"ftp-mcp-server": "./index.js"
|
|
10
|
-
},
|
|
11
|
-
"files": [
|
|
12
|
-
"index.js",
|
|
13
|
-
"policy-engine.js",
|
|
14
|
-
"snapshot-manager.js",
|
|
15
|
-
"sync-manifest.js",
|
|
16
|
-
"README.md",
|
|
17
|
-
"LICENSE",
|
|
18
|
-
".ftpconfig.example"
|
|
19
|
-
],
|
|
20
|
-
"scripts": {
|
|
21
|
-
"start": "node index.js",
|
|
22
|
-
"test": "vitest run"
|
|
23
|
-
},
|
|
24
|
-
"keywords": [
|
|
25
|
-
"mcp",
|
|
26
|
-
"mcp-protocol",
|
|
27
|
-
"model-context-protocol",
|
|
28
|
-
"ftp",
|
|
29
|
-
"ftp-client",
|
|
30
|
-
"sftp",
|
|
31
|
-
"sftp-client",
|
|
32
|
-
"ssh",
|
|
33
|
-
"ssh2",
|
|
34
|
-
"scp",
|
|
35
|
-
"ssh-agent",
|
|
36
|
-
"rsync",
|
|
37
|
-
"file-transfer",
|
|
38
|
-
"file-manager",
|
|
39
|
-
"sync",
|
|
40
|
-
"diff",
|
|
41
|
-
"patch",
|
|
42
|
-
"git",
|
|
43
|
-
"gitignore",
|
|
44
|
-
"deploy",
|
|
45
|
-
"deployment",
|
|
46
|
-
"devops",
|
|
47
|
-
"continuous-deployment",
|
|
48
|
-
"automation",
|
|
49
|
-
"ai",
|
|
50
|
-
"ai-tools",
|
|
51
|
-
"llm",
|
|
52
|
-
"assistant",
|
|
53
|
-
"agentic",
|
|
54
|
-
"code-assistant",
|
|
55
|
-
"tool-call",
|
|
56
|
-
"json-rpc",
|
|
57
|
-
"server",
|
|
58
|
-
"tools",
|
|
59
|
-
"claude",
|
|
60
|
-
"claude-mcp",
|
|
61
|
-
"claude-ftp",
|
|
62
|
-
"cline",
|
|
63
|
-
"cline-mcp",
|
|
64
|
-
"cline-ftp",
|
|
65
|
-
"cursor",
|
|
66
|
-
"cursor-mcp",
|
|
67
|
-
"cursor-ftp",
|
|
68
|
-
"windsurf",
|
|
69
|
-
"windsurf-mcp",
|
|
70
|
-
"roo",
|
|
71
|
-
"roo-code",
|
|
72
|
-
"roo-mcp",
|
|
73
|
-
"copilot",
|
|
74
|
-
"github-copilot",
|
|
75
|
-
"amp",
|
|
76
|
-
"amp-mcp",
|
|
77
|
-
"openai",
|
|
78
|
-
"anthropic",
|
|
79
|
-
"gemini",
|
|
80
|
-
"gemini-mcp",
|
|
81
|
-
"mcp-server",
|
|
82
|
-
"mcp-tools",
|
|
83
|
-
"server-tool",
|
|
84
|
-
"remote",
|
|
85
|
-
"remote-fs",
|
|
86
|
-
"vfs"
|
|
87
|
-
],
|
|
88
|
-
"engines": {
|
|
89
|
-
"node": ">=18.0.0"
|
|
90
|
-
},
|
|
91
|
-
"author": {
|
|
92
|
-
"name": "Kynlo Akari",
|
|
93
|
-
"url": "https://github.com/Kynlos/"
|
|
94
|
-
},
|
|
95
|
-
"license": "MIT",
|
|
96
|
-
"repository": {
|
|
97
|
-
"type": "git",
|
|
98
|
-
"url": "https://github.com/Kynlos/ftp-mcp.git"
|
|
99
|
-
},
|
|
100
|
-
"homepage": "https://github.com/Kynlos/ftp-mcp#readme",
|
|
101
|
-
"bugs": {
|
|
102
|
-
"url": "https://github.com/Kynlos/ftp-mcp/issues"
|
|
103
|
-
},
|
|
104
|
-
"publishConfig": {
|
|
105
|
-
"access": "public"
|
|
106
|
-
},
|
|
107
|
-
"dependencies": {
|
|
108
|
-
"@clack/prompts": "^1.2.0",
|
|
109
|
-
"@modelcontextprotocol/sdk": "^1.0.4",
|
|
110
|
-
"basic-ftp": "^5.0.5",
|
|
111
|
-
"diff": "^8.0.4",
|
|
112
|
-
"dotenv": "^17.4.0",
|
|
113
|
-
"ignore": "^7.0.5",
|
|
114
|
-
"minimatch": "^10.0.3",
|
|
115
|
-
"ssh2-sftp-client": "^11.0.0",
|
|
116
|
-
"zod": "^4.3.6"
|
|
117
|
-
},
|
|
118
|
-
"devDependencies": {
|
|
119
|
-
"ftp-srv": "^4.6.3",
|
|
120
|
-
"vitest": "^4.1.2"
|
|
121
|
-
}
|
|
122
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "ftp-mcp",
|
|
3
|
+
"version": "1.3.1",
|
|
4
|
+
"description": "Enterprise-grade MCP server providing heavily optimized FTP/SFTP operations with smart sync, patch/chunk streaming, caching, and explicit read-only security mappings for AI code assistants.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"ftp-mcp": "./index.js",
|
|
9
|
+
"ftp-mcp-server": "./index.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"index.js",
|
|
13
|
+
"policy-engine.js",
|
|
14
|
+
"snapshot-manager.js",
|
|
15
|
+
"sync-manifest.js",
|
|
16
|
+
"README.md",
|
|
17
|
+
"LICENSE",
|
|
18
|
+
".ftpconfig.example"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"start": "node index.js",
|
|
22
|
+
"test": "vitest run"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"mcp",
|
|
26
|
+
"mcp-protocol",
|
|
27
|
+
"model-context-protocol",
|
|
28
|
+
"ftp",
|
|
29
|
+
"ftp-client",
|
|
30
|
+
"sftp",
|
|
31
|
+
"sftp-client",
|
|
32
|
+
"ssh",
|
|
33
|
+
"ssh2",
|
|
34
|
+
"scp",
|
|
35
|
+
"ssh-agent",
|
|
36
|
+
"rsync",
|
|
37
|
+
"file-transfer",
|
|
38
|
+
"file-manager",
|
|
39
|
+
"sync",
|
|
40
|
+
"diff",
|
|
41
|
+
"patch",
|
|
42
|
+
"git",
|
|
43
|
+
"gitignore",
|
|
44
|
+
"deploy",
|
|
45
|
+
"deployment",
|
|
46
|
+
"devops",
|
|
47
|
+
"continuous-deployment",
|
|
48
|
+
"automation",
|
|
49
|
+
"ai",
|
|
50
|
+
"ai-tools",
|
|
51
|
+
"llm",
|
|
52
|
+
"assistant",
|
|
53
|
+
"agentic",
|
|
54
|
+
"code-assistant",
|
|
55
|
+
"tool-call",
|
|
56
|
+
"json-rpc",
|
|
57
|
+
"server",
|
|
58
|
+
"tools",
|
|
59
|
+
"claude",
|
|
60
|
+
"claude-mcp",
|
|
61
|
+
"claude-ftp",
|
|
62
|
+
"cline",
|
|
63
|
+
"cline-mcp",
|
|
64
|
+
"cline-ftp",
|
|
65
|
+
"cursor",
|
|
66
|
+
"cursor-mcp",
|
|
67
|
+
"cursor-ftp",
|
|
68
|
+
"windsurf",
|
|
69
|
+
"windsurf-mcp",
|
|
70
|
+
"roo",
|
|
71
|
+
"roo-code",
|
|
72
|
+
"roo-mcp",
|
|
73
|
+
"copilot",
|
|
74
|
+
"github-copilot",
|
|
75
|
+
"amp",
|
|
76
|
+
"amp-mcp",
|
|
77
|
+
"openai",
|
|
78
|
+
"anthropic",
|
|
79
|
+
"gemini",
|
|
80
|
+
"gemini-mcp",
|
|
81
|
+
"mcp-server",
|
|
82
|
+
"mcp-tools",
|
|
83
|
+
"server-tool",
|
|
84
|
+
"remote",
|
|
85
|
+
"remote-fs",
|
|
86
|
+
"vfs"
|
|
87
|
+
],
|
|
88
|
+
"engines": {
|
|
89
|
+
"node": ">=18.0.0"
|
|
90
|
+
},
|
|
91
|
+
"author": {
|
|
92
|
+
"name": "Kynlo Akari",
|
|
93
|
+
"url": "https://github.com/Kynlos/"
|
|
94
|
+
},
|
|
95
|
+
"license": "MIT",
|
|
96
|
+
"repository": {
|
|
97
|
+
"type": "git",
|
|
98
|
+
"url": "https://github.com/Kynlos/ftp-mcp.git"
|
|
99
|
+
},
|
|
100
|
+
"homepage": "https://github.com/Kynlos/ftp-mcp#readme",
|
|
101
|
+
"bugs": {
|
|
102
|
+
"url": "https://github.com/Kynlos/ftp-mcp/issues"
|
|
103
|
+
},
|
|
104
|
+
"publishConfig": {
|
|
105
|
+
"access": "public"
|
|
106
|
+
},
|
|
107
|
+
"dependencies": {
|
|
108
|
+
"@clack/prompts": "^1.2.0",
|
|
109
|
+
"@modelcontextprotocol/sdk": "^1.0.4",
|
|
110
|
+
"basic-ftp": "^5.0.5",
|
|
111
|
+
"diff": "^8.0.4",
|
|
112
|
+
"dotenv": "^17.4.0",
|
|
113
|
+
"ignore": "^7.0.5",
|
|
114
|
+
"minimatch": "^10.0.3",
|
|
115
|
+
"ssh2-sftp-client": "^11.0.0",
|
|
116
|
+
"zod": "^4.3.6"
|
|
117
|
+
},
|
|
118
|
+
"devDependencies": {
|
|
119
|
+
"ftp-srv": "^4.6.3",
|
|
120
|
+
"vitest": "^4.1.2"
|
|
121
|
+
}
|
|
122
|
+
}
|
package/snapshot-manager.js
CHANGED
|
@@ -3,6 +3,8 @@ import path from 'path';
|
|
|
3
3
|
import crypto from 'crypto';
|
|
4
4
|
import { Writable } from 'stream';
|
|
5
5
|
|
|
6
|
+
const MAX_SNAPSHOTS = 50;
|
|
7
|
+
|
|
6
8
|
export class SnapshotManager {
|
|
7
9
|
constructor(baseDir = process.cwd()) {
|
|
8
10
|
this.snapshotDir = path.join(baseDir, '.ftp-mcp-snapshots');
|
|
@@ -16,6 +18,24 @@ export class SnapshotManager {
|
|
|
16
18
|
}
|
|
17
19
|
}
|
|
18
20
|
|
|
21
|
+
async pruneOldSnapshots(maxToKeep = MAX_SNAPSHOTS) {
|
|
22
|
+
try {
|
|
23
|
+
const dirs = await fs.readdir(this.snapshotDir, { withFileTypes: true });
|
|
24
|
+
const txDirs = dirs
|
|
25
|
+
.filter(d => d.isDirectory() && d.name.startsWith('tx_'))
|
|
26
|
+
.map(d => ({ name: d.name, ts: parseInt(d.name.split('_')[1]) || 0 }))
|
|
27
|
+
.sort((a, b) => b.ts - a.ts);
|
|
28
|
+
|
|
29
|
+
if (txDirs.length > maxToKeep) {
|
|
30
|
+
for (const dir of txDirs.slice(maxToKeep)) {
|
|
31
|
+
await fs.rm(path.join(this.snapshotDir, dir.name), { recursive: true, force: true });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
} catch (e) {
|
|
35
|
+
// Ignore pruning errors
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
19
39
|
generateTransactionId() {
|
|
20
40
|
return `tx_${Date.now()}_${crypto.randomBytes(4).toString('hex')}`;
|
|
21
41
|
}
|
|
@@ -57,7 +77,7 @@ export class SnapshotManager {
|
|
|
57
77
|
}
|
|
58
78
|
|
|
59
79
|
if (isFile) {
|
|
60
|
-
const localSnapshotPath = path.join(txDir, crypto.createHash('
|
|
80
|
+
const localSnapshotPath = path.join(txDir, crypto.createHash('sha256').update(remotePath).digest('hex'));
|
|
61
81
|
|
|
62
82
|
if (useSFTP) {
|
|
63
83
|
await client.get(remotePath, localSnapshotPath);
|
|
@@ -87,6 +107,9 @@ export class SnapshotManager {
|
|
|
87
107
|
'utf8'
|
|
88
108
|
);
|
|
89
109
|
|
|
110
|
+
// Auto-prune old snapshots to prevent unbounded disk growth
|
|
111
|
+
await this.pruneOldSnapshots();
|
|
112
|
+
|
|
90
113
|
return txId;
|
|
91
114
|
}
|
|
92
115
|
|
package/sync-manifest.js
CHANGED
|
@@ -28,7 +28,7 @@ export class SyncManifestManager {
|
|
|
28
28
|
async getFileHash(filePath) {
|
|
29
29
|
try {
|
|
30
30
|
const content = await fs.readFile(filePath);
|
|
31
|
-
return crypto.createHash('
|
|
31
|
+
return crypto.createHash('sha256').update(content).digest('hex');
|
|
32
32
|
} catch (e) {
|
|
33
33
|
return null;
|
|
34
34
|
}
|