@marlinjai/studio-mcp 0.11.0 → 0.13.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
@@ -84,7 +84,7 @@ The token is held in memory only. It is never logged, never serialized into a re
84
84
  | Tool | What it does |
85
85
  |---|---|
86
86
  | `studio_list_projects` | List projects (id, slug, name). A `projectId` is needed by the workflow-based tools and optional on `studio_generate_image` and `studio_generate_3d`. |
87
- | `studio_generate_image` | Submit an image generation, wait for it, return the signed URL and cost. Only `prompt` is required: `brandSlug` (a brand of the key's company) applies that brand's style and references, and leaving it out generates without a brand; `characterSlug` pins a character; `projectId` chooses the project the image is filed in. A `brandSlug` or `characterSlug` the company cannot use is refused with `404` `input_not_found` before anything is spent. The result carries `candidates: { requested, rendered, mayRender? }` and, when the model renders fewer images than `candidateCount` asked for, a `notice`. `wait=false` returns the `jobId`. |
87
+ | `studio_generate_image` | Submit an image generation, wait for it, return the signed URL and cost. Only `prompt` is required: `brandSlug` (a brand of the key's company) applies that brand's style and references, and leaving it out generates without a brand; `characterSlug` pins a character; `mentions` (0.13.0) puts several characters, products and locations of the company in one image, in prompt order (`[{ kind, id: slug }]`, at most 10; more references than the model takes is a `400` `too_many_references`, one without a reference image a `422` `mention_without_reference`); `projectId` chooses the project the image is filed in. A `brandSlug`, `characterSlug` or mention the company cannot use is refused with `404` `input_not_found` before anything is spent. The result carries `candidates: { requested, rendered, mayRender? }` and, when the model renders fewer images than `candidateCount` asked for, a `notice`. `wait=false` returns the `jobId`. |
88
88
  | `studio_generate_3d` | Generate one 3D model (a textured GLB mesh) from a prompt or one image through 3D AI Studio, wait for it, return the signed GLB URL and cost (the price follows the model and the quality flags). Refuses a model and image mismatch before submitting. `wait=false` returns the `jobId`. |
89
89
  | `studio_rig_3d` | Rig a humanoid Model3D and apply up to 10 Meshy animation presets (by name or id) through a one-node workflow; returns the rigged GLB, each clip's name and url, and the cost ($0.20 per rig plus $0.12 per preset). Refuses an unknown preset, with close matches, before submitting. |
90
90
  | `studio_find_animations` | Search Meshy's 678-preset animation library by words. Local, free, no request. |
@@ -118,6 +118,7 @@ The token is held in memory only. It is never logged, never serialized into a re
118
118
  | `studio_composition_send_to_social` | Send the rendered post to Lumitra Social as a draft or scheduled post (a reel, an image, or a carousel of 2 to 10 slides). Idempotent: a retry with the same key resumes and never posts twice. |
119
119
  | `studio_create_project` / `studio_rename_project` | Create a project by name, or rename one. Any member's key may. |
120
120
  | `studio_delete_project` | Delete a project for everyone with its workflows, runs, assets and chats. Needs an admin key, and the PERSON's yes: the tool asks them through the client's confirmation dialog (Model Context Protocol elicitation), or, for a client without one, returns `confirmationRequired` with a `summary` and a one-time `confirmationToken` the agent may only send back after the person said yes in the chat. Refused for the default project and while work is running. |
121
+ | `studio_delete_asset` | Delete one asset (an image, a video, a rendered slide or reel) for everyone with its stored file. Needs an admin key, and the PERSON's yes, confirmed the same way as a project delete. Refused while a post, a saved workflow, a published recipe or work in flight still uses it: the result then carries `usedIn` with each place and nothing is deleted. Records of what happened (campaign shots, sent posts, past runs, the job and its cost) survive without it. |
121
122
  | `studio_list_workflows` / `studio_move_workflow` | List a project's saved workflows; move one to another project with its runs and results (reversible, not confirmed). |
122
123
  | `studio_list_campaigns` / `studio_delete_campaign` | List the company's campaigns; delete one with its shot list (its images stay), confirmed by the person exactly like a project delete. |
123
124
  | `studio_list_published` | List every published recipe: `{ recipes: [{ slug, label, publishedRevision, updatedAt, hasEffects }] }`. `hasEffects` tells you whether running it creates/attaches an entity record (a character, a brand reference) on success, versus a pure generation recipe. Free, read-only. |
package/dist/cli.js CHANGED
@@ -171,6 +171,12 @@ var StudioClient = class {
171
171
  deleteProject(projectId) {
172
172
  return this.json("DELETE", `/api/v1/projects/${encodeURIComponent(projectId)}`);
173
173
  }
174
+ describeAssetUsage(projectId, assetId) {
175
+ return this.json("GET", `/api/v1/projects/${encodeURIComponent(projectId)}/assets/${encodeURIComponent(assetId)}`);
176
+ }
177
+ deleteAsset(projectId, assetId) {
178
+ return this.json("DELETE", `/api/v1/projects/${encodeURIComponent(projectId)}/assets/${encodeURIComponent(assetId)}`);
179
+ }
174
180
  // ── Saved workflows (listing and moving; authoring lives with the workflow tools) ──
175
181
  listWorkflows(opts = {}) {
176
182
  return this.json("GET", `/api/v1/workflows${projectQuery(opts.projectId)}`);
@@ -196,7 +202,9 @@ var StudioClient = class {
196
202
  * use is refused with 404 `input_not_found` before anything is spent (since
197
203
  * 2026-10-11; it used to generate without the brand). `projectId` chooses the
198
204
  * project; without it the job lands in the project named after the brand, or
199
- * in `default`.
205
+ * in `default`. `mentions` (since 2026-10-25) puts several characters,
206
+ * products and locations in one image, in prompt order, each by its slug;
207
+ * more references than the model takes is a 400 `too_many_references`.
200
208
  */
201
209
  generate(body) {
202
210
  return this.json("POST", "/api/generate", { json: body });
@@ -728,7 +736,10 @@ var CATALOG_ENTRIES = [
728
736
  task: "text-to-image",
729
737
  label: "Imagen 4 Fast (KIE)",
730
738
  description: "Google Imagen 4 Fast via KIE. No IP indemnity.",
731
- capabilities: { resolutions: [] }
739
+ // Text only: KIE's imagen4-fast input has no image field, so the adapter
740
+ // (buildKieInput) sends none. Declared, so a reference is refused before
741
+ // spend instead of being dropped after it.
742
+ capabilities: { resolutions: [], maxInputImages: 0 }
732
743
  },
733
744
  {
734
745
  id: "kie/seedream-v4",
@@ -736,7 +747,9 @@ var CATALOG_ENTRIES = [
736
747
  modality: "image",
737
748
  task: "text-to-image",
738
749
  label: "Seedream V4 (KIE)",
739
- description: "ByteDance Seedream V4 via KIE. Stylized output not available on Vertex. No IP indemnity."
750
+ description: "ByteDance Seedream V4 via KIE. Stylized output not available on Vertex. No IP indemnity.",
751
+ // Text only, like imagen-4-fast: the seedream-v4 text-to-image input has no image field.
752
+ capabilities: { maxInputImages: 0 }
740
753
  },
741
754
  // ── KIE.ai: newer image models, the cheaper route (price feed 2026-09-23) ─
742
755
  {
@@ -3382,7 +3395,10 @@ var CATALOG_ENTRIES2 = [
3382
3395
  task: "text-to-image",
3383
3396
  label: "Imagen 4 Fast (KIE)",
3384
3397
  description: "Google Imagen 4 Fast via KIE. No IP indemnity.",
3385
- capabilities: { resolutions: [] }
3398
+ // Text only: KIE's imagen4-fast input has no image field, so the adapter
3399
+ // (buildKieInput) sends none. Declared, so a reference is refused before
3400
+ // spend instead of being dropped after it.
3401
+ capabilities: { resolutions: [], maxInputImages: 0 }
3386
3402
  },
3387
3403
  {
3388
3404
  id: "kie/seedream-v4",
@@ -3390,7 +3406,9 @@ var CATALOG_ENTRIES2 = [
3390
3406
  modality: "image",
3391
3407
  task: "text-to-image",
3392
3408
  label: "Seedream V4 (KIE)",
3393
- description: "ByteDance Seedream V4 via KIE. Stylized output not available on Vertex. No IP indemnity."
3409
+ description: "ByteDance Seedream V4 via KIE. Stylized output not available on Vertex. No IP indemnity.",
3410
+ // Text only, like imagen-4-fast: the seedream-v4 text-to-image input has no image field.
3411
+ capabilities: { maxInputImages: 0 }
3394
3412
  },
3395
3413
  // ── KIE.ai: newer image models, the cheaper route (price feed 2026-09-23) ─
3396
3414
  {
@@ -6633,6 +6651,15 @@ function campaignDeleteSummary(c) {
6633
6651
  const kept = c.imagesKept > 0 ? ` Its ${count(c.imagesKept, "image stays", "images stay")} in the asset library.` : "";
6634
6652
  return `Delete the campaign "${c.name}" with its ${count(c.shots, "shot", "shots")} and every approve and reject decision?${kept} This cannot be undone.`;
6635
6653
  }
6654
+ function assetReferenceLines(refs) {
6655
+ return refs.map((r) => `- ${r.label}: ${r.detail}`).join("\n");
6656
+ }
6657
+ function assetDeleteSummary(u) {
6658
+ const kind = u.subtype === "Image" ? "image" : u.subtype === "Video" ? "video" : u.subtype === "CarouselSlide" ? "rendered slide" : u.subtype === "Reel" ? "rendered reel" : `${u.subtype} asset`;
6659
+ const prompt = u.prompt?.trim();
6660
+ const named = prompt ? ` "${prompt.length > 120 ? `${prompt.slice(0, 117)}...` : prompt}"` : "";
6661
+ return `Delete the ${kind}${named} made ${u.createdAt.slice(0, 10)} (id ${u.assetId}) for everyone in the company, with its stored file? Campaign shots, sent posts and past runs keep their record without it. This cannot be undone.`;
6662
+ }
6636
6663
  function projectSubject(c) {
6637
6664
  return ["delete-project", c.project.id, c.project.name, c.workflows, c.publishedWorkflows, c.runs, c.assets, c.chats, c.campaignShots].join(":");
6638
6665
  }
@@ -6715,6 +6742,42 @@ var studioDeleteProject = defineTool({
6715
6742
  }
6716
6743
  }
6717
6744
  });
6745
+ var IN_USE_INSTRUCTION = "Nothing was deleted. Tell the person where the asset is still used (`usedIn`). Removing it from a post or a workflow is their edit to make (or yours with the composition or workflow tools, if they ask); work in flight has to finish first. Then call this tool again.";
6746
+ var studioDeleteAsset = defineTool({
6747
+ name: "studio_delete_asset",
6748
+ description: "Delete one asset (an image, a video, a rendered slide or reel) of your company for everyone, with its stored file. Needs a key with the company admin role. Refused while a post (a carousel slide or reel clip), a saved workflow or published recipe (a source node, a baked reference, a node pinned to the generation that made it) or work in flight (a generation, a run, a send to Lumitra Social) still uses it: the tool then returns `usedIn` with each place, and nothing is deleted. Records of what happened survive without it (campaign shots, product links, derived assets, the job and its cost, sent posts). The PERSON confirms every delete in the chat: this tool asks them through the client's confirmation dialog before anything happens. If the client has no such dialog, the tool returns `confirmationRequired` with a `summary` and a `confirmationToken`: show the summary to the person exactly as written, and only after they explicitly say yes call again with the token. Never confirm on their behalf.",
6749
+ inputSchema: {
6750
+ projectId: z10.string().min(1).describe("The project the asset is in, from studio_list_projects."),
6751
+ assetId: z10.string().min(1).describe("The asset, from studio_list_assets."),
6752
+ confirmationToken
6753
+ },
6754
+ annotations: { destructiveHint: true },
6755
+ handler: async (args, ctx) => {
6756
+ const inUse = (references) => ({
6757
+ deleted: false,
6758
+ inUse: true,
6759
+ usedIn: references,
6760
+ message: `The asset is still used:
6761
+ ${assetReferenceLines(references)}`,
6762
+ instruction: IN_USE_INSTRUCTION
6763
+ });
6764
+ const usage = await ctx.client.describeAssetUsage(args.projectId, args.assetId);
6765
+ if (usage.references.length > 0) return inUse(usage.references);
6766
+ const summary = assetDeleteSummary(usage);
6767
+ const gate = await confirmWithPerson(ctx, summary, ["delete-asset", args.projectId, args.assetId].join(":"), args.confirmationToken);
6768
+ if (gate !== "proceed") return gate;
6769
+ try {
6770
+ const res = await ctx.client.deleteAsset(args.projectId, args.assetId);
6771
+ return { deleted: true, assetId: res.assetId, filesDeleted: res.filesDeleted, filesKept: res.filesKept, summary };
6772
+ } catch (err) {
6773
+ if (err instanceof StudioApiError && err.status === 409) {
6774
+ const refs = err.body?.references ?? [];
6775
+ return inUse(refs);
6776
+ }
6777
+ return roleRefusal(err, "Deleting an asset needs a key with the company admin role; this key does not have it.");
6778
+ }
6779
+ }
6780
+ });
6718
6781
  var studioListWorkflows = defineTool({
6719
6782
  name: "studio_list_workflows",
6720
6783
  description: "List the saved workflows of one project (savedId, label, version). Omit projectId for the company's default project. Use the savedId with studio_workflow_get, studio_run_workflow or studio_move_workflow.",
@@ -6773,6 +6836,7 @@ var MANAGE_TOOLS = [
6773
6836
  studioCreateProject,
6774
6837
  studioRenameProject,
6775
6838
  studioDeleteProject,
6839
+ studioDeleteAsset,
6776
6840
  studioListWorkflows,
6777
6841
  studioMoveWorkflow,
6778
6842
  studioListCampaigns,
@@ -6853,7 +6917,7 @@ var studioListProjects = defineTool({
6853
6917
  });
6854
6918
  var studioGenerateImage = defineTool({
6855
6919
  name: "studio_generate_image",
6856
- description: "Generate an image from a prompt. A brand is optional: pass brandSlug to have the Studio apply that brand's style prefix and reference images server-side, or leave it out for an image without a brand. Optionally pin a character (characterSlug) so its identity references are injected too. A brandSlug or characterSlug that names nothing your company can use is refused before anything is spent (404, code input_not_found), and the error text says what to do next: act on it or relay it as written. The image is filed in projectId when given, otherwise in the project named after the brand (created on first use), otherwise in the project \"default\". Submits a job and, when wait=true (default), polls until it finishes and returns the signed image URL and costUsd (what the job cost your company: for a company on prepaid credits, what left its balance). With wait=false it returns the jobId immediately for studio_get_job. candidateCount asks for up to four candidates, but some models render one image regardless of the count: the result carries `candidates: { requested, rendered, mayRender? }`, and a `notice` to pass on to the user whenever fewer images will be made than were asked for. A typical image costs about $0.06 on prepaid credits without a subscription; the job's costUsd is the exact amount.",
6920
+ description: "Generate an image from a prompt. A brand is optional: pass brandSlug to have the Studio apply that brand's style prefix and reference images server-side, or leave it out for an image without a brand. Optionally pin a character (characterSlug) so its identity references are injected too, or put several characters, products and locations of your company in one image with mentions (in prompt order). A brandSlug, characterSlug or mention that names nothing your company can use is refused before anything is spent (404, code input_not_found), and the error text says what to do next: act on it or relay it as written. The image is filed in projectId when given, otherwise in the project named after the brand (created on first use), otherwise in the project \"default\". Submits a job and, when wait=true (default), polls until it finishes and returns the signed image URL and costUsd (what the job cost your company: for a company on prepaid credits, what left its balance). With wait=false it returns the jobId immediately for studio_get_job. candidateCount asks for up to four candidates, but some models render one image regardless of the count: the result carries `candidates: { requested, rendered, mayRender? }`, and a `notice` to pass on to the user whenever fewer images will be made than were asked for. A typical image costs about $0.06 on prepaid credits without a subscription; the job's costUsd is the exact amount.",
6857
6921
  inputSchema: {
6858
6922
  brandSlug: slug.optional().describe(
6859
6923
  "Optional. The slug of a brand of your company (create one with studio_create_brand). Omit it to generate without a brand. A slug that names no brand of your company is refused with 404 input_not_found; it is never used as a project name."
@@ -6861,7 +6925,15 @@ var studioGenerateImage = defineTool({
6861
6925
  brandMode: z11.string().optional().describe('Optional brand mode (e.g. "illustration"); modes are defined per brand. Only meaningful with brandSlug.'),
6862
6926
  prompt: z11.string().min(1).describe("What to generate. With brandSlug, the brand style prefix is prepended server-side."),
6863
6927
  characterSlug: slug.optional().describe(
6864
- "Optional character whose identity references are injected: one of your company's, or one another company shared (see studio_list_characters). A slug your company cannot use is refused with 404 input_not_found."
6928
+ "Optional character whose identity references are injected: one of your company's, or one another company shared (see studio_list_characters). A slug your company cannot use is refused with 404 input_not_found. To put several characters, products or locations in one image, use mentions instead."
6929
+ ),
6930
+ mentions: z11.array(
6931
+ z11.object({
6932
+ kind: z11.enum(["character", "product", "location"]).describe("What the mention names."),
6933
+ id: slug.describe("The slug of the character (studio_list_characters), product or location (GET /api/products, GET /api/locations).")
6934
+ })
6935
+ ).min(1).max(10).optional().describe(
6936
+ "Optional: the characters, products and locations of your company to put in the image, in the order the prompt names them (at most 10). Each one's reference images are sent in that order and the Studio tells the model which image is which, so name them in the prompt by their names (or as tokens such as @[character:ana], which the Studio replaces with the name). The model must take a reference image for each mention plus any attached image: an edit model such as fal/nano-banana-2-edit takes 8, and so does the default when no model is named (with mentions and a candidateCount above 1 the default is fal/nano-banana-2-edit, which renders up to 4); a text-only model takes none. Too many is refused with 400 too_many_references, a model that cannot take references with 400 model_takes_no_references, both before anything is spent. A mention your company cannot use is refused with 404 input_not_found, one without a reference image with 422 mention_without_reference. Sent together with characterSlug, that character comes first."
6865
6937
  ),
6866
6938
  projectId: z11.string().min(1).optional().describe(
6867
6939
  '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.'
@@ -6888,6 +6960,7 @@ var studioGenerateImage = defineTool({
6888
6960
  ...args.brandMode ? { brandMode: args.brandMode } : {},
6889
6961
  prompt: args.prompt,
6890
6962
  ...args.characterSlug ? { characterSlug: args.characterSlug } : {},
6963
+ ...args.mentions && args.mentions.length > 0 ? { mentions: args.mentions } : {},
6891
6964
  ...args.projectId ? { projectId: args.projectId } : {},
6892
6965
  ...Object.keys(settings).length > 0 ? { settings } : {}
6893
6966
  });
@@ -7560,7 +7633,7 @@ function registerTools(server, base) {
7560
7633
 
7561
7634
  // src/server.ts
7562
7635
  var SERVER_NAME = "lumitra-studio";
7563
- var SERVER_VERSION = "0.11.0";
7636
+ var SERVER_VERSION = "0.13.0";
7564
7637
  function createStudioMcpServer(opts = {}) {
7565
7638
  const config = opts.config ?? resolveConfig(opts.env ?? process.env);
7566
7639
  const client = new StudioClient(config, {
package/dist/index.d.ts CHANGED
@@ -1149,6 +1149,24 @@ interface ProjectSummary {
1149
1149
  slug: string;
1150
1150
  name: string;
1151
1151
  }
1152
+ /** A place that still uses an asset, as `GET /api/v1/projects/:id/assets/:assetId` lists it. */
1153
+ interface AssetReference {
1154
+ kind: 'post' | 'workflow' | 'recipe' | 'generation' | 'run' | 'social-send';
1155
+ id: string;
1156
+ label: string;
1157
+ detail: string;
1158
+ href: string | null;
1159
+ }
1160
+ /** `GET /api/v1/projects/:id/assets/:assetId`: the asset as a confirmation names it, and where it is used. */
1161
+ interface AssetUsage {
1162
+ assetId: string;
1163
+ projectId: string;
1164
+ subtype: string;
1165
+ prompt: string | null;
1166
+ mimeType: string | null;
1167
+ createdAt: string;
1168
+ references: AssetReference[];
1169
+ }
1152
1170
  /** `GET /api/v1/projects/:id`: the project and what deleting it would remove. */
1153
1171
  interface ProjectContents {
1154
1172
  project: ProjectSummary & {
@@ -1623,6 +1641,14 @@ declare class StudioClient {
1623
1641
  project: ProjectSummary;
1624
1642
  fallbackProjectId: string;
1625
1643
  }>;
1644
+ describeAssetUsage(projectId: string, assetId: string): Promise<AssetUsage>;
1645
+ deleteAsset(projectId: string, assetId: string): Promise<{
1646
+ deleted: true;
1647
+ assetId: string;
1648
+ filesDeleted: number;
1649
+ filesKept: number;
1650
+ generationsDetached: number;
1651
+ }>;
1626
1652
  listWorkflows(opts?: {
1627
1653
  projectId?: string;
1628
1654
  }): Promise<{
@@ -1654,13 +1680,19 @@ declare class StudioClient {
1654
1680
  * use is refused with 404 `input_not_found` before anything is spent (since
1655
1681
  * 2026-10-11; it used to generate without the brand). `projectId` chooses the
1656
1682
  * project; without it the job lands in the project named after the brand, or
1657
- * in `default`.
1683
+ * in `default`. `mentions` (since 2026-10-25) puts several characters,
1684
+ * products and locations in one image, in prompt order, each by its slug;
1685
+ * more references than the model takes is a 400 `too_many_references`.
1658
1686
  */
1659
1687
  generate(body: {
1660
1688
  brandSlug?: string;
1661
1689
  brandMode?: string;
1662
1690
  prompt: string;
1663
1691
  characterSlug?: string;
1692
+ mentions?: Array<{
1693
+ kind: 'character' | 'product' | 'location';
1694
+ id: string;
1695
+ }>;
1664
1696
  projectId?: string;
1665
1697
  settings?: Record<string, unknown>;
1666
1698
  }): Promise<GenerateImageResponse>;
@@ -2054,7 +2086,7 @@ declare function registerTools(server: McpServer, base: ToolContext): void;
2054
2086
  */
2055
2087
 
2056
2088
  declare const SERVER_NAME = "lumitra-studio";
2057
- declare const SERVER_VERSION = "0.11.0";
2089
+ declare const SERVER_VERSION = "0.13.0";
2058
2090
  interface CreateServerOptions {
2059
2091
  config?: StudioConfig;
2060
2092
  env?: NodeJS.ProcessEnv;
@@ -3422,4 +3454,4 @@ declare function parseArgs(argv: string[]): CliArgs;
3422
3454
  declare function createHttpHandler(): (req: IncomingMessage, res: ServerResponse) => Promise<void>;
3423
3455
  declare function main(argv?: string[]): Promise<void>;
3424
3456
 
3425
- export { type AllTenantsUsageResponse, type Binding, type BrandKitResponse, CHARACTER_SHEET_DEFINITION, CHARACTER_SHEET_NODES, type CampaignContents, type CampaignListing, type CandidatePlan, type CharacterReference, type CharacterSummary, type CharacterSwapInput, type CompositionRecord, type CompositionSummary, ConfigError, ContractError, type CreateServerOptions, DEFAULT_BASE_URL, DEFAULT_MOTION_PROMPT, DEFAULT_SWAP_EDIT_MODEL, DEFAULT_SWAP_PROMPT, DEFAULT_SWAP_VIDEO_MODEL, DEFAULT_TIMEOUT_MS, type DocumentSummary, type FetchLike, type GenerateImageResponse, type JobResponse, type JobStatus, type JudgeCandidate, MINT_REFERENCE_CATEGORIES, type NodeResultResponse, type NodeRun, type NodeStatus, type NodeSummary, type NodeTypesResponse, type PollOptions, PollTimeoutError, type ProjectAsset, type ProjectContents, type ProjectSummary, type Projection, type RemovedNode, type RunResponse, type RunStartResponse, type RunStatus, SERVER_NAME, SERVER_VERSION, SUMMARY_TEXT_CHARS, SWAP_SCOPES, type SavedWorkflowListing, type SocialProjectSummary, type SocialSendView, type SpendLedger, StudioApiError, StudioClient, type StudioClientOptions, type StudioConfig, type StudioMcp, type SummaryMeta, type SwapPromptOptions, type SwapScope, TOOLS, TOOL_NAMES, type TaskDescriptor, type TenantSpendSummary, type TenantUsageResponse, type ToolContext, type ToolDef, ToolInputError, type ToolResult, type TurnaroundView, type UploadFile, type UsageByModel, type UsageResponse, WORKFLOW_TOOLS, type WorkflowApplyResponse, type WorkflowCreateResponse, type WorkflowDefinition, type WorkflowDocumentResponse, type WorkflowNode, type WorkflowValidateResponse, affectedNodes, buildCharacterSheetParams, buildCharacterSwapDefinition, categoryForNode, characterSheetDefinition, composeSwapPrompt, createHttpHandler, createStudioMcpServer, extensionForMime, filenameFromUrl, invokeTool, main, mimeForFilename, parseArgs, parseDocument, parseOps, pollUntil, projectionOf, redactSecret, registerTools, resolveConfig, seedFacePrompt, studioWorkflowApply, studioWorkflowCreate, studioWorkflowDescribe, studioWorkflowGet, studioWorkflowScreenshot, studioWorkflowValidate, summarizeDocument, summarizeNode, touchedNodeIds, turnaroundViewPrompt, waitForJob, waitForRun };
3457
+ export { type AllTenantsUsageResponse, type AssetReference, type AssetUsage, type Binding, type BrandKitResponse, CHARACTER_SHEET_DEFINITION, CHARACTER_SHEET_NODES, type CampaignContents, type CampaignListing, type CandidatePlan, type CharacterReference, type CharacterSummary, type CharacterSwapInput, type CompositionRecord, type CompositionSummary, ConfigError, ContractError, type CreateServerOptions, DEFAULT_BASE_URL, DEFAULT_MOTION_PROMPT, DEFAULT_SWAP_EDIT_MODEL, DEFAULT_SWAP_PROMPT, DEFAULT_SWAP_VIDEO_MODEL, DEFAULT_TIMEOUT_MS, type DocumentSummary, type FetchLike, type GenerateImageResponse, type JobResponse, type JobStatus, type JudgeCandidate, MINT_REFERENCE_CATEGORIES, type NodeResultResponse, type NodeRun, type NodeStatus, type NodeSummary, type NodeTypesResponse, type PollOptions, PollTimeoutError, type ProjectAsset, type ProjectContents, type ProjectSummary, type Projection, type RemovedNode, type RunResponse, type RunStartResponse, type RunStatus, SERVER_NAME, SERVER_VERSION, SUMMARY_TEXT_CHARS, SWAP_SCOPES, type SavedWorkflowListing, type SocialProjectSummary, type SocialSendView, type SpendLedger, StudioApiError, StudioClient, type StudioClientOptions, type StudioConfig, type StudioMcp, type SummaryMeta, type SwapPromptOptions, type SwapScope, TOOLS, TOOL_NAMES, type TaskDescriptor, type TenantSpendSummary, type TenantUsageResponse, type ToolContext, type ToolDef, ToolInputError, type ToolResult, type TurnaroundView, type UploadFile, type UsageByModel, type UsageResponse, WORKFLOW_TOOLS, type WorkflowApplyResponse, type WorkflowCreateResponse, type WorkflowDefinition, type WorkflowDocumentResponse, type WorkflowNode, type WorkflowValidateResponse, affectedNodes, buildCharacterSheetParams, buildCharacterSwapDefinition, categoryForNode, characterSheetDefinition, composeSwapPrompt, createHttpHandler, createStudioMcpServer, extensionForMime, filenameFromUrl, invokeTool, main, mimeForFilename, parseArgs, parseDocument, parseOps, pollUntil, projectionOf, redactSecret, registerTools, resolveConfig, seedFacePrompt, studioWorkflowApply, studioWorkflowCreate, studioWorkflowDescribe, studioWorkflowGet, studioWorkflowScreenshot, studioWorkflowValidate, summarizeDocument, summarizeNode, touchedNodeIds, turnaroundViewPrompt, waitForJob, waitForRun };
package/dist/index.js CHANGED
@@ -118,6 +118,12 @@ var StudioClient = class {
118
118
  deleteProject(projectId) {
119
119
  return this.json("DELETE", `/api/v1/projects/${encodeURIComponent(projectId)}`);
120
120
  }
121
+ describeAssetUsage(projectId, assetId) {
122
+ return this.json("GET", `/api/v1/projects/${encodeURIComponent(projectId)}/assets/${encodeURIComponent(assetId)}`);
123
+ }
124
+ deleteAsset(projectId, assetId) {
125
+ return this.json("DELETE", `/api/v1/projects/${encodeURIComponent(projectId)}/assets/${encodeURIComponent(assetId)}`);
126
+ }
121
127
  // ── Saved workflows (listing and moving; authoring lives with the workflow tools) ──
122
128
  listWorkflows(opts = {}) {
123
129
  return this.json("GET", `/api/v1/workflows${projectQuery(opts.projectId)}`);
@@ -143,7 +149,9 @@ var StudioClient = class {
143
149
  * use is refused with 404 `input_not_found` before anything is spent (since
144
150
  * 2026-10-11; it used to generate without the brand). `projectId` chooses the
145
151
  * project; without it the job lands in the project named after the brand, or
146
- * in `default`.
152
+ * in `default`. `mentions` (since 2026-10-25) puts several characters,
153
+ * products and locations in one image, in prompt order, each by its slug;
154
+ * more references than the model takes is a 400 `too_many_references`.
147
155
  */
148
156
  generate(body) {
149
157
  return this.json("POST", "/api/generate", { json: body });
@@ -720,7 +728,10 @@ var CATALOG_ENTRIES = [
720
728
  task: "text-to-image",
721
729
  label: "Imagen 4 Fast (KIE)",
722
730
  description: "Google Imagen 4 Fast via KIE. No IP indemnity.",
723
- capabilities: { resolutions: [] }
731
+ // Text only: KIE's imagen4-fast input has no image field, so the adapter
732
+ // (buildKieInput) sends none. Declared, so a reference is refused before
733
+ // spend instead of being dropped after it.
734
+ capabilities: { resolutions: [], maxInputImages: 0 }
724
735
  },
725
736
  {
726
737
  id: "kie/seedream-v4",
@@ -728,7 +739,9 @@ var CATALOG_ENTRIES = [
728
739
  modality: "image",
729
740
  task: "text-to-image",
730
741
  label: "Seedream V4 (KIE)",
731
- description: "ByteDance Seedream V4 via KIE. Stylized output not available on Vertex. No IP indemnity."
742
+ description: "ByteDance Seedream V4 via KIE. Stylized output not available on Vertex. No IP indemnity.",
743
+ // Text only, like imagen-4-fast: the seedream-v4 text-to-image input has no image field.
744
+ capabilities: { maxInputImages: 0 }
732
745
  },
733
746
  // ── KIE.ai: newer image models, the cheaper route (price feed 2026-09-23) ─
734
747
  {
@@ -3374,7 +3387,10 @@ var CATALOG_ENTRIES2 = [
3374
3387
  task: "text-to-image",
3375
3388
  label: "Imagen 4 Fast (KIE)",
3376
3389
  description: "Google Imagen 4 Fast via KIE. No IP indemnity.",
3377
- capabilities: { resolutions: [] }
3390
+ // Text only: KIE's imagen4-fast input has no image field, so the adapter
3391
+ // (buildKieInput) sends none. Declared, so a reference is refused before
3392
+ // spend instead of being dropped after it.
3393
+ capabilities: { resolutions: [], maxInputImages: 0 }
3378
3394
  },
3379
3395
  {
3380
3396
  id: "kie/seedream-v4",
@@ -3382,7 +3398,9 @@ var CATALOG_ENTRIES2 = [
3382
3398
  modality: "image",
3383
3399
  task: "text-to-image",
3384
3400
  label: "Seedream V4 (KIE)",
3385
- description: "ByteDance Seedream V4 via KIE. Stylized output not available on Vertex. No IP indemnity."
3401
+ description: "ByteDance Seedream V4 via KIE. Stylized output not available on Vertex. No IP indemnity.",
3402
+ // Text only, like imagen-4-fast: the seedream-v4 text-to-image input has no image field.
3403
+ capabilities: { maxInputImages: 0 }
3386
3404
  },
3387
3405
  // ── KIE.ai: newer image models, the cheaper route (price feed 2026-09-23) ─
3388
3406
  {
@@ -6628,6 +6646,15 @@ function campaignDeleteSummary(c) {
6628
6646
  const kept = c.imagesKept > 0 ? ` Its ${count(c.imagesKept, "image stays", "images stay")} in the asset library.` : "";
6629
6647
  return `Delete the campaign "${c.name}" with its ${count(c.shots, "shot", "shots")} and every approve and reject decision?${kept} This cannot be undone.`;
6630
6648
  }
6649
+ function assetReferenceLines(refs) {
6650
+ return refs.map((r) => `- ${r.label}: ${r.detail}`).join("\n");
6651
+ }
6652
+ function assetDeleteSummary(u) {
6653
+ const kind = u.subtype === "Image" ? "image" : u.subtype === "Video" ? "video" : u.subtype === "CarouselSlide" ? "rendered slide" : u.subtype === "Reel" ? "rendered reel" : `${u.subtype} asset`;
6654
+ const prompt = u.prompt?.trim();
6655
+ const named = prompt ? ` "${prompt.length > 120 ? `${prompt.slice(0, 117)}...` : prompt}"` : "";
6656
+ return `Delete the ${kind}${named} made ${u.createdAt.slice(0, 10)} (id ${u.assetId}) for everyone in the company, with its stored file? Campaign shots, sent posts and past runs keep their record without it. This cannot be undone.`;
6657
+ }
6631
6658
  function projectSubject(c) {
6632
6659
  return ["delete-project", c.project.id, c.project.name, c.workflows, c.publishedWorkflows, c.runs, c.assets, c.chats, c.campaignShots].join(":");
6633
6660
  }
@@ -6710,6 +6737,42 @@ var studioDeleteProject = defineTool({
6710
6737
  }
6711
6738
  }
6712
6739
  });
6740
+ var IN_USE_INSTRUCTION = "Nothing was deleted. Tell the person where the asset is still used (`usedIn`). Removing it from a post or a workflow is their edit to make (or yours with the composition or workflow tools, if they ask); work in flight has to finish first. Then call this tool again.";
6741
+ var studioDeleteAsset = defineTool({
6742
+ name: "studio_delete_asset",
6743
+ description: "Delete one asset (an image, a video, a rendered slide or reel) of your company for everyone, with its stored file. Needs a key with the company admin role. Refused while a post (a carousel slide or reel clip), a saved workflow or published recipe (a source node, a baked reference, a node pinned to the generation that made it) or work in flight (a generation, a run, a send to Lumitra Social) still uses it: the tool then returns `usedIn` with each place, and nothing is deleted. Records of what happened survive without it (campaign shots, product links, derived assets, the job and its cost, sent posts). The PERSON confirms every delete in the chat: this tool asks them through the client's confirmation dialog before anything happens. If the client has no such dialog, the tool returns `confirmationRequired` with a `summary` and a `confirmationToken`: show the summary to the person exactly as written, and only after they explicitly say yes call again with the token. Never confirm on their behalf.",
6744
+ inputSchema: {
6745
+ projectId: z10.string().min(1).describe("The project the asset is in, from studio_list_projects."),
6746
+ assetId: z10.string().min(1).describe("The asset, from studio_list_assets."),
6747
+ confirmationToken
6748
+ },
6749
+ annotations: { destructiveHint: true },
6750
+ handler: async (args, ctx) => {
6751
+ const inUse = (references) => ({
6752
+ deleted: false,
6753
+ inUse: true,
6754
+ usedIn: references,
6755
+ message: `The asset is still used:
6756
+ ${assetReferenceLines(references)}`,
6757
+ instruction: IN_USE_INSTRUCTION
6758
+ });
6759
+ const usage = await ctx.client.describeAssetUsage(args.projectId, args.assetId);
6760
+ if (usage.references.length > 0) return inUse(usage.references);
6761
+ const summary = assetDeleteSummary(usage);
6762
+ const gate = await confirmWithPerson(ctx, summary, ["delete-asset", args.projectId, args.assetId].join(":"), args.confirmationToken);
6763
+ if (gate !== "proceed") return gate;
6764
+ try {
6765
+ const res = await ctx.client.deleteAsset(args.projectId, args.assetId);
6766
+ return { deleted: true, assetId: res.assetId, filesDeleted: res.filesDeleted, filesKept: res.filesKept, summary };
6767
+ } catch (err) {
6768
+ if (err instanceof StudioApiError && err.status === 409) {
6769
+ const refs = err.body?.references ?? [];
6770
+ return inUse(refs);
6771
+ }
6772
+ return roleRefusal(err, "Deleting an asset needs a key with the company admin role; this key does not have it.");
6773
+ }
6774
+ }
6775
+ });
6713
6776
  var studioListWorkflows = defineTool({
6714
6777
  name: "studio_list_workflows",
6715
6778
  description: "List the saved workflows of one project (savedId, label, version). Omit projectId for the company's default project. Use the savedId with studio_workflow_get, studio_run_workflow or studio_move_workflow.",
@@ -6768,6 +6831,7 @@ var MANAGE_TOOLS = [
6768
6831
  studioCreateProject,
6769
6832
  studioRenameProject,
6770
6833
  studioDeleteProject,
6834
+ studioDeleteAsset,
6771
6835
  studioListWorkflows,
6772
6836
  studioMoveWorkflow,
6773
6837
  studioListCampaigns,
@@ -6848,7 +6912,7 @@ var studioListProjects = defineTool({
6848
6912
  });
6849
6913
  var studioGenerateImage = defineTool({
6850
6914
  name: "studio_generate_image",
6851
- description: "Generate an image from a prompt. A brand is optional: pass brandSlug to have the Studio apply that brand's style prefix and reference images server-side, or leave it out for an image without a brand. Optionally pin a character (characterSlug) so its identity references are injected too. A brandSlug or characterSlug that names nothing your company can use is refused before anything is spent (404, code input_not_found), and the error text says what to do next: act on it or relay it as written. The image is filed in projectId when given, otherwise in the project named after the brand (created on first use), otherwise in the project \"default\". Submits a job and, when wait=true (default), polls until it finishes and returns the signed image URL and costUsd (what the job cost your company: for a company on prepaid credits, what left its balance). With wait=false it returns the jobId immediately for studio_get_job. candidateCount asks for up to four candidates, but some models render one image regardless of the count: the result carries `candidates: { requested, rendered, mayRender? }`, and a `notice` to pass on to the user whenever fewer images will be made than were asked for. A typical image costs about $0.06 on prepaid credits without a subscription; the job's costUsd is the exact amount.",
6915
+ description: "Generate an image from a prompt. A brand is optional: pass brandSlug to have the Studio apply that brand's style prefix and reference images server-side, or leave it out for an image without a brand. Optionally pin a character (characterSlug) so its identity references are injected too, or put several characters, products and locations of your company in one image with mentions (in prompt order). A brandSlug, characterSlug or mention that names nothing your company can use is refused before anything is spent (404, code input_not_found), and the error text says what to do next: act on it or relay it as written. The image is filed in projectId when given, otherwise in the project named after the brand (created on first use), otherwise in the project \"default\". Submits a job and, when wait=true (default), polls until it finishes and returns the signed image URL and costUsd (what the job cost your company: for a company on prepaid credits, what left its balance). With wait=false it returns the jobId immediately for studio_get_job. candidateCount asks for up to four candidates, but some models render one image regardless of the count: the result carries `candidates: { requested, rendered, mayRender? }`, and a `notice` to pass on to the user whenever fewer images will be made than were asked for. A typical image costs about $0.06 on prepaid credits without a subscription; the job's costUsd is the exact amount.",
6852
6916
  inputSchema: {
6853
6917
  brandSlug: slug.optional().describe(
6854
6918
  "Optional. The slug of a brand of your company (create one with studio_create_brand). Omit it to generate without a brand. A slug that names no brand of your company is refused with 404 input_not_found; it is never used as a project name."
@@ -6856,7 +6920,15 @@ var studioGenerateImage = defineTool({
6856
6920
  brandMode: z11.string().optional().describe('Optional brand mode (e.g. "illustration"); modes are defined per brand. Only meaningful with brandSlug.'),
6857
6921
  prompt: z11.string().min(1).describe("What to generate. With brandSlug, the brand style prefix is prepended server-side."),
6858
6922
  characterSlug: slug.optional().describe(
6859
- "Optional character whose identity references are injected: one of your company's, or one another company shared (see studio_list_characters). A slug your company cannot use is refused with 404 input_not_found."
6923
+ "Optional character whose identity references are injected: one of your company's, or one another company shared (see studio_list_characters). A slug your company cannot use is refused with 404 input_not_found. To put several characters, products or locations in one image, use mentions instead."
6924
+ ),
6925
+ mentions: z11.array(
6926
+ z11.object({
6927
+ kind: z11.enum(["character", "product", "location"]).describe("What the mention names."),
6928
+ id: slug.describe("The slug of the character (studio_list_characters), product or location (GET /api/products, GET /api/locations).")
6929
+ })
6930
+ ).min(1).max(10).optional().describe(
6931
+ "Optional: the characters, products and locations of your company to put in the image, in the order the prompt names them (at most 10). Each one's reference images are sent in that order and the Studio tells the model which image is which, so name them in the prompt by their names (or as tokens such as @[character:ana], which the Studio replaces with the name). The model must take a reference image for each mention plus any attached image: an edit model such as fal/nano-banana-2-edit takes 8, and so does the default when no model is named (with mentions and a candidateCount above 1 the default is fal/nano-banana-2-edit, which renders up to 4); a text-only model takes none. Too many is refused with 400 too_many_references, a model that cannot take references with 400 model_takes_no_references, both before anything is spent. A mention your company cannot use is refused with 404 input_not_found, one without a reference image with 422 mention_without_reference. Sent together with characterSlug, that character comes first."
6860
6932
  ),
6861
6933
  projectId: z11.string().min(1).optional().describe(
6862
6934
  '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.'
@@ -6883,6 +6955,7 @@ var studioGenerateImage = defineTool({
6883
6955
  ...args.brandMode ? { brandMode: args.brandMode } : {},
6884
6956
  prompt: args.prompt,
6885
6957
  ...args.characterSlug ? { characterSlug: args.characterSlug } : {},
6958
+ ...args.mentions && args.mentions.length > 0 ? { mentions: args.mentions } : {},
6886
6959
  ...args.projectId ? { projectId: args.projectId } : {},
6887
6960
  ...Object.keys(settings).length > 0 ? { settings } : {}
6888
6961
  });
@@ -7555,7 +7628,7 @@ function registerTools(server, base) {
7555
7628
 
7556
7629
  // src/server.ts
7557
7630
  var SERVER_NAME = "lumitra-studio";
7558
- var SERVER_VERSION = "0.11.0";
7631
+ var SERVER_VERSION = "0.13.0";
7559
7632
  function createStudioMcpServer(opts = {}) {
7560
7633
  const config = opts.config ?? resolveConfig(opts.env ?? process.env);
7561
7634
  const client = new StudioClient(config, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marlinjai/studio-mcp",
3
- "version": "0.11.0",
3
+ "version": "0.13.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",