@dypai-ai/mcp 1.6.6 → 1.6.7

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.6.6",
3
+ "version": "1.6.7",
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
@@ -553,7 +553,7 @@ async function handleRequest(msg) {
553
553
  return makeResponse(id, {
554
554
  protocolVersion: "2024-11-05",
555
555
  capabilities: { tools: {} },
556
- serverInfo: { name: "dypai", version: "1.6.6" },
556
+ serverInfo: { name: "dypai", version: "1.6.7" },
557
557
  instructions: serverInstructions,
558
558
  })
559
559
  }
@@ -187,24 +187,16 @@ function loadArtifactFromDir(artifactDir) {
187
187
  return { dir: artifactDir, manifest }
188
188
  }
189
189
 
190
- async function materializeArtifactFromGithub({ slug, source_repo, source_path, source_ref }) {
191
- const repo = String(source_repo || "").trim()
190
+ async function materializeArtifactFromCatalog({ slug }) {
192
191
  const wantedSlug = String(slug || "").trim()
193
- if (!repo && !wantedSlug) throw new Error("slug is required.")
194
- const path = String(source_path || "").trim()
195
- const ref = String(source_ref || "main").trim() || "main"
196
-
197
- const remote = await proxyToolCall(
198
- "fetch_project_artifact",
199
- repo
200
- ? { source_repo: repo, source_path: path, source_ref: ref }
201
- : { slug: wantedSlug },
202
- )
192
+ if (!wantedSlug) throw new Error("slug is required.")
193
+
194
+ const remote = await proxyToolCall("fetch_project_artifact", { slug: wantedSlug })
203
195
  if (!isObject(remote) || !remote.ok) {
204
196
  throw new Error(isObject(remote) && remote.error ? remote.error : "fetch_project_artifact failed")
205
197
  }
206
198
 
207
- const key = crypto.createHash("sha256").update(`${repo || wantedSlug}|${path}|${ref}`).digest("hex")
199
+ const key = crypto.createHash("sha256").update(`${wantedSlug}|${remote.content_hash || remote.version || "latest"}`).digest("hex")
208
200
  const artifactDir = join(tmpdir(), "dypai-artifact-fetch", key)
209
201
  rmSync(artifactDir, { recursive: true, force: true })
210
202
  mkdirSync(artifactDir, { recursive: true })
@@ -226,38 +218,12 @@ async function materializeArtifactFromGithub({ slug, source_repo, source_path, s
226
218
  const loaded = loadArtifactFromDir(artifactDir)
227
219
  return {
228
220
  ...loaded,
229
- source: "github",
230
- source_repo: repo,
231
- source_path: path,
232
- source_ref: ref,
221
+ source: remote.source || "catalog",
233
222
  agentNotes: typeof remote.agent_notes === "string" ? remote.agent_notes : undefined,
234
223
  checklist: typeof remote.checklist === "string" ? remote.checklist : undefined,
235
224
  }
236
225
  }
237
226
 
238
- async function lookupArtifactGithubSource(slug) {
239
- const wanted = String(slug || "").trim()
240
- if (!wanted) throw new Error("slug is required.")
241
-
242
- const remote = await proxyToolCall("search_project_artifacts", { query: wanted, limit: 20 })
243
- if (!isObject(remote) || remote.ok === false) {
244
- throw new Error(isObject(remote) && remote.error ? remote.error : "search_project_artifacts failed")
245
- }
246
-
247
- const pools = [remote.artifacts, remote.features, remote.bases].filter(Array.isArray)
248
- for (const pool of pools) {
249
- const hit = pool.find((item) => isObject(item) && String(item.slug || "").trim() === wanted)
250
- if (hit?.source_repo) {
251
- return {
252
- source_repo: String(hit.source_repo).trim(),
253
- source_path: String(hit.source_path || "").trim(),
254
- source_ref: String(hit.source_ref || "main").trim() || "main",
255
- }
256
- }
257
- }
258
- throw new Error(`Artifact "${wanted}" not found in catalog. Call search_project_artifacts first.`)
259
- }
260
-
261
227
  async function searchProjectArtifacts(args = {}) {
262
228
  const requestedLimit = Number(args.limit || 3)
263
229
  const remoteArgs = {
@@ -271,16 +237,8 @@ async function searchProjectArtifacts(args = {}) {
271
237
  return filterArtifactSearchResult(raw, requestedLimit)
272
238
  }
273
239
 
274
- async function resolveArtifactInstallation({ slug, source_repo, source_path, source_ref }) {
275
- const resolved = String(source_repo || "").trim()
276
- ? {
277
- slug: String(slug || "").trim(),
278
- source_repo: String(source_repo).trim(),
279
- source_path: String(source_path || "").trim(),
280
- source_ref: String(source_ref || "main").trim() || "main",
281
- }
282
- : { slug: String(slug || "").trim() }
283
- return materializeArtifactFromGithub(resolved)
240
+ async function resolveArtifactInstallation({ slug }) {
241
+ return materializeArtifactFromCatalog({ slug: String(slug || "").trim() })
284
242
  }
285
243
 
286
244
  function resolveWorkspaceRoot(inputRoot) {
@@ -506,13 +464,11 @@ function writeTemplateFile({ sourceAbs, targetRel, workspaceRoot, manifest, nami
506
464
  return true
507
465
  }
508
466
 
509
- async function inspectProjectArtifact({ slug, version = "1.0.0", source_repo, source_path, source_ref }) {
510
- const { dir, manifest, source, agentNotes, checklist } = await resolveArtifactInstallation({ slug, source_repo, source_path, source_ref })
467
+ async function inspectProjectArtifact({ slug, version = "1.0.0" }) {
468
+ const { dir, manifest, agentNotes, checklist } = await resolveArtifactInstallation({ slug })
511
469
  return {
512
470
  ok: true,
513
471
  operation: "inspect",
514
- source,
515
- artifactRoot: dir,
516
472
  artifact: manifest,
517
473
  assets: assetIndex(dir),
518
474
  agentNotes: agentNotes || (existsSync(join(dir, "agent.md")) ? readFileSync(join(dir, "agent.md"), "utf8") : undefined),
@@ -531,11 +487,8 @@ async function applyProjectArtifact({
531
487
  target = {},
532
488
  overwrite = "skip",
533
489
  workspace_root,
534
- source_repo,
535
- source_path,
536
- source_ref,
537
490
  }) {
538
- const { dir, manifest, source } = await resolveArtifactInstallation({ slug, source_repo, source_path, source_ref })
491
+ const { dir, manifest } = await resolveArtifactInstallation({ slug })
539
492
  const workspaceRoot = resolveWorkspaceRoot(workspace_root)
540
493
  const record = readInstallRecord(workspaceRoot)
541
494
  const previousEntries = (record.artifacts || []).filter((item) => item.slug === manifest.slug && item.version === manifest.version)
@@ -697,7 +650,6 @@ async function applyProjectArtifact({
697
650
  return {
698
651
  ok: true,
699
652
  operation: "apply",
700
- source,
701
653
  slug: manifest.slug,
702
654
  version: manifest.version,
703
655
  workspaceRoot,
@@ -740,7 +692,7 @@ async function applyProjectArtifact({
740
692
 
741
693
  export const manageProjectArtifactTool = {
742
694
  name: "manage_project_artifact",
743
- description: "Inspect or install a project artifact into the workspace. Call search_project_artifacts first, then pass the exact slug; the platform resolves GitHub source server-side. Apply never executes SQL, publishes backend, deploys frontend, or installs npm packages.",
695
+ description: "Inspect or install a project artifact into the workspace. Call search_project_artifacts first, then pass the exact slug. Apply copies files into the workspace; it never executes SQL, publishes backend, deploys frontend, or installs npm packages.",
744
696
  inputSchema: {
745
697
  type: "object",
746
698
  properties: {
@@ -792,11 +744,7 @@ export const searchProjectArtifactsTool = {
792
744
  type: "object",
793
745
  properties: {
794
746
  query: { type: "string", description: "Natural language need, e.g. 'hero section for a florist landing'." },
795
- surface: { type: "string", enum: ["public", "private", "mixed", "agnostic"], description: "Optional surface filter." },
796
- kind: { type: "string", enum: ["shell", "feature"], description: "Optional kind filter. Studio normally uses feature artifacts." },
797
- compatible_shell: { type: "string", description: "Optional shell slug compatibility filter." },
798
- frontend_only: { type: "boolean", default: true, description: "When true, return only frontend/UI artifacts safe to install in Studio." },
799
- limit: { type: "integer", default: 20, minimum: 1, maximum: 50 },
747
+ limit: { type: "integer", default: 3, minimum: 1, maximum: 5 },
800
748
  },
801
749
  required: ["query"],
802
750
  },