mcp-use 1.2.5-canary.2 → 1.2.5-canary.4

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.
@@ -1054,7 +1054,7 @@ var McpServer = class {
1054
1054
  async readBuildManifest() {
1055
1055
  try {
1056
1056
  const manifestPath = pathHelpers.join(
1057
- getCwd(),
1057
+ isDeno ? "." : getCwd(),
1058
1058
  "dist",
1059
1059
  "mcp-use.json"
1060
1060
  );
@@ -1396,7 +1396,7 @@ if (container && Component) {
1396
1396
  async mountWidgetsProduction(options) {
1397
1397
  const baseRoute = options?.baseRoute || "/mcp-use/widgets";
1398
1398
  const widgetsDir = pathHelpers.join(
1399
- getCwd(),
1399
+ isDeno ? "." : getCwd(),
1400
1400
  "dist",
1401
1401
  "resources",
1402
1402
  "widgets"
@@ -1405,14 +1405,19 @@ if (container && Component) {
1405
1405
  this.setupWidgetRoutes();
1406
1406
  const manifestPath = "./dist/mcp-use.json";
1407
1407
  let widgets = [];
1408
+ let widgetsMetadata = {};
1408
1409
  try {
1409
1410
  const manifestContent = await fsHelpers.readFileSync(manifestPath, "utf8");
1410
1411
  const manifest = JSON.parse(manifestContent);
1411
- if (manifest.widgets && Array.isArray(manifest.widgets)) {
1412
- widgets = manifest.widgets;
1412
+ if (manifest.widgets && typeof manifest.widgets === "object" && !Array.isArray(manifest.widgets)) {
1413
+ widgets = Object.keys(manifest.widgets);
1414
+ widgetsMetadata = manifest.widgets;
1413
1415
  console.log(`[WIDGETS] Loaded ${widgets.length} widget(s) from manifest`);
1416
+ } else if (manifest.widgets && Array.isArray(manifest.widgets)) {
1417
+ widgets = manifest.widgets;
1418
+ console.log(`[WIDGETS] Loaded ${widgets.length} widget(s) from manifest (legacy format)`);
1414
1419
  } else {
1415
- console.log("[WIDGETS] No widgets array found in manifest");
1420
+ console.log("[WIDGETS] No widgets found in manifest");
1416
1421
  }
1417
1422
  } catch (error) {
1418
1423
  console.log(
@@ -1444,7 +1449,6 @@ if (container && Component) {
1444
1449
  for (const widgetName of widgets) {
1445
1450
  const widgetPath = pathHelpers.join(widgetsDir, widgetName);
1446
1451
  const indexPath = pathHelpers.join(widgetPath, "index.html");
1447
- const metadataPath = pathHelpers.join(widgetPath, "metadata.json");
1448
1452
  let html = "";
1449
1453
  try {
1450
1454
  html = await fsHelpers.readFileSync(indexPath, "utf8");
@@ -1491,25 +1495,14 @@ if (container && Component) {
1491
1495
  );
1492
1496
  continue;
1493
1497
  }
1494
- let metadata = {};
1498
+ const metadata = widgetsMetadata[widgetName] || {};
1495
1499
  let props = {};
1496
1500
  let description = `Widget: ${widgetName}`;
1497
- try {
1498
- const metadataContent = await fsHelpers.readFileSync(
1499
- metadataPath,
1500
- "utf8"
1501
- );
1502
- metadata = JSON.parse(metadataContent);
1503
- if (metadata.description) {
1504
- description = metadata.description;
1505
- }
1506
- if (metadata.inputs) {
1507
- props = metadata.inputs;
1508
- }
1509
- } catch (error) {
1510
- console.log(
1511
- `[WIDGET] No metadata found for ${widgetName}, using defaults`
1512
- );
1501
+ if (metadata.description) {
1502
+ description = metadata.description;
1503
+ }
1504
+ if (metadata.inputs) {
1505
+ props = metadata.inputs;
1513
1506
  }
1514
1507
  this.uiResource({
1515
1508
  name: widgetName,
@@ -1016,7 +1016,7 @@ var McpServer = class {
1016
1016
  async readBuildManifest() {
1017
1017
  try {
1018
1018
  const manifestPath = pathHelpers.join(
1019
- getCwd(),
1019
+ isDeno ? "." : getCwd(),
1020
1020
  "dist",
1021
1021
  "mcp-use.json"
1022
1022
  );
@@ -1358,7 +1358,7 @@ if (container && Component) {
1358
1358
  async mountWidgetsProduction(options) {
1359
1359
  const baseRoute = options?.baseRoute || "/mcp-use/widgets";
1360
1360
  const widgetsDir = pathHelpers.join(
1361
- getCwd(),
1361
+ isDeno ? "." : getCwd(),
1362
1362
  "dist",
1363
1363
  "resources",
1364
1364
  "widgets"
@@ -1367,14 +1367,19 @@ if (container && Component) {
1367
1367
  this.setupWidgetRoutes();
1368
1368
  const manifestPath = "./dist/mcp-use.json";
1369
1369
  let widgets = [];
1370
+ let widgetsMetadata = {};
1370
1371
  try {
1371
1372
  const manifestContent = await fsHelpers.readFileSync(manifestPath, "utf8");
1372
1373
  const manifest = JSON.parse(manifestContent);
1373
- if (manifest.widgets && Array.isArray(manifest.widgets)) {
1374
- widgets = manifest.widgets;
1374
+ if (manifest.widgets && typeof manifest.widgets === "object" && !Array.isArray(manifest.widgets)) {
1375
+ widgets = Object.keys(manifest.widgets);
1376
+ widgetsMetadata = manifest.widgets;
1375
1377
  console.log(`[WIDGETS] Loaded ${widgets.length} widget(s) from manifest`);
1378
+ } else if (manifest.widgets && Array.isArray(manifest.widgets)) {
1379
+ widgets = manifest.widgets;
1380
+ console.log(`[WIDGETS] Loaded ${widgets.length} widget(s) from manifest (legacy format)`);
1376
1381
  } else {
1377
- console.log("[WIDGETS] No widgets array found in manifest");
1382
+ console.log("[WIDGETS] No widgets found in manifest");
1378
1383
  }
1379
1384
  } catch (error) {
1380
1385
  console.log(
@@ -1406,7 +1411,6 @@ if (container && Component) {
1406
1411
  for (const widgetName of widgets) {
1407
1412
  const widgetPath = pathHelpers.join(widgetsDir, widgetName);
1408
1413
  const indexPath = pathHelpers.join(widgetPath, "index.html");
1409
- const metadataPath = pathHelpers.join(widgetPath, "metadata.json");
1410
1414
  let html = "";
1411
1415
  try {
1412
1416
  html = await fsHelpers.readFileSync(indexPath, "utf8");
@@ -1453,25 +1457,14 @@ if (container && Component) {
1453
1457
  );
1454
1458
  continue;
1455
1459
  }
1456
- let metadata = {};
1460
+ const metadata = widgetsMetadata[widgetName] || {};
1457
1461
  let props = {};
1458
1462
  let description = `Widget: ${widgetName}`;
1459
- try {
1460
- const metadataContent = await fsHelpers.readFileSync(
1461
- metadataPath,
1462
- "utf8"
1463
- );
1464
- metadata = JSON.parse(metadataContent);
1465
- if (metadata.description) {
1466
- description = metadata.description;
1467
- }
1468
- if (metadata.inputs) {
1469
- props = metadata.inputs;
1470
- }
1471
- } catch (error) {
1472
- console.log(
1473
- `[WIDGET] No metadata found for ${widgetName}, using defaults`
1474
- );
1463
+ if (metadata.description) {
1464
+ description = metadata.description;
1465
+ }
1466
+ if (metadata.inputs) {
1467
+ props = metadata.inputs;
1475
1468
  }
1476
1469
  this.uiResource({
1477
1470
  name: widgetName,
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../../../src/server/mcp-server.ts"],"names":[],"mappings":"AAKA,OAAO,EAAsB,KAAK,IAAI,IAAI,QAAQ,EAAa,MAAM,MAAM,CAAC;AAY5E,OAAO,KAAK,EAEV,gBAAgB,EAChB,kBAAkB,EAClB,0BAA0B,EAC1B,YAAY,EACZ,cAAc,EAEd,oBAAoB,EAErB,MAAM,kBAAkB,CAAC;AA4G1B,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,GAAG,CAAW;IACtB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,UAAU,CAAC,CAAS;IAC5B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,aAAa,CAAC,CAAS;IAE/B;;;;;;;;;OASG;gBACS,MAAM,EAAE,YAAY;IA2GhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;IACH,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,IAAI;IAmBtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,gBAAgB,CACd,0BAA0B,EAAE,0BAA0B,GACrD,IAAI;IAiDP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IACH,IAAI,CAAC,cAAc,EAAE,cAAc,GAAG,IAAI;IAmB1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,MAAM,CAAC,gBAAgB,EAAE,gBAAgB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7 @@
1
1
  {
2
2
  "name": "mcp-use",
3
3
  "type": "module",
4
- "version": "1.2.5-canary.2",
4
+ "version": "1.2.5-canary.4",
5
5
  "packageManager": "pnpm@10.6.1",
6
6
  "description": "Opinionated MCP Framework for TypeScript (@modelcontextprotocol/sdk compatible) - Build MCP Agents and Clients + MCP Servers with support for MCP-UI.",
7
7
  "author": "mcp-use, Inc.",