@marlinjai/studio-mcp 0.11.0 → 0.12.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
@@ -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)}`);
@@ -6633,6 +6639,15 @@ function campaignDeleteSummary(c) {
6633
6639
  const kept = c.imagesKept > 0 ? ` Its ${count(c.imagesKept, "image stays", "images stay")} in the asset library.` : "";
6634
6640
  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
6641
  }
6642
+ function assetReferenceLines(refs) {
6643
+ return refs.map((r) => `- ${r.label}: ${r.detail}`).join("\n");
6644
+ }
6645
+ function assetDeleteSummary(u) {
6646
+ const kind = u.subtype === "Image" ? "image" : u.subtype === "Video" ? "video" : u.subtype === "CarouselSlide" ? "rendered slide" : u.subtype === "Reel" ? "rendered reel" : `${u.subtype} asset`;
6647
+ const prompt = u.prompt?.trim();
6648
+ const named = prompt ? ` "${prompt.length > 120 ? `${prompt.slice(0, 117)}...` : prompt}"` : "";
6649
+ 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.`;
6650
+ }
6636
6651
  function projectSubject(c) {
6637
6652
  return ["delete-project", c.project.id, c.project.name, c.workflows, c.publishedWorkflows, c.runs, c.assets, c.chats, c.campaignShots].join(":");
6638
6653
  }
@@ -6715,6 +6730,42 @@ var studioDeleteProject = defineTool({
6715
6730
  }
6716
6731
  }
6717
6732
  });
6733
+ 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.";
6734
+ var studioDeleteAsset = defineTool({
6735
+ name: "studio_delete_asset",
6736
+ 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.",
6737
+ inputSchema: {
6738
+ projectId: z10.string().min(1).describe("The project the asset is in, from studio_list_projects."),
6739
+ assetId: z10.string().min(1).describe("The asset, from studio_list_assets."),
6740
+ confirmationToken
6741
+ },
6742
+ annotations: { destructiveHint: true },
6743
+ handler: async (args, ctx) => {
6744
+ const inUse = (references) => ({
6745
+ deleted: false,
6746
+ inUse: true,
6747
+ usedIn: references,
6748
+ message: `The asset is still used:
6749
+ ${assetReferenceLines(references)}`,
6750
+ instruction: IN_USE_INSTRUCTION
6751
+ });
6752
+ const usage = await ctx.client.describeAssetUsage(args.projectId, args.assetId);
6753
+ if (usage.references.length > 0) return inUse(usage.references);
6754
+ const summary = assetDeleteSummary(usage);
6755
+ const gate = await confirmWithPerson(ctx, summary, ["delete-asset", args.projectId, args.assetId].join(":"), args.confirmationToken);
6756
+ if (gate !== "proceed") return gate;
6757
+ try {
6758
+ const res = await ctx.client.deleteAsset(args.projectId, args.assetId);
6759
+ return { deleted: true, assetId: res.assetId, filesDeleted: res.filesDeleted, filesKept: res.filesKept, summary };
6760
+ } catch (err) {
6761
+ if (err instanceof StudioApiError && err.status === 409) {
6762
+ const refs = err.body?.references ?? [];
6763
+ return inUse(refs);
6764
+ }
6765
+ return roleRefusal(err, "Deleting an asset needs a key with the company admin role; this key does not have it.");
6766
+ }
6767
+ }
6768
+ });
6718
6769
  var studioListWorkflows = defineTool({
6719
6770
  name: "studio_list_workflows",
6720
6771
  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 +6824,7 @@ var MANAGE_TOOLS = [
6773
6824
  studioCreateProject,
6774
6825
  studioRenameProject,
6775
6826
  studioDeleteProject,
6827
+ studioDeleteAsset,
6776
6828
  studioListWorkflows,
6777
6829
  studioMoveWorkflow,
6778
6830
  studioListCampaigns,
@@ -7560,7 +7612,7 @@ function registerTools(server, base) {
7560
7612
 
7561
7613
  // src/server.ts
7562
7614
  var SERVER_NAME = "lumitra-studio";
7563
- var SERVER_VERSION = "0.11.0";
7615
+ var SERVER_VERSION = "0.12.0";
7564
7616
  function createStudioMcpServer(opts = {}) {
7565
7617
  const config = opts.config ?? resolveConfig(opts.env ?? process.env);
7566
7618
  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<{
@@ -2054,7 +2080,7 @@ declare function registerTools(server: McpServer, base: ToolContext): void;
2054
2080
  */
2055
2081
 
2056
2082
  declare const SERVER_NAME = "lumitra-studio";
2057
- declare const SERVER_VERSION = "0.11.0";
2083
+ declare const SERVER_VERSION = "0.12.0";
2058
2084
  interface CreateServerOptions {
2059
2085
  config?: StudioConfig;
2060
2086
  env?: NodeJS.ProcessEnv;
@@ -3422,4 +3448,4 @@ declare function parseArgs(argv: string[]): CliArgs;
3422
3448
  declare function createHttpHandler(): (req: IncomingMessage, res: ServerResponse) => Promise<void>;
3423
3449
  declare function main(argv?: string[]): Promise<void>;
3424
3450
 
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 };
3451
+ 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)}`);
@@ -6628,6 +6634,15 @@ function campaignDeleteSummary(c) {
6628
6634
  const kept = c.imagesKept > 0 ? ` Its ${count(c.imagesKept, "image stays", "images stay")} in the asset library.` : "";
6629
6635
  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
6636
  }
6637
+ function assetReferenceLines(refs) {
6638
+ return refs.map((r) => `- ${r.label}: ${r.detail}`).join("\n");
6639
+ }
6640
+ function assetDeleteSummary(u) {
6641
+ const kind = u.subtype === "Image" ? "image" : u.subtype === "Video" ? "video" : u.subtype === "CarouselSlide" ? "rendered slide" : u.subtype === "Reel" ? "rendered reel" : `${u.subtype} asset`;
6642
+ const prompt = u.prompt?.trim();
6643
+ const named = prompt ? ` "${prompt.length > 120 ? `${prompt.slice(0, 117)}...` : prompt}"` : "";
6644
+ 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.`;
6645
+ }
6631
6646
  function projectSubject(c) {
6632
6647
  return ["delete-project", c.project.id, c.project.name, c.workflows, c.publishedWorkflows, c.runs, c.assets, c.chats, c.campaignShots].join(":");
6633
6648
  }
@@ -6710,6 +6725,42 @@ var studioDeleteProject = defineTool({
6710
6725
  }
6711
6726
  }
6712
6727
  });
6728
+ 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.";
6729
+ var studioDeleteAsset = defineTool({
6730
+ name: "studio_delete_asset",
6731
+ 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.",
6732
+ inputSchema: {
6733
+ projectId: z10.string().min(1).describe("The project the asset is in, from studio_list_projects."),
6734
+ assetId: z10.string().min(1).describe("The asset, from studio_list_assets."),
6735
+ confirmationToken
6736
+ },
6737
+ annotations: { destructiveHint: true },
6738
+ handler: async (args, ctx) => {
6739
+ const inUse = (references) => ({
6740
+ deleted: false,
6741
+ inUse: true,
6742
+ usedIn: references,
6743
+ message: `The asset is still used:
6744
+ ${assetReferenceLines(references)}`,
6745
+ instruction: IN_USE_INSTRUCTION
6746
+ });
6747
+ const usage = await ctx.client.describeAssetUsage(args.projectId, args.assetId);
6748
+ if (usage.references.length > 0) return inUse(usage.references);
6749
+ const summary = assetDeleteSummary(usage);
6750
+ const gate = await confirmWithPerson(ctx, summary, ["delete-asset", args.projectId, args.assetId].join(":"), args.confirmationToken);
6751
+ if (gate !== "proceed") return gate;
6752
+ try {
6753
+ const res = await ctx.client.deleteAsset(args.projectId, args.assetId);
6754
+ return { deleted: true, assetId: res.assetId, filesDeleted: res.filesDeleted, filesKept: res.filesKept, summary };
6755
+ } catch (err) {
6756
+ if (err instanceof StudioApiError && err.status === 409) {
6757
+ const refs = err.body?.references ?? [];
6758
+ return inUse(refs);
6759
+ }
6760
+ return roleRefusal(err, "Deleting an asset needs a key with the company admin role; this key does not have it.");
6761
+ }
6762
+ }
6763
+ });
6713
6764
  var studioListWorkflows = defineTool({
6714
6765
  name: "studio_list_workflows",
6715
6766
  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 +6819,7 @@ var MANAGE_TOOLS = [
6768
6819
  studioCreateProject,
6769
6820
  studioRenameProject,
6770
6821
  studioDeleteProject,
6822
+ studioDeleteAsset,
6771
6823
  studioListWorkflows,
6772
6824
  studioMoveWorkflow,
6773
6825
  studioListCampaigns,
@@ -7555,7 +7607,7 @@ function registerTools(server, base) {
7555
7607
 
7556
7608
  // src/server.ts
7557
7609
  var SERVER_NAME = "lumitra-studio";
7558
- var SERVER_VERSION = "0.11.0";
7610
+ var SERVER_VERSION = "0.12.0";
7559
7611
  function createStudioMcpServer(opts = {}) {
7560
7612
  const config = opts.config ?? resolveConfig(opts.env ?? process.env);
7561
7613
  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.12.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",