@dypai-ai/mcp 1.5.0 → 1.5.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dypai-ai/mcp",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "description": "DYPAI MCP Server — AI agent toolkit for building and deploying full-stack apps",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/index.js CHANGED
@@ -201,15 +201,10 @@ NOTE: user IDs are TEXT (better-auth nanoids like "G1LIBXsbMLxUrs99ebCaL9X4auxW2
201
201
  sort_order: { type: "string", enum: ["asc", "desc"], description: "Sort direction (default 'desc'). Optional for: list." },
202
202
  },
203
203
  required: ["operation"],
204
- allOf: [
205
- { if: { properties: { operation: { const: "get" } }, required: ["operation"] }, then: { required: ["user_id"] } },
206
- { if: { properties: { operation: { const: "create" } }, required: ["operation"] }, then: { required: ["email", "password"] } },
207
- { if: { properties: { operation: { const: "set_password" } }, required: ["operation"] }, then: { required: ["user_id", "password"] } },
208
- { if: { properties: { operation: { const: "update_role" } }, required: ["operation"] }, then: { required: ["user_id", "role"] } },
209
- { if: { properties: { operation: { const: "delete" } }, required: ["operation"] }, then: { required: ["user_id"] } },
210
- { if: { properties: { operation: { const: "ban" } }, required: ["operation"] }, then: { required: ["user_id"] } },
211
- { if: { properties: { operation: { const: "unban" } }, required: ["operation"] }, then: { required: ["user_id"] } },
212
- ],
204
+ // NOTE: Anthropic's API rejects `oneOf`, `allOf`, `anyOf` at the top
205
+ // level of a tool input_schema. Per-operation required-field checks
206
+ // are enforced inside the tool's execute() (see description for the
207
+ // contract). Do not re-add the allOf block.
213
208
  },
214
209
  },
215
210
 
@@ -234,11 +229,8 @@ Operations:
234
229
  permissions: { type: "object", description: "JSON of role flags. Keys: manage_users, manage_roles, manage_system. Optional for: create, update." },
235
230
  },
236
231
  required: ["operation"],
237
- allOf: [
238
- { if: { properties: { operation: { const: "create" } }, required: ["operation"] }, then: { required: ["name"] } },
239
- { if: { properties: { operation: { const: "update" } }, required: ["operation"] }, then: { required: ["role_id"] } },
240
- { if: { properties: { operation: { const: "delete" } }, required: ["operation"] }, then: { required: ["role_id"] } },
241
- ],
232
+ // Anthropic API does not allow allOf/oneOf/anyOf at the top level of
233
+ // a tool input_schema; per-operation required fields validated in execute().
242
234
  },
243
235
  },
244
236
 
@@ -285,10 +277,8 @@ Typical flow:
285
277
  resource_names: { type: "array", items: { type: "string" }, description: "Optional. For discard: scope to drafts whose resource_name matches one of these. Ignored by list/publish." },
286
278
  },
287
279
  required: ["operation"],
288
- allOf: [
289
- { if: { properties: { operation: { const: "publish" } }, required: ["operation"] }, then: { required: ["confirm"] } },
290
- { if: { properties: { operation: { const: "discard" } }, required: ["operation"] }, then: { required: ["confirm"] } },
291
- ],
280
+ // Anthropic API does not allow allOf/oneOf/anyOf at the top level of a
281
+ // tool input_schema. Per-operation required fields validated in execute().
292
282
  },
293
283
  },
294
284
 
@@ -355,14 +345,8 @@ Notes:
355
345
  offset: { type: "integer", description: "Pagination offset. Default 0." },
356
346
  },
357
347
  required: [],
358
- allOf: [
359
- { if: { properties: { operation: { const: "create" } }, required: ["operation"] }, then: { required: ["name"] } },
360
- { if: { properties: { operation: { const: "delete" } }, required: ["operation"] }, then: { required: ["name"] } },
361
- { if: { properties: { operation: { const: "upload_file" } }, required: ["operation"] }, then: { required: ["bucket", "local_path"] } },
362
- { if: { properties: { operation: { const: "list_objects" } }, required: ["operation"] }, then: { required: ["bucket"] } },
363
- { if: { properties: { operation: { const: "delete_object" } }, required: ["operation"] }, then: { required: ["bucket", "name"] } },
364
- { if: { properties: { operation: { const: "get_signed_download_url" } }, required: ["operation"] }, then: { required: ["bucket", "name"] } },
365
- ],
348
+ // Anthropic API does not allow allOf/oneOf/anyOf at the top level of a
349
+ // tool input_schema. Per-operation required fields validated in execute().
366
350
  },
367
351
  },
368
352
 
@@ -401,12 +385,8 @@ and \`dypai_push\`. This tool does NOT modify the schedule definition.`,
401
385
  offset: { type: "integer", description: "Pagination offset. Optional for: list, history. Default 0." },
402
386
  },
403
387
  required: ["operation"],
404
- allOf: [
405
- { if: { properties: { operation: { const: "get" } }, required: ["operation"] }, then: { required: ["endpoint_name"] } },
406
- { if: { properties: { operation: { const: "pause" } }, required: ["operation"] }, then: { required: ["endpoint_name"] } },
407
- { if: { properties: { operation: { const: "resume" } }, required: ["operation"] }, then: { required: ["endpoint_name"] } },
408
- { if: { properties: { operation: { const: "history" } }, required: ["operation"] }, then: { required: ["endpoint_name"] } },
409
- ],
388
+ // Anthropic API does not allow allOf/oneOf/anyOf at the top level of a
389
+ // tool input_schema. Per-operation required fields validated in execute().
410
390
  },
411
391
  },
412
392
 
@@ -448,14 +428,8 @@ endpoint YAML and \`dypai_push\`. This tool does NOT modify the definition.`,
448
428
  test_headers: { type: "object", description: "Extra headers to attach to the synthetic call. Optional for: test." },
449
429
  },
450
430
  required: ["operation"],
451
- allOf: [
452
- { if: { properties: { operation: { const: "get" } }, required: ["operation"] }, then: { required: ["endpoint_name"] } },
453
- { if: { properties: { operation: { const: "pause" } }, required: ["operation"] }, then: { required: ["endpoint_name"] } },
454
- { if: { properties: { operation: { const: "resume" } }, required: ["operation"] }, then: { required: ["endpoint_name"] } },
455
- { if: { properties: { operation: { const: "history" } }, required: ["operation"] }, then: { required: ["endpoint_name"] } },
456
- { if: { properties: { operation: { const: "test" } }, required: ["operation"] }, then: { required: ["endpoint_name"] } },
457
- { if: { properties: { operation: { const: "rotate_secret" } }, required: ["operation"] }, then: { required: ["endpoint_name"] } },
458
- ],
431
+ // Anthropic API does not allow allOf/oneOf/anyOf at the top level of a
432
+ // tool input_schema. Per-operation required fields validated in execute().
459
433
  },
460
434
  },
461
435
 
@@ -489,6 +463,46 @@ endpoint YAML and \`dypai_push\`. This tool does NOT modify the definition.`,
489
463
 
490
464
  const SERVER_INSTRUCTIONS = `You are building full-stack applications on the DYPAI platform. You handle BACKEND (workflow endpoints, database, auth, realtime) and FRONTEND (SDK integration, React/Vite/Next code).
491
465
 
466
+ # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
467
+ # BEFORE YOU DO ANYTHING — materialize the project locally
468
+ # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
469
+
470
+ **This is the single biggest failure mode. Read it even if you skip everything else.**
471
+
472
+ A DYPAI project lives in THREE places:
473
+ 1. The platform (remote DB, engine, deployed frontend).
474
+ 2. Your agent host's workspace (local files on disk — \`dypai/\` backend + \`src/\`/\`package.json\` frontend).
475
+ 3. The user's head ("I want to change X").
476
+
477
+ **You can only edit what's on disk.** No workspace files = you're blind. Tools like \`execute_sql\`, \`dypai_push\`, and frontend edits assume the local files exist; running them against a workspace that hasn't been synced produces broken or imaginary output. This is the #1 source of wasted sessions.
478
+
479
+ ## The checklist — run this at the start of EVERY conversation that mentions an existing project or a just-created one
480
+
481
+ Before the first \`execute_sql\`, before the first file edit, before ANYTHING:
482
+
483
+ 1. **Look at the workspace.** Is there a \`dypai/\` folder? A \`src/\`? A \`package.json\`? If you're using a Read/ls tool, check now.
484
+ 2. **Missing backend (\`dypai/\` absent)?** You have no endpoint YAMLs, no \`schema.sql\`, no node catalog. Cannot write queries, cannot push, cannot reason about the schema.
485
+ 3. **Missing frontend (\`src/\` or \`package.json\` absent)?** You have no React/Vite/Next code. Cannot change the UI, cannot run \`npm install\`, cannot test locally.
486
+ 4. **If either is missing → sync FIRST:**
487
+ - Ask the user for an absolute workspace path if you don't have one (e.g. \`/Users/me/code/my-app\`).
488
+ - Run \`dypai_pull(project_id, out_dir: <abs>/dypai)\` — materializes backend (endpoints, SQL, prompts, schema.sql, node-catalog.json).
489
+ - Run \`manage_frontend(operation:"sync", project_id, targetDirectory: <abs>)\` — materializes frontend (React/Vite/Next source + \`.env.local\`).
490
+ - Run both — they're independent. The user may only have asked about one, but you'll probably need the other for context.
491
+ 5. **Only then start editing.**
492
+
493
+ ## Same applies after \`create_project\`
494
+
495
+ A freshly created project has **zero** local files. The create response gives you \`project_id\` and URLs, nothing else. The workspace is empty until you pull + sync. Do NOT start writing code, do NOT call \`execute_sql\` — the response may say "next_step: run dypai_pull" but run BOTH pull AND frontend sync, not just the backend.
496
+
497
+ ## Symptoms that mean "I didn't materialize properly"
498
+
499
+ - User: *"Change the login button color"* and you start with \`execute_sql\`. Stop. Check \`src/\`. If missing, sync frontend.
500
+ - User: *"Why doesn't this endpoint work?"* and you have no \`dypai/endpoints/\`. Stop. Pull backend.
501
+ - You catch yourself "remembering" an endpoint from a previous conversation. Memory is not a tool. Pull first, then read from disk.
502
+ - You're about to edit a file but \`dypai/schema.sql\` doesn't exist. You don't know the schema. Pull first.
503
+
504
+ **Rule of thumb: if you can't \`Read\` it from disk, you can't touch it. Sync before you guess.**
505
+
492
506
  # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
493
507
  # TALKING TO THE USER — plain language, not tool names
494
508
  # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -512,18 +512,8 @@ export const manageDatabaseTool = {
512
512
  },
513
513
  },
514
514
  required: ["operation"],
515
- allOf: [
516
- { if: { properties: { operation: { const: "apply_migration" } }, required: ["operation"] },
517
- then: { required: ["migration_file"] } },
518
- { if: { properties: { operation: { const: "introspect_schema" } }, required: ["operation"] },
519
- then: { required: ["name"] } },
520
- { if: { properties: { operation: { const: "introspect_table" } }, required: ["operation"] },
521
- then: { required: ["name"] } },
522
- { if: { properties: { operation: { const: "introspect_function" } }, required: ["operation"] },
523
- then: { required: ["name"] } },
524
- { if: { properties: { operation: { const: "execute_script" } }, required: ["operation"] },
525
- then: { required: ["sql"] } },
526
- ],
515
+ // Anthropic API does not allow allOf/oneOf/anyOf at the top level of a
516
+ // tool input_schema. Per-operation required fields validated in execute().
527
517
  },
528
518
 
529
519
  async execute(args = {}) {