@ductape/mcp 0.1.20 → 0.1.22

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 +42 -18
  2. package/package.json +1 -1
  3. package/src/index.ts +42 -18
package/dist/index.js CHANGED
@@ -99,11 +99,15 @@ There are THREE categories of operations. Use the right tool for each:
99
99
  2. RUNTIME OPERATIONS (run, dispatch, execute, start, send, produce, query, insert, update, delete…)
100
100
  The "input" field shape is product- and operation-specific — it is NOT derivable from Joi validators.
101
101
  It is defined by how the product's action/feature/session/quota/etc. was configured in Ductape.
102
- → ALWAYS call ductape_generate_payload first to get the canonical payload template.
102
+ → ALWAYS call ductape_generate_payload first to get the canonical payload template, EXCEPT for
103
+ messaging (produce/consume/dispatch) — see the Events section for why.
103
104
  → The template shows you exactly which input keys are expected and their types/defaults.
104
105
  → Then fill in the values and pass the completed payload to ductape_execute.
106
+ → Applies to: actions, features, sessions, notifications, databases, storage, graphs, vectors,
107
+ quotas, fallbacks, jobs, and any other operation that executes against a pre-configured schema.
105
108
 
106
- Skipping ductape_generate_payload for runtime operations will produce incorrect or empty input payloads.
109
+ Skipping ductape_generate_payload for applicable runtime operations will produce incorrect or empty input payloads.
110
+ Exception: messaging produce/consume/dispatch — the producer defines the schema, so infer from context instead.
107
111
 
108
112
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
109
113
 
@@ -305,9 +309,9 @@ ALL params are passed as a JSON array in positional order matching the SDK signa
305
309
  sample?: object, idempotent?: boolean, queueUrls?: [{ env_slug: string, url: string }] }]
306
310
  messageBrokers.topics.fetch [product_tag, topic_tag]
307
311
  messageBrokers.topics.list [product_tag, broker_tag]
308
- messageBrokers.produce [{ product, env, event: "broker_tag:topic_tag", message: { key: value }, session?, cache? }] ← CALL ductape_generate_payload FIRST (operation_family="messaging", method="produce", targets={broker, event})
312
+ messageBrokers.produce [{ product, env, event: "broker_tag:topic_tag", message: { key: value }, session?, cache? }]
309
313
  messageBrokers.consume [{ product, env, event: "broker_tag:topic_tag", callback: "function_ref" }]
310
- messageBrokers.dispatch [{ product, env, broker, event, input: { message }, retries?, session?, cache?, schedule?: { cron?, every?, start_at? } }] ← CALL ductape_generate_payload FIRST (operation_family="messaging", method="dispatch")
314
+ messageBrokers.dispatch [{ product, env, broker, event, input: { message }, retries?, session?, cache?, schedule?: { cron?, every?, start_at? } }]
311
315
  messageBrokers.messages.query [{ product, env, brokerTag, topicTag?, producerTag?, consumerTag?, status?, startDate?, endDate?, page?, limit? }]
312
316
  messageBrokers.messages.getProducers [{ product, env, brokerTag, topicTag?, page?, limit? }]
313
317
  messageBrokers.messages.getConsumers [{ product, env, brokerTag, topicTag?, page?, limit? }]
@@ -2063,25 +2067,45 @@ Import (register an EXISTING cloud resource):
2063
2067
  List topics on a broker:
2064
2068
  ductape_execute("messageBrokers.topics.list", [product_tag, "broker-tag"])
2065
2069
 
2066
- ━━━ RUNTIME: PRODUCE AND CONSUME ━━━
2070
+ ━━━ STEP 3: PRODUCE AND CONSUME — WRITTEN IN APPLICATION CODE ━━━
2067
2071
 
2068
- Produce (publish a message):
2069
- CALL ductape_generate_payload FIRST (operation_family="messaging", method="produce")
2070
- messageBrokers.produce [{ product, env, event: "broker_tag:topic_tag", message: { key: value } }]
2071
- Idempotent publish (deduplicates by key, default TTL 86400 s):
2072
- messageBrokers.publishIdempotent [{ product, env, event, message, idempotency_key, ttl? }]
2072
+ There is NO admin command or file to declare producers/consumers.
2073
+ There is NO "create producer" step before writing code.
2074
+ Producers and consumers are registered automatically by the SDK the first time your code calls
2075
+ produce/consume you do not pre-declare them.
2073
2076
 
2074
- Consume (subscribe):
2075
- messageBrokers.consume [{ product, env, event: "broker_tag:topic_tag",
2076
- callback: async (message) => { ... } }]
2077
+ The entire producer/consumer contract is the code you write in your controllers or services:
2078
+
2079
+ Produce (publish a message) write in your service/controller:
2080
+ Do NOT call ductape_generate_payload for messaging. Events have no pre-existing backend schema
2081
+ to discover — the producer defines the schema. Instead, infer the message shape from context
2082
+ (event name, existing data models, user input), present it to the user for approval, then implement.
2083
+ await ductape.events.produce({
2084
+ product: "my-product",
2085
+ env: "prd",
2086
+ event: "broker_tag:topic_tag", // "broker_tag:topic_tag" — always colon-separated
2087
+ message: { key: value }, // shape inferred from context, approved by user
2088
+ });
2089
+ Idempotent publish (deduplicates by key):
2090
+ await ductape.events.publishIdempotent({ product, env, event, message, idempotencyKey, idempotencyTtl? })
2091
+
2092
+ Consume (subscribe) — write in your service/controller:
2093
+ await ductape.events.consume({
2094
+ product: "my-product",
2095
+ env: "prd",
2096
+ event: "broker_tag:topic_tag",
2097
+ callback: async (message) => { /* handle message */ },
2098
+ });
2077
2099
  Callback errors are re-thrown so the broker can nack/retry.
2078
2100
 
2079
- Background dispatch with scheduling:
2080
- messageBrokers.dispatch [{ product, env, broker, event, input: { message },
2081
- schedule?: { start_at?, cron?, every?, limit?, endDate?, tz? } }]
2082
- → CALL ductape_generate_payload FIRST (operation_family="messaging", method="dispatch")
2101
+ Background dispatch with scheduling — write in your service/controller:
2102
+ await ductape.events.dispatch({ product, env, broker, event, input: { message },
2103
+ schedule?: { start_at?, cron?, every?, limit?, endDate?, tz? } })
2104
+
2105
+ For the four standard producer declarations (match-state, match-report, projection-updated,
2106
+ notification), write these produce calls in the relevant application service methods — there is
2107
+ no separate configuration file or CLI step. The SDK creates the producer metadata on first call.
2083
2108
 
2084
- Event format string: "broker_tag:topic_tag" — always colon-separated.
2085
2109
  Message payload is AES-encrypted before the tracking API call — tracking never sees plaintext.
2086
2110
 
2087
2111
  ━━━ OBSERVABILITY ━━━
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ductape/mcp",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
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
@@ -110,11 +110,15 @@ There are THREE categories of operations. Use the right tool for each:
110
110
  2. RUNTIME OPERATIONS (run, dispatch, execute, start, send, produce, query, insert, update, delete…)
111
111
  The "input" field shape is product- and operation-specific — it is NOT derivable from Joi validators.
112
112
  It is defined by how the product's action/feature/session/quota/etc. was configured in Ductape.
113
- → ALWAYS call ductape_generate_payload first to get the canonical payload template.
113
+ → ALWAYS call ductape_generate_payload first to get the canonical payload template, EXCEPT for
114
+ messaging (produce/consume/dispatch) — see the Events section for why.
114
115
  → The template shows you exactly which input keys are expected and their types/defaults.
115
116
  → Then fill in the values and pass the completed payload to ductape_execute.
117
+ → Applies to: actions, features, sessions, notifications, databases, storage, graphs, vectors,
118
+ quotas, fallbacks, jobs, and any other operation that executes against a pre-configured schema.
116
119
 
117
- Skipping ductape_generate_payload for runtime operations will produce incorrect or empty input payloads.
120
+ Skipping ductape_generate_payload for applicable runtime operations will produce incorrect or empty input payloads.
121
+ Exception: messaging produce/consume/dispatch — the producer defines the schema, so infer from context instead.
118
122
 
119
123
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
120
124
 
@@ -316,9 +320,9 @@ ALL params are passed as a JSON array in positional order matching the SDK signa
316
320
  sample?: object, idempotent?: boolean, queueUrls?: [{ env_slug: string, url: string }] }]
317
321
  messageBrokers.topics.fetch [product_tag, topic_tag]
318
322
  messageBrokers.topics.list [product_tag, broker_tag]
319
- messageBrokers.produce [{ product, env, event: "broker_tag:topic_tag", message: { key: value }, session?, cache? }] ← CALL ductape_generate_payload FIRST (operation_family="messaging", method="produce", targets={broker, event})
323
+ messageBrokers.produce [{ product, env, event: "broker_tag:topic_tag", message: { key: value }, session?, cache? }]
320
324
  messageBrokers.consume [{ product, env, event: "broker_tag:topic_tag", callback: "function_ref" }]
321
- messageBrokers.dispatch [{ product, env, broker, event, input: { message }, retries?, session?, cache?, schedule?: { cron?, every?, start_at? } }] ← CALL ductape_generate_payload FIRST (operation_family="messaging", method="dispatch")
325
+ messageBrokers.dispatch [{ product, env, broker, event, input: { message }, retries?, session?, cache?, schedule?: { cron?, every?, start_at? } }]
322
326
  messageBrokers.messages.query [{ product, env, brokerTag, topicTag?, producerTag?, consumerTag?, status?, startDate?, endDate?, page?, limit? }]
323
327
  messageBrokers.messages.getProducers [{ product, env, brokerTag, topicTag?, page?, limit? }]
324
328
  messageBrokers.messages.getConsumers [{ product, env, brokerTag, topicTag?, page?, limit? }]
@@ -2132,25 +2136,45 @@ Import (register an EXISTING cloud resource):
2132
2136
  List topics on a broker:
2133
2137
  ductape_execute("messageBrokers.topics.list", [product_tag, "broker-tag"])
2134
2138
 
2135
- ━━━ RUNTIME: PRODUCE AND CONSUME ━━━
2139
+ ━━━ STEP 3: PRODUCE AND CONSUME — WRITTEN IN APPLICATION CODE ━━━
2136
2140
 
2137
- Produce (publish a message):
2138
- CALL ductape_generate_payload FIRST (operation_family="messaging", method="produce")
2139
- messageBrokers.produce [{ product, env, event: "broker_tag:topic_tag", message: { key: value } }]
2140
- Idempotent publish (deduplicates by key, default TTL 86400 s):
2141
- messageBrokers.publishIdempotent [{ product, env, event, message, idempotency_key, ttl? }]
2141
+ There is NO admin command or file to declare producers/consumers.
2142
+ There is NO "create producer" step before writing code.
2143
+ Producers and consumers are registered automatically by the SDK the first time your code calls
2144
+ produce/consume you do not pre-declare them.
2142
2145
 
2143
- Consume (subscribe):
2144
- messageBrokers.consume [{ product, env, event: "broker_tag:topic_tag",
2145
- callback: async (message) => { ... } }]
2146
+ The entire producer/consumer contract is the code you write in your controllers or services:
2147
+
2148
+ Produce (publish a message) write in your service/controller:
2149
+ Do NOT call ductape_generate_payload for messaging. Events have no pre-existing backend schema
2150
+ to discover — the producer defines the schema. Instead, infer the message shape from context
2151
+ (event name, existing data models, user input), present it to the user for approval, then implement.
2152
+ await ductape.events.produce({
2153
+ product: "my-product",
2154
+ env: "prd",
2155
+ event: "broker_tag:topic_tag", // "broker_tag:topic_tag" — always colon-separated
2156
+ message: { key: value }, // shape inferred from context, approved by user
2157
+ });
2158
+ Idempotent publish (deduplicates by key):
2159
+ await ductape.events.publishIdempotent({ product, env, event, message, idempotencyKey, idempotencyTtl? })
2160
+
2161
+ Consume (subscribe) — write in your service/controller:
2162
+ await ductape.events.consume({
2163
+ product: "my-product",
2164
+ env: "prd",
2165
+ event: "broker_tag:topic_tag",
2166
+ callback: async (message) => { /* handle message */ },
2167
+ });
2146
2168
  Callback errors are re-thrown so the broker can nack/retry.
2147
2169
 
2148
- Background dispatch with scheduling:
2149
- messageBrokers.dispatch [{ product, env, broker, event, input: { message },
2150
- schedule?: { start_at?, cron?, every?, limit?, endDate?, tz? } }]
2151
- → CALL ductape_generate_payload FIRST (operation_family="messaging", method="dispatch")
2170
+ Background dispatch with scheduling — write in your service/controller:
2171
+ await ductape.events.dispatch({ product, env, broker, event, input: { message },
2172
+ schedule?: { start_at?, cron?, every?, limit?, endDate?, tz? } })
2173
+
2174
+ For the four standard producer declarations (match-state, match-report, projection-updated,
2175
+ notification), write these produce calls in the relevant application service methods — there is
2176
+ no separate configuration file or CLI step. The SDK creates the producer metadata on first call.
2152
2177
 
2153
- Event format string: "broker_tag:topic_tag" — always colon-separated.
2154
2178
  Message payload is AES-encrypted before the tracking API call — tracking never sees plaintext.
2155
2179
 
2156
2180
  ━━━ OBSERVABILITY ━━━