@ductape/mcp 0.2.29 → 0.2.30

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/index.js CHANGED
@@ -197,14 +197,14 @@ There are THREE categories of operations. Use the right tool for each:
197
197
  1. ASSET CREATION / UPDATE (create, update, add, register… for ANY asset type)
198
198
  ALL creation and update operations require an access key and CANNOT go through ductape_execute.
199
199
  → Use ductape_cli for every create/update operation. Examples:
200
- ductape_cli("apps create -f app.json") # no --name/--description flags exist, only -f <file.json> or interactive TTY. body: { app_name, description, tag, envs?: [{ env_name, slug, description, base_url, active }] } — tag is REQUIRED.
200
+ ductape_cli("apps create -f ductape/apps/<app-tag>.app.json") # no --name/--description flags exist, only -f <file.json> or interactive TTY. body: { app_name, description, tag, envs?: [{ env_name, slug, description, base_url, active }] } — tag is REQUIRED.
201
201
  ductape_cli("apps list")
202
202
  ductape_cli("resources storage list")
203
- ductape_cli("resources database create -f db-config.json")
203
+ ductape_cli("resources database create -f ductape/databases/<database-tag>.database.json")
204
204
  This applies to: products, apps, and resources (databases, storage, caches, etc.),
205
205
  cloud connections, and secrets. Environments have their own CLI commands (see below);
206
206
  app actions have their own CLI commands too — ductape_cli("apps actions create --app <tag>
207
- --action-file action.json") (NOT -f — that flag is claimed by the parent "apps" command, so
207
+ --action-file ductape/actions/<app-tag>/<action-tag>.action.json") (NOT -f — that flag is claimed by the parent "apps" command, so
208
208
  Commander resolves it against the ancestor and this subcommand never sees it; same fix as
209
209
  "products environments create/update" uses --env-file for the identical reason). Body: {
210
210
  tag, name, resource, method, request_type, description?, params?, query?, headers?, body?,
@@ -290,6 +290,16 @@ There are THREE categories of operations. Use the right tool for each:
290
290
  → Applies to: actions, features, sessions, notifications, databases, storage, graphs, vectors,
291
291
  quotas, fallbacks, jobs, and any other operation that executes against a pre-configured schema.
292
292
 
293
+ SAVED ACTION REUSE IS MANDATORY:
294
+ → Before creating a database, graph, or vector action, list the existing actions on that exact
295
+ component and inspect plausible matches with get/fetch.
296
+ → Reuse an existing action when its operation, target, template/query, parameters, and output
297
+ semantics satisfy the requested behavior. Invoke it by tag; do not create a duplicate merely
298
+ because the requested name differs.
299
+ → Create a new action only when no existing action provides the required behavior. Update an
300
+ existing action only for a compatible correction; do not mutate a shared action into different
301
+ semantics. State the evidence used to decide reuse versus creation.
302
+
293
303
  Skipping ductape_generate_payload for applicable runtime operations will produce incorrect or empty input payloads.
294
304
  Exception: messaging produce/consume/dispatch — the producer defines the schema, so infer from context instead.
295
305
 
@@ -483,8 +493,8 @@ ALL params are passed as a JSON array in positional order matching the SDK signa
483
493
 
484
494
  ━━━ MODULE: actions (app actions) ━━━
485
495
  These are admin ops — go through ductape_cli, not ductape_execute:
486
- ductape_cli("apps actions create --app <app_tag> --action-file action.json")
487
- ductape_cli("apps actions update --app <app_tag> --action <action_tag> --action-file action.json")
496
+ ductape_cli("apps actions create --app <app_tag> --action-file ductape/actions/<app_tag>/<action_tag>.action.json")
497
+ ductape_cli("apps actions update --app <app_tag> --action <action_tag> --action-file ductape/actions/<app_tag>/<action_tag>.action.json")
488
498
  ductape_cli("apps actions list --app <app_tag> --json")
489
499
  ductape_cli("apps actions get --app <app_tag> --action <action_tag> --json")
490
500
  ductape_cli("apps actions delete --app <app_tag> --action <action_tag>")
@@ -782,7 +792,7 @@ ALL params are passed as a JSON array in positional order matching the SDK signa
782
792
  databases.migration.status [migrations]
783
793
  databases.action.create [{ tag: "product:database:action", name, description, tableName, operation: "query"|"insert"|"update"|"delete"|"aggregate"|"count", template, filterTemplate? }]
784
794
  ← ADMINISTRATIVE (access key required). FORBIDDEN via ductape_execute (publishable key) —
785
- use ductape_cli("db actions create --action-file action.json") instead. tag MUST be fully qualified
795
+ use ductape_cli("db actions create --action-file ductape/database/actions/<action-tag>.action.json") instead. tag MUST be fully qualified
786
796
  "product_tag:database_tag:action_tag" — a 2-part "database:action" shorthand only resolves
787
797
  inside a long-lived process that already has that product's builder cached, never in a
788
798
  fresh CLI/MCP call. This is pure metadata registration; it never connects to the live
@@ -2432,9 +2442,15 @@ ctx.database.execute inside a Feature step invokes a saved action through its \`
2432
2442
  Direct ctx.database.query/insert/update/delete calls retain their normal {table, where, data, ...}
2433
2443
  shape and do not resolve a saved action.
2434
2444
 
2445
+ REUSE BEFORE CREATE:
2446
+ 1. ductape_cli("db actions list --database product_tag:database_tag --json")
2447
+ 2. Inspect likely matches with ductape_cli("db actions get product_tag:database_tag:action_tag --json").
2448
+ 3. Reuse the matching tag with database.execute/ctx.database.execute when operation, table,
2449
+ template, parameters, and result semantics match. Create only when no exact functional match exists.
2450
+
2435
2451
  Create/update/delete are ADMINISTRATIVE (access key) — FORBIDDEN through ductape_execute
2436
2452
  (publishable key). Use ductape_cli, same as every other admin resource:
2437
- ductape_cli("db actions create --action-file action.json")
2453
+ ductape_cli("db actions create --action-file ductape/database/actions/<action-tag>.action.json")
2438
2454
  File: { tag: "product:database:action", name, description, tableName,
2439
2455
  operation: "query"|"insert"|"update"|"delete"|"aggregate"|"count",
2440
2456
  template, filterTemplate? }
@@ -2478,6 +2494,10 @@ scheduled, dispatched with retries, and audited via logs.
2478
2494
  graphs: `
2479
2495
  DUCTAPE GRAPH DATABASES
2480
2496
 
2497
+ Before creating a graph action, list existing actions for the graph and inspect likely matches.
2498
+ Reuse an action whose query/operation, parameters, and result semantics already satisfy the task;
2499
+ create a new action only when no functional match exists.
2500
+
2481
2501
  Supported engines: neo4j | neptune | cosmos-gremlin | spanner-graph | arangodb | memgraph
2482
2502
 
2483
2503
  Registration (admin — ductape_cli):
@@ -2841,7 +2861,7 @@ action, connect it to the product) before writing the ctx.api.run call below.
2841
2861
 
2842
2862
  Create an app (admin — ductape_cli; no --name/--description flags exist, only -f <file.json> or
2843
2863
  interactive TTY):
2844
- ductape_cli("apps create -f app.json") # body: { app_name, description, tag, envs?: [...] } — tag is REQUIRED
2864
+ ductape_cli("apps create -f ductape/apps/<app-tag>.app.json") # body: { app_name, description, tag, envs?: [...] } — tag is REQUIRED
2845
2865
  ductape_cli("app.init", ["app_tag"]) → loads app into builder state
2846
2866
 
2847
2867
  Import from a file:
@@ -2924,14 +2944,14 @@ Connecting an app to a product (after creation):
2924
2944
 
2925
2945
  FULL FLOW to make an app callable from a product — call ductape_integrate_endpoint for the
2926
2946
  ordered version of this with exact ask-the-user points; summary (all verified live):
2927
- 1. Create the app: ductape_cli("apps create -f app.json")
2947
+ 1. Create the app: ductape_cli("apps create -f ductape/apps/<app-tag>.app.json")
2928
2948
  body: { app_name, description, tag, envs: [{ env_name, slug, description,
2929
2949
  base_url, active }, ...] } — tag is REQUIRED; every active env needs a base_url.
2930
2950
  No --name/--description flags exist, only -f <file.json> or interactive TTY.
2931
2951
  2. Add environments: Part of step 1's envs array, or later via ductape_cli("apps update --tag
2932
- <app_tag> --proxy -f app.json") with an updated envs array.
2952
+ <app_tag> --proxy -f ductape/apps/<app-tag>.app.json") with an updated envs array.
2933
2953
  3. Configure auth: Workbench (no CLI command).
2934
- 4. Define actions: ductape_cli("apps actions create --app <app_tag> --action-file action.json")
2954
+ 4. Define actions: ductape_cli("apps actions create --app <app_tag> --action-file ductape/actions/<app_tag>/<action-tag>.action.json")
2935
2955
  body: { tag, name, resource, method, request_type, description?, params?,
2936
2956
  query?, headers?, body?, response? } — request_type is REQUIRED, one of
2937
2957
  "application/json" | "application/x-www-form-urlencoded" |
@@ -5075,8 +5095,11 @@ EXACT CODE-FIRST VECTOR CONTEXT:
5075
5095
  them into the Feature definition. Note the deliberate naming: ctx.vector.query uses values for
5076
5096
  the embedding, while the lower-level ductape.vector.query runtime facade uses vector.
5077
5097
  Register reusable vector actions administratively, then read them back before compiling Features:
5098
+ ductape vector actions list --vector <vector-tag> --json
5078
5099
  ductape vector actions create --action-file vector-action.json --json
5079
5100
  ductape vector actions get <action-tag> --vector <vector-tag> --json
5101
+ Always list and inspect first. Reuse an existing action when operation, namespace/filter/template,
5102
+ parameters, and output semantics match; do not create a duplicate action under a new name.
5080
5103
  Update/delete/list use the same \`ductape vector actions\` surface. At runtime the SDK namespace is
5081
5104
  \`ductape.vector.actions.*\` (plural), while Feature reuse is singular \`ctx.vector.execute(...)\`.
5082
5105
  Vertex AI Vector Search stores and searches supplied vectors. It does NOT generate embeddings.
@@ -5303,7 +5326,8 @@ const integrateEndpointHandler = async (args) => {
5303
5326
  'Write a JSON body: { app_name, description, tag, envs: [{ env_name, slug, description, ' +
5304
5327
  'base_url, active: true }, ...] }. tag is REQUIRED — derive a slug from app_name if the ' +
5305
5328
  'user has not given one explicitly.',
5306
- 'Run: ductape_cli("apps create -f <path-to-body.json> --json")',
5329
+ 'Persist it at ductape/apps/<app-tag>.app.json. Do not use a scratchpad, temporary file, or repository-root JSON.',
5330
+ 'Run: ductape_cli("apps create -f ductape/apps/<app-tag>.app.json --json")',
5307
5331
  'The app tag is what you supplied, not something the response generates — use it as app_tag ' +
5308
5332
  'in every later stage.',
5309
5333
  ],
@@ -5330,7 +5354,8 @@ const integrateEndpointHandler = async (args) => {
5330
5354
  '"json"/"xml"/"form"). If response is included, response.status_code and ' +
5331
5355
  'response.response_format use that same set of values, and status_code is a STRING (e.g. ' +
5332
5356
  '"200", not the number 200).',
5333
- 'Run: ductape_cli("apps actions create --app <app_tag> --action-file <path-to-action.json> ' +
5357
+ 'Persist it at ductape/actions/<app_tag>/<action-tag>.action.json. This canonical file must remain in the project after creation.',
5358
+ 'Run: ductape_cli("apps actions create --app <app_tag> --action-file ductape/actions/<app_tag>/<action-tag>.action.json ' +
5334
5359
  '--json") — the flag is --action-file, not -f (that flag belongs to the parent "apps" ' +
5335
5360
  'command and Commander resolves it there, so -f would silently be ignored here).',
5336
5361
  ],
@@ -5422,7 +5447,7 @@ const eventsProjectValidationHandler = async (args) => {
5422
5447
  const cliInputSchema = z.object({
5423
5448
  command: z.string().describe('The ductape CLI command to run, without the leading "ductape" word. ' +
5424
5449
  'Examples: "products list", "products create --name \\"My Product\\" --tag my-product", ' +
5425
- '"apps list", "apps create -f app.json", "resources storage list", ' +
5450
+ '"apps list", "apps create -f ductape/apps/<app-tag>.app.json", "resources storage list", ' +
5426
5451
  '"events topics create -f topic.json", "events topics list --tag broker-tag", ' +
5427
5452
  '"cloud connections list", "link --product my-product --env dev".\n\n' +
5428
5453
  'Use this tool for administrative operations: creating or updating products, apps, ' +
@@ -5492,6 +5517,16 @@ function handleCliFlags() {
5492
5517
  // Surfaced to every connected agent at initialize time, before any tool is called.
5493
5518
  // Keep this short — it is ambient, unconditional overhead on every session.
5494
5519
  // The full doctrine with concrete API shapes lives in the "ductape-first-approach" prompt below.
5520
+ const DUCTAPE_ASSET_FILE_POLICY = 'Canonical asset-file policy: every JSON file used by the CLI to create, update, import, ' +
5521
+ 'provision, or apply a Ductape asset must be kept inside the target project\'s ductape/ folder, ' +
5522
+ 'under the matching asset-type directory (for example ductape/apps/, ductape/actions/, ' +
5523
+ 'ductape/databases/, ductape/quotas/, ductape/fallbacks/, or ductape/healthchecks/). Use a ' +
5524
+ 'stable tag-based filename such as <tag>.<asset-type>.json. Never create authoritative asset ' +
5525
+ 'JSON in /tmp, a scratchpad, the repository root, or another disposable location and then pass ' +
5526
+ 'that path to the CLI. Preserve established specialized layouts such as ' +
5527
+ 'ductape/database/schema.json, ductape/database/migrations/, ductape/graphs/<graph-tag>/actions/, ' +
5528
+ 'and ductape/events/<topic-tag>.topic.json. The ductape/ copy is the source-controlled source of ' +
5529
+ 'truth and must remain after the CLI command completes.';
5495
5530
  const DUCTAPE_FIRST_INSTRUCTIONS = 'Ductape-first: before writing custom code for a capability, check whether Ductape already ' +
5496
5531
  'provides it (databases, storage, notifications, events, sessions, caches, actions, quotas, ' +
5497
5532
  'fallback, health). Model any multi-step or externally-risky operation as a Feature ' +
@@ -5504,7 +5539,7 @@ const DUCTAPE_FIRST_INSTRUCTIONS = 'Ductape-first: before writing custom code fo
5504
5539
  'to be defined once and reused across products and environments — check what already exists ' +
5505
5540
  'before creating something new. Treat the ductape/ folder (features/, database/schema.json, ' +
5506
5541
  'notifications.json, events/) as the source of truth: define there first, sync/apply, then ' +
5507
- 'write application code against it — never the reverse. Invoke the "ductape-first-approach" ' +
5542
+ 'write application code against it — never the reverse. ' + DUCTAPE_ASSET_FILE_POLICY + ' Invoke the "ductape-first-approach" ' +
5508
5543
  'prompt for the full doctrine with concrete API shapes before scaffolding a new backend.';
5509
5544
  // The detailed doctrine, invoked on demand via the "ductape-first-approach" prompt rather than
5510
5545
  // forced onto every session. Grounded in the actual module contracts this server exposes
@@ -5525,7 +5560,7 @@ const DUCTAPE_FIRST_DOCTRINE = 'Follow this checklist before defaulting to plain
5525
5560
  '"ductape features sync", ductape/database/schema.json + "ductape db schema generate/migrate", ' +
5526
5561
  'ductape/notifications.json + "ductape apply notifications", ductape/events/*.topic.json + ' +
5527
5562
  '"ductape apply events". Define the capability there first, then write application code that ' +
5528
- 'calls into it — never duplicate the logic inline.\n\n' +
5563
+ 'calls into it — never duplicate the logic inline. ' + DUCTAPE_ASSET_FILE_POLICY + '\n\n' +
5529
5564
  '5. Secrets never live in code or plain config. Store every credential with secrets.create ' +
5530
5565
  '(scoped and env-aware), then reference it as $Secret{KEY} wherever a credential is needed — ' +
5531
5566
  'action auth headers, database/storage connection config, notification provider config. ' +
@@ -6144,6 +6179,7 @@ async function main() {
6144
6179
  server.registerTool('ductape_cli', {
6145
6180
  title: 'Ductape CLI',
6146
6181
  description: 'Run a Ductape CLI command for administrative operations.\n\n' +
6182
+ DUCTAPE_ASSET_FILE_POLICY + '\n\n' +
6147
6183
  'USE THIS TOOL for any operation that creates or modifies platform configuration:\n' +
6148
6184
  ' - Creating or updating products (products create/update) and apps (apps create/update)\n' +
6149
6185
  ' - Importing an app from a Postman v2.1 or OpenAPI 3.0 file: "apps import <file> -t postman|openapi"\n' +
package/docs/TOOLS.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # MCP Tools Reference
2
2
 
3
+ ## Canonical asset files
4
+
5
+ Every JSON document used by the CLI to create, update, import, provision, or apply an asset is a
6
+ project asset, not a temporary command payload. Store it beneath `<project-root>/ductape/` in the
7
+ matching asset-type directory and keep it after the command completes. For example:
8
+
9
+ ```text
10
+ ductape/apps/paystack.app.json
11
+ ductape/actions/paystack/initialize-transaction.action.json
12
+ ductape/databases/orders.database.json
13
+ ductape/quotas/payment-gateway.quota.json
14
+ ductape/fallbacks/payment-gateway.fallback.json
15
+ ductape/healthchecks/paystack.healthcheck.json
16
+ ```
17
+
18
+ Never place authoritative asset JSON in `/tmp`, a scratchpad, the repository root, or another
19
+ disposable directory. Established specialized layouts remain authoritative, including
20
+ `ductape/database/schema.json`, `ductape/database/migrations/`,
21
+ `ductape/graphs/<graph-tag>/actions/`, and `ductape/events/<topic-tag>.topic.json`.
22
+
3
23
  The Ductape MCP server exposes proxy, CLI, discovery, documentation, migration, and portable-function setup tools.
4
24
 
5
25
  ## Tool: `ductape_integrate_endpoint`
@@ -12,11 +32,12 @@ It is read-only guidance — it runs no CLI command itself and returns the order
12
32
  decide. If new: `ductape_cli("apps create -f app.json")`, body `{ app_name, description, tag,
13
33
  envs: [...] }` (`tag` is REQUIRED — no `--name`/`--description` flags exist, only `-f
14
34
  <file.json>` or interactive TTY), collecting an environment + base URL for each environment the
15
- app needs; every active environment needs a `base_url` before its action can be called.
35
+ app needs; every active environment needs a `base_url` before its action can be called. Persist
36
+ the body at `ductape/apps/<app-tag>.app.json`.
16
37
  2. **Define the action** — the HTTP method and the endpoint's path *relative to the app's base_url*
17
38
  (e.g. `/v1/users/{id}`, never a full URL — Ductape joins `base_url + resource` per environment at
18
39
  call time), plus only the params/headers/body/response fields relevant to that endpoint. Then
19
- `ductape_cli("apps actions create --app <tag> --action-file action.json")` — the flag is
40
+ `ductape_cli("apps actions create --app <tag> --action-file ductape/actions/<app-tag>/<action-tag>.action.json")` — the flag is
20
41
  `--action-file`, **not** `-f`/`--file` (that flag belongs to the parent `apps` command; Commander
21
42
  resolves a flag shared by an ancestor and a descendant against the ancestor, so `-f` here is
22
43
  silently ignored — same fix `products environments create/update` uses `--env-file` for).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ductape/mcp",
3
- "version": "0.2.29",
3
+ "version": "0.2.30",
4
4
  "description": "MCP server that exposes Ductape SDK operations via the backend proxy",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -15,7 +15,7 @@
15
15
  ],
16
16
  "scripts": {
17
17
  "build": "tsc",
18
- "test": "npm run build && node scripts/check-cli-command-security.mjs && node scripts/check-frontend-analytics-guidance.mjs && node scripts/check-events-discovery.mjs && node scripts/check-schema-fallback.mjs && node scripts/check-paystack-action-schema.mjs && node scripts/check-portable-functions.mjs && node scripts/check-project-link-guidance.mjs && node scripts/check-graph-vector-projection-guidance.mjs",
18
+ "test": "npm run build && node scripts/check-cli-command-security.mjs && node scripts/check-frontend-analytics-guidance.mjs && node scripts/check-events-discovery.mjs && node scripts/check-schema-fallback.mjs && node scripts/check-paystack-action-schema.mjs && node scripts/check-portable-functions.mjs && node scripts/check-project-link-guidance.mjs && node scripts/check-graph-vector-projection-guidance.mjs && node scripts/check-asset-file-guidance.mjs",
19
19
  "start": "node dist/index.js",
20
20
  "dev": "tsx src/index.ts"
21
21
  },