aimetadatacleaner-mcp 0.1.0 → 0.1.2
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/index.js +17 -9
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* Needs AMC_API_KEY (a Business key from https://aimetadatacleaner.com/api-keys).
|
|
10
10
|
*/
|
|
11
11
|
import { createReadStream, createWriteStream } from 'node:fs';
|
|
12
|
-
import { stat, readdir, rename, unlink } from 'node:fs/promises';
|
|
12
|
+
import { mkdir, stat, readdir, rename, unlink } from 'node:fs/promises';
|
|
13
13
|
import { homedir } from 'node:os';
|
|
14
14
|
import path from 'node:path';
|
|
15
15
|
import { Readable } from 'node:stream';
|
|
@@ -18,7 +18,7 @@ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
|
18
18
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
19
19
|
import { z } from 'zod';
|
|
20
20
|
|
|
21
|
-
const VERSION = '0.1.
|
|
21
|
+
const VERSION = '0.1.2';
|
|
22
22
|
const API = (process.env.AMC_API_URL || 'https://api.aimetadatacleaner.com').replace(/\/+$/, '');
|
|
23
23
|
const KEY = (process.env.AMC_API_KEY || '').trim();
|
|
24
24
|
const KEYS_URL = 'https://aimetadatacleaner.com/api-keys';
|
|
@@ -155,7 +155,11 @@ async function collect(paths) {
|
|
|
155
155
|
if (!entry.isFile() || entry.name.startsWith('.')) continue;
|
|
156
156
|
const ext = path.extname(entry.name).toLowerCase();
|
|
157
157
|
// Earlier clean copies sit in the same folder; cleaning them again would just use up jobs.
|
|
158
|
-
if (
|
|
158
|
+
if (/-clean( \(\d+\))?$/.test(path.basename(entry.name, ext))) continue;
|
|
159
|
+
if (!SUPPORTED.has(ext)) {
|
|
160
|
+
skipped.push({ path: path.join(p, entry.name), reason: 'this file type is not supported' });
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
159
163
|
files.push(path.join(p, entry.name));
|
|
160
164
|
}
|
|
161
165
|
} else if (s.isFile()) {
|
|
@@ -219,9 +223,10 @@ server.registerTool(
|
|
|
219
223
|
let outputDir;
|
|
220
224
|
if (output_dir) {
|
|
221
225
|
outputDir = path.resolve(expandHome(output_dir));
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
226
|
+
try {
|
|
227
|
+
await mkdir(outputDir, { recursive: true });
|
|
228
|
+
} catch {
|
|
229
|
+
return { isError: true, content: [{ type: 'text', text: `Couldn't create the output folder: ${outputDir}` }] };
|
|
225
230
|
}
|
|
226
231
|
}
|
|
227
232
|
|
|
@@ -278,19 +283,22 @@ server.registerTool(
|
|
|
278
283
|
}
|
|
279
284
|
|
|
280
285
|
const cleaned = results.filter((r) => r.saved_to).length;
|
|
286
|
+
const confirmed = results.filter((r) => r.status === 'clean').length;
|
|
287
|
+
const unconfirmed = cleaned - confirmed;
|
|
281
288
|
const last = [...results].reverse().find((r) => r.usage)?.usage;
|
|
282
289
|
const summary = [
|
|
283
|
-
`Cleaned ${
|
|
290
|
+
`Cleaned ${confirmed} of ${files.length} file${files.length === 1 ? '' : 's'}.` +
|
|
291
|
+
(unconfirmed ? ` ${unconfirmed} more ${unconfirmed === 1 ? 'was' : 'were'} saved but not everything could be confirmed removed (see below).` : ''),
|
|
284
292
|
...(last ? [`Jobs used this month: ${last.jobs_used.toLocaleString('en-US')} of ${last.job_limit.toLocaleString('en-US')}.`] : []),
|
|
285
293
|
'',
|
|
286
294
|
...results.map(describe),
|
|
287
|
-
...skipped.map((s) => `${s.path}: skipped (${s.reason})`)
|
|
295
|
+
...skipped.map((s) => `${path.basename(s.path)}: skipped (${s.reason})`)
|
|
288
296
|
].join('\n');
|
|
289
297
|
|
|
290
298
|
return {
|
|
291
299
|
isError: cleaned === 0,
|
|
292
300
|
content: [{ type: 'text', text: summary }],
|
|
293
|
-
structuredContent: { cleaned, total: files.length, results, skipped }
|
|
301
|
+
structuredContent: { clean: confirmed, saved: cleaned, total: files.length, results, skipped }
|
|
294
302
|
};
|
|
295
303
|
}
|
|
296
304
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aimetadatacleaner-mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Remove metadata (GPS, device, dates, AI labels) from video, PDF, RAW and photos from Claude, Cursor and other AI assistants. Uses the AI Metadata Cleaner API.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|