@jclvsh/dropspace 2.1.0 → 2.3.1

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 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,3 @@
1
+ import type { Command } from "commander";
2
+ import type { DropspaceClient } from "../client.js";
3
+ export declare function registerCreditCommands(program: Command, client: DropspaceClient): void;
@@ -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
+ }
@@ -26,7 +26,7 @@ export function registerKeyCommands(program, client) {
26
26
  keys.command("create")
27
27
  .description("create a new API key (requires admin scope)")
28
28
  .requiredOption("-n, --name <name>", "key name")
29
- .option("--scopes <list>", "comma-separated scopes: read,write,delete,publish,generate,admin", parseList)
29
+ .option("--scopes <list>", "comma-separated scopes: read,write,generate,send,admin (legacy publish/delete still accepted)", parseList)
30
30
  .action(async (opts) => {
31
31
  try {
32
32
  const body = { name: opts.name };
@@ -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,3 @@
1
+ import type { Command } from "commander";
2
+ import type { DropspaceClient } from "../client.js";
3
+ export declare function registerMediaCommands(program: Command, client: DropspaceClient): void;
@@ -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
+ }
@@ -74,6 +74,18 @@ export function registerWebhookCommands(program, client) {
74
74
  handleError(error);
75
75
  }
76
76
  });
77
+ webhooks
78
+ .command("test <id>")
79
+ .description("send a synthetic webhook.test event to a webhook URL — verifies end-to-end delivery and signing (requires admin scope)")
80
+ .action(async (id) => {
81
+ try {
82
+ const result = await client.post(`/webhooks/${id}/test`);
83
+ formatOutput(result, getFormat(program.opts()));
84
+ }
85
+ catch (error) {
86
+ handleError(error);
87
+ }
88
+ });
77
89
  webhooks
78
90
  .command("rotate-secret <id>")
79
91
  .description("rotate a webhook's signing secret (requires admin scope)")
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.3",
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,3 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { DropspaceClient } from "../client.js";
3
+ export declare function registerCreditTools(server: McpServer, client: DropspaceClient): void;
@@ -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
+ }
@@ -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,3 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { DropspaceClient } from "../client.js";
3
+ export declare function registerMediaTools(server: McpServer, client: DropspaceClient): void;
@@ -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
+ }
@@ -152,6 +152,27 @@ export function registerWebhookTools(server, client) {
152
152
  };
153
153
  }
154
154
  });
155
+ server.tool("test_webhook", "send a synthetic webhook.test event to a webhook URL and report the receiver's response status — useful for verifying setup before relying on real events (requires admin scope)", {
156
+ id: z.string().uuid().describe("webhook ID"),
157
+ }, async ({ id }) => {
158
+ try {
159
+ const result = await client.post(`/webhooks/${id}/test`);
160
+ return {
161
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
162
+ };
163
+ }
164
+ catch (error) {
165
+ return {
166
+ content: [
167
+ {
168
+ type: "text",
169
+ text: `error: ${error instanceof Error ? error.message : String(error)}`,
170
+ },
171
+ ],
172
+ isError: true,
173
+ };
174
+ }
175
+ });
155
176
  server.tool("list_webhook_deliveries", "list delivery attempts for a webhook with pagination (requires admin scope)", {
156
177
  id: z.string().uuid().describe("webhook ID"),
157
178
  page: z.number().int().positive().optional().describe("page number (default: 1)"),
package/dist/types.d.ts CHANGED
@@ -198,6 +198,13 @@ export interface RotateSecretResponse {
198
198
  id: string;
199
199
  secret: string;
200
200
  }
201
+ /** Result of POST /webhooks/:id/test — outcome of a synthetic webhook delivery */
202
+ export interface TestWebhookResponse {
203
+ success: boolean;
204
+ delivery_id: string | null;
205
+ response_status: number | null;
206
+ response_body: string | null;
207
+ }
201
208
  /** Webhook delivery log entry */
202
209
  export interface WebhookDelivery {
203
210
  id: string;
@@ -260,3 +267,52 @@ export interface RetryContentResponse {
260
267
  still_failing: string[];
261
268
  rate_limited: string[];
262
269
  }
270
+ /** Credit pack offering */
271
+ export interface CreditPack {
272
+ id: string;
273
+ credits: number;
274
+ price_usd: string;
275
+ }
276
+ /** Credit balance response (shape varies by auth type) */
277
+ export interface CreditBalance {
278
+ balance: number;
279
+ packs?: CreditPack[];
280
+ purchase_endpoint?: string;
281
+ message?: string;
282
+ }
283
+ /** Credit pack purchase response */
284
+ export interface CreditPurchaseResult {
285
+ credits_added: number;
286
+ new_balance: number;
287
+ pack: CreditPack;
288
+ }
289
+ /** Media generation job (initial response from POST /media/generate) */
290
+ export interface MediaGenerationStarted {
291
+ status: "processing";
292
+ job_id: string;
293
+ fal_request_id: string;
294
+ generation_type: "image" | "video";
295
+ usage: {
296
+ used: number;
297
+ limit: number | "unlimited";
298
+ remaining: number | "unlimited";
299
+ };
300
+ plan: string;
301
+ }
302
+ /** Media generation job state (from GET /media/:jobId) */
303
+ export interface MediaGenerationJob {
304
+ id: string;
305
+ generation_type: "image" | "video";
306
+ model_id: string;
307
+ prompt: string;
308
+ result_url: string | null;
309
+ status: string;
310
+ progress: number | null;
311
+ error_message: string | null;
312
+ launch_id: string | null;
313
+ reference_image_url: string | null;
314
+ created_at: string;
315
+ completed_at: string | null;
316
+ }
317
+ /** Response when rotating an API key (includes new raw key, shown once) */
318
+ export type RotateApiKeyResponse = CreateApiKeyResponse;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jclvsh/dropspace",
3
- "version": "2.1.0",
3
+ "version": "2.3.1",
4
4
  "description": "MCP server and CLI for the Dropspace API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",