@ductape/mcp 0.2.13 → 0.2.14

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/CHANGELOG.md CHANGED
@@ -6,6 +6,7 @@
6
6
 
7
7
  ## Unreleased
8
8
 
9
+ - Added read-only `ductape_events_topic_setup` and `ductape_events_validate_project` tools and made the canonical one-topic-per-file `ductape/events/<topic-tag>.topic.json` layout explicit and enforceable through the CLI.
9
10
  - Mark `ductape_function_setup` as read-only, non-destructive, idempotent, and closed-world in both MCP registration APIs so hosts do not incorrectly require mutation approval for its pure setup-plan generation.
10
11
  - Broadened Feature guidance from durable/event-driven workflows to synchronous or asynchronous named product capabilities.
11
12
  - Added evidence-backed `FEATURE`, `FEATURE_STEP`, `DOMAIN_SERVICE`, `UTILITY`, and `INFRASTRUCTURE_ADAPTER` classification guidance.
package/README.md CHANGED
@@ -82,7 +82,12 @@ The server exposes runtime, schema, documentation, CLI, discovery, migration, an
82
82
  - ready-to-copy SDK snippet in `typescript` or `python`
83
83
  - Intended for engineers and copilots that need executable examples quickly.
84
84
 
85
- 4. **`ductape_function_setup`**:
85
+ 4. **`ductape_events_topic_setup` / `ductape_events_validate_project`**:
86
+ - Generate one canonical `ductape/events/<topic-tag>.topic.json` asset shape without writing it.
87
+ - Validate filenames, one-object-per-file schemas, unique qualified tags, supported fields, and publisher references before provisioning.
88
+ - Aggregate topic catalogues, manifests, envelope registries, and custom event registries are rejected.
89
+
90
+ 5. **`ductape_function_setup`**:
86
91
  - Produces the secure local and remote setup for application functions referenced by portable Features.
87
92
  - Requires an externally reachable HTTPS base URL (HTTP only for localhost development).
88
93
  - Returns deterministic well-known routes, framework raw-body requirements, HMAC-SHA256 headers,
package/dist/index.js CHANGED
@@ -630,8 +630,8 @@ ALL params are passed as a JSON array in positional order matching the SDK signa
630
630
  events.list [product_tag]
631
631
  events.delete [product_tag, broker_tag]
632
632
  events.topics.create ← FORBIDDEN with publishable key. Use ductape_cli instead:
633
- ductape_cli("events topics create -f topic.json")
634
- topic.json: { tag: "broker-tag:topic-tag", name, description?, sample?, idempotent?, queueUrls?: [{ env_slug, url }] }
633
+ ductape_cli("events topics create -f ductape/events/<topic-tag>.topic.json")
634
+ One directly importable topic per file: { tag: "broker-tag:topic-tag", name, description?, sample?, idempotent?, queueUrls?: [{ env_slug, url }] }
635
635
  ← Always required before consuming. For SQS: must include queueUrls per env.
636
636
  ← For Pub/Sub, Kafka, RabbitMQ, Redis, NATS: the first produce call auto-registers the topic,
637
637
  but you should still create it explicitly so consumers can subscribe before any produce occurs.
@@ -1477,6 +1477,24 @@ const portableFunctionSetupAnnotations = {
1477
1477
  idempotentHint: true,
1478
1478
  openWorldHint: false,
1479
1479
  };
1480
+ const eventsTopicSetupInputSchema = z.object({
1481
+ broker_tag: z.string().regex(/^[A-Za-z0-9]+(?:[-_][A-Za-z0-9]+)*$/).describe('Existing Ductape Events broker tag.'),
1482
+ topic_tag: z.string().regex(/^[A-Za-z0-9]+(?:[-_][A-Za-z0-9]+)*$/).describe('Unqualified topic tag used as the canonical filename.'),
1483
+ name: z.string().min(1),
1484
+ description: z.string().optional(),
1485
+ sample: z.record(z.unknown()).optional(),
1486
+ idempotent: z.boolean().optional(),
1487
+ queueUrls: z.array(z.object({ env_slug: z.string().min(1), url: z.string().url() }).strict()).optional(),
1488
+ });
1489
+ const eventsProjectValidationInputSchema = z.object({
1490
+ dir: z.string().default('ductape/events').describe('Must be ductape/events relative to DUCTAPE_PROJECT_DIR.'),
1491
+ });
1492
+ const readOnlyLocalAnnotations = {
1493
+ readOnlyHint: true,
1494
+ destructiveHint: false,
1495
+ idempotentHint: true,
1496
+ openWorldHint: false,
1497
+ };
1480
1498
  const migrationInputSchema = z.object({
1481
1499
  source: z.string().describe('Absolute path to the existing codebase.'),
1482
1500
  e2e_baseline: z.string().describe('Absolute path to a passing migration-e2e baseline manifest created before migration inspection.'),
@@ -3863,10 +3881,28 @@ Import (register an EXISTING cloud resource):
3863
3881
  IMPORTANT: events.topics.create requires an access key (admin operation).
3864
3882
  Use ductape_cli — NOT ductape_execute — to create topics.
3865
3883
 
3866
- Write a topic.json file, then:
3867
- ductape_cli("events topics create -f topic.json")
3868
-
3869
- topic.json schema:
3884
+ CANONICAL ASSET CONTRACT HARD REQUIREMENT:
3885
+ Ductape topic assets are individual, directly importable files at
3886
+ <project-root>/ductape/events/<topic-tag>.topic.json
3887
+ Never replace them with an aggregate catalog, manifest, envelope registry, custom event registry,
3888
+ or multi-topic JSON file. Exactly one topic definition is allowed per file. The filename uses the
3889
+ unqualified topic portion: tag "order-events:order-created" must be stored as
3890
+ ductape/events/order-created.topic.json.
3891
+
3892
+ Generate the exact path and body before writing a topic:
3893
+ ductape_events_topic_setup({ broker_tag: "order-events", topic_tag: "order-created", name: "Order Created" })
3894
+ Validate the complete repository before any remote mutation:
3895
+ ductape_events_validate_project({ dir: "ductape/events" })
3896
+ Or through the CLI:
3897
+ ductape_cli("events topics validate --dir ductape/events --json")
3898
+ ductape_cli("events topics create-all --dir ductape/events --json")
3899
+
3900
+ Create one topic directly from its canonical asset:
3901
+ ductape_cli("events topics create -f ductape/events/order-created.topic.json --json")
3902
+
3903
+ Each *.topic.json file may contain ONLY tag, name, description, sample, idempotent, and the
3904
+ currently supported provider-specific field queueUrls. Unknown custom fields are rejected.
3905
+ Canonical topic file schema:
3870
3906
  {
3871
3907
  "tag": "order-events:order-created", // ALWAYS "broker-tag:topic-tag" — full event string
3872
3908
  "name": "Order Created",
@@ -4738,6 +4774,48 @@ const portableFunctionSetupHandler = async (args) => {
4738
4774
  ],
4739
4775
  }, null, 2) }] };
4740
4776
  };
4777
+ const eventsTopicSetupHandler = async (args) => {
4778
+ const tag = `${args.broker_tag}:${args.topic_tag}`;
4779
+ const relativePath = `ductape/events/${args.topic_tag}.topic.json`;
4780
+ const definition = {
4781
+ tag,
4782
+ name: args.name,
4783
+ ...(args.description === undefined ? {} : { description: args.description }),
4784
+ ...(args.sample === undefined ? {} : { sample: args.sample }),
4785
+ ...(args.idempotent === undefined ? {} : { idempotent: args.idempotent }),
4786
+ ...(args.queueUrls === undefined ? {} : { queueUrls: args.queueUrls }),
4787
+ };
4788
+ return {
4789
+ content: [{ type: 'text', text: JSON.stringify({
4790
+ ok: true,
4791
+ project_root: cliCwd(),
4792
+ path: join(cliCwd(), relativePath),
4793
+ relative_path: relativePath,
4794
+ definition,
4795
+ create_command: `ductape events topics create -f ${relativePath} --json`,
4796
+ validate_command: 'ductape events topics validate --dir ductape/events --json',
4797
+ rules: [
4798
+ 'Write exactly this one JSON object to the returned path.',
4799
+ 'Do not create an aggregate topic catalogue, manifest, envelope registry, or multi-topic JSON file.',
4800
+ 'Run project validation before creating any remote topic.',
4801
+ ],
4802
+ }, null, 2) }],
4803
+ };
4804
+ };
4805
+ const eventsProjectValidationHandler = async (args) => {
4806
+ const dir = args.dir ?? 'ductape/events';
4807
+ if (dir !== 'ductape/events') {
4808
+ return {
4809
+ content: [{ type: 'text', text: 'Events topic assets must use the canonical directory ductape/events; custom directories are forbidden.' }],
4810
+ isError: true,
4811
+ };
4812
+ }
4813
+ const result = runCli('events topics validate --dir ductape/events --json');
4814
+ return {
4815
+ content: [{ type: 'text', text: result.output || '(no output)' }],
4816
+ ...(result.success ? {} : { isError: true }),
4817
+ };
4818
+ };
4741
4819
  const cliInputSchema = z.object({
4742
4820
  command: z.string().describe('The ductape CLI command to run, without the leading "ductape" word. ' +
4743
4821
  'Examples: "products list", "products create --name \\"My Product\\" --tag my-product", ' +
@@ -5230,6 +5308,21 @@ async function main() {
5230
5308
  'applications own transactional outboxes, domain rejection handling, and idempotent consumer mutations.',
5231
5309
  inputSchema: eventsDiscoveryInputSchema,
5232
5310
  }, eventsDiscoveryHandler);
5311
+ server.registerTool('ductape_events_topic_setup', {
5312
+ title: 'Ductape Events Topic Setup',
5313
+ description: 'Read-only generator for one canonical Ductape topic asset. Returns the required ' +
5314
+ 'ductape/events/<topic-tag>.topic.json path, its directly importable JSON object, and validation/create commands. ' +
5315
+ 'It does not write files or mutate remote resources.',
5316
+ inputSchema: eventsTopicSetupInputSchema,
5317
+ annotations: readOnlyLocalAnnotations,
5318
+ }, eventsTopicSetupHandler);
5319
+ server.registerTool('ductape_events_validate_project', {
5320
+ title: 'Validate Ductape Events Project',
5321
+ description: 'Read-only validation of canonical ductape/events/*.topic.json assets and statically discoverable publisher references. ' +
5322
+ 'Rejects aggregate catalogues, invalid filenames/shapes/tags, duplicates, unknown fields, and undefined published topics.',
5323
+ inputSchema: eventsProjectValidationInputSchema,
5324
+ annotations: readOnlyLocalAnnotations,
5325
+ }, eventsProjectValidationHandler);
5233
5326
  server.registerTool('ductape_function_setup', {
5234
5327
  title: 'Ductape Portable Function Setup',
5235
5328
  description: 'Read-only: generate (without applying) the mandatory secure local + remote runtime setup for application functions used by Features. ' +
@@ -5345,7 +5438,7 @@ async function main() {
5345
5438
  ' GCP Pub/Sub service identifier is "pubsub". AWS SQS is "sqs". Azure Service Bus is "servicebus".\n' +
5346
5439
  ' Message brokers are import-only (no provision-persist). Import flow is the same as storage.\n' +
5347
5440
  ' type field = "messageBrokers" (not "messagebrokers" or "events").\n' +
5348
- ' 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' +
5441
+ ' After importing, create one topic per canonical ductape/events/<topic-tag>.topic.json file. First run "events topics validate --dir ductape/events --json", then use "events topics create-all --dir ductape/events --json" or create each file directly. SQS requires queueUrls. Aggregate topic catalogues are forbidden.\n' +
5349
5442
  ' - Listing workspaces, products, focused product components, secrets\n' +
5350
5443
  ' Prefer "products components list --product-tag <tag> --json" for compact inventory; use\n' +
5351
5444
  ' "products components get --product-tag <tag> --type notifications|events|healthchecks|features --json" for focused detail.\n' +
@@ -5372,6 +5465,8 @@ async function main() {
5372
5465
  server.tool('ductape_schema', schemaInputSchema.shape, schemaHandler);
5373
5466
  server.tool('ductape_docs', docsInputSchema.shape, docsHandler);
5374
5467
  server.tool('ductape_events_discover', eventsDiscoveryInputSchema.shape, eventsDiscoveryHandler);
5468
+ server.tool('ductape_events_topic_setup', eventsTopicSetupInputSchema.shape, readOnlyLocalAnnotations, eventsTopicSetupHandler);
5469
+ server.tool('ductape_events_validate_project', eventsProjectValidationInputSchema.shape, readOnlyLocalAnnotations, eventsProjectValidationHandler);
5375
5470
  server.tool('ductape_function_setup', portableFunctionSetupInputSchema.shape, portableFunctionSetupAnnotations, portableFunctionSetupHandler);
5376
5471
  server.tool('ductape_redis_setup', redisSetupInputSchema.shape, redisSetupHandler);
5377
5472
  server.tool('ductape_migration_plan', migrationInputSchema.shape, migrationHandler);
package/docs/TOOLS.md CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  The Ductape MCP server exposes proxy, CLI, discovery, documentation, migration, and portable-function setup tools.
4
4
 
5
+ ## Tools: `ductape_events_topic_setup` and `ductape_events_validate_project`
6
+
7
+ `ductape_events_topic_setup` is a read-only generator for one canonical topic asset. It returns the
8
+ exact `<project-root>/ductape/events/<topic-tag>.topic.json` path, one directly importable JSON
9
+ object, and its validation/create commands. It never writes the file or creates a remote topic.
10
+
11
+ `ductape_events_validate_project` runs the CLI's repository validator. It rejects missing canonical
12
+ directories, non-`.topic.json` JSON files, aggregate arrays/catalogues, filename/tag disagreement,
13
+ unknown fields, duplicate tags, and statically discoverable publishers without a matching topic.
14
+
15
+ Ductape topic assets are always one topic per file. Never substitute an aggregate catalogue,
16
+ manifest, envelope registry, or custom event registry.
17
+
18
+ ---
19
+
5
20
  ## Tool: `ductape_function_setup`
6
21
 
7
22
  Produces the mandatory local registry and signed HTTPS exposure plan for portable application
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ductape/mcp",
3
- "version": "0.2.13",
3
+ "version": "0.2.14",
4
4
  "description": "MCP server that exposes Ductape SDK operations via the backend proxy",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",