imgx-mcp 1.4.0 → 1.5.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 +31 -0
- package/README.md +508 -481
- package/dist/cli.bundle.js +16 -4
- package/dist/image-generation-skill.zip +0 -0
- package/dist/mcp.bundle.js +20 -10
- package/package.json +1 -1
- package/skills/image-generation/SKILL.md +8 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.5.1 (2026-03-05)
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- **Re-release of v1.5.0** — v1.5.0 was unpublished during documentation review; npm does not allow re-publishing the same version. No code changes from v1.5.0.
|
|
8
|
+
- **Documentation** — Added `.imgx/` directory location explanation, `output_dir`/history relationship, and updated SKILL.md tips
|
|
9
|
+
|
|
10
|
+
## 1.5.0 (2026-03-05) [YANKED — npm does not allow re-publish]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **User config `projectRoot` fallback** — `findProjectRoot()` now checks `projectRoot` in user config as a final fallback when env var, MCP roots, and `.imgxrc` detection all fail
|
|
15
|
+
- **CLI `project-root` config key** — `imgx config set project-root /path/to/project` and `imgx config get project-root`
|
|
16
|
+
- 3 new tests for `projectRoot` fallback (total: 84 tests)
|
|
17
|
+
|
|
18
|
+
### Project root configuration (3 tiers)
|
|
19
|
+
|
|
20
|
+
| Method | Scope | How to set |
|
|
21
|
+
|--------|-------|------------|
|
|
22
|
+
| `IMGX_PROJECT_ROOT` env var in client config | Per-client (highest priority) | Add to `env` in `claude_desktop_config.json`, `.mcp.json`, etc. |
|
|
23
|
+
| Auto-detection (MCP roots / `.imgxrc` search) | Automatic | Works on CLI agents (Claude Code, Gemini CLI). Not available on Claude Desktop |
|
|
24
|
+
| `imgx config set project-root` | All clients on the machine | Stored in `~/.config/imgx/config.json` or `%APPDATA%\imgx\config.json` |
|
|
25
|
+
|
|
26
|
+
Detection priority: env var → MCP roots → `.imgxrc` upward search → user config `projectRoot`
|
|
27
|
+
|
|
28
|
+
## 1.4.1 (2026-03-04)
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
|
|
32
|
+
- **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.
|
|
33
|
+
|
|
3
34
|
## 1.4.0 (2026-03-04)
|
|
4
35
|
|
|
5
36
|
### Added
|
package/README.md
CHANGED
|
@@ -1,481 +1,508 @@
|
|
|
1
|
-
# imgx-mcp
|
|
2
|
-
|
|
3
|
-
AI image generation and editing MCP server. Works with Claude Code, Gemini CLI, Cursor, Windsurf, and any MCP-compatible tool.
|
|
4
|
-
|
|
5
|
-
Generate images from text, edit existing images with text instructions, iterate on results — all from your AI coding environment.
|
|
6
|
-
|
|
7
|
-
## Quick start
|
|
8
|
-
|
|
9
|
-
Add to your tool's MCP config (`.mcp.json`, `settings.json`, etc.):
|
|
10
|
-
|
|
11
|
-
```json
|
|
12
|
-
{
|
|
13
|
-
"mcpServers": {
|
|
14
|
-
"imgx": {
|
|
15
|
-
"command": "npx",
|
|
16
|
-
"args": ["--package=imgx-mcp", "-y", "imgx-mcp"],
|
|
17
|
-
"env": { "GEMINI_API_KEY": "your-key" }
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
That's it. Your AI agent can now generate and edit images.
|
|
24
|
-
|
|
25
|
-
> **Windows**: Replace `"command": "npx"` with `"command": "cmd"` and prepend `"/c"` to the args array.
|
|
26
|
-
|
|
27
|
-
## Skill (Claude Code)
|
|
28
|
-
|
|
29
|
-
For Claude Code users, imgx-mcp includes an `image-generation` skill — a guided prompt that teaches Claude how to use the MCP tools effectively. With the skill installed, type `/image-generation` to start a guided workflow.
|
|
30
|
-
|
|
31
|
-
### Install the skill
|
|
32
|
-
|
|
33
|
-
Copy the skill directory from the npm package or GitHub repository to your project:
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
# From npm (after npx has cached the package)
|
|
37
|
-
cp -r $(npm root -g)/imgx-mcp/skills .claude/skills
|
|
38
|
-
|
|
39
|
-
# Or from the GitHub repository
|
|
40
|
-
curl -sL https://raw.githubusercontent.com/somacoffeekyoto/imgx-mcp/main/skills/image-generation/SKILL.md \
|
|
41
|
-
-o .claude/skills/image-generation/SKILL.md --create-dirs
|
|
42
|
-
curl -sL https://raw.githubusercontent.com/somacoffeekyoto/imgx-mcp/main/skills/image-generation/references/providers.md \
|
|
43
|
-
-o .claude/skills/image-generation/references/providers.md --create-dirs
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
Or place skill files manually:
|
|
47
|
-
|
|
48
|
-
```
|
|
49
|
-
your-project/
|
|
50
|
-
.mcp.json ← MCP server config (Quick start above)
|
|
51
|
-
.claude/
|
|
52
|
-
skills/
|
|
53
|
-
image-generation/
|
|
54
|
-
SKILL.md ← skill prompt
|
|
55
|
-
references/
|
|
56
|
-
providers.md ← provider reference
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
The skill files are included in the [npm package](https://www.npmjs.com/package/imgx-mcp) under `skills/` and in the [GitHub repository](https://github.com/somacoffeekyoto/imgx-mcp/tree/main/skills/image-generation).
|
|
60
|
-
|
|
61
|
-
> **Personal skill** (all projects): Place in `~/.claude/skills/image-generation/` instead of `.claude/skills/`.
|
|
62
|
-
|
|
63
|
-
### Claude Desktop
|
|
64
|
-
|
|
65
|
-
Claude Desktop supports skills via ZIP upload:
|
|
66
|
-
|
|
67
|
-
1. Download [`image-generation-skill.zip`](dist/image-generation-skill.zip) from the repository (or find it in the [npm package](https://www.npmjs.com/package/imgx-mcp) under `dist/`)
|
|
68
|
-
2. In Claude Desktop: **Settings > Profile > Customize > Skills > Add Skill**
|
|
69
|
-
3. Upload the ZIP
|
|
70
|
-
|
|
71
|
-
> Update the skill by re-downloading and re-uploading the ZIP after new releases.
|
|
72
|
-
|
|
73
|
-
### What the skill does
|
|
74
|
-
|
|
75
|
-
The skill guides Claude Code through image workflows: blog covers, iterative editing, provider comparison, icon generation. It knows the MCP tool parameters and best practices, so you get better results with less effort.
|
|
76
|
-
|
|
77
|
-
### MCP server vs Skill
|
|
78
|
-
|
|
79
|
-
| | MCP server | Skill |
|
|
80
|
-
|---|---|---|
|
|
81
|
-
| What it does | Exposes image tools to AI agents | Guided prompt for using the tools |
|
|
82
|
-
| Works with | Any MCP-compatible tool | Claude Code, Claude Desktop |
|
|
83
|
-
| Install | Add to `.mcp.json` | Copy skill files to project |
|
|
84
|
-
| Team sharing | Commit `.mcp.json` to repo | Commit `.claude/skills/` to repo |
|
|
85
|
-
|
|
86
|
-
**Recommended**: Set up the MCP server (Quick start) + install the skill if you use Claude Code.
|
|
87
|
-
|
|
88
|
-
## MCP tools
|
|
89
|
-
|
|
90
|
-
| Tool | Description |
|
|
91
|
-
|------|-------------|
|
|
92
|
-
| `generate_image` | Generate an image from a text prompt |
|
|
93
|
-
| `edit_image` | Edit an existing image with text instructions |
|
|
94
|
-
| `edit_last` | Edit the last generated/edited image (no input path needed) |
|
|
95
|
-
| `undo_edit` | Undo the last edit, reverting to the previous image in the session |
|
|
96
|
-
| `redo_edit` | Redo a previously undone edit |
|
|
97
|
-
| `edit_history` | Show all sessions and their edit history with metadata |
|
|
98
|
-
| `switch_session` | Switch to a different editing session |
|
|
99
|
-
| `clear_history` | Clear project history (optionally delete image files) |
|
|
100
|
-
| `set_output_dir` | Change the default output directory (optionally move existing files) |
|
|
101
|
-
| `list_providers` | List available providers and capabilities |
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
edit_last
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
```
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
###
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
imgx
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
imgx
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
imgx
|
|
332
|
-
|
|
333
|
-
#
|
|
334
|
-
imgx
|
|
335
|
-
imgx
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
5
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
##
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
```
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
1
|
+
# imgx-mcp
|
|
2
|
+
|
|
3
|
+
AI image generation and editing MCP server. Works with Claude Code, Gemini CLI, Cursor, Windsurf, and any MCP-compatible tool.
|
|
4
|
+
|
|
5
|
+
Generate images from text, edit existing images with text instructions, iterate on results — all from your AI coding environment.
|
|
6
|
+
|
|
7
|
+
## Quick start
|
|
8
|
+
|
|
9
|
+
Add to your tool's MCP config (`.mcp.json`, `settings.json`, etc.):
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"mcpServers": {
|
|
14
|
+
"imgx": {
|
|
15
|
+
"command": "npx",
|
|
16
|
+
"args": ["--package=imgx-mcp", "-y", "imgx-mcp"],
|
|
17
|
+
"env": { "GEMINI_API_KEY": "your-key" }
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
That's it. Your AI agent can now generate and edit images.
|
|
24
|
+
|
|
25
|
+
> **Windows**: Replace `"command": "npx"` with `"command": "cmd"` and prepend `"/c"` to the args array.
|
|
26
|
+
|
|
27
|
+
## Skill (Claude Code)
|
|
28
|
+
|
|
29
|
+
For Claude Code users, imgx-mcp includes an `image-generation` skill — a guided prompt that teaches Claude how to use the MCP tools effectively. With the skill installed, type `/image-generation` to start a guided workflow.
|
|
30
|
+
|
|
31
|
+
### Install the skill
|
|
32
|
+
|
|
33
|
+
Copy the skill directory from the npm package or GitHub repository to your project:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# From npm (after npx has cached the package)
|
|
37
|
+
cp -r $(npm root -g)/imgx-mcp/skills .claude/skills
|
|
38
|
+
|
|
39
|
+
# Or from the GitHub repository
|
|
40
|
+
curl -sL https://raw.githubusercontent.com/somacoffeekyoto/imgx-mcp/main/skills/image-generation/SKILL.md \
|
|
41
|
+
-o .claude/skills/image-generation/SKILL.md --create-dirs
|
|
42
|
+
curl -sL https://raw.githubusercontent.com/somacoffeekyoto/imgx-mcp/main/skills/image-generation/references/providers.md \
|
|
43
|
+
-o .claude/skills/image-generation/references/providers.md --create-dirs
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Or place skill files manually:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
your-project/
|
|
50
|
+
.mcp.json ← MCP server config (Quick start above)
|
|
51
|
+
.claude/
|
|
52
|
+
skills/
|
|
53
|
+
image-generation/
|
|
54
|
+
SKILL.md ← skill prompt
|
|
55
|
+
references/
|
|
56
|
+
providers.md ← provider reference
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
The skill files are included in the [npm package](https://www.npmjs.com/package/imgx-mcp) under `skills/` and in the [GitHub repository](https://github.com/somacoffeekyoto/imgx-mcp/tree/main/skills/image-generation).
|
|
60
|
+
|
|
61
|
+
> **Personal skill** (all projects): Place in `~/.claude/skills/image-generation/` instead of `.claude/skills/`.
|
|
62
|
+
|
|
63
|
+
### Claude Desktop
|
|
64
|
+
|
|
65
|
+
Claude Desktop supports skills via ZIP upload:
|
|
66
|
+
|
|
67
|
+
1. Download [`image-generation-skill.zip`](dist/image-generation-skill.zip) from the repository (or find it in the [npm package](https://www.npmjs.com/package/imgx-mcp) under `dist/`)
|
|
68
|
+
2. In Claude Desktop: **Settings > Profile > Customize > Skills > Add Skill**
|
|
69
|
+
3. Upload the ZIP
|
|
70
|
+
|
|
71
|
+
> Update the skill by re-downloading and re-uploading the ZIP after new releases.
|
|
72
|
+
|
|
73
|
+
### What the skill does
|
|
74
|
+
|
|
75
|
+
The skill guides Claude Code through image workflows: blog covers, iterative editing, provider comparison, icon generation. It knows the MCP tool parameters and best practices, so you get better results with less effort.
|
|
76
|
+
|
|
77
|
+
### MCP server vs Skill
|
|
78
|
+
|
|
79
|
+
| | MCP server | Skill |
|
|
80
|
+
|---|---|---|
|
|
81
|
+
| What it does | Exposes image tools to AI agents | Guided prompt for using the tools |
|
|
82
|
+
| Works with | Any MCP-compatible tool | Claude Code, Claude Desktop |
|
|
83
|
+
| Install | Add to `.mcp.json` | Copy skill files to project |
|
|
84
|
+
| Team sharing | Commit `.mcp.json` to repo | Commit `.claude/skills/` to repo |
|
|
85
|
+
|
|
86
|
+
**Recommended**: Set up the MCP server (Quick start) + install the skill if you use Claude Code.
|
|
87
|
+
|
|
88
|
+
## MCP tools
|
|
89
|
+
|
|
90
|
+
| Tool | Description |
|
|
91
|
+
|------|-------------|
|
|
92
|
+
| `generate_image` | Generate an image from a text prompt |
|
|
93
|
+
| `edit_image` | Edit an existing image with text instructions |
|
|
94
|
+
| `edit_last` | Edit the last generated/edited image (no input path needed) |
|
|
95
|
+
| `undo_edit` | Undo the last edit, reverting to the previous image in the session |
|
|
96
|
+
| `redo_edit` | Redo a previously undone edit |
|
|
97
|
+
| `edit_history` | Show all sessions and their edit history with metadata |
|
|
98
|
+
| `switch_session` | Switch to a different editing session |
|
|
99
|
+
| `clear_history` | Clear project history (optionally delete image files) |
|
|
100
|
+
| `set_output_dir` | Change the default output directory (optionally move existing files) |
|
|
101
|
+
| `list_providers` | List available providers and capabilities |
|
|
102
|
+
|
|
103
|
+
The `.imgx/` directory holds both edit history and default image output. Its location depends on project root detection:
|
|
104
|
+
|
|
105
|
+
| Project root | `.imgx/` location | History |
|
|
106
|
+
|---|---|---|
|
|
107
|
+
| Detected | `<project-root>/.imgx/` | `<project-root>/.imgx/output-history.json` |
|
|
108
|
+
| Not detected | `~/Pictures/imgx/` (images only) | `~/.config/imgx/output-history.json` (global) |
|
|
109
|
+
|
|
110
|
+
All clients that resolve to the same project root share the same history. Each session gets its own subdirectory. File paths are returned in the response. Inline image preview is included in MCP responses (base64).
|
|
111
|
+
|
|
112
|
+
### Iterative editing
|
|
113
|
+
|
|
114
|
+
The `edit_last` tool uses the output of the previous `generate_image` or `edit_image` call as input. This enables a conversational workflow:
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
"Generate a coffee shop interior" → generate_image
|
|
118
|
+
"Make the lighting warmer" → edit_last
|
|
119
|
+
"Add a person reading a book" → edit_last
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
No need to specify file paths between steps.
|
|
123
|
+
|
|
124
|
+
### Session management
|
|
125
|
+
|
|
126
|
+
Each `generate_image` call starts a new session. Subsequent `edit_last` calls are added to the same session, forming an edit chain. Each session has its own output directory.
|
|
127
|
+
|
|
128
|
+
**Undo / Redo** — Step backward and forward through the edit chain:
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
generate → edit_last → edit_last → edit_last
|
|
132
|
+
↑ current
|
|
133
|
+
← undo_edit
|
|
134
|
+
↑ current
|
|
135
|
+
redo_edit →
|
|
136
|
+
↑ current
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
After undo, calling `edit_last` branches from the current position (abandoned entries and their files are deleted from disk).
|
|
140
|
+
|
|
141
|
+
**File naming** — `edit_last` generates sequential filenames based on the origin file:
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
generate_image → cover.png
|
|
145
|
+
edit_last → cover-1.png
|
|
146
|
+
edit_last → cover-2.png
|
|
147
|
+
|
|
148
|
+
generate_image (no output) → imgx-a1b2c3d4.png
|
|
149
|
+
edit_last → imgx-a1b2c3d4-1.png
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**Session switching** — Use `edit_history` to see all sessions, then `switch_session` to resume a previous session. The `edit_last` tool will use the current position in the switched session.
|
|
153
|
+
|
|
154
|
+
**Output directory** — `edit_last` inherits the output directory from the session. If `generate_image` was called with `output_dir`, all subsequent `edit_last` calls in that session output to the same directory. The `output_dir` path is recorded as session metadata in `output-history.json`. This only affects where image files are saved — history always stays in `.imgx/` (or the global config directory).
|
|
155
|
+
|
|
156
|
+
## API key setup
|
|
157
|
+
|
|
158
|
+
Set up at least one provider:
|
|
159
|
+
|
|
160
|
+
**Gemini** — get a key from [Google AI Studio](https://aistudio.google.com/apikey) (free tier available):
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
imgx config set api-key YOUR_GEMINI_API_KEY --provider gemini
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**OpenAI** — get a key from [OpenAI Platform](https://platform.openai.com/api-keys):
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
imgx config set api-key YOUR_OPENAI_API_KEY --provider openai
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Keys are stored in `~/.config/imgx/config.json` (Linux/macOS) or `%APPDATA%\imgx\config.json` (Windows). Alternatively, pass keys via the `env` section in your MCP config, or set environment variables:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
export GEMINI_API_KEY="your-api-key"
|
|
176
|
+
export OPENAI_API_KEY="your-api-key"
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Only include the API keys for providers you want to use. At least one is required.
|
|
180
|
+
|
|
181
|
+
## MCP configuration by tool
|
|
182
|
+
|
|
183
|
+
### Claude Code
|
|
184
|
+
|
|
185
|
+
`.mcp.json` in your project root:
|
|
186
|
+
|
|
187
|
+
```json
|
|
188
|
+
{
|
|
189
|
+
"mcpServers": {
|
|
190
|
+
"imgx": {
|
|
191
|
+
"command": "npx",
|
|
192
|
+
"args": ["--package=imgx-mcp", "-y", "imgx-mcp"],
|
|
193
|
+
"env": { "GEMINI_API_KEY": "your-key", "OPENAI_API_KEY": "your-key" }
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Gemini CLI
|
|
200
|
+
|
|
201
|
+
`~/.gemini/settings.json`:
|
|
202
|
+
|
|
203
|
+
```json
|
|
204
|
+
{
|
|
205
|
+
"mcpServers": {
|
|
206
|
+
"imgx": {
|
|
207
|
+
"command": "npx",
|
|
208
|
+
"args": ["--package=imgx-mcp", "-y", "imgx-mcp"],
|
|
209
|
+
"env": { "GEMINI_API_KEY": "your-key", "OPENAI_API_KEY": "your-key" }
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Claude Desktop
|
|
216
|
+
|
|
217
|
+
`claude_desktop_config.json`:
|
|
218
|
+
|
|
219
|
+
macOS / Linux:
|
|
220
|
+
|
|
221
|
+
```json
|
|
222
|
+
{
|
|
223
|
+
"mcpServers": {
|
|
224
|
+
"imgx": {
|
|
225
|
+
"command": "npx",
|
|
226
|
+
"args": ["--package=imgx-mcp", "-y", "imgx-mcp"],
|
|
227
|
+
"env": {
|
|
228
|
+
"GEMINI_API_KEY": "your-key",
|
|
229
|
+
"OPENAI_API_KEY": "your-key",
|
|
230
|
+
"IMGX_PROJECT_ROOT": ""
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Windows:
|
|
238
|
+
|
|
239
|
+
```json
|
|
240
|
+
{
|
|
241
|
+
"mcpServers": {
|
|
242
|
+
"imgx": {
|
|
243
|
+
"command": "cmd",
|
|
244
|
+
"args": ["/c", "npx", "--package=imgx-mcp", "-y", "imgx-mcp"],
|
|
245
|
+
"env": {
|
|
246
|
+
"GEMINI_API_KEY": "your-key",
|
|
247
|
+
"OPENAI_API_KEY": "your-key",
|
|
248
|
+
"IMGX_PROJECT_ROOT": ""
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
`IMGX_PROJECT_ROOT` — Set to your project path to save images inside the project (e.g. `"C:\\Users\\you\\my-project"`). Leave empty to use the global default (`~/Pictures/imgx`).
|
|
256
|
+
|
|
257
|
+
Config file location: `%APPDATA%\Claude\claude_desktop_config.json` (Windows) or `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS). After editing, restart Claude Desktop.
|
|
258
|
+
|
|
259
|
+
> **Note:** Claude Desktop does not support auto-detection (MCP roots / CWD-based `.imgxrc` search). Use `IMGX_PROJECT_ROOT` in the config above (per-client), or run `imgx config set project-root /path/to/project` (shared across all clients).
|
|
260
|
+
|
|
261
|
+
### Codex CLI
|
|
262
|
+
|
|
263
|
+
`.codex/config.toml`:
|
|
264
|
+
|
|
265
|
+
```toml
|
|
266
|
+
[mcp_servers.imgx]
|
|
267
|
+
command = "npx"
|
|
268
|
+
args = ["--package=imgx-mcp", "-y", "imgx-mcp"]
|
|
269
|
+
env = { GEMINI_API_KEY = "your-key", OPENAI_API_KEY = "your-key" }
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### Other tools
|
|
273
|
+
|
|
274
|
+
The same `npx` pattern works with Cursor, Windsurf, Continue.dev, Cline, Zed, and other MCP-compatible tools. On Windows, use `cmd /c npx` instead of `npx` directly.
|
|
275
|
+
|
|
276
|
+
## Providers
|
|
277
|
+
|
|
278
|
+
| Provider | Models | Capabilities |
|
|
279
|
+
|----------|--------|-------------|
|
|
280
|
+
| Gemini | `gemini-3-pro-image-preview`, `gemini-2.5-flash-image` | Generate, edit, aspect ratio, resolution, reference images, person control |
|
|
281
|
+
| OpenAI | `gpt-image-1` | Generate, edit, aspect ratio, multi-output, output format (PNG/JPEG/WebP) |
|
|
282
|
+
|
|
283
|
+
## Architecture
|
|
284
|
+
|
|
285
|
+
imgx separates **model-independent** and **model-dependent** concerns:
|
|
286
|
+
|
|
287
|
+
```
|
|
288
|
+
MCP server (tool definitions, stdio transport) CLI (argument parsing, output formatting)
|
|
289
|
+
↓ ↓
|
|
290
|
+
Core (Capability enum, ImageProvider interface, provider registry, file I/O, history)
|
|
291
|
+
↓
|
|
292
|
+
Provider (model-specific API calls, capability declarations)
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
MCP server and CLI are two entry points into the same core. Both call the same provider functions.
|
|
296
|
+
|
|
297
|
+
Each provider declares its supported capabilities. Adding a new provider means implementing the `ImageProvider` interface and registering it — no changes to the MCP or CLI layer.
|
|
298
|
+
|
|
299
|
+
### Capability system
|
|
300
|
+
|
|
301
|
+
| Capability | Description |
|
|
302
|
+
|------------|-------------|
|
|
303
|
+
| `TEXT_TO_IMAGE` | Generate images from text prompts |
|
|
304
|
+
| `IMAGE_EDITING` | Edit images with text instructions |
|
|
305
|
+
| `ASPECT_RATIO` | Control output aspect ratio |
|
|
306
|
+
| `RESOLUTION_CONTROL` | Control output resolution |
|
|
307
|
+
| `MULTIPLE_OUTPUTS` | Generate multiple images per request |
|
|
308
|
+
| `REFERENCE_IMAGES` | Use reference images for guidance |
|
|
309
|
+
| `PERSON_CONTROL` | Control person generation in output |
|
|
310
|
+
| `OUTPUT_FORMAT` | Choose output format (PNG, JPEG, WebP) |
|
|
311
|
+
|
|
312
|
+
## CLI
|
|
313
|
+
|
|
314
|
+
imgx-mcp also works as a standalone command-line tool.
|
|
315
|
+
|
|
316
|
+
### Install
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
npm install -g imgx-mcp
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
Requires Node.js 18+.
|
|
323
|
+
|
|
324
|
+
### Usage
|
|
325
|
+
|
|
326
|
+
```bash
|
|
327
|
+
# Generate
|
|
328
|
+
imgx generate -p "A coffee cup on a wooden table, morning light" -o output.png
|
|
329
|
+
|
|
330
|
+
# Edit
|
|
331
|
+
imgx edit -i photo.png -p "Change the background to sunset" -o edited.png
|
|
332
|
+
|
|
333
|
+
# Iterative editing
|
|
334
|
+
imgx edit -i photo.png -p "Make the background darker"
|
|
335
|
+
imgx edit --last -p "Add warm lighting"
|
|
336
|
+
imgx edit --last -p "Crop to 16:9" -o final.png
|
|
337
|
+
|
|
338
|
+
# Undo / redo
|
|
339
|
+
imgx undo # Revert to previous image in session
|
|
340
|
+
imgx redo # Re-apply an undone edit
|
|
341
|
+
|
|
342
|
+
# History
|
|
343
|
+
imgx history # Show all sessions and entries
|
|
344
|
+
imgx history switch <session-id> # Switch to a different session
|
|
345
|
+
imgx history clear # Clear project history (interactive)
|
|
346
|
+
imgx history clear --yes # Clear without confirmation
|
|
347
|
+
imgx history clear --keep-files # Clear history but keep image files
|
|
348
|
+
imgx history clear --all # Clear ALL history across all projects
|
|
349
|
+
|
|
350
|
+
# Provider management
|
|
351
|
+
imgx providers # List providers and capabilities
|
|
352
|
+
imgx capabilities # Detailed capabilities of current provider
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### CLI options
|
|
356
|
+
|
|
357
|
+
| Flag | Short | Description |
|
|
358
|
+
|------|-------|-------------|
|
|
359
|
+
| `--prompt` | `-p` | Image description or edit instruction (required) |
|
|
360
|
+
| `--output` | `-o` | Output file path (auto-generated if omitted) |
|
|
361
|
+
| `--input` | `-i` | Input image to edit (`edit` command only) |
|
|
362
|
+
| `--last` | `-l` | Use last output as input (`edit` command only) |
|
|
363
|
+
| `--aspect-ratio` | `-a` | `1:1`, `16:9`, `9:16`, `4:3`, `3:4`, `2:3`, `3:2` |
|
|
364
|
+
| `--resolution` | `-r` | `1K`, `2K`, `4K` |
|
|
365
|
+
| `--count` | `-n` | Number of images to generate |
|
|
366
|
+
| `--format` | `-f` | Output format: `png`, `jpeg`, `webp` (OpenAI only) |
|
|
367
|
+
| `--model` | `-m` | Model name |
|
|
368
|
+
| `--provider` | | Provider name (default: `gemini`) |
|
|
369
|
+
| `--output-dir` | `-d` | Output directory |
|
|
370
|
+
|
|
371
|
+
### Configuration
|
|
372
|
+
|
|
373
|
+
```bash
|
|
374
|
+
imgx config set api-key <key> --provider gemini # Save Gemini API key
|
|
375
|
+
imgx config set api-key <key> --provider openai # Save OpenAI API key
|
|
376
|
+
imgx config set model <name> # Set default model
|
|
377
|
+
imgx config set output-dir <dir> # Set default output directory
|
|
378
|
+
imgx config set aspect-ratio 16:9 # Set default aspect ratio
|
|
379
|
+
imgx config set resolution 2K # Set default resolution
|
|
380
|
+
imgx config list # Show all settings
|
|
381
|
+
imgx config get api-key # Show a specific setting (API key is masked)
|
|
382
|
+
imgx config path # Show config file location
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
### Project config (`.imgxrc`)
|
|
386
|
+
|
|
387
|
+
Generate a template with `imgx init`:
|
|
388
|
+
|
|
389
|
+
```bash
|
|
390
|
+
imgx init
|
|
391
|
+
# → creates .imgxrc in current directory
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
Or create manually:
|
|
395
|
+
|
|
396
|
+
```json
|
|
397
|
+
{
|
|
398
|
+
"defaults": {
|
|
399
|
+
"model": "gemini-2.5-flash-image",
|
|
400
|
+
"outputDir": "./assets/images",
|
|
401
|
+
"aspectRatio": "16:9"
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
Project config is shared via Git. Do not put API keys in `.imgxrc`.
|
|
407
|
+
|
|
408
|
+
#### Project root configuration (3 tiers)
|
|
409
|
+
|
|
410
|
+
| Method | Scope | How to set |
|
|
411
|
+
|--------|-------|------------|
|
|
412
|
+
| `IMGX_PROJECT_ROOT` env var in client config | Per-client (highest priority) | Add to `env` in `claude_desktop_config.json`, `.mcp.json`, etc. |
|
|
413
|
+
| Auto-detection (MCP roots / `.imgxrc` search) | Automatic | Works on CLI agents (Claude Code, Gemini CLI). Not available on Claude Desktop |
|
|
414
|
+
| `imgx config set project-root` | All clients on the machine | Stored in user config (`~/.config/imgx/config.json` or `%APPDATA%\imgx\config.json`) |
|
|
415
|
+
|
|
416
|
+
Detection priority: env var → MCP roots → `.imgxrc` upward search → user config `projectRoot`.
|
|
417
|
+
|
|
418
|
+
History is saved to `<project-root>/.imgx/output-history.json` (project-scoped, not shared with other projects). Default image output goes to `<project-root>/.imgx/<session-id>/`. Relative paths in `output` and `output_dir` are resolved against the project root instead of the MCP server's working directory.
|
|
419
|
+
|
|
420
|
+
### Settings resolution
|
|
421
|
+
|
|
422
|
+
1. CLI flags (`--model`, `--output-dir`, etc.)
|
|
423
|
+
2. Environment variables (`IMGX_MODEL`, `IMGX_OUTPUT_DIR`, etc.)
|
|
424
|
+
3. Project config (`.imgxrc` — searched from current directory upward)
|
|
425
|
+
4. User config (`~/.config/imgx/config.json` or `%APPDATA%\imgx\config.json`)
|
|
426
|
+
5. Provider defaults
|
|
427
|
+
|
|
428
|
+
### Output format
|
|
429
|
+
|
|
430
|
+
All CLI commands output JSON:
|
|
431
|
+
|
|
432
|
+
```json
|
|
433
|
+
{"success": true, "filePaths": ["./output.png"]}
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
## Claude Code plugin
|
|
437
|
+
|
|
438
|
+
The plugin bundles MCP server + skill in one step. If you prefer not to configure `.mcp.json` and skill files manually:
|
|
439
|
+
|
|
440
|
+
```
|
|
441
|
+
/plugin marketplace add somacoffeekyoto/imgx-mcp
|
|
442
|
+
/plugin install imgx-mcp@somacoffeekyoto-imgx-mcp
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
Update: `/plugin` → installed → imgx-mcp → update. If the update shows no changes, uninstall and reinstall.
|
|
446
|
+
|
|
447
|
+
Uninstall: `/plugin uninstall imgx-mcp@somacoffeekyoto-imgx-mcp` then `/plugin marketplace remove somacoffeekyoto-imgx-mcp`.
|
|
448
|
+
|
|
449
|
+
## Development
|
|
450
|
+
|
|
451
|
+
```bash
|
|
452
|
+
git clone https://github.com/somacoffeekyoto/imgx-mcp.git
|
|
453
|
+
cd imgx-mcp
|
|
454
|
+
npm install
|
|
455
|
+
npm run bundle # TypeScript compile + esbuild bundle
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
The build produces two bundles:
|
|
459
|
+
|
|
460
|
+
- `dist/mcp.bundle.js` — MCP server entry point
|
|
461
|
+
- `dist/cli.bundle.js` — CLI entry point
|
|
462
|
+
|
|
463
|
+
## Uninstall
|
|
464
|
+
|
|
465
|
+
### MCP server
|
|
466
|
+
|
|
467
|
+
Remove the `imgx` entry from your tool's MCP configuration file.
|
|
468
|
+
|
|
469
|
+
### Skill
|
|
470
|
+
|
|
471
|
+
Delete the `image-generation/` directory from `.claude/skills/` or `~/.claude/skills/`.
|
|
472
|
+
|
|
473
|
+
### CLI
|
|
474
|
+
|
|
475
|
+
```bash
|
|
476
|
+
npm uninstall -g imgx-mcp
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
`npm uninstall` removes the package but does not delete configuration or generated files. Remove them manually if needed:
|
|
480
|
+
|
|
481
|
+
**Global configuration:**
|
|
482
|
+
|
|
483
|
+
```bash
|
|
484
|
+
# Linux / macOS
|
|
485
|
+
rm -rf ~/.config/imgx/
|
|
486
|
+
|
|
487
|
+
# Windows (PowerShell)
|
|
488
|
+
Remove-Item -Recurse -Force "$env:APPDATA\imgx"
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
**Project history and images:** Each project may have a `.imgx/` directory containing edit history and generated images. Remove it from each project as needed.
|
|
492
|
+
|
|
493
|
+
```bash
|
|
494
|
+
rm -rf <project-root>/.imgx/
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
## License
|
|
498
|
+
|
|
499
|
+
MIT — [SOMA COFFEE KYOTO](https://github.com/somacoffeekyoto)
|
|
500
|
+
|
|
501
|
+
## Links
|
|
502
|
+
|
|
503
|
+
- [Official page](https://somacoffee.net/imgx-mcp/)
|
|
504
|
+
- [GitHub](https://github.com/somacoffeekyoto/imgx-mcp)
|
|
505
|
+
- [npm](https://www.npmjs.com/package/imgx-mcp)
|
|
506
|
+
- [MCP Registry](https://registry.modelcontextprotocol.io)
|
|
507
|
+
- [SOMA COFFEE KYOTO](https://somacoffee.net)
|
|
508
|
+
- [X (@somacoffeekyoto)](https://x.com/somacoffeekyoto)
|
package/dist/cli.bundle.js
CHANGED
|
@@ -22071,6 +22071,11 @@ function findProjectRoot(startDir) {
|
|
|
22071
22071
|
break;
|
|
22072
22072
|
dir = parent;
|
|
22073
22073
|
}
|
|
22074
|
+
const config = loadConfig();
|
|
22075
|
+
if (config.projectRoot) {
|
|
22076
|
+
_cachedProjectRoot = config.projectRoot;
|
|
22077
|
+
return config.projectRoot;
|
|
22078
|
+
}
|
|
22074
22079
|
_cachedProjectRoot = null;
|
|
22075
22080
|
return null;
|
|
22076
22081
|
}
|
|
@@ -39958,7 +39963,7 @@ function runConfig(args) {
|
|
|
39958
39963
|
const key = filtered[0];
|
|
39959
39964
|
const value = filtered[1];
|
|
39960
39965
|
if (!key || !value) {
|
|
39961
|
-
fail("Usage: imgx config set <key> <value> [--provider <name>]\n Keys: api-key, provider, model, output-dir, aspect-ratio, resolution");
|
|
39966
|
+
fail("Usage: imgx config set <key> <value> [--provider <name>]\n Keys: api-key, provider, model, output-dir, aspect-ratio, resolution, project-root");
|
|
39962
39967
|
}
|
|
39963
39968
|
if (key === "output-dir") {
|
|
39964
39969
|
setOutputDir(value, hasYes, hasNoMove);
|
|
@@ -40023,8 +40028,12 @@ function setKey(key, value, provider) {
|
|
|
40023
40028
|
config.defaults.resolution = value;
|
|
40024
40029
|
break;
|
|
40025
40030
|
}
|
|
40031
|
+
case "project-root": {
|
|
40032
|
+
config.projectRoot = value;
|
|
40033
|
+
break;
|
|
40034
|
+
}
|
|
40026
40035
|
default:
|
|
40027
|
-
fail(`Unknown key: ${key}. Valid keys: api-key, provider, model, output-dir, aspect-ratio, resolution`);
|
|
40036
|
+
fail(`Unknown key: ${key}. Valid keys: api-key, provider, model, output-dir, aspect-ratio, resolution, project-root`);
|
|
40028
40037
|
}
|
|
40029
40038
|
saveConfig(config);
|
|
40030
40039
|
success({ key, status: "saved" });
|
|
@@ -40110,8 +40119,11 @@ function getKey(key, provider) {
|
|
|
40110
40119
|
case "resolution":
|
|
40111
40120
|
success({ key, value: config.defaults?.resolution ?? null });
|
|
40112
40121
|
return;
|
|
40122
|
+
case "project-root":
|
|
40123
|
+
success({ key, value: config.projectRoot ?? null });
|
|
40124
|
+
return;
|
|
40113
40125
|
default:
|
|
40114
|
-
fail(`Unknown key: ${key}. Valid keys: api-key, provider, model, output-dir, aspect-ratio, resolution`);
|
|
40126
|
+
fail(`Unknown key: ${key}. Valid keys: api-key, provider, model, output-dir, aspect-ratio, resolution, project-root`);
|
|
40115
40127
|
}
|
|
40116
40128
|
}
|
|
40117
40129
|
function showAll() {
|
|
@@ -40281,7 +40293,7 @@ function runRedo() {
|
|
|
40281
40293
|
}
|
|
40282
40294
|
|
|
40283
40295
|
// build/cli/index.js
|
|
40284
|
-
var VERSION2 = "1.
|
|
40296
|
+
var VERSION2 = "1.5.1";
|
|
40285
40297
|
var HELP = `imgx v${VERSION2} \u2014 AI image generation and editing for MCP-compatible AI agents
|
|
40286
40298
|
|
|
40287
40299
|
Commands:
|
|
Binary file
|
package/dist/mcp.bundle.js
CHANGED
|
@@ -6847,6 +6847,11 @@ function findProjectRoot(startDir) {
|
|
|
6847
6847
|
break;
|
|
6848
6848
|
dir = parent;
|
|
6849
6849
|
}
|
|
6850
|
+
const config2 = loadConfig();
|
|
6851
|
+
if (config2.projectRoot) {
|
|
6852
|
+
_cachedProjectRoot = config2.projectRoot;
|
|
6853
|
+
return config2.projectRoot;
|
|
6854
|
+
}
|
|
6850
6855
|
_cachedProjectRoot = null;
|
|
6851
6856
|
return null;
|
|
6852
6857
|
}
|
|
@@ -69977,7 +69982,7 @@ function buildImageContent(images, paths, extra) {
|
|
|
69977
69982
|
}
|
|
69978
69983
|
var server = new McpServer({
|
|
69979
69984
|
name: "imgx",
|
|
69980
|
-
version: "1.
|
|
69985
|
+
version: "1.5.1"
|
|
69981
69986
|
});
|
|
69982
69987
|
initGemini();
|
|
69983
69988
|
initOpenAI();
|
|
@@ -70287,17 +70292,22 @@ function fileUriToPath(uri) {
|
|
|
70287
70292
|
}
|
|
70288
70293
|
async function main() {
|
|
70289
70294
|
const transport = new StdioServerTransport();
|
|
70290
|
-
|
|
70291
|
-
|
|
70292
|
-
|
|
70293
|
-
|
|
70294
|
-
|
|
70295
|
-
|
|
70296
|
-
|
|
70295
|
+
server.server.oninitialized = async () => {
|
|
70296
|
+
try {
|
|
70297
|
+
const caps = server.server.getClientCapabilities();
|
|
70298
|
+
if (!caps?.roots)
|
|
70299
|
+
return;
|
|
70300
|
+
const result = await server.server.listRoots();
|
|
70301
|
+
if (result.roots.length > 0) {
|
|
70302
|
+
const rootUri = result.roots[0].uri;
|
|
70303
|
+
if (rootUri.startsWith("file://")) {
|
|
70304
|
+
setProjectRoot(fileUriToPath(rootUri));
|
|
70305
|
+
}
|
|
70297
70306
|
}
|
|
70307
|
+
} catch {
|
|
70298
70308
|
}
|
|
70299
|
-
}
|
|
70300
|
-
|
|
70309
|
+
};
|
|
70310
|
+
await server.connect(transport);
|
|
70301
70311
|
}
|
|
70302
70312
|
main().catch((err) => {
|
|
70303
70313
|
console.error("MCP server error:", err);
|
package/package.json
CHANGED
|
@@ -144,11 +144,12 @@ Switch to a different editing session to continue work on a previous image chain
|
|
|
144
144
|
|
|
145
145
|
### clear_history
|
|
146
146
|
|
|
147
|
-
Clear
|
|
147
|
+
Clear edit history for the current project. Optionally delete image files in managed directories.
|
|
148
148
|
|
|
149
149
|
| Parameter | Required | Description |
|
|
150
150
|
|-----------|----------|-------------|
|
|
151
|
-
| `delete_files` | No | Delete image files in
|
|
151
|
+
| `delete_files` | No | Delete image files in managed directories only (default: false) |
|
|
152
|
+
| `session_id` | No | Session ID to clear. Omit to clear all sessions |
|
|
152
153
|
|
|
153
154
|
### set_output_dir
|
|
154
155
|
|
|
@@ -214,10 +215,14 @@ Generate the same prompt with different providers to let the user choose:
|
|
|
214
215
|
- **Be specific in prompts**: "A wooden table with a ceramic pour-over dripper, steam rising, soft natural light from left" works better than "coffee scene"
|
|
215
216
|
- **Use edit_last for iteration**: Don't ask the user to specify file paths. Just use `edit_last` after any generation or edit
|
|
216
217
|
- **Check provider capabilities**: Use `list_providers` if unsure what a provider supports
|
|
217
|
-
- **
|
|
218
|
+
- **Where `.imgx/` is created**: The `.imgx/` directory holds both edit history (`output-history.json`) and default image output. When a project root is detected, it's created at `<project-root>/.imgx/`. Without a project root, images go to `~/Pictures/imgx/` and history to `~/.config/imgx/`. All clients sharing the same project root share the same history
|
|
219
|
+
- **Default output**: Images save to `<project-root>/.imgx/<session-id>/` (project auto-detected). Falls back to `~/Pictures/imgx/` when no project is detected. Use `output` or `output_dir` to customize
|
|
220
|
+
- **Custom output_dir and history**: When `output_dir` is specified on `generate_image`, the path is recorded as session metadata in `output-history.json`. `edit_last` reads this to inherit the output location. Only image files go to the custom path — history always stays in `.imgx/` (or global config directory)
|
|
218
221
|
- **Inline preview**: MCP responses include base64 image data for inline display in supported clients
|
|
219
222
|
- **Undo/redo**: Use `undo_edit` and `redo_edit` to step through edit history. Each session holds up to 10 entries
|
|
220
223
|
- **Sessions**: Each `generate_image` starts a new session. Use `edit_history` to see all sessions and `switch_session` to resume a previous one
|
|
224
|
+
- **Sequential naming**: When `output` specifies a filename, `edit_last` appends sequential numbers: `cover.png` → `cover-1.png` → `cover-2.png`. Undo automatically deletes discarded files
|
|
225
|
+
- **Project scope**: History is stored per-project in `<project-root>/.imgx/output-history.json`. `clear_history` only affects the current project
|
|
221
226
|
|
|
222
227
|
## CLI fallback
|
|
223
228
|
|