@ductape/mcp 0.1.39 → 0.1.40

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.
Files changed (3) hide show
  1. package/dist/index.js +44 -32
  2. package/package.json +1 -1
  3. package/src/index.ts +44 -32
package/dist/index.js CHANGED
@@ -464,18 +464,18 @@ ALL params are passed as a JSON array in positional order matching the SDK signa
464
464
  messageBrokers.fetch [product_tag, broker_tag]
465
465
  messageBrokers.list [product_tag]
466
466
  messageBrokers.delete [product_tag, broker_tag]
467
- messageBrokers.topics.create [product_tag, data: { tag: string, name: string, broker: string,
468
- description?: string, sample?: object, idempotent?: boolean,
469
- queueUrls?: [{ env_slug: string, url: string }] // SQS only: per-env queue URL per topic
470
- }]
471
- OPTIONAL for most providers: creating a producer automatically creates the topic if it does not exist.
472
- Only required explicitly for SQS (must supply queueUrls per env) or when you want to set sample/idempotent upfront.
473
- For Pub/Sub, Kafka, RabbitMQ, Redis, NATS: skip this — let producer creation handle it.
474
- A broker can have unlimited topics. Add one per logical event type.
475
- messageBrokers.topics.update [product_tag, topic_tag, data: { name?: string, description?: string,
476
- sample?: object, idempotent?: boolean, queueUrls?: [{ env_slug: string, url: string }] }]
477
- messageBrokers.topics.fetch [product_tag, topic_tag]
478
- messageBrokers.topics.list [product_tag, broker_tag]
467
+ messageBrokers.topics.create FORBIDDEN with publishable key. Use ductape_cli instead:
468
+ ductape_cli("events topics create -f topic.json")
469
+ topic.json: { tag, name, broker, description?, sample?, idempotent?, queueUrls?: [{ env_slug, url }] }
470
+ ← Always required before consuming. For SQS: must include queueUrls per env.
471
+ For Pub/Sub, Kafka, RabbitMQ, Redis, NATS: the first produce call auto-registers the topic,
472
+ but you should still create it explicitly so consumers can subscribe before any produce occurs.
473
+ messageBrokers.topics.update FORBIDDEN with publishable key. Use ductape_cli:
474
+ ductape_cli("events topics update --tag broker:topic -f patch.json")
475
+ messageBrokers.topics.delete ← FORBIDDEN with publishable key. Use ductape_cli:
476
+ ductape_cli("events topics delete --tag broker:topic")
477
+ messageBrokers.topics.fetch [product_tag, topic_tag] ← safe via ductape_execute
478
+ messageBrokers.topics.list [product_tag, broker_tag] ← safe via ductape_execute
479
479
  messageBrokers.produce [{ product, env, event: "broker_tag:topic_tag", message: { key: value }, session?, cache? }]
480
480
  messageBrokers.consume [{ product, env, event: "broker_tag:topic_tag", callback: "function_ref" }]
481
481
  messageBrokers.dispatch [{ product, env, broker, event, input: { message }, retries?, session?, cache?, schedule?: { cron?, every?, start_at? } }]
@@ -2422,22 +2422,34 @@ Import (register an EXISTING cloud resource):
2422
2422
  Producing to a topic also calls ensureTopicRegistered in the background — but DO NOT rely on
2423
2423
  auto-registration for consume paths. Always create topics explicitly.
2424
2424
 
2425
- ductape_execute("messageBrokers.topics.create", [product_tag, {
2426
- tag: "order-created", // topic tag (just the topic part, NOT "broker:topic")
2427
- name: "Order Created",
2428
- broker: "order-events", // broker component tag
2429
- description?: string,
2430
- sample: { orderId: "string", total: 0 }, // documents expected message shape
2431
- idempotent?: boolean, // if true, Ductape deduplicates by idempotency_key
2432
- // AWS SQS only — must supply per-env queue URL:
2433
- queueUrls?: [
2434
- { env_slug: "snd", url: "https://sqs.us-east-1.amazonaws.com/123/queue-snd" },
2435
- { env_slug: "prd", url: "https://sqs.us-east-1.amazonaws.com/123/queue-prd" }
2436
- ]
2437
- }])
2425
+ IMPORTANT: messageBrokers.topics.create requires an access key (admin operation).
2426
+ Use ductape_cli NOT ductape_execute to create topics.
2427
+
2428
+ Write a topic.json file, then:
2429
+ ductape_cli("events topics create -f topic.json")
2430
+
2431
+ topic.json schema:
2432
+ {
2433
+ "tag": "order-created", // topic tag only — NOT "broker:topic"
2434
+ "name": "Order Created",
2435
+ "broker": "order-events", // broker component tag
2436
+ "description": "...", // optional
2437
+ "sample": { "orderId": "string", "total": 0 }, // expected message shape
2438
+ "idempotent": false, // optional — deduplicates by idempotency_key when true
2439
+ // AWS SQS only — per-env queue URL:
2440
+ "queueUrls": [
2441
+ { "env_slug": "snd", "url": "https://sqs.us-east-1.amazonaws.com/123/queue-snd" },
2442
+ { "env_slug": "prd", "url": "https://sqs.us-east-1.amazonaws.com/123/queue-prd" }
2443
+ ]
2444
+ }
2445
+
2446
+ Other topic operations (all require access key via ductape_cli):
2447
+ ductape_cli("events topics list --tag order-events") → list topics for a broker
2448
+ ductape_cli("events topics get --tag order-events:order-created")
2449
+ ductape_cli("events topics update --tag order-events:order-created -f patch.json")
2450
+ ductape_cli("events topics delete --tag order-events:order-created")
2438
2451
 
2439
- List / fetch topics:
2440
- ductape_execute("messageBrokers.topics.list", [product_tag, "broker-tag"])
2452
+ Read-only fetches (safe with publishable key via ductape_execute):
2441
2453
  ductape_execute("messageBrokers.fetch", [product_tag, "broker-tag"]) → includes topics[]
2442
2454
 
2443
2455
  ━━━ STEP 3: PRODUCE — WRITTEN IN APPLICATION CODE ━━━
@@ -2465,13 +2477,13 @@ Import (register an EXISTING cloud resource):
2465
2477
  });
2466
2478
 
2467
2479
  NESTJS — method decorator:
2468
- import { Messaging } from '@ductape/nestjs';
2480
+ import { Events } from '@ductape/nestjs';
2469
2481
  @Injectable() export class OrdersService {
2470
- @Messaging.Produce({ event: 'order-events:order-created' })
2482
+ @Events.Produce({ event: 'order-events:order-created' })
2471
2483
  emitOrderCreated(payload: { orderId: string; total: number }) { return payload; }
2472
2484
 
2473
2485
  // Scheduled dispatch — fire-and-forget with optional schedule:
2474
- @Messaging.Dispatch({ broker: 'order-events', event: 'order-events:order-created',
2486
+ @Events.Dispatch({ broker: 'order-events', event: 'order-events:order-created',
2475
2487
  schedule?: { start_at?, cron?, every?, limit?, tz? } })
2476
2488
  scheduleOrderNotification(payload: Record<string, unknown>) { return payload; }
2477
2489
  }
@@ -2546,7 +2558,7 @@ Import (register an EXISTING cloud resource):
2546
2558
  consumer?: { tag: "order-processor", name: "Order Processor" },
2547
2559
  });
2548
2560
 
2549
- NESTJS — use SDK in onModuleInit (no @Messaging.Consume decorator exists yet):
2561
+ NESTJS — use SDK in onModuleInit (no @Events.Consume decorator exists yet):
2550
2562
  @Injectable()
2551
2563
  export class OrderConsumerService implements OnModuleInit {
2552
2564
  constructor(private readonly ductape: Ductape) {}
@@ -3523,7 +3535,7 @@ async function main() {
3523
3535
  ' GCP Pub/Sub service identifier is "pubsub". AWS SQS is "sqs". Azure Service Bus is "servicebus".\n' +
3524
3536
  ' Message brokers are import-only (no provision-persist). Import flow is the same as storage.\n' +
3525
3537
  ' type field = "messageBrokers" (not "messagebrokers" or "events").\n' +
3526
- ' After importing, create producers topics are auto-created with the producer (except SQS, which needs explicit topics.create with queueUrls first).\n' +
3538
+ ' After importing, create topics first with ductape_cli("events topics create -f topic.json") — SQS requires explicit topic creation with queueUrls. For other providers, topics auto-register on first produce but should still be created explicitly before any consumer subscribes.\n' +
3527
3539
  ' - Listing workspaces, products, secrets\n' +
3528
3540
  ' - Linking a project folder: "link --product <tag> --env <slug>"\n' +
3529
3541
  ' - Syncing sessions/notifications/events: "apply" or "apply sessions" etc.\n' +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ductape/mcp",
3
- "version": "0.1.39",
3
+ "version": "0.1.40",
4
4
  "description": "MCP server that exposes Ductape SDK operations via the backend proxy",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/src/index.ts CHANGED
@@ -475,18 +475,18 @@ ALL params are passed as a JSON array in positional order matching the SDK signa
475
475
  messageBrokers.fetch [product_tag, broker_tag]
476
476
  messageBrokers.list [product_tag]
477
477
  messageBrokers.delete [product_tag, broker_tag]
478
- messageBrokers.topics.create [product_tag, data: { tag: string, name: string, broker: string,
479
- description?: string, sample?: object, idempotent?: boolean,
480
- queueUrls?: [{ env_slug: string, url: string }] // SQS only: per-env queue URL per topic
481
- }]
482
- OPTIONAL for most providers: creating a producer automatically creates the topic if it does not exist.
483
- Only required explicitly for SQS (must supply queueUrls per env) or when you want to set sample/idempotent upfront.
484
- For Pub/Sub, Kafka, RabbitMQ, Redis, NATS: skip this — let producer creation handle it.
485
- A broker can have unlimited topics. Add one per logical event type.
486
- messageBrokers.topics.update [product_tag, topic_tag, data: { name?: string, description?: string,
487
- sample?: object, idempotent?: boolean, queueUrls?: [{ env_slug: string, url: string }] }]
488
- messageBrokers.topics.fetch [product_tag, topic_tag]
489
- messageBrokers.topics.list [product_tag, broker_tag]
478
+ messageBrokers.topics.create FORBIDDEN with publishable key. Use ductape_cli instead:
479
+ ductape_cli("events topics create -f topic.json")
480
+ topic.json: { tag, name, broker, description?, sample?, idempotent?, queueUrls?: [{ env_slug, url }] }
481
+ ← Always required before consuming. For SQS: must include queueUrls per env.
482
+ For Pub/Sub, Kafka, RabbitMQ, Redis, NATS: the first produce call auto-registers the topic,
483
+ but you should still create it explicitly so consumers can subscribe before any produce occurs.
484
+ messageBrokers.topics.update FORBIDDEN with publishable key. Use ductape_cli:
485
+ ductape_cli("events topics update --tag broker:topic -f patch.json")
486
+ messageBrokers.topics.delete ← FORBIDDEN with publishable key. Use ductape_cli:
487
+ ductape_cli("events topics delete --tag broker:topic")
488
+ messageBrokers.topics.fetch [product_tag, topic_tag] ← safe via ductape_execute
489
+ messageBrokers.topics.list [product_tag, broker_tag] ← safe via ductape_execute
490
490
  messageBrokers.produce [{ product, env, event: "broker_tag:topic_tag", message: { key: value }, session?, cache? }]
491
491
  messageBrokers.consume [{ product, env, event: "broker_tag:topic_tag", callback: "function_ref" }]
492
492
  messageBrokers.dispatch [{ product, env, broker, event, input: { message }, retries?, session?, cache?, schedule?: { cron?, every?, start_at? } }]
@@ -2495,22 +2495,34 @@ Import (register an EXISTING cloud resource):
2495
2495
  Producing to a topic also calls ensureTopicRegistered in the background — but DO NOT rely on
2496
2496
  auto-registration for consume paths. Always create topics explicitly.
2497
2497
 
2498
- ductape_execute("messageBrokers.topics.create", [product_tag, {
2499
- tag: "order-created", // topic tag (just the topic part, NOT "broker:topic")
2500
- name: "Order Created",
2501
- broker: "order-events", // broker component tag
2502
- description?: string,
2503
- sample: { orderId: "string", total: 0 }, // documents expected message shape
2504
- idempotent?: boolean, // if true, Ductape deduplicates by idempotency_key
2505
- // AWS SQS only — must supply per-env queue URL:
2506
- queueUrls?: [
2507
- { env_slug: "snd", url: "https://sqs.us-east-1.amazonaws.com/123/queue-snd" },
2508
- { env_slug: "prd", url: "https://sqs.us-east-1.amazonaws.com/123/queue-prd" }
2509
- ]
2510
- }])
2498
+ IMPORTANT: messageBrokers.topics.create requires an access key (admin operation).
2499
+ Use ductape_cli NOT ductape_execute to create topics.
2500
+
2501
+ Write a topic.json file, then:
2502
+ ductape_cli("events topics create -f topic.json")
2503
+
2504
+ topic.json schema:
2505
+ {
2506
+ "tag": "order-created", // topic tag only — NOT "broker:topic"
2507
+ "name": "Order Created",
2508
+ "broker": "order-events", // broker component tag
2509
+ "description": "...", // optional
2510
+ "sample": { "orderId": "string", "total": 0 }, // expected message shape
2511
+ "idempotent": false, // optional — deduplicates by idempotency_key when true
2512
+ // AWS SQS only — per-env queue URL:
2513
+ "queueUrls": [
2514
+ { "env_slug": "snd", "url": "https://sqs.us-east-1.amazonaws.com/123/queue-snd" },
2515
+ { "env_slug": "prd", "url": "https://sqs.us-east-1.amazonaws.com/123/queue-prd" }
2516
+ ]
2517
+ }
2518
+
2519
+ Other topic operations (all require access key via ductape_cli):
2520
+ ductape_cli("events topics list --tag order-events") → list topics for a broker
2521
+ ductape_cli("events topics get --tag order-events:order-created")
2522
+ ductape_cli("events topics update --tag order-events:order-created -f patch.json")
2523
+ ductape_cli("events topics delete --tag order-events:order-created")
2511
2524
 
2512
- List / fetch topics:
2513
- ductape_execute("messageBrokers.topics.list", [product_tag, "broker-tag"])
2525
+ Read-only fetches (safe with publishable key via ductape_execute):
2514
2526
  ductape_execute("messageBrokers.fetch", [product_tag, "broker-tag"]) → includes topics[]
2515
2527
 
2516
2528
  ━━━ STEP 3: PRODUCE — WRITTEN IN APPLICATION CODE ━━━
@@ -2538,13 +2550,13 @@ Import (register an EXISTING cloud resource):
2538
2550
  });
2539
2551
 
2540
2552
  NESTJS — method decorator:
2541
- import { Messaging } from '@ductape/nestjs';
2553
+ import { Events } from '@ductape/nestjs';
2542
2554
  @Injectable() export class OrdersService {
2543
- @Messaging.Produce({ event: 'order-events:order-created' })
2555
+ @Events.Produce({ event: 'order-events:order-created' })
2544
2556
  emitOrderCreated(payload: { orderId: string; total: number }) { return payload; }
2545
2557
 
2546
2558
  // Scheduled dispatch — fire-and-forget with optional schedule:
2547
- @Messaging.Dispatch({ broker: 'order-events', event: 'order-events:order-created',
2559
+ @Events.Dispatch({ broker: 'order-events', event: 'order-events:order-created',
2548
2560
  schedule?: { start_at?, cron?, every?, limit?, tz? } })
2549
2561
  scheduleOrderNotification(payload: Record<string, unknown>) { return payload; }
2550
2562
  }
@@ -2619,7 +2631,7 @@ Import (register an EXISTING cloud resource):
2619
2631
  consumer?: { tag: "order-processor", name: "Order Processor" },
2620
2632
  });
2621
2633
 
2622
- NESTJS — use SDK in onModuleInit (no @Messaging.Consume decorator exists yet):
2634
+ NESTJS — use SDK in onModuleInit (no @Events.Consume decorator exists yet):
2623
2635
  @Injectable()
2624
2636
  export class OrderConsumerService implements OnModuleInit {
2625
2637
  constructor(private readonly ductape: Ductape) {}
@@ -3659,7 +3671,7 @@ async function main() {
3659
3671
  ' GCP Pub/Sub service identifier is "pubsub". AWS SQS is "sqs". Azure Service Bus is "servicebus".\n' +
3660
3672
  ' Message brokers are import-only (no provision-persist). Import flow is the same as storage.\n' +
3661
3673
  ' type field = "messageBrokers" (not "messagebrokers" or "events").\n' +
3662
- ' After importing, create producers topics are auto-created with the producer (except SQS, which needs explicit topics.create with queueUrls first).\n' +
3674
+ ' After importing, create topics first with ductape_cli("events topics create -f topic.json") — SQS requires explicit topic creation with queueUrls. For other providers, topics auto-register on first produce but should still be created explicitly before any consumer subscribes.\n' +
3663
3675
  ' - Listing workspaces, products, secrets\n' +
3664
3676
  ' - Linking a project folder: "link --product <tag> --env <slug>"\n' +
3665
3677
  ' - Syncing sessions/notifications/events: "apply" or "apply sessions" etc.\n' +