codex-imagegen-mcp 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.
Files changed (105) hide show
  1. package/CHANGELOG.md +96 -0
  2. package/LICENSE +201 -0
  3. package/NOTICE +19 -0
  4. package/README.md +373 -0
  5. package/dist/src/auth/borrowed.js +77 -0
  6. package/dist/src/auth/borrowed.js.map +1 -0
  7. package/dist/src/auth/browser-login.js +179 -0
  8. package/dist/src/auth/browser-login.js.map +1 -0
  9. package/dist/src/auth/device-login.js +39 -0
  10. package/dist/src/auth/device-login.js.map +1 -0
  11. package/dist/src/auth/jwt.js +69 -0
  12. package/dist/src/auth/jwt.js.map +1 -0
  13. package/dist/src/auth/manager.js +289 -0
  14. package/dist/src/auth/manager.js.map +1 -0
  15. package/dist/src/auth/oauth.js +246 -0
  16. package/dist/src/auth/oauth.js.map +1 -0
  17. package/dist/src/auth/pages.js +39 -0
  18. package/dist/src/auth/pages.js.map +1 -0
  19. package/dist/src/auth/pkce.js +14 -0
  20. package/dist/src/auth/pkce.js.map +1 -0
  21. package/dist/src/auth/store.js +75 -0
  22. package/dist/src/auth/store.js.map +1 -0
  23. package/dist/src/backend/images-client.js +223 -0
  24. package/dist/src/backend/images-client.js.map +1 -0
  25. package/dist/src/backend/ratelimits.js +183 -0
  26. package/dist/src/backend/ratelimits.js.map +1 -0
  27. package/dist/src/cli.js +407 -0
  28. package/dist/src/cli.js.map +1 -0
  29. package/dist/src/config.js +87 -0
  30. package/dist/src/config.js.map +1 -0
  31. package/dist/src/constants.js +52 -0
  32. package/dist/src/constants.js.map +1 -0
  33. package/dist/src/doctor.js +122 -0
  34. package/dist/src/doctor.js.map +1 -0
  35. package/dist/src/errors.js +76 -0
  36. package/dist/src/errors.js.map +1 -0
  37. package/dist/src/generation.js +183 -0
  38. package/dist/src/generation.js.map +1 -0
  39. package/dist/src/history.js +47 -0
  40. package/dist/src/history.js.map +1 -0
  41. package/dist/src/images/chroma.js +200 -0
  42. package/dist/src/images/chroma.js.map +1 -0
  43. package/dist/src/images/codec.js +159 -0
  44. package/dist/src/images/codec.js.map +1 -0
  45. package/dist/src/images/inputs.js +83 -0
  46. package/dist/src/images/inputs.js.map +1 -0
  47. package/dist/src/images/output.js +100 -0
  48. package/dist/src/images/output.js.map +1 -0
  49. package/dist/src/images/preview.js +20 -0
  50. package/dist/src/images/preview.js.map +1 -0
  51. package/dist/src/images/resize.js +135 -0
  52. package/dist/src/images/resize.js.map +1 -0
  53. package/dist/src/install/opencode.js +138 -0
  54. package/dist/src/install/opencode.js.map +1 -0
  55. package/dist/src/install/skill.js +128 -0
  56. package/dist/src/install/skill.js.map +1 -0
  57. package/dist/src/install/snippets.js +127 -0
  58. package/dist/src/install/snippets.js.map +1 -0
  59. package/dist/src/log.js +58 -0
  60. package/dist/src/log.js.map +1 -0
  61. package/dist/src/remove-background.js +101 -0
  62. package/dist/src/remove-background.js.map +1 -0
  63. package/dist/src/server/context.js +2 -0
  64. package/dist/src/server/context.js.map +1 -0
  65. package/dist/src/server/index.js +94 -0
  66. package/dist/src/server/index.js.map +1 -0
  67. package/dist/src/server/instructions.js +20 -0
  68. package/dist/src/server/instructions.js.map +1 -0
  69. package/dist/src/server/login-coordinator.js +73 -0
  70. package/dist/src/server/login-coordinator.js.map +1 -0
  71. package/dist/src/server/progress.js +33 -0
  72. package/dist/src/server/progress.js.map +1 -0
  73. package/dist/src/server/prompts.js +45 -0
  74. package/dist/src/server/prompts.js.map +1 -0
  75. package/dist/src/server/resources.js +73 -0
  76. package/dist/src/server/resources.js.map +1 -0
  77. package/dist/src/server/tools.js +338 -0
  78. package/dist/src/server/tools.js.map +1 -0
  79. package/dist/src/server/workspace.js +45 -0
  80. package/dist/src/server/workspace.js.map +1 -0
  81. package/dist/src/status.js +86 -0
  82. package/dist/src/status.js.map +1 -0
  83. package/dist/src/util/format.js +36 -0
  84. package/dist/src/util/format.js.map +1 -0
  85. package/dist/src/util/fs.js +117 -0
  86. package/dist/src/util/fs.js.map +1 -0
  87. package/dist/src/util/http.js +65 -0
  88. package/dist/src/util/http.js.map +1 -0
  89. package/dist/src/util/invocation.js +43 -0
  90. package/dist/src/util/invocation.js.map +1 -0
  91. package/dist/src/util/open.js +41 -0
  92. package/dist/src/util/open.js.map +1 -0
  93. package/docs/ARCHITECTURE.md +123 -0
  94. package/docs/AUTH.md +242 -0
  95. package/docs/BACKEND.md +169 -0
  96. package/docs/CLIENTS.md +154 -0
  97. package/docs/DEVELOPMENT.md +171 -0
  98. package/docs/README.md +84 -0
  99. package/docs/TOOLS.md +221 -0
  100. package/package.json +67 -0
  101. package/skill/imagegen/LICENSE.txt +201 -0
  102. package/skill/imagegen/SKILL.md +189 -0
  103. package/skill/imagegen/references/prompting.md +112 -0
  104. package/skill/imagegen/references/sample-prompts.md +418 -0
  105. package/skill/imagegen/references/tools.md +90 -0
@@ -0,0 +1,418 @@
1
+ # Sample prompts (copy/paste)
2
+
3
+ Prompt recipes for the imagegen MCP tools (`generate_image`, `edit_image`). Adapted from the OpenAI Codex imagegen skill; the recipes below are unchanged.
4
+
5
+ Use these as starting points. They are intentionally complete prompt recipes, not the default amount of augmentation to add to every user request.
6
+
7
+ When adapting a user's prompt:
8
+ - keep user-provided requirements
9
+ - only add detail according to the specificity policy in `SKILL.md`
10
+ - do not treat every example below as permission to invent extra story elements
11
+
12
+ The labeled lines are prompt scaffolding, not a closed schema. `Asset type` and `Input images` are prompt-only scaffolding.
13
+
14
+ Execution details are tool parameters, not prompt lines:
15
+ - canvas shape → `aspect_ratio` (e.g. `16:9` for heroes, `1:1` for icons and tiles, `9:16` for mobile screens);
16
+ - transparency → `background: "transparent"` (keep the alpha; see `SKILL.md` for the chroma-key fallback);
17
+ - destination → `output_path` inside the workspace for project assets.
18
+
19
+ The service chooses resolution and quality itself, so recipes don't include `Quality:` or pixel sizes. For exact dimensions, generate the closest aspect ratio, then resize or crop locally.
20
+
21
+ For prompting principles (structure, specificity, invariants, iteration), see `references/prompting.md`.
22
+
23
+ ## Generate
24
+
25
+ ### photorealistic-natural
26
+ ```
27
+ Use case: photorealistic-natural
28
+ Primary request: candid photo of an elderly sailor on a small fishing boat adjusting a net
29
+ Scene/backdrop: coastal water with soft haze
30
+ Subject: weathered skin with wrinkles and sun texture
31
+ Style/medium: photorealistic candid photo
32
+ Composition/framing: medium close-up, eye-level
33
+ Lighting/mood: soft coastal daylight, shallow depth of field, subtle film grain
34
+ Materials/textures: real skin texture, worn fabric, salt-worn wood
35
+ Constraints: natural color balance; no heavy retouching; no glamorization; no watermark
36
+ Avoid: studio polish; staged look
37
+ ```
38
+
39
+ ### product-mockup
40
+ ```
41
+ Use case: product-mockup
42
+ Primary request: premium product photo of a matte black shampoo bottle with a minimal label
43
+ Scene/backdrop: clean studio gradient from light gray to white
44
+ Subject: single bottle centered with subtle reflection
45
+ Style/medium: premium product photography
46
+ Composition/framing: centered, slight three-quarter angle, generous padding
47
+ Lighting/mood: softbox lighting, clean highlights, controlled shadows
48
+ Materials/textures: matte plastic, crisp label printing
49
+ Constraints: no logos or trademarks; no watermark
50
+ ```
51
+
52
+ ### ui-mockup
53
+ ```
54
+ Use case: ui-mockup
55
+ Primary request: mobile app home screen for a local farmers market with vendors and daily specials
56
+ Asset type: mobile app screen
57
+ Style/medium: realistic product UI, not concept art
58
+ Composition/framing: clean vertical mobile layout with clear hierarchy
59
+ Constraints: practical layout, clear typography, no logos or trademarks, no watermark
60
+ ```
61
+
62
+ ### infographic-diagram
63
+ ```
64
+ Use case: infographic-diagram
65
+ Primary request: detailed infographic of an automatic coffee machine flow
66
+ Scene/backdrop: clean, light neutral background
67
+ Subject: bean hopper -> grinder -> brew group -> boiler -> water tank -> drip tray
68
+ Style/medium: clean vector-like infographic with clear callouts and arrows
69
+ Composition/framing: vertical poster layout, top-to-bottom flow
70
+ Text (verbatim): "Bean Hopper", "Grinder", "Brew Group", "Boiler", "Water Tank", "Drip Tray"
71
+ Constraints: clear labels, strong contrast, no logos or trademarks, no watermark
72
+ ```
73
+
74
+ ### scientific-educational
75
+ ```
76
+ Use case: scientific-educational
77
+ Primary request: biology diagram titled "Cellular Respiration at a Glance" for high school students
78
+ Scene/backdrop: clean white classroom handout background
79
+ Subject: glucose turns into energy inside a cell; include glycolysis, Krebs cycle, and electron transport chain
80
+ Style/medium: flat scientific diagram with consistent icons, arrows, and readable labels
81
+ Composition/framing: landscape slide-style layout with clear hierarchy and generous whitespace
82
+ Text (verbatim): "Cellular Respiration at a Glance", "Glucose", "Pyruvate", "ATP", "NADH", "FADH2", "CO2", "O2", "H2O"
83
+ Constraints: scientifically plausible; avoid tiny text; no extra decoration; no watermark
84
+ ```
85
+
86
+ ### logo-brand
87
+ ```
88
+ Use case: logo-brand
89
+ Primary request: original logo for "Field & Flour", a local bakery
90
+ Style/medium: vector logo mark; flat colors; minimal
91
+ Composition/framing: single centered logo on a plain background with generous padding
92
+ Constraints: strong silhouette, balanced negative space; original design only; no gradients unless essential; no trademarks; no watermark
93
+ ```
94
+
95
+ ### illustration-story
96
+ ```
97
+ Use case: illustration-story
98
+ Primary request: 4-panel comic about a pet left alone at home
99
+ Scene/backdrop: cozy living room across panels
100
+ Subject: pet reacting to the owner leaving, then relaxing, then returning to a composed pose
101
+ Style/medium: comic illustration with clear panels
102
+ Composition/framing: 4 equal-sized vertical panels, readable actions per panel
103
+ Constraints: no text; no logos or trademarks; no watermark
104
+ ```
105
+
106
+ ### stylized-concept
107
+ ```
108
+ Use case: stylized-concept
109
+ Primary request: cavernous hangar interior with tall support beams and drifting fog
110
+ Scene/backdrop: industrial hangar interior, deep scale, light haze
111
+ Subject: compact shuttle parked near the center
112
+ Style/medium: cinematic concept art, industrial realism
113
+ Composition/framing: wide-angle, low-angle
114
+ Lighting/mood: volumetric light rays cutting through fog
115
+ Constraints: no logos or trademarks; no watermark
116
+ ```
117
+
118
+ ### ads-marketing
119
+ ```
120
+ Use case: ads-marketing
121
+ Primary request: campaign image for a streetwear brand called Thread
122
+ Subject: group of friends hanging out together in a stylish urban setting
123
+ Style/medium: polished youth streetwear campaign photography
124
+ Composition/framing: vertical ad layout with natural poses and integrated headline space
125
+ Lighting/mood: contemporary, energetic, tasteful
126
+ Text (verbatim): "Yours to Create."
127
+ Constraints: render the tagline exactly once; clean legible typography; no extra text; no watermarks; no unrelated logos
128
+ ```
129
+
130
+ ### productivity-visual
131
+ ```
132
+ Use case: productivity-visual
133
+ Primary request: one pitch-deck slide titled "Market Opportunity"
134
+ Asset type: fundraising slide image
135
+ Style/medium: clean modern deck slide, white background, crisp sans-serif typography
136
+ Subject: TAM/SAM/SOM concentric-circle diagram plus a small growth bar chart from 2021 to 2026
137
+ Composition/framing: 16:9 landscape slide, clear data hierarchy, polished spacing
138
+ Text (verbatim): "Market Opportunity", "TAM: $42B", "SAM: $8.7B", "SOM: $340M", "AGI Research, 2024", "Internal analysis"
139
+ Constraints: readable labels, no clip art, no stock photography, no decorative clutter, no watermark
140
+ ```
141
+
142
+ ### historical-scene
143
+ ```
144
+ Use case: historical-scene
145
+ Primary request: outdoor crowd scene in Bethel, New York on August 16, 1969
146
+ Scene/backdrop: open field with period-appropriate staging
147
+ Subject: crowd in period-accurate clothing, authentic environment
148
+ Style/medium: photorealistic photo
149
+ Composition/framing: wide shot, eye-level
150
+ Constraints: period-accurate details; no modern objects; no logos or trademarks; no watermark
151
+ ```
152
+
153
+ ## Asset type templates (taxonomy-aligned)
154
+
155
+ ### Website assets template
156
+ ```
157
+ Use case: <photorealistic-natural|stylized-concept|product-mockup|infographic-diagram|ui-mockup>
158
+ Asset type: <hero image / section illustration / blog header>
159
+ Primary request: <short description>
160
+ Scene/backdrop: <environment or abstract backdrop>
161
+ Subject: <main subject>
162
+ Style/medium: <photo/illustration/3D>
163
+ Composition/framing: <wide/centered; note usable negative space only if needed>
164
+ Lighting/mood: <soft/bright/neutral>
165
+ Color palette: <brand colors or neutral>
166
+ Constraints: <no text; no logos; no watermark; leave room for UI if needed>
167
+ ```
168
+
169
+ ### Website assets example: minimal hero background
170
+ ```
171
+ Use case: stylized-concept
172
+ Asset type: landing page hero background
173
+ Primary request: minimal abstract background with a soft gradient and subtle texture
174
+ Style/medium: matte illustration / soft-rendered abstract background
175
+ Composition/framing: wide composition with usable negative space for page copy
176
+ Lighting/mood: gentle studio glow
177
+ Color palette: restrained neutral palette
178
+ Constraints: no text; no logos; no watermark
179
+ ```
180
+
181
+ ### Website assets example: feature section illustration
182
+ ```
183
+ Use case: stylized-concept
184
+ Asset type: feature section illustration
185
+ Primary request: simple abstract shapes suggesting connection and flow
186
+ Scene/backdrop: subtle light-gray backdrop with faint texture
187
+ Style/medium: flat illustration; soft shadows; restrained contrast
188
+ Composition/framing: centered cluster; open margins for UI
189
+ Color palette: muted neutral palette
190
+ Constraints: no text; no logos; no watermark
191
+ ```
192
+
193
+ ### Website assets example: blog header image
194
+ ```
195
+ Use case: photorealistic-natural
196
+ Asset type: blog header image
197
+ Primary request: overhead desk scene with notebook, pen, and coffee cup
198
+ Scene/backdrop: warm wooden tabletop
199
+ Style/medium: photorealistic photo
200
+ Composition/framing: wide crop with clean room for page copy
201
+ Lighting/mood: soft morning light
202
+ Constraints: no text; no logos; no watermark
203
+ ```
204
+
205
+ ### Game assets template
206
+ ```
207
+ Use case: stylized-concept
208
+ Asset type: <game environment concept art / game character concept / game UI icon / tileable game texture>
209
+ Primary request: <biome/scene/character/icon/material>
210
+ Scene/backdrop: <location + set dressing> (if applicable)
211
+ Subject: <main focal element(s)>
212
+ Style/medium: <realistic/stylized>; <concept art / character render / UI icon / texture>
213
+ Composition/framing: <wide/establishing/top-down>; <camera angle>; <focal point placement>
214
+ Lighting/mood: <time of day>; <mood>; <volumetric/fog/etc>
215
+ Constraints: no logos or trademarks; no watermark
216
+ ```
217
+
218
+ ### Game assets example: environment concept art
219
+ ```
220
+ Use case: stylized-concept
221
+ Asset type: game environment concept art
222
+ Primary request: cavernous hangar interior with tall support beams and drifting fog
223
+ Scene/backdrop: industrial hangar interior, deep scale, light haze
224
+ Subject: compact shuttle parked near the center
225
+ Style/medium: cinematic concept art, industrial realism
226
+ Composition/framing: wide-angle, low-angle
227
+ Lighting/mood: volumetric light rays cutting through fog
228
+ Constraints: no logos or trademarks; no watermark
229
+ ```
230
+
231
+ ### Game assets example: character concept
232
+ ```
233
+ Use case: stylized-concept
234
+ Asset type: game character concept
235
+ Primary request: desert scout character with layered travel gear
236
+ Subject: long coat, satchel, practical travel clothing
237
+ Style/medium: character render; stylized realism
238
+ Composition/framing: neutral hero pose on a simple backdrop
239
+ Constraints: no logos or trademarks; no watermark
240
+ ```
241
+
242
+ ### Game assets example: UI icon
243
+ ```
244
+ Use case: stylized-concept
245
+ Asset type: game UI icon
246
+ Primary request: round shield icon with a subtle rune pattern
247
+ Style/medium: painted game UI icon
248
+ Composition/framing: centered icon; generous padding; clear silhouette
249
+ Constraints: no text; no background scene elements; no logos or trademarks; no watermark
250
+ ```
251
+
252
+ ### Game assets example: tileable texture
253
+ ```
254
+ Use case: stylized-concept
255
+ Asset type: tileable game texture
256
+ Primary request: worn sandstone blocks
257
+ Style/medium: seamless tileable texture; PBR-ish look
258
+ Scene/backdrop: neutral lighting reference only
259
+ Constraints: seamless edges; no obvious focal elements; no text; no logos or trademarks; no watermark
260
+ ```
261
+
262
+ ### Wireframe template
263
+ ```
264
+ Use case: ui-mockup
265
+ Asset type: website wireframe
266
+ Primary request: <page or flow to sketch>
267
+ Style/medium: low-fi grayscale wireframe
268
+ Composition/framing: <landscape or portrait to match expected device>
269
+ Subject: <sections in order; grid/columns; key labels>
270
+ Constraints: no color; no logos; no real photos; no watermark
271
+ ```
272
+
273
+ ### Wireframe example: homepage (desktop)
274
+ ```
275
+ Use case: ui-mockup
276
+ Asset type: website wireframe
277
+ Primary request: SaaS homepage layout with clear hierarchy
278
+ Style/medium: low-fi grayscale wireframe
279
+ Subject: top nav; hero with headline and CTA; three feature cards; testimonial strip; pricing preview; footer
280
+ Composition/framing: landscape desktop layout
281
+ Constraints: label major blocks; no color; no logos; no real photos; no watermark
282
+ ```
283
+
284
+ ### Wireframe example: pricing page
285
+ ```
286
+ Use case: ui-mockup
287
+ Asset type: website wireframe
288
+ Primary request: pricing page layout with comparison table
289
+ Style/medium: low-fi grayscale wireframe
290
+ Subject: header; plan toggle; 3 pricing cards; comparison table; FAQ accordion; footer
291
+ Composition/framing: desktop or tablet layout
292
+ Constraints: label key areas; no color; no logos; no real photos; no watermark
293
+ ```
294
+
295
+ ### Wireframe example: mobile onboarding flow
296
+ ```
297
+ Use case: ui-mockup
298
+ Asset type: mobile onboarding wireframe
299
+ Primary request: three-screen mobile onboarding flow
300
+ Style/medium: low-fi grayscale wireframe
301
+ Subject: screen 1 headline and CTA; screen 2 feature bullets; screen 3 form fields and CTA
302
+ Composition/framing: portrait mobile layout
303
+ Constraints: label screens and blocks; no color; no logos; no real photos; no watermark
304
+ ```
305
+
306
+ ### Logo template
307
+ ```
308
+ Use case: logo-brand
309
+ Asset type: logo concept
310
+ Primary request: <brand idea or symbol concept>
311
+ Style/medium: vector logo mark; flat colors; minimal
312
+ Composition/framing: centered mark; clear silhouette; generous margin
313
+ Color palette: <1-2 colors; high contrast>
314
+ Text (verbatim): "<exact name>" (only if needed)
315
+ Constraints: no gradients; no mockups; no 3D; no watermark
316
+ ```
317
+
318
+ ### Logo example: abstract symbol mark
319
+ ```
320
+ Use case: logo-brand
321
+ Asset type: logo concept
322
+ Primary request: geometric leaf symbol suggesting sustainability and growth
323
+ Style/medium: vector logo mark; flat colors; minimal
324
+ Composition/framing: centered mark; clear silhouette
325
+ Color palette: deep green and off-white
326
+ Constraints: no text unless requested; no gradients; no mockups; no 3D; no watermark
327
+ ```
328
+
329
+ ### Logo example: monogram mark
330
+ ```
331
+ Use case: logo-brand
332
+ Asset type: logo concept
333
+ Primary request: interlocking monogram of the letters "AV"
334
+ Style/medium: vector logo mark; flat colors; minimal
335
+ Composition/framing: centered mark; balanced spacing
336
+ Color palette: black on white
337
+ Constraints: no gradients; no mockups; no 3D; no watermark
338
+ ```
339
+
340
+ ### Logo example: wordmark
341
+ ```
342
+ Use case: logo-brand
343
+ Asset type: logo concept
344
+ Primary request: clean wordmark for a modern studio
345
+ Style/medium: vector wordmark; flat colors; minimal
346
+ Text (verbatim): "Studio North"
347
+ Composition/framing: centered text; even letter spacing
348
+ Constraints: no gradients; no mockups; no 3D; no watermark
349
+ ```
350
+
351
+ ## Edit
352
+
353
+ ### text-localization
354
+ ```
355
+ Use case: text-localization
356
+ Input images: Image 1: original infographic
357
+ Primary request: replace "Bean Hopper", "Grinder", "Brew Group", "Boiler", "Water Tank", and "Drip Tray" with "Tolva", "Molino", "Grupo de infusión", "Caldera", "Depósito de agua", and "Bandeja de goteo"
358
+ Constraints: change only the text; preserve layout, typography, spacing, and hierarchy; no extra words; do not alter logos or imagery
359
+ ```
360
+
361
+ ### identity-preserve
362
+ ```
363
+ Use case: identity-preserve
364
+ Input images: Image 1: person photo; Image 2..N: clothing references
365
+ Primary request: replace only the clothing with the provided garments
366
+ Constraints: preserve face, body shape, pose, hair, expression, and identity; match lighting and shadows; keep the background unchanged; no accessories or text
367
+ ```
368
+
369
+ ### precise-object-edit
370
+ ```
371
+ Use case: precise-object-edit
372
+ Input images: Image 1: room photo
373
+ Primary request: replace only the white chairs with wooden chairs
374
+ Constraints: preserve camera angle, room lighting, floor shadows, and surrounding objects; keep all other aspects unchanged
375
+ ```
376
+
377
+ ### lighting-weather
378
+ ```
379
+ Use case: lighting-weather
380
+ Input images: Image 1: original photo
381
+ Primary request: make it look like a winter evening with gentle snowfall
382
+ Constraints: preserve subject identity, geometry, camera angle, and composition; change only lighting, atmosphere, and weather
383
+ ```
384
+
385
+ ### style-transfer
386
+ ```
387
+ Use case: style-transfer
388
+ Input images: Image 1: style reference
389
+ Primary request: apply Image 1's visual style to a man riding a motorcycle on a plain white backdrop
390
+ Constraints: preserve palette, texture, and brushwork; no extra elements
391
+ ```
392
+
393
+ ### compositing
394
+ ```
395
+ Use case: compositing
396
+ Input images: Image 1: base scene; Image 2: subject to insert
397
+ Primary request: place the subject from Image 2 next to the person in Image 1
398
+ Constraints: match lighting, perspective, and scale; keep the base framing unchanged; no extra elements
399
+ ```
400
+
401
+ ### character consistency workflow
402
+ ```
403
+ Use case: identity-preserve
404
+ Input images: Image 1: previous character anchor illustration
405
+ Primary request: continue the story with the same character in a new scene and action
406
+ Scene/backdrop: snowy forest after a winter storm
407
+ Subject: same young forest hero gently helping a frightened squirrel out of a fallen tree
408
+ Style/medium: same children's book watercolor illustration style as Image 1
409
+ Constraints: do not redesign the character; preserve facial features, proportions, outfit, color palette, and personality; no text; no watermark
410
+ ```
411
+
412
+ ### sketch-to-render
413
+ ```
414
+ Use case: sketch-to-render
415
+ Input images: Image 1: drawing
416
+ Primary request: turn the drawing into a photorealistic image
417
+ Constraints: preserve layout, proportions, and perspective; choose realistic materials and lighting; do not add new elements or text
418
+ ```
@@ -0,0 +1,90 @@
1
+ # imagegen MCP tools reference
2
+
3
+ The server exposes five tools. Clients add a prefix (`imagegen_generate_image` in opencode, `mcp__imagegen__generate_image` in Claude Code). All paths may be absolute, `~/…`, or relative to the workspace root (the client's MCP root, or the directory the server was started in).
4
+
5
+ ## generate_image
6
+
7
+ Create a new image from text. Calls `POST /backend-api/codex/images/generations`.
8
+
9
+ | Parameter | Default | Notes |
10
+ |---|---|---|
11
+ | `prompt` | required | 1-32000 characters. Use the labeled schema from `SKILL.md`. |
12
+ | `aspect_ratio` | `auto` | `1:1`, `4:5`, `5:4`, `4:3`, `3:4`, `3:2`, `2:3`, `16:9`, `9:16`, `21:9`, `9:21`. Appended to the prompt as an explicit line; the service then picks a matching canvas. |
13
+ | `background` | `auto` | `transparent` returns a PNG with real alpha. `opaque` asks for a filled background; it's a hint, so also describe the backdrop in the prompt, and avoid wording like "the backdrop will be removed". |
14
+ | `n` | `1` | 1-4 variants of the same prompt, run as parallel requests. Each one counts against the quota. |
15
+ | `output_path` | library | File (`.png`, `.jpg`, `.jpeg`) or directory. Without it, the image goes to the server's image library, outside the project. |
16
+ | `output_format` | `png` | `jpeg` is converted locally, flattened on white, and cannot be transparent. Inferred from the `output_path` extension. |
17
+ | `overwrite` | `false` | When false, an existing file is never replaced; `name-2.png`, `name-3.png`… is used instead. |
18
+ | `include_preview` | `true` | Attaches a downscaled JPEG preview (longest edge 1024 px). Transparent areas are shown as a checkerboard. |
19
+
20
+ The text result lists each saved file with its dimensions, size, background, and an id such as `img_ab12…`. It also includes the exact prompt sent and any warnings.
21
+
22
+ ## edit_image
23
+
24
+ Edit images, or generate with reference images. Calls `POST /backend-api/codex/images/edits`. It takes the same parameters as `generate_image`, plus:
25
+
26
+ | Parameter | Notes |
27
+ |---|---|
28
+ | `images` | Required, 1-5 entries: local paths, `file://` URLs, `http(s)://` URLs, or `data:image/…;base64,…`. PNG, JPEG or WebP, up to 15 MB each. |
29
+
30
+ - **Indexing:** `images[0]` is Image 1, the primary edit target. Refer to the others by index in the prompt.
31
+ - **Inputs:** the input files are never modified.
32
+ - **Iterating:** pass a previous output path as Image 1.
33
+
34
+ ## remove_background
35
+
36
+ Local chroma-key removal. This is a port of the Codex skill's `remove_chroma_key.py`. It makes no network call and uses no quota.
37
+
38
+ | Parameter | Default | Notes |
39
+ |---|---|---|
40
+ | `input_path` | required | PNG or JPEG. |
41
+ | `output_path` | `<input>-transparent.png` | Must be `.png`. Never overwrites unless `overwrite: true`. |
42
+ | `key_color` | auto | Hex color such as `#00ff00`. When omitted, it is the median color of the image border. |
43
+ | `soft_matte` | `true` | Smooth alpha ramp between `transparent_threshold` (12) and `opaque_threshold` (96), using per-channel max distance to the key. |
44
+ | `despill` | `true` | Removes key-color fringe from semi-transparent edge pixels. |
45
+ | `tolerance` | `12` | Hard-key tolerance, used only when `soft_matte: false`. |
46
+ | `edge_contract` | `0` | Erodes the matte by N pixels (0-16) to remove a thin halo. |
47
+ | `edge_feather` | `0` | Gaussian blur radius (0-64) for softer edges. |
48
+
49
+ The result reports the key color used and the fully and partially transparent percentages. It warns when nothing matched or when almost everything became transparent.
50
+
51
+ ## auth_status
52
+
53
+ - **Reports:** whether a usable sign-in exists, which source and ChatGPT account/plan it belongs to, and when its token expires.
54
+ - **Quota:** the usage windows (5-hour and weekly), fetched from `GET /backend-api/wham/usage`, which uses no image quota.
55
+ - **During sign-in:** it also shows any sign-in that is in progress.
56
+
57
+ ## sign_in
58
+
59
+ | Parameter | Default | Notes |
60
+ |---|---|---|
61
+ | `method` | `browser` | `browser`: the user opens a link on this machine, and the sign-in redirects to `http://localhost:1455`. `device`: the user enters a code at `https://auth.openai.com/codex/device` from any device; it must be enabled in ChatGPT → Settings → Security. |
62
+ | `open_browser` | `true` | Tries to open the link automatically. |
63
+ | `force` | `false` | Starts a new sign-in even if one exists, e.g. to switch accounts. |
64
+
65
+ Returns immediately with the link or code, and sign-in completes in the background. Relay the link or code to the user verbatim, then call `auth_status`.
66
+
67
+ ## Where credentials come from
68
+
69
+ The server checks these sources in order:
70
+ 1. **Its own sign-in** (`codex-imagegen-mcp login` or `sign_in`). Refreshed automatically.
71
+ 2. **The Codex CLI/app sign-in** at `~/.codex/auth.json`. Read-only; used while its token is valid.
72
+ 3. **The opencode ChatGPT sign-in** at `~/.local/share/opencode/auth.json`. Read-only.
73
+
74
+ Borrowed sign-ins are never refreshed or modified, because refreshing them would sign the other app out. When a borrowed token expires, opening that app renews it, or you can sign in to this server directly.
75
+
76
+ ## Errors and what to do
77
+
78
+ | Error | Meaning | Do |
79
+ |---|---|---|
80
+ | not signed in / session expired / HTTP 401 | No usable ChatGPT credentials | `sign_in` (relay the link), or ask the user to run the login command in the message, then `auth_status`. |
81
+ | usage limit (HTTP 429) | ChatGPT image or Codex usage limit reached | Stop. Tell the user when it resets (included in the message). |
82
+ | content policy | The prompt or output was blocked by OpenAI's safety system | Rephrase within policy, or ask the user. Don't resend the same prompt. |
83
+ | HTTP 403 | The plan or workspace doesn't include Codex image generation (e.g. Free), or the request was blocked | Tell the user; `auth_status` shows the plan. |
84
+ | server error / network / timeout | Transient | One retry is reasonable (the server already retries 5xx twice). |
85
+ | invalid input | Bad path, unsupported format (GIF, SVG), too large, too many images | Fix the arguments. |
86
+
87
+ ## Limits
88
+ - Up to 5 input images, each at most 15 MB; up to 4 variants per call.
89
+ - Typical latency is 15-60 s per image. Requests are parallel, so `n: 4` takes about as long as one.
90
+ - Service output is a PNG up to about 1672×941 / 1536×1024 / 1024×1536 (roughly 1.5-1.6 MP). Larger or exact sizes need local resizing.