@buildpad/mcp 0.1.11 → 0.1.12

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
@@ -5840,6 +5840,73 @@ function loadRegistry() {
5840
5840
  "hasOptions": true
5841
5841
  }
5842
5842
  },
5843
+ {
5844
+ "name": "input-hash",
5845
+ "title": "InputHash",
5846
+ "description": "Hashed input interface for securely storing values like passwords. Shows lock icon indicator for existing hashed values.",
5847
+ "category": "input",
5848
+ "files": [
5849
+ {
5850
+ "source": "ui-interfaces/src/input-hash/InputHash.tsx",
5851
+ "target": "components/ui/input-hash.tsx"
5852
+ }
5853
+ ],
5854
+ "dependencies": [
5855
+ "@mantine/core",
5856
+ "@tabler/icons-react"
5857
+ ],
5858
+ "internalDependencies": [],
5859
+ "interface": {
5860
+ "id": "input-hash",
5861
+ "name": "Hash",
5862
+ "icon": "IconFingerprint",
5863
+ "types": [
5864
+ "hash"
5865
+ ],
5866
+ "localTypes": [
5867
+ "standard"
5868
+ ],
5869
+ "group": "other",
5870
+ "order": 4,
5871
+ "supported": true,
5872
+ "hasOptions": true
5873
+ }
5874
+ },
5875
+ {
5876
+ "name": "system-token",
5877
+ "title": "SystemToken",
5878
+ "description": "Token generator interface with generate, copy, and remove actions. Used for API tokens and system authentication keys.",
5879
+ "category": "input",
5880
+ "files": [
5881
+ {
5882
+ "source": "ui-interfaces/src/system-token/SystemToken.tsx",
5883
+ "target": "components/ui/system-token.tsx"
5884
+ }
5885
+ ],
5886
+ "dependencies": [
5887
+ "@mantine/core",
5888
+ "@tabler/icons-react"
5889
+ ],
5890
+ "internalDependencies": [
5891
+ "services",
5892
+ "hooks"
5893
+ ],
5894
+ "interface": {
5895
+ "id": "system-token",
5896
+ "name": "Token",
5897
+ "icon": "IconKey",
5898
+ "types": [
5899
+ "hash"
5900
+ ],
5901
+ "localTypes": [
5902
+ "standard"
5903
+ ],
5904
+ "group": "other",
5905
+ "order": 5,
5906
+ "supported": true,
5907
+ "hasOptions": false
5908
+ }
5909
+ },
5843
5910
  {
5844
5911
  "name": "input-block-editor",
5845
5912
  "title": "InputBlockEditor",
@@ -7466,6 +7533,9 @@ function getComponentsByCategory(category) {
7466
7533
  function getCategories() {
7467
7534
  return getRegistry().categories;
7468
7535
  }
7536
+ function getLibModule(name) {
7537
+ return getRegistry().lib[name];
7538
+ }
7469
7539
  var PACKAGES = [
7470
7540
  {
7471
7541
  name: "@buildpad/types",
@@ -7718,10 +7788,12 @@ server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
7718
7788
  if (uri.startsWith("buildpad://components/")) {
7719
7789
  const componentName = uri.replace("buildpad://components/", "");
7720
7790
  const component = getComponent(componentName);
7721
- if (!component) {
7791
+ const libModule = !component ? getLibModule(componentName) : void 0;
7792
+ if (!component && !libModule) {
7722
7793
  throw new Error(`Component not found: ${componentName}`);
7723
7794
  }
7724
- const sourcePath = component.files[0]?.source;
7795
+ const files = component ? component.files : libModule.files ?? [];
7796
+ const sourcePath = files[0]?.source;
7725
7797
  const source = sourcePath ? readSourceFile(sourcePath) : null;
7726
7798
  if (!source) {
7727
7799
  throw new Error(`Source file not found for component: ${componentName}`);
@@ -7934,9 +8006,32 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
7934
8006
  throw new Error("Component name is required");
7935
8007
  }
7936
8008
  const component = getComponent(componentName);
7937
- if (!component) {
8009
+ const libModule = !component ? getLibModule(componentName) : void 0;
8010
+ if (!component && !libModule) {
7938
8011
  throw new Error(`Component not found: ${componentName}`);
7939
8012
  }
8013
+ if (libModule) {
8014
+ const libFiles = {};
8015
+ for (const file of libModule.files ?? []) {
8016
+ const content = readSourceFile(file.source);
8017
+ if (content) libFiles[file.target] = content;
8018
+ }
8019
+ return {
8020
+ content: [{
8021
+ type: "text",
8022
+ text: JSON.stringify({
8023
+ name: libModule.name,
8024
+ description: libModule.description,
8025
+ type: "lib-module",
8026
+ files: libModule.files,
8027
+ dependencies: libModule.dependencies ?? [],
8028
+ internalDependencies: libModule.internalDependencies ?? [],
8029
+ allSources: libFiles,
8030
+ installCommand: `npx @buildpad/cli add ${libModule.name}`
8031
+ }, null, 2)
8032
+ }]
8033
+ };
8034
+ }
7940
8035
  const sources = {};
7941
8036
  for (const file of component.files) {
7942
8037
  const content = readSourceFile(file.source);
@@ -7976,9 +8071,22 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
7976
8071
  throw new Error("Component name is required");
7977
8072
  }
7978
8073
  const component = getComponent(componentName);
7979
- if (!component) {
8074
+ const libModule = !component ? getLibModule(componentName) : void 0;
8075
+ if (!component && !libModule) {
7980
8076
  throw new Error(`Component not found: ${componentName}`);
7981
8077
  }
8078
+ if (libModule) {
8079
+ return {
8080
+ content: [{
8081
+ type: "text",
8082
+ text: `// Lib module: ${libModule.name}
8083
+ // Install via CLI:
8084
+ // npx @buildpad/cli add ${libModule.name}
8085
+
8086
+ // ${libModule.description}`
8087
+ }]
8088
+ };
8089
+ }
7982
8090
  const example = generateUsageExample(component);
7983
8091
  return {
7984
8092
  content: [
@@ -8214,9 +8322,58 @@ your-project/
8214
8322
  throw new Error("Component name is required");
8215
8323
  }
8216
8324
  const component = getComponent(componentName);
8217
- if (!component) {
8325
+ const libModule = !component ? getLibModule(componentName) : void 0;
8326
+ if (!component && !libModule) {
8218
8327
  throw new Error(`Component not found: ${componentName}`);
8219
8328
  }
8329
+ if (libModule) {
8330
+ const registry = getRegistry();
8331
+ const allLibFiles = [];
8332
+ const visited = /* @__PURE__ */ new Set();
8333
+ const resolveLib = (name2) => {
8334
+ if (visited.has(name2)) return;
8335
+ visited.add(name2);
8336
+ const mod = registry.lib[name2];
8337
+ if (!mod) return;
8338
+ for (const dep of mod.internalDependencies ?? []) resolveLib(dep);
8339
+ for (const file of mod.files ?? []) {
8340
+ const content = readSourceFile(file.source);
8341
+ if (content) allLibFiles.push({ path: file.target, content, module: name2 });
8342
+ }
8343
+ };
8344
+ resolveLib(componentName);
8345
+ const allDeps = [...new Set(
8346
+ [...visited].flatMap((n) => (registry.lib[n]?.dependencies ?? []).map((d) => d.replace(/@[^@/]*$/, "")))
8347
+ )];
8348
+ return {
8349
+ content: [{
8350
+ type: "text",
8351
+ text: JSON.stringify({
8352
+ name: libModule.name,
8353
+ description: libModule.description,
8354
+ type: "lib-module",
8355
+ files: allLibFiles,
8356
+ peerDependencies: allDeps,
8357
+ installCommand: `npx @buildpad/cli add ${libModule.name}`,
8358
+ instructions: `## Install lib module: ${libModule.name}
8359
+
8360
+ \`\`\`bash
8361
+ npx @buildpad/cli add ${libModule.name}
8362
+ \`\`\`
8363
+
8364
+ ${libModule.description}
8365
+
8366
+ Files installed:
8367
+ ${allLibFiles.map((f) => `- \`${f.path}\` (${f.module})`).join("\n")}${allDeps.length ? `
8368
+
8369
+ ### npm dependencies
8370
+ \`\`\`bash
8371
+ pnpm add ${allDeps.join(" ")}
8372
+ \`\`\`` : ""}`
8373
+ }, null, 2)
8374
+ }]
8375
+ };
8376
+ }
8220
8377
  const files = [];
8221
8378
  for (const file of component.files) {
8222
8379
  const content = readSourceFile(file.source);
@@ -8231,10 +8388,10 @@ your-project/
8231
8388
  if (includeLib && component.internalDependencies?.length > 0) {
8232
8389
  const registry = getRegistry();
8233
8390
  for (const dep of component.internalDependencies) {
8234
- const libModule = registry.lib[dep];
8235
- if (libModule) {
8236
- if (libModule.files) {
8237
- for (const file of libModule.files) {
8391
+ const libModule2 = registry.lib[dep];
8392
+ if (libModule2) {
8393
+ if (libModule2.files) {
8394
+ for (const file of libModule2.files) {
8238
8395
  const content = readSourceFile(file.source);
8239
8396
  if (content) {
8240
8397
  libFiles.push({
@@ -8244,11 +8401,11 @@ your-project/
8244
8401
  });
8245
8402
  }
8246
8403
  }
8247
- } else if (libModule.path && libModule.target) {
8248
- const content = readSourceFile(libModule.path);
8404
+ } else if (libModule2.path && libModule2.target) {
8405
+ const content = readSourceFile(libModule2.path);
8249
8406
  if (content) {
8250
8407
  libFiles.push({
8251
- path: libModule.target,
8408
+ path: libModule2.target,
8252
8409
  content,
8253
8410
  module: dep
8254
8411
  });