imgx-mcp 1.4.0 → 1.4.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.4.1 (2026-03-04)
4
+
5
+ ### Fixed
6
+
7
+ - **MCP roots detection race condition** — `listRoots()` was called immediately after `server.connect()`, before the MCP initialization handshake completed. The request failed silently, causing `setProjectRoot()` to never execute and images to save to the fallback `~/Pictures/imgx/` instead of `<project-root>/.imgx/`. Now uses `oninitialized` callback to wait for handshake completion and checks `roots` capability before requesting.
8
+
3
9
  ## 1.4.0 (2026-03-04)
4
10
 
5
11
  ### Added
@@ -40281,7 +40281,7 @@ function runRedo() {
40281
40281
  }
40282
40282
 
40283
40283
  // build/cli/index.js
40284
- var VERSION2 = "1.4.0";
40284
+ var VERSION2 = "1.4.1";
40285
40285
  var HELP = `imgx v${VERSION2} \u2014 AI image generation and editing for MCP-compatible AI agents
40286
40286
 
40287
40287
  Commands:
@@ -69977,7 +69977,7 @@ function buildImageContent(images, paths, extra) {
69977
69977
  }
69978
69978
  var server = new McpServer({
69979
69979
  name: "imgx",
69980
- version: "1.4.0"
69980
+ version: "1.4.1"
69981
69981
  });
69982
69982
  initGemini();
69983
69983
  initOpenAI();
@@ -70287,17 +70287,22 @@ function fileUriToPath(uri) {
70287
70287
  }
70288
70288
  async function main() {
70289
70289
  const transport = new StdioServerTransport();
70290
- await server.connect(transport);
70291
- try {
70292
- const result = await server.server.listRoots();
70293
- if (result.roots.length > 0) {
70294
- const rootUri = result.roots[0].uri;
70295
- if (rootUri.startsWith("file://")) {
70296
- setProjectRoot(fileUriToPath(rootUri));
70290
+ server.server.oninitialized = async () => {
70291
+ try {
70292
+ const caps = server.server.getClientCapabilities();
70293
+ if (!caps?.roots)
70294
+ return;
70295
+ const result = await server.server.listRoots();
70296
+ if (result.roots.length > 0) {
70297
+ const rootUri = result.roots[0].uri;
70298
+ if (rootUri.startsWith("file://")) {
70299
+ setProjectRoot(fileUriToPath(rootUri));
70300
+ }
70297
70301
  }
70302
+ } catch {
70298
70303
  }
70299
- } catch {
70300
- }
70304
+ };
70305
+ await server.connect(transport);
70301
70306
  }
70302
70307
  main().catch((err) => {
70303
70308
  console.error("MCP server error:", err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imgx-mcp",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "mcpName": "io.github.somacoffeekyoto/imgx",
5
5
  "description": "AI image generation and editing for Claude Code, Codex CLI, and MCP-compatible AI agents",
6
6
  "type": "module",