imgx-mcp 1.0.1 → 1.0.3
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/CHANGELOG.md +13 -1
- package/dist/cli.bundle.js +8 -5
- package/dist/mcp.bundle.js +25 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 1.0.
|
|
3
|
+
## 1.0.3 (2026-03-03)
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- **`clear_history` directory removal** — `rmSync()` does not remove directories; replaced with `rmdirSync()` in both MCP server and CLI to correctly remove empty session directories after file deletion
|
|
8
|
+
|
|
9
|
+
## 1.0.2 (2026-03-03)
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- **v1.0.1 published with stale bundles** — `npm run bundle` (esbuild) was not run before `npm publish`, so v1.0.1 contained old `dist/mcp.bundle.js`. v1.0.2 is the correct release with session outputDir inheritance fix
|
|
14
|
+
|
|
15
|
+
## 1.0.1 (2026-03-03) [YANKED — published with stale bundles]
|
|
4
16
|
|
|
5
17
|
### Fixed
|
|
6
18
|
|
package/dist/cli.bundle.js
CHANGED
|
@@ -39600,6 +39600,8 @@ function pushHistory(entry, opts) {
|
|
|
39600
39600
|
const session2 = createSession();
|
|
39601
39601
|
if (opts.sessionId)
|
|
39602
39602
|
session2.id = opts.sessionId;
|
|
39603
|
+
if (opts.outputDir)
|
|
39604
|
+
session2.outputDir = opts.outputDir;
|
|
39603
39605
|
session2.entries.push(entry);
|
|
39604
39606
|
history.sessions.push(session2);
|
|
39605
39607
|
history.activeSessionId = session2.id;
|
|
@@ -39762,7 +39764,7 @@ async function runGenerate(provider, args) {
|
|
|
39762
39764
|
operation: "generate",
|
|
39763
39765
|
inputImage: null,
|
|
39764
39766
|
timestamp: Date.now()
|
|
39765
|
-
}, { newSession: true, sessionId });
|
|
39767
|
+
}, { newSession: true, sessionId, outputDir: args.outputDir });
|
|
39766
39768
|
success({ filePaths: paths });
|
|
39767
39769
|
}
|
|
39768
39770
|
|
|
@@ -39802,7 +39804,8 @@ async function runEdit(provider, args) {
|
|
|
39802
39804
|
timestamp: Date.now()
|
|
39803
39805
|
}, {
|
|
39804
39806
|
newSession: args.isNewSession,
|
|
39805
|
-
sessionId: args.isNewSession ? sessionId : void 0
|
|
39807
|
+
sessionId: args.isNewSession ? sessionId : void 0,
|
|
39808
|
+
outputDir: args.isNewSession ? args.outputDir : void 0
|
|
39806
39809
|
});
|
|
39807
39810
|
success({ filePaths: paths });
|
|
39808
39811
|
}
|
|
@@ -40013,7 +40016,7 @@ function showAll() {
|
|
|
40013
40016
|
|
|
40014
40017
|
// build/cli/commands/history.js
|
|
40015
40018
|
import { createInterface as createInterface2 } from "node:readline";
|
|
40016
|
-
import { rmSync as rmSync2, existsSync as existsSync3 } from "node:fs";
|
|
40019
|
+
import { rmSync as rmSync2, rmdirSync, existsSync as existsSync3 } from "node:fs";
|
|
40017
40020
|
import { dirname as dirname2 } from "node:path";
|
|
40018
40021
|
function runHistory(args) {
|
|
40019
40022
|
const sub = args[0];
|
|
@@ -40099,7 +40102,7 @@ function deleteSessionFiles(filePaths) {
|
|
|
40099
40102
|
}
|
|
40100
40103
|
for (const dir of dirs) {
|
|
40101
40104
|
try {
|
|
40102
|
-
|
|
40105
|
+
rmdirSync(dir);
|
|
40103
40106
|
} catch {
|
|
40104
40107
|
}
|
|
40105
40108
|
}
|
|
@@ -40135,7 +40138,7 @@ function runRedo() {
|
|
|
40135
40138
|
}
|
|
40136
40139
|
|
|
40137
40140
|
// build/cli/index.js
|
|
40138
|
-
var VERSION2 = "1.0.
|
|
40141
|
+
var VERSION2 = "1.0.3";
|
|
40139
40142
|
var HELP = `imgx v${VERSION2} \u2014 AI image generation and editing for MCP-compatible AI agents
|
|
40140
40143
|
|
|
40141
40144
|
Commands:
|
package/dist/mcp.bundle.js
CHANGED
|
@@ -28887,6 +28887,7 @@ __export(history_exports, {
|
|
|
28887
28887
|
clearHistory: () => clearHistory,
|
|
28888
28888
|
createSession: () => createSession,
|
|
28889
28889
|
getActiveEntry: () => getActiveEntry,
|
|
28890
|
+
getActiveSessionOutputDir: () => getActiveSessionOutputDir,
|
|
28890
28891
|
getHistory: () => getHistory,
|
|
28891
28892
|
loadHistory: () => loadHistory,
|
|
28892
28893
|
pushHistory: () => pushHistory,
|
|
@@ -28944,6 +28945,8 @@ function pushHistory(entry, opts) {
|
|
|
28944
28945
|
const session2 = createSession();
|
|
28945
28946
|
if (opts.sessionId)
|
|
28946
28947
|
session2.id = opts.sessionId;
|
|
28948
|
+
if (opts.outputDir)
|
|
28949
|
+
session2.outputDir = opts.outputDir;
|
|
28947
28950
|
session2.entries.push(entry);
|
|
28948
28951
|
history.sessions.push(session2);
|
|
28949
28952
|
history.activeSessionId = session2.id;
|
|
@@ -28973,6 +28976,13 @@ function getActiveEntry() {
|
|
|
28973
28976
|
return void 0;
|
|
28974
28977
|
return session.entries[session.cursor];
|
|
28975
28978
|
}
|
|
28979
|
+
function getActiveSessionOutputDir() {
|
|
28980
|
+
const history = loadHistory();
|
|
28981
|
+
if (!history.activeSessionId)
|
|
28982
|
+
return void 0;
|
|
28983
|
+
const session = history.sessions.find((s2) => s2.id === history.activeSessionId);
|
|
28984
|
+
return session?.outputDir;
|
|
28985
|
+
}
|
|
28976
28986
|
function getActiveSession() {
|
|
28977
28987
|
const history = loadHistory();
|
|
28978
28988
|
if (!history.activeSessionId) {
|
|
@@ -69810,7 +69820,7 @@ function buildImageContent(images, paths, extra) {
|
|
|
69810
69820
|
}
|
|
69811
69821
|
var server = new McpServer({
|
|
69812
69822
|
name: "imgx",
|
|
69813
|
-
version: "1.0.
|
|
69823
|
+
version: "1.0.3"
|
|
69814
69824
|
});
|
|
69815
69825
|
initGemini();
|
|
69816
69826
|
initOpenAI();
|
|
@@ -69862,7 +69872,7 @@ server.tool("generate_image", "Generate an image from a text prompt", {
|
|
|
69862
69872
|
operation: "generate",
|
|
69863
69873
|
inputImage: null,
|
|
69864
69874
|
timestamp: Date.now()
|
|
69865
|
-
}, { newSession: true, sessionId });
|
|
69875
|
+
}, { newSession: true, sessionId, outputDir: args.output_dir });
|
|
69866
69876
|
return { content: buildImageContent(result.images, paths) };
|
|
69867
69877
|
} catch (err) {
|
|
69868
69878
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -69908,7 +69918,7 @@ server.tool("edit_image", "Edit an existing image with text instructions", {
|
|
|
69908
69918
|
operation: "edit",
|
|
69909
69919
|
inputImage: args.input,
|
|
69910
69920
|
timestamp: Date.now()
|
|
69911
|
-
}, { newSession: true, sessionId });
|
|
69921
|
+
}, { newSession: true, sessionId, outputDir: args.output_dir });
|
|
69912
69922
|
return { content: buildImageContent(result.images, [saved]) };
|
|
69913
69923
|
} catch (err) {
|
|
69914
69924
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -69950,7 +69960,8 @@ server.tool("edit_last", "Edit the last generated/edited image with new text ins
|
|
|
69950
69960
|
return { content: [{ type: "text", text: `Error: ${result.error || "Edit failed"}` }] };
|
|
69951
69961
|
}
|
|
69952
69962
|
const sessionId = loadHistory().activeSessionId;
|
|
69953
|
-
const
|
|
69963
|
+
const sessionOutputDir = args.output_dir || getActiveSessionOutputDir();
|
|
69964
|
+
const saved = saveImage(result.images[0], args.output, sessionOutputDir, sessionId || void 0);
|
|
69954
69965
|
pushHistory({
|
|
69955
69966
|
filePaths: [saved],
|
|
69956
69967
|
prompt: args.prompt,
|
|
@@ -70028,16 +70039,25 @@ server.tool("clear_history", "Clear all edit history. Optionally delete image fi
|
|
|
70028
70039
|
const result = clearHistory();
|
|
70029
70040
|
let filesDeleted = 0;
|
|
70030
70041
|
if (args.delete_files) {
|
|
70031
|
-
const { existsSync, rmSync } = await import("node:fs");
|
|
70042
|
+
const { existsSync, rmSync, rmdirSync } = await import("node:fs");
|
|
70043
|
+
const { dirname: dirname2 } = await import("node:path");
|
|
70044
|
+
const dirs = /* @__PURE__ */ new Set();
|
|
70032
70045
|
for (const fp of result.filePaths) {
|
|
70033
70046
|
try {
|
|
70034
70047
|
if (existsSync(fp)) {
|
|
70035
70048
|
rmSync(fp);
|
|
70036
70049
|
filesDeleted++;
|
|
70050
|
+
dirs.add(dirname2(fp));
|
|
70037
70051
|
}
|
|
70038
70052
|
} catch {
|
|
70039
70053
|
}
|
|
70040
70054
|
}
|
|
70055
|
+
for (const dir of dirs) {
|
|
70056
|
+
try {
|
|
70057
|
+
rmdirSync(dir);
|
|
70058
|
+
} catch {
|
|
70059
|
+
}
|
|
70060
|
+
}
|
|
70041
70061
|
}
|
|
70042
70062
|
return { content: [{ type: "text", text: JSON.stringify({ success: true, cleared: true, filesDeleted }) }] };
|
|
70043
70063
|
} catch (err) {
|
package/package.json
CHANGED