@jclvsh/dropspace 2.0.4 → 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/README.md CHANGED
@@ -9,6 +9,7 @@ npm install -g @jclvsh/dropspace
9
9
  ```
10
10
 
11
11
  This installs two binaries:
12
+
12
13
  - `dropspace` — CLI for terminal use
13
14
  - `dropspace-mcp` — MCP server for AI agents
14
15
 
@@ -41,15 +42,15 @@ dropspace launches --help
41
42
 
42
43
  ### CLI Commands
43
44
 
44
- | Group | Commands | Count |
45
- | --- | --- | --- |
46
- | launches | list, create, get, update, delete, publish, retry, generate, retry-content, analytics, batch-analytics, status, delete-post, delete-posts | 14 |
47
- | personas | list, create, get, update, delete, analyze | 6 |
48
- | connections | list | 1 |
49
- | keys | me, list, create, rename, revoke | 5 |
50
- | webhooks | list, create, get, update, delete, rotate-secret, deliveries | 7 |
51
- | status | dropspace official account connections | 1 |
52
- | usage | plan, limits, and billing period | 1 |
45
+ | Group | Commands | Count |
46
+ | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ----- |
47
+ | launches | list, create, get, update, delete, publish, retry, generate, retry-content, analytics, batch-analytics, status, delete-post, delete-posts | 14 |
48
+ | personas | list, create, get, update, delete, analyze | 6 |
49
+ | connections | list | 1 |
50
+ | keys | me, list, create, rename, revoke | 5 |
51
+ | webhooks | list, create, get, update, delete, rotate-secret, deliveries | 7 |
52
+ | status | dropspace official account connections | 1 |
53
+ | usage | plan, limits, and billing period | 1 |
53
54
 
54
55
  ## MCP Server Configuration
55
56
 
@@ -269,14 +270,14 @@ Generate an API key at [www.dropspace.dev/settings](https://www.dropspace.dev/se
269
270
 
270
271
  API keys support scoped permissions:
271
272
 
272
- | Scope | Access |
273
- | ---------- | ---------------------------------------------------------------------- |
274
- | `read` | List and read launches, personas, connections, dropspace status |
275
- | `write` | Create and update launches, personas |
276
- | `delete` | Delete launches, personas |
277
- | `publish` | Publish and retry launches |
278
- | `generate` | Generate AI content, retry content generation |
279
- | `admin` | Manage API keys and webhooks |
273
+ | Scope | Access |
274
+ | ---------- | --------------------------------------------------------------- |
275
+ | `read` | List and read launches, personas, connections, dropspace status |
276
+ | `write` | Create and update launches, personas |
277
+ | `delete` | Delete launches, personas |
278
+ | `publish` | Publish and retry launches |
279
+ | `generate` | Generate AI content, retry content generation |
280
+ | `admin` | Manage API keys and webhooks |
280
281
 
281
282
  ### Recommended Scopes by Use Case
282
283
 
package/dist/cli-utils.js CHANGED
@@ -27,5 +27,8 @@ export function getFormat(opts) {
27
27
  return opts.format || "json";
28
28
  }
29
29
  export function parseList(value) {
30
- return value.split(",").map((s) => s.trim()).filter(Boolean);
30
+ return value
31
+ .split(",")
32
+ .map((s) => s.trim())
33
+ .filter(Boolean);
31
34
  }
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
+ }
@@ -1,8 +1,7 @@
1
1
  import { formatOutput, handleError, getFormat, parseList } from "../cli-utils.js";
2
2
  export function registerKeyCommands(program, client) {
3
3
  const keys = program.command("keys").alias("k").description("manage API keys");
4
- keys
5
- .command("me")
4
+ keys.command("me")
6
5
  .description("get current API key info")
7
6
  .action(async () => {
8
7
  try {
@@ -13,8 +12,7 @@ export function registerKeyCommands(program, client) {
13
12
  handleError(error);
14
13
  }
15
14
  });
16
- keys
17
- .command("list")
15
+ keys.command("list")
18
16
  .description("list API keys (requires admin scope)")
19
17
  .action(async () => {
20
18
  try {
@@ -25,8 +23,7 @@ export function registerKeyCommands(program, client) {
25
23
  handleError(error);
26
24
  }
27
25
  });
28
- keys
29
- .command("create")
26
+ keys.command("create")
30
27
  .description("create a new API key (requires admin scope)")
31
28
  .requiredOption("-n, --name <name>", "key name")
32
29
  .option("--scopes <list>", "comma-separated scopes: read,write,delete,publish,generate,admin", parseList)
@@ -42,8 +39,7 @@ export function registerKeyCommands(program, client) {
42
39
  handleError(error);
43
40
  }
44
41
  });
45
- keys
46
- .command("rename <id>")
42
+ keys.command("rename <id>")
47
43
  .description("rename an API key (requires admin scope)")
48
44
  .requiredOption("-n, --name <name>", "new key name")
49
45
  .action(async (id, opts) => {
@@ -55,8 +51,7 @@ export function registerKeyCommands(program, client) {
55
51
  handleError(error);
56
52
  }
57
53
  });
58
- keys
59
- .command("revoke <id>")
54
+ keys.command("revoke <id>")
60
55
  .description("permanently revoke an API key (requires admin scope)")
61
56
  .action(async (id) => {
62
57
  try {
@@ -67,4 +62,15 @@ export function registerKeyCommands(program, client) {
67
62
  handleError(error);
68
63
  }
69
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
+ });
70
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
+ }
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
+ }
@@ -1,5 +1,8 @@
1
1
  import { z } from "zod";
2
- const SCOPES = ["read", "write", "delete", "publish", "generate", "admin"];
2
+ // Cross-repo canonical scope vocabulary (2026-05-07): read/write/generate/send/admin.
3
+ // Pre-rename: `delete` was folded into `write` (soft-deletes are writes); `publish` is now `send`.
4
+ // Existing keys with legacy scope values continue to authenticate via SCOPE_ALIASES on the server.
5
+ const SCOPES = ["read", "write", "generate", "send", "admin"];
3
6
  export function registerKeyTools(server, client) {
4
7
  server.tool("get_current_api_key", "get the current API key's info — name, scopes, and prefix (no scope required)", {}, async () => {
5
8
  try {
@@ -104,4 +107,25 @@ export function registerKeyTools(server, client) {
104
107
  };
105
108
  }
106
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
+ });
107
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
+ }
package/dist/types.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /** Paginated API response wrapper */
2
2
  export interface PaginatedResponse<T> {
3
+ success: true;
3
4
  data: T[];
4
5
  pagination: {
5
6
  page: number;
@@ -10,14 +11,18 @@ export interface PaginatedResponse<T> {
10
11
  }
11
12
  /** Single-item API response wrapper */
12
13
  export interface DataResponse<T> {
14
+ success: true;
13
15
  data: T;
14
16
  }
15
17
  /** API error response */
16
18
  export interface ApiErrorResponse {
19
+ success: false;
17
20
  error: {
18
21
  code: string;
19
22
  message: string;
23
+ requestId: string;
20
24
  field?: string;
25
+ details?: Record<string, unknown>;
21
26
  };
22
27
  }
23
28
  /** Launch resource */
@@ -255,3 +260,52 @@ export interface RetryContentResponse {
255
260
  still_failing: string[];
256
261
  rate_limited: string[];
257
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jclvsh/dropspace",
3
- "version": "2.0.4",
3
+ "version": "2.2.0",
4
4
  "description": "MCP server and CLI for the Dropspace API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",