@jclvsh/dropspace 2.1.0 → 2.2.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/dist/cli.js +4 -0
- package/dist/commands/credits.d.ts +3 -0
- package/dist/commands/credits.js +32 -0
- package/dist/commands/keys.js +11 -0
- package/dist/commands/media.d.ts +3 -0
- package/dist/commands/media.js +60 -0
- package/dist/index.js +5 -1
- package/dist/tools/credits.d.ts +3 -0
- package/dist/tools/credits.js +46 -0
- package/dist/tools/keys.js +21 -0
- package/dist/tools/media.d.ts +3 -0
- package/dist/tools/media.js +83 -0
- package/dist/types.d.ts +49 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -11,6 +11,8 @@ import { registerKeyCommands } from "./commands/keys.js";
|
|
|
11
11
|
import { registerWebhookCommands } from "./commands/webhooks.js";
|
|
12
12
|
import { registerDropspaceCommands } from "./commands/dropspace.js";
|
|
13
13
|
import { registerUsageCommands } from "./commands/usage.js";
|
|
14
|
+
import { registerCreditCommands } from "./commands/credits.js";
|
|
15
|
+
import { registerMediaCommands } from "./commands/media.js";
|
|
14
16
|
const program = new Command()
|
|
15
17
|
.name("dropspace")
|
|
16
18
|
.description("dropspace CLI - manage launches, personas, and more")
|
|
@@ -26,6 +28,8 @@ try {
|
|
|
26
28
|
registerWebhookCommands(program, client);
|
|
27
29
|
registerDropspaceCommands(program, client);
|
|
28
30
|
registerUsageCommands(program, client);
|
|
31
|
+
registerCreditCommands(program, client);
|
|
32
|
+
registerMediaCommands(program, client);
|
|
29
33
|
await program.parseAsync(process.argv);
|
|
30
34
|
}
|
|
31
35
|
catch (error) {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { formatOutput, handleError, getFormat } from "../cli-utils.js";
|
|
2
|
+
export function registerCreditCommands(program, client) {
|
|
3
|
+
const credits = program.command("credits").description("manage MPP credit balance and packs");
|
|
4
|
+
credits
|
|
5
|
+
.command("balance")
|
|
6
|
+
.description("get current credit balance and available packs")
|
|
7
|
+
.action(async () => {
|
|
8
|
+
try {
|
|
9
|
+
const result = await client.get("/credits");
|
|
10
|
+
formatOutput(result, getFormat(program.opts()));
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
handleError(error);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
credits
|
|
17
|
+
.command("purchase")
|
|
18
|
+
.description("purchase a credit pack (MPP auth only — API key and x402 callers are rejected)")
|
|
19
|
+
.option("--pack <id>", "pack ID (defaults to the standard pack)")
|
|
20
|
+
.action(async (opts) => {
|
|
21
|
+
try {
|
|
22
|
+
const body = {};
|
|
23
|
+
if (opts.pack)
|
|
24
|
+
body.pack = opts.pack;
|
|
25
|
+
const result = await client.post("/credits/purchase", body);
|
|
26
|
+
formatOutput(result, getFormat(program.opts()));
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
handleError(error);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
package/dist/commands/keys.js
CHANGED
|
@@ -62,4 +62,15 @@ export function registerKeyCommands(program, client) {
|
|
|
62
62
|
handleError(error);
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
|
+
keys.command("rotate <id>")
|
|
66
|
+
.description("rotate an API key — old key is revoked, new key returned once (requires admin scope)")
|
|
67
|
+
.action(async (id) => {
|
|
68
|
+
try {
|
|
69
|
+
const result = await client.post(`/keys/${id}/rotate`);
|
|
70
|
+
formatOutput(result, getFormat(program.opts()));
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
handleError(error);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
65
76
|
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { formatOutput, handleError, getFormat } from "../cli-utils.js";
|
|
2
|
+
export function registerMediaCommands(program, client) {
|
|
3
|
+
const media = program.command("media").alias("m").description("generate AI images and videos");
|
|
4
|
+
media
|
|
5
|
+
.command("generate")
|
|
6
|
+
.description("submit an AI image or video generation job (returns 202 with job_id)")
|
|
7
|
+
.requiredOption("-t, --type <type>", "generation type: image, video, or script_video")
|
|
8
|
+
.requiredOption("--launch <id>", "launch ID this media is for")
|
|
9
|
+
.requiredOption("--platform <platform>", "target platform")
|
|
10
|
+
.option("--prompt <text>", "explicit prompt (required for script_video)")
|
|
11
|
+
.option("-d, --description <text>", "product description (used to derive prompt)")
|
|
12
|
+
.option("--reference <url>", "reference image URL")
|
|
13
|
+
.option("--aspect <ratio>", "aspect ratio (e.g. 1:1, 16:9, 9:16)")
|
|
14
|
+
.option("--duration <n>", "video duration in seconds (4, 6, or 8)")
|
|
15
|
+
.option("--seed <n>", "RNG seed for reproducibility")
|
|
16
|
+
.option("--negative-prompt <text>", "things to avoid in the generation")
|
|
17
|
+
.action(async (opts) => {
|
|
18
|
+
try {
|
|
19
|
+
const body = {
|
|
20
|
+
type: opts.type,
|
|
21
|
+
launch_id: opts.launch,
|
|
22
|
+
platform: opts.platform,
|
|
23
|
+
};
|
|
24
|
+
if (opts.prompt)
|
|
25
|
+
body.prompt = opts.prompt;
|
|
26
|
+
if (opts.description)
|
|
27
|
+
body.product_description = opts.description;
|
|
28
|
+
if (opts.reference)
|
|
29
|
+
body.reference_image_url = opts.reference;
|
|
30
|
+
const options = {};
|
|
31
|
+
if (opts.aspect)
|
|
32
|
+
options.aspect_ratio = opts.aspect;
|
|
33
|
+
if (opts.duration)
|
|
34
|
+
options.duration_seconds = parseInt(opts.duration, 10);
|
|
35
|
+
if (opts.seed)
|
|
36
|
+
options.seed = parseInt(opts.seed, 10);
|
|
37
|
+
if (opts.negativePrompt)
|
|
38
|
+
options.negative_prompt = opts.negativePrompt;
|
|
39
|
+
if (Object.keys(options).length > 0)
|
|
40
|
+
body.options = options;
|
|
41
|
+
const result = await client.post("/media/generate", body);
|
|
42
|
+
formatOutput(result, getFormat(program.opts()));
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
handleError(error);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
media
|
|
49
|
+
.command("job <id>")
|
|
50
|
+
.description("poll the status of a media generation job")
|
|
51
|
+
.action(async (id) => {
|
|
52
|
+
try {
|
|
53
|
+
const result = await client.get(`/media/${id}`);
|
|
54
|
+
formatOutput(result, getFormat(program.opts()));
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
handleError(error);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -9,9 +9,11 @@ import { registerKeyTools } from "./tools/keys.js";
|
|
|
9
9
|
import { registerWebhookTools } from "./tools/webhooks.js";
|
|
10
10
|
import { registerDropspaceTools } from "./tools/dropspace.js";
|
|
11
11
|
import { registerUsageTools } from "./tools/usage.js";
|
|
12
|
+
import { registerCreditTools } from "./tools/credits.js";
|
|
13
|
+
import { registerMediaTools } from "./tools/media.js";
|
|
12
14
|
const server = new McpServer({
|
|
13
15
|
name: "dropspace",
|
|
14
|
-
version: "2.0
|
|
16
|
+
version: "2.2.0",
|
|
15
17
|
});
|
|
16
18
|
const client = new DropspaceClient();
|
|
17
19
|
registerLaunchTools(server, client);
|
|
@@ -21,5 +23,7 @@ registerKeyTools(server, client);
|
|
|
21
23
|
registerWebhookTools(server, client);
|
|
22
24
|
registerDropspaceTools(server, client);
|
|
23
25
|
registerUsageTools(server, client);
|
|
26
|
+
registerCreditTools(server, client);
|
|
27
|
+
registerMediaTools(server, client);
|
|
24
28
|
const transport = new StdioServerTransport();
|
|
25
29
|
await server.connect(transport);
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export function registerCreditTools(server, client) {
|
|
3
|
+
server.tool("get_credit_balance", "get current MPP credit balance and available packs. API key callers always see balance 0 (credits are for MPP/x402 agent identities).", {}, async () => {
|
|
4
|
+
try {
|
|
5
|
+
const result = await client.get("/credits");
|
|
6
|
+
return {
|
|
7
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
return {
|
|
12
|
+
content: [
|
|
13
|
+
{
|
|
14
|
+
type: "text",
|
|
15
|
+
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
isError: true,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
server.tool("purchase_credit_pack", "purchase a credit pack via MPP (Stripe-based agent payment). API key and x402 wallet callers receive 400/401 — credits are MPP-only.", {
|
|
23
|
+
pack: z.string().optional().describe("pack ID (defaults to the standard pack if omitted)"),
|
|
24
|
+
}, async ({ pack }) => {
|
|
25
|
+
try {
|
|
26
|
+
const body = {};
|
|
27
|
+
if (pack)
|
|
28
|
+
body.pack = pack;
|
|
29
|
+
const result = await client.post("/credits/purchase", body);
|
|
30
|
+
return {
|
|
31
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
return {
|
|
36
|
+
content: [
|
|
37
|
+
{
|
|
38
|
+
type: "text",
|
|
39
|
+
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
isError: true,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
package/dist/tools/keys.js
CHANGED
|
@@ -107,4 +107,25 @@ export function registerKeyTools(server, client) {
|
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
109
|
});
|
|
110
|
+
server.tool("rotate_api_key", "rotate an API key — revokes the old key and returns a new one with the same name and scopes. The new raw key is shown once; store it immediately. The old key stops authenticating as soon as this returns. (requires admin scope)", {
|
|
111
|
+
id: z.string().uuid().describe("API key ID to rotate"),
|
|
112
|
+
}, async ({ id }) => {
|
|
113
|
+
try {
|
|
114
|
+
const result = await client.post(`/keys/${id}/rotate`);
|
|
115
|
+
return {
|
|
116
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
return {
|
|
121
|
+
content: [
|
|
122
|
+
{
|
|
123
|
+
type: "text",
|
|
124
|
+
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
isError: true,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
});
|
|
110
131
|
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const PLATFORMS = [
|
|
3
|
+
"facebook",
|
|
4
|
+
"linkedin",
|
|
5
|
+
"linkedin-community",
|
|
6
|
+
"twitter",
|
|
7
|
+
"reddit",
|
|
8
|
+
"instagram",
|
|
9
|
+
"tiktok",
|
|
10
|
+
"youtube",
|
|
11
|
+
"substack",
|
|
12
|
+
"producthunt",
|
|
13
|
+
"hackernews",
|
|
14
|
+
];
|
|
15
|
+
const ASPECT_RATIOS = ["1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "5:4", "4:5", "21:9"];
|
|
16
|
+
export function registerMediaTools(server, client) {
|
|
17
|
+
server.tool("generate_media", "submit an AI image or video generation job for a launch. Returns 202 with a job_id; poll get_media_job for completion. Requires generate scope. script_video requires platform=instagram|tiktok and prompt is required (not just product_description). video and script_video only support 16:9 and 9:16 aspect ratios.", {
|
|
18
|
+
type: z.enum(["image", "video", "script_video"]).describe("generation type"),
|
|
19
|
+
launch_id: z.string().uuid().describe("launch ID this media is for"),
|
|
20
|
+
platform: z.enum(PLATFORMS).describe("target platform"),
|
|
21
|
+
prompt: z.string().optional().describe("explicit prompt — required for script_video"),
|
|
22
|
+
product_description: z
|
|
23
|
+
.string()
|
|
24
|
+
.optional()
|
|
25
|
+
.describe("product description (used to derive prompt when no explicit prompt is given)"),
|
|
26
|
+
reference_image_url: z
|
|
27
|
+
.string()
|
|
28
|
+
.url()
|
|
29
|
+
.optional()
|
|
30
|
+
.describe("reference image URL — guides image style/composition via the edit endpoint"),
|
|
31
|
+
options: z
|
|
32
|
+
.object({
|
|
33
|
+
aspect_ratio: z.enum(ASPECT_RATIOS).optional().describe("aspect ratio"),
|
|
34
|
+
duration_seconds: z
|
|
35
|
+
.union([z.literal(4), z.literal(6), z.literal(8)])
|
|
36
|
+
.optional()
|
|
37
|
+
.describe("video duration in seconds (4, 6, or 8)"),
|
|
38
|
+
seed: z.number().optional().describe("RNG seed for reproducibility"),
|
|
39
|
+
negative_prompt: z.string().optional().describe("things to avoid in the generation"),
|
|
40
|
+
})
|
|
41
|
+
.optional()
|
|
42
|
+
.describe("generation options"),
|
|
43
|
+
}, async (args) => {
|
|
44
|
+
try {
|
|
45
|
+
const result = await client.post("/media/generate", args);
|
|
46
|
+
return {
|
|
47
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
return {
|
|
52
|
+
content: [
|
|
53
|
+
{
|
|
54
|
+
type: "text",
|
|
55
|
+
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
isError: true,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
server.tool("get_media_job", "poll the status of a media generation job. Returns the result_url when complete.", {
|
|
63
|
+
job_id: z.string().uuid().describe("media job ID returned by generate_media"),
|
|
64
|
+
}, async ({ job_id }) => {
|
|
65
|
+
try {
|
|
66
|
+
const result = await client.get(`/media/${job_id}`);
|
|
67
|
+
return {
|
|
68
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
return {
|
|
73
|
+
content: [
|
|
74
|
+
{
|
|
75
|
+
type: "text",
|
|
76
|
+
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
isError: true,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
package/dist/types.d.ts
CHANGED
|
@@ -260,3 +260,52 @@ export interface RetryContentResponse {
|
|
|
260
260
|
still_failing: string[];
|
|
261
261
|
rate_limited: string[];
|
|
262
262
|
}
|
|
263
|
+
/** Credit pack offering */
|
|
264
|
+
export interface CreditPack {
|
|
265
|
+
id: string;
|
|
266
|
+
credits: number;
|
|
267
|
+
price_usd: string;
|
|
268
|
+
}
|
|
269
|
+
/** Credit balance response (shape varies by auth type) */
|
|
270
|
+
export interface CreditBalance {
|
|
271
|
+
balance: number;
|
|
272
|
+
packs?: CreditPack[];
|
|
273
|
+
purchase_endpoint?: string;
|
|
274
|
+
message?: string;
|
|
275
|
+
}
|
|
276
|
+
/** Credit pack purchase response */
|
|
277
|
+
export interface CreditPurchaseResult {
|
|
278
|
+
credits_added: number;
|
|
279
|
+
new_balance: number;
|
|
280
|
+
pack: CreditPack;
|
|
281
|
+
}
|
|
282
|
+
/** Media generation job (initial response from POST /media/generate) */
|
|
283
|
+
export interface MediaGenerationStarted {
|
|
284
|
+
status: "processing";
|
|
285
|
+
job_id: string;
|
|
286
|
+
fal_request_id: string;
|
|
287
|
+
generation_type: "image" | "video";
|
|
288
|
+
usage: {
|
|
289
|
+
used: number;
|
|
290
|
+
limit: number | "unlimited";
|
|
291
|
+
remaining: number | "unlimited";
|
|
292
|
+
};
|
|
293
|
+
plan: string;
|
|
294
|
+
}
|
|
295
|
+
/** Media generation job state (from GET /media/:jobId) */
|
|
296
|
+
export interface MediaGenerationJob {
|
|
297
|
+
id: string;
|
|
298
|
+
generation_type: "image" | "video";
|
|
299
|
+
model_id: string;
|
|
300
|
+
prompt: string;
|
|
301
|
+
result_url: string | null;
|
|
302
|
+
status: string;
|
|
303
|
+
progress: number | null;
|
|
304
|
+
error_message: string | null;
|
|
305
|
+
launch_id: string | null;
|
|
306
|
+
reference_image_url: string | null;
|
|
307
|
+
created_at: string;
|
|
308
|
+
completed_at: string | null;
|
|
309
|
+
}
|
|
310
|
+
/** Response when rotating an API key (includes new raw key, shown once) */
|
|
311
|
+
export type RotateApiKeyResponse = CreateApiKeyResponse;
|