@marlinjai/studio-mcp 0.16.0 → 0.17.0

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/README.md CHANGED
@@ -169,6 +169,7 @@ Nothing breaks for an existing caller that sends a real brand slug: every argume
169
169
  - **`studio_generate_image` no longer requires `brandSlug`.** Leave it out and the image is generated without a brand. Up to 0.4.0 the field was required, so an agent of a company with no brand sent a made-up slug. Since 2026-10-11 the Studio refuses a slug that names no brand of the key's company (`404`, `code: "input_not_found"`) instead of generating without a style into a project of that name, which left such an agent with no way to make an image at all.
170
170
  - **`studio_generate_image` takes `projectId`.** The image is filed in that project (one of the company's, from `studio_list_projects`). Without it the image lands in the project named after the brand, or in `default` when there is no brand.
171
171
  - **The candidate plan is passed through.** The result carries `candidates: { requested, rendered, mayRender? }` as the Studio reported it when it accepted the job, and a `notice` sentence when fewer images will be made than `candidateCount` asked for: most KIE image models render one image whatever the count. Only rendered images are charged.
172
+ - **People never go to KIE.** A request that carries a person (a character, a try-on, a swap, or an uploaded or referenced image or video) runs on the fal model of an automatic entry (`route/...`) only, priced as the fal model, and a model pinned to KIE (`kie/...`) is refused for it with `person_model_not_available` and the fal or automatic entry to use instead.
172
173
  - **A refusal reaches the agent as the Studio worded it.** The Studio's `error` sentence, which names the next step, is handed on unchanged, followed by a `hint` the sentence does not already contain and by the machine `code`, for example `POST /api/generate -> 404: Brand 'acme' not found. Create the brand first (POST /api/brands, or the studio_create_brand tool), or leave brandSlug out to generate without a brand. (code: input_not_found)`. Up to 0.4.0 the `code` and the `hint` were dropped. A client that matched a tool error by its exact full text sees the added ` (code: ...)` suffix; the sentence before it is unchanged.
173
174
  - **Descriptions match the Studio of 2026-10-11.** `studio_get_usage` describes the `credits` field (balance, daily limit, used today, reset time); `studio_list_characters`, `studio_get_character` and the `characterSlug` arguments describe shared characters (readable and castable, not editable, reference images as Studio addresses); `studio_upload_brand_reference` and `studio_replace_character_in_video` say that a slug the company cannot use is a `404` before anything is spent.
174
175
 
@@ -239,7 +240,7 @@ real person: I confirm the likeness acknowledgement for this character.
239
240
 
240
241
  ```text
241
242
  Generate a 16:9 image for brand "busbasis" with Bruno at a workbench in a bright workshop,
242
- model kie/nano-banana-2, and tell me the cost.
243
+ model route/nano-banana-2, and tell me the cost.
243
244
  ```
244
245
 
245
246
  ```text
package/dist/cli.js CHANGED
@@ -565,13 +565,14 @@ var veo = (tier, label) => {
565
565
  fallback: { start: `fal/${slug2}-image-to-video`, startAndEnd: `fal/${slug2}-first-last-frame` }
566
566
  };
567
567
  };
568
- var image = (slug2, label, defaultTier) => ({
568
+ var image = (slug2, label, defaultTier, fallbackWithImages) => ({
569
569
  kind: "image",
570
570
  id: `route/${slug2}`,
571
571
  label: `${label} (KIE, fal fallback)`,
572
572
  primary: `kie/${slug2}`,
573
573
  fallback: `fal/${slug2}`,
574
- defaultTier
574
+ defaultTier,
575
+ ...fallbackWithImages ? { fallbackWithImages } : {}
575
576
  });
576
577
  var ROUTES = [
577
578
  veo("lite", "Veo 3.1 Lite"),
@@ -650,7 +651,8 @@ var ROUTES = [
650
651
  primary: "kie/wan-3-0-image-to-video",
651
652
  fallback: { start: "fal/wan-3-0-image-to-video" }
652
653
  },
653
- image("nano-banana-2", "Nano Banana 2", "1K"),
654
+ // A character or reference image on the default image route: fal takes it on the edit endpoint.
655
+ image("nano-banana-2", "Nano Banana 2", "1K", "fal/nano-banana-2-edit"),
654
656
  image("nano-banana-2-edit", "Nano Banana 2 Edit", "1K"),
655
657
  image("nano-banana-pro", "Nano Banana Pro", "1K"),
656
658
  image("nano-banana-pro-edit", "Nano Banana Pro Edit", "1K"),
@@ -1621,11 +1623,22 @@ var CATALOG_ENTRIES = [
1621
1623
  ];
1622
1624
  var PINNED_FAL_NOTE = "Pinned to fal: a job on this entry never goes to KIE.";
1623
1625
  var PINNED_KIE_NOTE = "Pinned to KIE: no fal fallback. Pick the automatic entry of this model to get one.";
1626
+ var KIE_PERSON_NOTE = "Not available for images of people (a character, a try-on, a swap, or an uploaded or referenced image or video), because KIE offers no data processing agreement.";
1627
+ var ROUTE_PERSON_NOTE = "A request with a person in it (a character, a try-on, a swap, or an uploaded or referenced image or video) skips KIE and runs on fal only, priced as the fal model.";
1628
+ function kiePersonNote(entry) {
1629
+ if (entry.provider !== "kie" || entry.modality !== "image" && entry.modality !== "video") return null;
1630
+ const role = routeRoleOf(entry.id);
1631
+ if (role?.role !== "primary") return `${KIE_PERSON_NOTE} For those, pick a fal model.`;
1632
+ const route = role.route;
1633
+ const twin = route.kind === "image" ? route.fallback : "byResolution" in route.fallback ? Object.values(route.fallback.byResolution)[0] : route.fallback.start;
1634
+ return `${KIE_PERSON_NOTE} For those, pick ${twin} or the automatic entry ${route.id}, which runs them on fal.`;
1635
+ }
1624
1636
  function withRouteNote(entry) {
1625
1637
  const role = routeRoleOf(entry.id);
1626
- if (!role) return entry;
1627
- const note = role.role === "fallback" ? PINNED_FAL_NOTE : PINNED_KIE_NOTE;
1628
- return { ...entry, description: `${entry.description ?? ""} ${note}`.trim() };
1638
+ const person = kiePersonNote(entry);
1639
+ if (!role && !person) return entry;
1640
+ const note = !role ? "" : role.role === "fallback" ? PINNED_FAL_NOTE : PINNED_KIE_NOTE;
1641
+ return { ...entry, description: [entry.description ?? "", note, person ?? ""].filter(Boolean).join(" ").trim() };
1629
1642
  }
1630
1643
  var MODEL_CATALOG = CATALOG_ENTRIES.map(withRouteNote);
1631
1644
  var routeEntries = /* @__PURE__ */ new Map();
@@ -1642,7 +1655,7 @@ function routeEntry(id) {
1642
1655
  isDefault: void 0,
1643
1656
  id: route.id,
1644
1657
  label: route.label,
1645
- description: `Runs on KIE first and, when KIE fails on its side, again on fal with the same settings. ` + `To keep a job off KIE, pin the fal entry of this model. ${primary.description ?? ""}`.trim()
1658
+ description: `Runs on KIE first and, when KIE fails on its side, again on fal with the same settings. ${ROUTE_PERSON_NOTE} ` + `To keep a job off KIE, pin the fal entry of this model. ${primary.description ?? ""}`.trim()
1646
1659
  };
1647
1660
  routeEntries.set(id, entry);
1648
1661
  return entry;
@@ -3270,13 +3283,14 @@ var veo2 = (tier, label) => {
3270
3283
  fallback: { start: `fal/${slug2}-image-to-video`, startAndEnd: `fal/${slug2}-first-last-frame` }
3271
3284
  };
3272
3285
  };
3273
- var image2 = (slug2, label, defaultTier) => ({
3286
+ var image2 = (slug2, label, defaultTier, fallbackWithImages) => ({
3274
3287
  kind: "image",
3275
3288
  id: `route/${slug2}`,
3276
3289
  label: `${label} (KIE, fal fallback)`,
3277
3290
  primary: `kie/${slug2}`,
3278
3291
  fallback: `fal/${slug2}`,
3279
- defaultTier
3292
+ defaultTier,
3293
+ ...fallbackWithImages ? { fallbackWithImages } : {}
3280
3294
  });
3281
3295
  var ROUTES2 = [
3282
3296
  veo2("lite", "Veo 3.1 Lite"),
@@ -3355,7 +3369,8 @@ var ROUTES2 = [
3355
3369
  primary: "kie/wan-3-0-image-to-video",
3356
3370
  fallback: { start: "fal/wan-3-0-image-to-video" }
3357
3371
  },
3358
- image2("nano-banana-2", "Nano Banana 2", "1K"),
3372
+ // A character or reference image on the default image route: fal takes it on the edit endpoint.
3373
+ image2("nano-banana-2", "Nano Banana 2", "1K", "fal/nano-banana-2-edit"),
3359
3374
  image2("nano-banana-2-edit", "Nano Banana 2 Edit", "1K"),
3360
3375
  image2("nano-banana-pro", "Nano Banana Pro", "1K"),
3361
3376
  image2("nano-banana-pro-edit", "Nano Banana Pro Edit", "1K"),
@@ -4326,11 +4341,22 @@ var CATALOG_ENTRIES2 = [
4326
4341
  ];
4327
4342
  var PINNED_FAL_NOTE2 = "Pinned to fal: a job on this entry never goes to KIE.";
4328
4343
  var PINNED_KIE_NOTE2 = "Pinned to KIE: no fal fallback. Pick the automatic entry of this model to get one.";
4344
+ var KIE_PERSON_NOTE2 = "Not available for images of people (a character, a try-on, a swap, or an uploaded or referenced image or video), because KIE offers no data processing agreement.";
4345
+ var ROUTE_PERSON_NOTE2 = "A request with a person in it (a character, a try-on, a swap, or an uploaded or referenced image or video) skips KIE and runs on fal only, priced as the fal model.";
4346
+ function kiePersonNote2(entry) {
4347
+ if (entry.provider !== "kie" || entry.modality !== "image" && entry.modality !== "video") return null;
4348
+ const role = routeRoleOf2(entry.id);
4349
+ if (role?.role !== "primary") return `${KIE_PERSON_NOTE2} For those, pick a fal model.`;
4350
+ const route = role.route;
4351
+ const twin = route.kind === "image" ? route.fallback : "byResolution" in route.fallback ? Object.values(route.fallback.byResolution)[0] : route.fallback.start;
4352
+ return `${KIE_PERSON_NOTE2} For those, pick ${twin} or the automatic entry ${route.id}, which runs them on fal.`;
4353
+ }
4329
4354
  function withRouteNote2(entry) {
4330
4355
  const role = routeRoleOf2(entry.id);
4331
- if (!role) return entry;
4332
- const note = role.role === "fallback" ? PINNED_FAL_NOTE2 : PINNED_KIE_NOTE2;
4333
- return { ...entry, description: `${entry.description ?? ""} ${note}`.trim() };
4356
+ const person = kiePersonNote2(entry);
4357
+ if (!role && !person) return entry;
4358
+ const note = !role ? "" : role.role === "fallback" ? PINNED_FAL_NOTE2 : PINNED_KIE_NOTE2;
4359
+ return { ...entry, description: [entry.description ?? "", note, person ?? ""].filter(Boolean).join(" ").trim() };
4334
4360
  }
4335
4361
  var MODEL_CATALOG2 = CATALOG_ENTRIES2.map(withRouteNote2);
4336
4362
  var routeEntries2 = /* @__PURE__ */ new Map();
@@ -4347,7 +4373,7 @@ function routeEntry2(id) {
4347
4373
  isDefault: void 0,
4348
4374
  id: route.id,
4349
4375
  label: route.label,
4350
- description: `Runs on KIE first and, when KIE fails on its side, again on fal with the same settings. ` + `To keep a job off KIE, pin the fal entry of this model. ${primary.description ?? ""}`.trim()
4376
+ description: `Runs on KIE first and, when KIE fails on its side, again on fal with the same settings. ${ROUTE_PERSON_NOTE2} ` + `To keep a job off KIE, pin the fal entry of this model. ${primary.description ?? ""}`.trim()
4351
4377
  };
4352
4378
  routeEntries2.set(id, entry);
4353
4379
  return entry;
@@ -4894,6 +4920,18 @@ function opTouches(doc, op) {
4894
4920
  }
4895
4921
  return [...out];
4896
4922
  }
4923
+ var MEDIA_INPUT_KEYS = [
4924
+ "inputImages",
4925
+ "inputImage",
4926
+ "inputImageUrl",
4927
+ "endImageUrl",
4928
+ "keyframeImageUrls",
4929
+ "referenceImageUrls",
4930
+ "inputVideoUrl",
4931
+ "draftCacheUrl",
4932
+ "parentAssetId"
4933
+ ];
4934
+ var MEDIA_KEYS = new Set(MEDIA_INPUT_KEYS);
4897
4935
  var RECIPE_EFFECT_TYPES = ["createCharacter", "addCharacterReference", "createBrand", "addBrandReference"];
4898
4936
  var EffectValueSourceSchema = z5.discriminatedUnion("kind", [
4899
4937
  z5.object({ kind: z5.literal("literal"), value: JsonNonNullValueSchema }),
@@ -5262,7 +5300,7 @@ function documentToDefinition(doc, opts = {}) {
5262
5300
  const keyframes = port === "image" && task === "image-to-video" && modelAcceptsKeyframes(node.model);
5263
5301
  const references = port === "reference";
5264
5302
  const listKey = orderedPortKey(task, port, 0, node.model) ?? b.key;
5265
- const items = [];
5303
+ const items2 = [];
5266
5304
  const itemSources = [];
5267
5305
  let uploading = false;
5268
5306
  for (const [ordinal, e] of portWires.entries()) {
@@ -5303,11 +5341,11 @@ function documentToDefinition(doc, opts = {}) {
5303
5341
  if (!item) continue;
5304
5342
  if (single) inputs[key] = item;
5305
5343
  else {
5306
- items.push(item);
5344
+ items2.push(item);
5307
5345
  itemSources.push(e.source);
5308
5346
  }
5309
5347
  }
5310
- if (references && !uploading && items.length > 0) {
5348
+ if (references && !uploading && items2.length > 0) {
5311
5349
  const limits = modelCharacterReferences(node.model);
5312
5350
  const grouped = limits ? referenceElementsFor(
5313
5351
  itemSources,
@@ -5320,7 +5358,7 @@ function documentToDefinition(doc, opts = {}) {
5320
5358
  if (grouped.ok) {
5321
5359
  inputs[listKey] = {
5322
5360
  kind: "list",
5323
- items: grouped.order.map((i) => items[i])
5361
+ items: grouped.order.map((i) => items2[i])
5324
5362
  };
5325
5363
  inputs.referenceElementIndexes = {
5326
5364
  kind: "literal",
@@ -5335,9 +5373,9 @@ function documentToDefinition(doc, opts = {}) {
5335
5373
  }
5336
5374
  continue;
5337
5375
  }
5338
- if (!uploading && items.length > 0)
5339
- inputs[listKey] = { kind: "list", items };
5340
- if (keyframes && !uploading && items.length > 0) {
5376
+ if (!uploading && items2.length > 0)
5377
+ inputs[listKey] = { kind: "list", items: items2 };
5378
+ if (keyframes && !uploading && items2.length > 0) {
5341
5379
  const positions = keyframePositionsFor(
5342
5380
  portWires.map((e) => e.source),
5343
5381
  node.settings
@@ -7116,7 +7154,7 @@ var studioGenerateImage = defineTool({
7116
7154
  projectId: z12.string().min(1).optional().describe(
7117
7155
  'Optional project to file the image under (an id from studio_list_projects; it must be a project of your company, anything else is a 404). Omit it to use the project named after brandSlug, or "default" when there is no brand.'
7118
7156
  ),
7119
- model: z12.string().optional().describe('Image model id (e.g. "kie/nano-banana-2", "fal/nano-banana-2"). Omit for the Studio default.'),
7157
+ model: z12.string().optional().describe('Image model id (e.g. "route/nano-banana-2", "fal/nano-banana-2"). Omit for the Studio default. A model pinned to KIE (kie/...) is not available for images of people (a character, a try-on, a swap, or an uploaded or referenced image) and is refused for them: use its fal entry (fal/...) or its automatic entry (route/...), which runs such a request on fal only.'),
7120
7158
  aspectRatio: z12.string().optional().describe('Aspect ratio such as "1:1", "16:9", "3:4".'),
7121
7159
  imageSize: z12.string().optional().describe('Provider size hint, e.g. "1K", "2K".'),
7122
7160
  seed: z12.number().int().optional(),
@@ -7489,7 +7527,7 @@ var studioUploadBrandReference = defineTool({
7489
7527
  }
7490
7528
  });
7491
7529
  var workflowDefinitionSchema = WorkflowDefinitionSchema.describe(
7492
- `Inline workflow DAG: { id, label?, params?: [{ name, type: string|number|boolean|json, required?, label?, description?, inputType?, cardinality?: one|many, default? }], nodes: [{ id, task (one of the model tasks listed), model (catalog id, e.g. fal/nano-banana-2-edit), inputs, retry? }] }. Node inputs are bindings: {kind:"literal",value}, {kind:"param",name,wrap?:"array"}, {kind:"ref",node,path:"url",wrap?:"array"} or an ordered {kind:"list",items:[...]} of those. Image-edit nodes take inputImages (an array: one wrapped ref/param, or a list in reference order, scene frame first); image-to-video nodes take inputImageUrl (start frame) and optionally endImageUrl (end frame, on models that accept one), EXCEPT on a keyframes model (fal/flux-3-keyframes-to-video and its -draft tier), which instead takes keyframeImageUrls (an ordered list of up to 10 images) with keyframeFrameIndexes (one strictly increasing frame per image on a fixed 24 fps timeline). Pass one shape or the other, never both. To hold a character's identity through the clip, an image-to-video node on a model with character references (route/kling-o3, kie/kling-o3-image-to-video, fal/kling-o3-pro-reference-to-video) also takes referenceImageUrls (a list of character photos, grouped by character, each character's frontal view first, 2 to 4 images per character, up to 3 characters) with referenceElementIndexes (the 0-based character of each image, ascending without gaps, e.g. [0,0,0,1,1]); they never count as the start or end frame, and they need inputImageUrl. kie/gemini-omni-flash-1-1-reference-to-video takes the same two fields with 1 to 6 character images in all and no end frame: its start frame goes in as reference image 1, named in the prompt as the exact scene and first frame, because KIE does not lock a first frame in its reference mode.`
7530
+ `Inline workflow DAG: { id, label?, params?: [{ name, type: string|number|boolean|json, required?, label?, description?, inputType?, cardinality?: one|many, default? }], nodes: [{ id, task (one of the model tasks listed), model (catalog id, e.g. fal/nano-banana-2-edit), inputs, retry? }] }. Node inputs are bindings: {kind:"literal",value}, {kind:"param",name,wrap?:"array"}, {kind:"ref",node,path:"url",wrap?:"array"} or an ordered {kind:"list",items:[...]} of those. Image-edit nodes take inputImages (an array: one wrapped ref/param, or a list in reference order, scene frame first); image-to-video nodes take inputImageUrl (start frame) and optionally endImageUrl (end frame, on models that accept one), EXCEPT on a keyframes model (fal/flux-3-keyframes-to-video and its -draft tier), which instead takes keyframeImageUrls (an ordered list of up to 10 images) with keyframeFrameIndexes (one strictly increasing frame per image on a fixed 24 fps timeline). Pass one shape or the other, never both. To hold a character's identity through the clip, an image-to-video node on a model with character references (route/kling-o3 or fal/kling-o3-pro-reference-to-video; a model pinned to KIE, kie/..., is not available for images of people and refuses a run whose node carries a character, a try-on, a swap or an uploaded or referenced image or video, so use the fal or route/ entry for those) also takes referenceImageUrls (a list of character photos, grouped by character, each character's frontal view first, 2 to 4 images per character, up to 3 characters) with referenceElementIndexes (the 0-based character of each image, ascending without gaps, e.g. [0,0,0,1,1]); they never count as the start or end frame, and they need inputImageUrl. kie/gemini-omni-flash-1-1-reference-to-video takes the same two fields with 1 to 6 character images in all and no end frame: its start frame goes in as reference image 1, named in the prompt as the exact scene and first frame, because KIE does not lock a first frame in its reference mode. It runs on KIE, so while Studio keeps people off KIE it is refused for character references like every other kie/ model.`
7493
7531
  );
7494
7532
  var studioRunWorkflow = defineTool({
7495
7533
  name: "studio_run_workflow",
@@ -7842,7 +7880,7 @@ function registerTools(server, base) {
7842
7880
 
7843
7881
  // src/server.ts
7844
7882
  var SERVER_NAME = "lumitra-studio";
7845
- var SERVER_VERSION = "0.16.0";
7883
+ var SERVER_VERSION = "0.17.0";
7846
7884
  function createStudioMcpServer(opts = {}) {
7847
7885
  const config = opts.config ?? resolveConfig(opts.env ?? process.env);
7848
7886
  const client = new StudioClient(config, {
package/dist/index.d.ts CHANGED
@@ -2182,7 +2182,7 @@ declare function registerTools(server: McpServer, base: ToolContext): void;
2182
2182
  */
2183
2183
 
2184
2184
  declare const SERVER_NAME = "lumitra-studio";
2185
- declare const SERVER_VERSION = "0.16.0";
2185
+ declare const SERVER_VERSION = "0.17.0";
2186
2186
  interface CreateServerOptions {
2187
2187
  config?: StudioConfig;
2188
2188
  env?: NodeJS.ProcessEnv;
package/dist/index.js CHANGED
@@ -557,13 +557,14 @@ var veo = (tier, label) => {
557
557
  fallback: { start: `fal/${slug2}-image-to-video`, startAndEnd: `fal/${slug2}-first-last-frame` }
558
558
  };
559
559
  };
560
- var image = (slug2, label, defaultTier) => ({
560
+ var image = (slug2, label, defaultTier, fallbackWithImages) => ({
561
561
  kind: "image",
562
562
  id: `route/${slug2}`,
563
563
  label: `${label} (KIE, fal fallback)`,
564
564
  primary: `kie/${slug2}`,
565
565
  fallback: `fal/${slug2}`,
566
- defaultTier
566
+ defaultTier,
567
+ ...fallbackWithImages ? { fallbackWithImages } : {}
567
568
  });
568
569
  var ROUTES = [
569
570
  veo("lite", "Veo 3.1 Lite"),
@@ -642,7 +643,8 @@ var ROUTES = [
642
643
  primary: "kie/wan-3-0-image-to-video",
643
644
  fallback: { start: "fal/wan-3-0-image-to-video" }
644
645
  },
645
- image("nano-banana-2", "Nano Banana 2", "1K"),
646
+ // A character or reference image on the default image route: fal takes it on the edit endpoint.
647
+ image("nano-banana-2", "Nano Banana 2", "1K", "fal/nano-banana-2-edit"),
646
648
  image("nano-banana-2-edit", "Nano Banana 2 Edit", "1K"),
647
649
  image("nano-banana-pro", "Nano Banana Pro", "1K"),
648
650
  image("nano-banana-pro-edit", "Nano Banana Pro Edit", "1K"),
@@ -1613,11 +1615,22 @@ var CATALOG_ENTRIES = [
1613
1615
  ];
1614
1616
  var PINNED_FAL_NOTE = "Pinned to fal: a job on this entry never goes to KIE.";
1615
1617
  var PINNED_KIE_NOTE = "Pinned to KIE: no fal fallback. Pick the automatic entry of this model to get one.";
1618
+ var KIE_PERSON_NOTE = "Not available for images of people (a character, a try-on, a swap, or an uploaded or referenced image or video), because KIE offers no data processing agreement.";
1619
+ var ROUTE_PERSON_NOTE = "A request with a person in it (a character, a try-on, a swap, or an uploaded or referenced image or video) skips KIE and runs on fal only, priced as the fal model.";
1620
+ function kiePersonNote(entry) {
1621
+ if (entry.provider !== "kie" || entry.modality !== "image" && entry.modality !== "video") return null;
1622
+ const role = routeRoleOf(entry.id);
1623
+ if (role?.role !== "primary") return `${KIE_PERSON_NOTE} For those, pick a fal model.`;
1624
+ const route = role.route;
1625
+ const twin = route.kind === "image" ? route.fallback : "byResolution" in route.fallback ? Object.values(route.fallback.byResolution)[0] : route.fallback.start;
1626
+ return `${KIE_PERSON_NOTE} For those, pick ${twin} or the automatic entry ${route.id}, which runs them on fal.`;
1627
+ }
1616
1628
  function withRouteNote(entry) {
1617
1629
  const role = routeRoleOf(entry.id);
1618
- if (!role) return entry;
1619
- const note = role.role === "fallback" ? PINNED_FAL_NOTE : PINNED_KIE_NOTE;
1620
- return { ...entry, description: `${entry.description ?? ""} ${note}`.trim() };
1630
+ const person = kiePersonNote(entry);
1631
+ if (!role && !person) return entry;
1632
+ const note = !role ? "" : role.role === "fallback" ? PINNED_FAL_NOTE : PINNED_KIE_NOTE;
1633
+ return { ...entry, description: [entry.description ?? "", note, person ?? ""].filter(Boolean).join(" ").trim() };
1621
1634
  }
1622
1635
  var MODEL_CATALOG = CATALOG_ENTRIES.map(withRouteNote);
1623
1636
  var routeEntries = /* @__PURE__ */ new Map();
@@ -1634,7 +1647,7 @@ function routeEntry(id) {
1634
1647
  isDefault: void 0,
1635
1648
  id: route.id,
1636
1649
  label: route.label,
1637
- description: `Runs on KIE first and, when KIE fails on its side, again on fal with the same settings. ` + `To keep a job off KIE, pin the fal entry of this model. ${primary.description ?? ""}`.trim()
1650
+ description: `Runs on KIE first and, when KIE fails on its side, again on fal with the same settings. ${ROUTE_PERSON_NOTE} ` + `To keep a job off KIE, pin the fal entry of this model. ${primary.description ?? ""}`.trim()
1638
1651
  };
1639
1652
  routeEntries.set(id, entry);
1640
1653
  return entry;
@@ -3262,13 +3275,14 @@ var veo2 = (tier, label) => {
3262
3275
  fallback: { start: `fal/${slug2}-image-to-video`, startAndEnd: `fal/${slug2}-first-last-frame` }
3263
3276
  };
3264
3277
  };
3265
- var image2 = (slug2, label, defaultTier) => ({
3278
+ var image2 = (slug2, label, defaultTier, fallbackWithImages) => ({
3266
3279
  kind: "image",
3267
3280
  id: `route/${slug2}`,
3268
3281
  label: `${label} (KIE, fal fallback)`,
3269
3282
  primary: `kie/${slug2}`,
3270
3283
  fallback: `fal/${slug2}`,
3271
- defaultTier
3284
+ defaultTier,
3285
+ ...fallbackWithImages ? { fallbackWithImages } : {}
3272
3286
  });
3273
3287
  var ROUTES2 = [
3274
3288
  veo2("lite", "Veo 3.1 Lite"),
@@ -3347,7 +3361,8 @@ var ROUTES2 = [
3347
3361
  primary: "kie/wan-3-0-image-to-video",
3348
3362
  fallback: { start: "fal/wan-3-0-image-to-video" }
3349
3363
  },
3350
- image2("nano-banana-2", "Nano Banana 2", "1K"),
3364
+ // A character or reference image on the default image route: fal takes it on the edit endpoint.
3365
+ image2("nano-banana-2", "Nano Banana 2", "1K", "fal/nano-banana-2-edit"),
3351
3366
  image2("nano-banana-2-edit", "Nano Banana 2 Edit", "1K"),
3352
3367
  image2("nano-banana-pro", "Nano Banana Pro", "1K"),
3353
3368
  image2("nano-banana-pro-edit", "Nano Banana Pro Edit", "1K"),
@@ -4318,11 +4333,22 @@ var CATALOG_ENTRIES2 = [
4318
4333
  ];
4319
4334
  var PINNED_FAL_NOTE2 = "Pinned to fal: a job on this entry never goes to KIE.";
4320
4335
  var PINNED_KIE_NOTE2 = "Pinned to KIE: no fal fallback. Pick the automatic entry of this model to get one.";
4336
+ var KIE_PERSON_NOTE2 = "Not available for images of people (a character, a try-on, a swap, or an uploaded or referenced image or video), because KIE offers no data processing agreement.";
4337
+ var ROUTE_PERSON_NOTE2 = "A request with a person in it (a character, a try-on, a swap, or an uploaded or referenced image or video) skips KIE and runs on fal only, priced as the fal model.";
4338
+ function kiePersonNote2(entry) {
4339
+ if (entry.provider !== "kie" || entry.modality !== "image" && entry.modality !== "video") return null;
4340
+ const role = routeRoleOf2(entry.id);
4341
+ if (role?.role !== "primary") return `${KIE_PERSON_NOTE2} For those, pick a fal model.`;
4342
+ const route = role.route;
4343
+ const twin = route.kind === "image" ? route.fallback : "byResolution" in route.fallback ? Object.values(route.fallback.byResolution)[0] : route.fallback.start;
4344
+ return `${KIE_PERSON_NOTE2} For those, pick ${twin} or the automatic entry ${route.id}, which runs them on fal.`;
4345
+ }
4321
4346
  function withRouteNote2(entry) {
4322
4347
  const role = routeRoleOf2(entry.id);
4323
- if (!role) return entry;
4324
- const note = role.role === "fallback" ? PINNED_FAL_NOTE2 : PINNED_KIE_NOTE2;
4325
- return { ...entry, description: `${entry.description ?? ""} ${note}`.trim() };
4348
+ const person = kiePersonNote2(entry);
4349
+ if (!role && !person) return entry;
4350
+ const note = !role ? "" : role.role === "fallback" ? PINNED_FAL_NOTE2 : PINNED_KIE_NOTE2;
4351
+ return { ...entry, description: [entry.description ?? "", note, person ?? ""].filter(Boolean).join(" ").trim() };
4326
4352
  }
4327
4353
  var MODEL_CATALOG2 = CATALOG_ENTRIES2.map(withRouteNote2);
4328
4354
  var routeEntries2 = /* @__PURE__ */ new Map();
@@ -4339,7 +4365,7 @@ function routeEntry2(id) {
4339
4365
  isDefault: void 0,
4340
4366
  id: route.id,
4341
4367
  label: route.label,
4342
- description: `Runs on KIE first and, when KIE fails on its side, again on fal with the same settings. ` + `To keep a job off KIE, pin the fal entry of this model. ${primary.description ?? ""}`.trim()
4368
+ description: `Runs on KIE first and, when KIE fails on its side, again on fal with the same settings. ${ROUTE_PERSON_NOTE2} ` + `To keep a job off KIE, pin the fal entry of this model. ${primary.description ?? ""}`.trim()
4343
4369
  };
4344
4370
  routeEntries2.set(id, entry);
4345
4371
  return entry;
@@ -4886,6 +4912,18 @@ function opTouches(doc, op) {
4886
4912
  }
4887
4913
  return [...out];
4888
4914
  }
4915
+ var MEDIA_INPUT_KEYS = [
4916
+ "inputImages",
4917
+ "inputImage",
4918
+ "inputImageUrl",
4919
+ "endImageUrl",
4920
+ "keyframeImageUrls",
4921
+ "referenceImageUrls",
4922
+ "inputVideoUrl",
4923
+ "draftCacheUrl",
4924
+ "parentAssetId"
4925
+ ];
4926
+ var MEDIA_KEYS = new Set(MEDIA_INPUT_KEYS);
4889
4927
  var RECIPE_EFFECT_TYPES = ["createCharacter", "addCharacterReference", "createBrand", "addBrandReference"];
4890
4928
  var EffectValueSourceSchema = z5.discriminatedUnion("kind", [
4891
4929
  z5.object({ kind: z5.literal("literal"), value: JsonNonNullValueSchema }),
@@ -5254,7 +5292,7 @@ function documentToDefinition(doc, opts = {}) {
5254
5292
  const keyframes = port === "image" && task === "image-to-video" && modelAcceptsKeyframes(node.model);
5255
5293
  const references = port === "reference";
5256
5294
  const listKey = orderedPortKey(task, port, 0, node.model) ?? b.key;
5257
- const items = [];
5295
+ const items2 = [];
5258
5296
  const itemSources = [];
5259
5297
  let uploading = false;
5260
5298
  for (const [ordinal, e] of portWires.entries()) {
@@ -5295,11 +5333,11 @@ function documentToDefinition(doc, opts = {}) {
5295
5333
  if (!item) continue;
5296
5334
  if (single) inputs[key] = item;
5297
5335
  else {
5298
- items.push(item);
5336
+ items2.push(item);
5299
5337
  itemSources.push(e.source);
5300
5338
  }
5301
5339
  }
5302
- if (references && !uploading && items.length > 0) {
5340
+ if (references && !uploading && items2.length > 0) {
5303
5341
  const limits = modelCharacterReferences(node.model);
5304
5342
  const grouped = limits ? referenceElementsFor(
5305
5343
  itemSources,
@@ -5312,7 +5350,7 @@ function documentToDefinition(doc, opts = {}) {
5312
5350
  if (grouped.ok) {
5313
5351
  inputs[listKey] = {
5314
5352
  kind: "list",
5315
- items: grouped.order.map((i) => items[i])
5353
+ items: grouped.order.map((i) => items2[i])
5316
5354
  };
5317
5355
  inputs.referenceElementIndexes = {
5318
5356
  kind: "literal",
@@ -5327,9 +5365,9 @@ function documentToDefinition(doc, opts = {}) {
5327
5365
  }
5328
5366
  continue;
5329
5367
  }
5330
- if (!uploading && items.length > 0)
5331
- inputs[listKey] = { kind: "list", items };
5332
- if (keyframes && !uploading && items.length > 0) {
5368
+ if (!uploading && items2.length > 0)
5369
+ inputs[listKey] = { kind: "list", items: items2 };
5370
+ if (keyframes && !uploading && items2.length > 0) {
5333
5371
  const positions = keyframePositionsFor(
5334
5372
  portWires.map((e) => e.source),
5335
5373
  node.settings
@@ -7111,7 +7149,7 @@ var studioGenerateImage = defineTool({
7111
7149
  projectId: z12.string().min(1).optional().describe(
7112
7150
  'Optional project to file the image under (an id from studio_list_projects; it must be a project of your company, anything else is a 404). Omit it to use the project named after brandSlug, or "default" when there is no brand.'
7113
7151
  ),
7114
- model: z12.string().optional().describe('Image model id (e.g. "kie/nano-banana-2", "fal/nano-banana-2"). Omit for the Studio default.'),
7152
+ model: z12.string().optional().describe('Image model id (e.g. "route/nano-banana-2", "fal/nano-banana-2"). Omit for the Studio default. A model pinned to KIE (kie/...) is not available for images of people (a character, a try-on, a swap, or an uploaded or referenced image) and is refused for them: use its fal entry (fal/...) or its automatic entry (route/...), which runs such a request on fal only.'),
7115
7153
  aspectRatio: z12.string().optional().describe('Aspect ratio such as "1:1", "16:9", "3:4".'),
7116
7154
  imageSize: z12.string().optional().describe('Provider size hint, e.g. "1K", "2K".'),
7117
7155
  seed: z12.number().int().optional(),
@@ -7484,7 +7522,7 @@ var studioUploadBrandReference = defineTool({
7484
7522
  }
7485
7523
  });
7486
7524
  var workflowDefinitionSchema = WorkflowDefinitionSchema.describe(
7487
- `Inline workflow DAG: { id, label?, params?: [{ name, type: string|number|boolean|json, required?, label?, description?, inputType?, cardinality?: one|many, default? }], nodes: [{ id, task (one of the model tasks listed), model (catalog id, e.g. fal/nano-banana-2-edit), inputs, retry? }] }. Node inputs are bindings: {kind:"literal",value}, {kind:"param",name,wrap?:"array"}, {kind:"ref",node,path:"url",wrap?:"array"} or an ordered {kind:"list",items:[...]} of those. Image-edit nodes take inputImages (an array: one wrapped ref/param, or a list in reference order, scene frame first); image-to-video nodes take inputImageUrl (start frame) and optionally endImageUrl (end frame, on models that accept one), EXCEPT on a keyframes model (fal/flux-3-keyframes-to-video and its -draft tier), which instead takes keyframeImageUrls (an ordered list of up to 10 images) with keyframeFrameIndexes (one strictly increasing frame per image on a fixed 24 fps timeline). Pass one shape or the other, never both. To hold a character's identity through the clip, an image-to-video node on a model with character references (route/kling-o3, kie/kling-o3-image-to-video, fal/kling-o3-pro-reference-to-video) also takes referenceImageUrls (a list of character photos, grouped by character, each character's frontal view first, 2 to 4 images per character, up to 3 characters) with referenceElementIndexes (the 0-based character of each image, ascending without gaps, e.g. [0,0,0,1,1]); they never count as the start or end frame, and they need inputImageUrl. kie/gemini-omni-flash-1-1-reference-to-video takes the same two fields with 1 to 6 character images in all and no end frame: its start frame goes in as reference image 1, named in the prompt as the exact scene and first frame, because KIE does not lock a first frame in its reference mode.`
7525
+ `Inline workflow DAG: { id, label?, params?: [{ name, type: string|number|boolean|json, required?, label?, description?, inputType?, cardinality?: one|many, default? }], nodes: [{ id, task (one of the model tasks listed), model (catalog id, e.g. fal/nano-banana-2-edit), inputs, retry? }] }. Node inputs are bindings: {kind:"literal",value}, {kind:"param",name,wrap?:"array"}, {kind:"ref",node,path:"url",wrap?:"array"} or an ordered {kind:"list",items:[...]} of those. Image-edit nodes take inputImages (an array: one wrapped ref/param, or a list in reference order, scene frame first); image-to-video nodes take inputImageUrl (start frame) and optionally endImageUrl (end frame, on models that accept one), EXCEPT on a keyframes model (fal/flux-3-keyframes-to-video and its -draft tier), which instead takes keyframeImageUrls (an ordered list of up to 10 images) with keyframeFrameIndexes (one strictly increasing frame per image on a fixed 24 fps timeline). Pass one shape or the other, never both. To hold a character's identity through the clip, an image-to-video node on a model with character references (route/kling-o3 or fal/kling-o3-pro-reference-to-video; a model pinned to KIE, kie/..., is not available for images of people and refuses a run whose node carries a character, a try-on, a swap or an uploaded or referenced image or video, so use the fal or route/ entry for those) also takes referenceImageUrls (a list of character photos, grouped by character, each character's frontal view first, 2 to 4 images per character, up to 3 characters) with referenceElementIndexes (the 0-based character of each image, ascending without gaps, e.g. [0,0,0,1,1]); they never count as the start or end frame, and they need inputImageUrl. kie/gemini-omni-flash-1-1-reference-to-video takes the same two fields with 1 to 6 character images in all and no end frame: its start frame goes in as reference image 1, named in the prompt as the exact scene and first frame, because KIE does not lock a first frame in its reference mode. It runs on KIE, so while Studio keeps people off KIE it is refused for character references like every other kie/ model.`
7488
7526
  );
7489
7527
  var studioRunWorkflow = defineTool({
7490
7528
  name: "studio_run_workflow",
@@ -7837,7 +7875,7 @@ function registerTools(server, base) {
7837
7875
 
7838
7876
  // src/server.ts
7839
7877
  var SERVER_NAME = "lumitra-studio";
7840
- var SERVER_VERSION = "0.16.0";
7878
+ var SERVER_VERSION = "0.17.0";
7841
7879
  function createStudioMcpServer(opts = {}) {
7842
7880
  const config = opts.config ?? resolveConfig(opts.env ?? process.env);
7843
7881
  const client = new StudioClient(config, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marlinjai/studio-mcp",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "private": false,
5
5
  "description": "Model Context Protocol (MCP) server over the Lumitra Studio HTTP API: generate images, mint characters, run workflows, swap characters into video.",
6
6
  "license": "MIT",