@mcp-use/cli 2.13.5 → 2.13.6

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.cjs CHANGED
@@ -5072,6 +5072,8 @@ export default {
5072
5072
  sourcemap: false,
5073
5073
  // Minify for smaller bundle size
5074
5074
  minify: "esbuild",
5075
+ // Widgets bundle React+Zod; suppress expected chunk size warning
5076
+ chunkSizeWarningLimit: 1024,
5075
5077
  // For inline builds, disable CSS code splitting and inline all assets
5076
5078
  ...inline ? {
5077
5079
  cssCodeSplit: false,
@@ -5375,7 +5377,7 @@ program.command("dev").description("Run development server with auto-reload and
5375
5377
  );
5376
5378
  const chokidarModule = await import("chokidar");
5377
5379
  const chokidar = chokidarModule.default || chokidarModule;
5378
- const { pathToFileURL } = await import("url");
5380
+ const { pathToFileURL, fileURLToPath: fileURLToPath2 } = await import("url");
5379
5381
  const { createRequire: createRequire2 } = await import("module");
5380
5382
  let tsImport = null;
5381
5383
  try {
@@ -5396,13 +5398,40 @@ program.command("dev").description("Run development server with auto-reload and
5396
5398
  const serverFileUrl = pathToFileURL(serverFilePath).href;
5397
5399
  globalThis.__mcpUseHmrMode = true;
5398
5400
  const importServerModule = async () => {
5401
+ const previousServer = globalThis.__mcpUseLastServer;
5402
+ globalThis.__mcpUseLastServer = null;
5399
5403
  if (tsImport) {
5400
- await tsImport(`${serverFilePath}?t=${Date.now()}`, importMetaUrl);
5404
+ await tsImport(`${serverFilePath}?t=${Date.now()}`, {
5405
+ parentURL: importMetaUrl,
5406
+ onImport: (file) => {
5407
+ const filePath = file.startsWith("file://") ? fileURLToPath2(file) : file;
5408
+ if (!filePath.includes("node_modules") && filePath.startsWith(projectPath)) {
5409
+ console.debug(`[HMR] Loaded: ${file}`);
5410
+ }
5411
+ }
5412
+ });
5401
5413
  } else {
5402
5414
  await import(`${serverFileUrl}?t=${Date.now()}`);
5403
5415
  }
5404
5416
  const instance = globalThis.__mcpUseLastServer;
5405
- return instance || null;
5417
+ if (!instance) {
5418
+ globalThis.__mcpUseLastServer = previousServer;
5419
+ console.warn(
5420
+ source_default.yellow(
5421
+ "[HMR] Warning: Module re-import did not create a new MCPServer instance. The module may be cached. Check that your server file creates an MCPServer."
5422
+ )
5423
+ );
5424
+ return null;
5425
+ }
5426
+ if (instance === previousServer) {
5427
+ console.warn(
5428
+ source_default.yellow(
5429
+ "[HMR] Warning: Module re-import returned the same server instance. The module may not have been re-evaluated. " + (!tsImport ? "Install tsx as a devDependency for reliable TypeScript HMR." : "This may be a tsx caching issue.")
5430
+ )
5431
+ );
5432
+ return null;
5433
+ }
5434
+ return instance;
5406
5435
  };
5407
5436
  console.log(source_default.gray(`Loading server from ${serverFile}...`));
5408
5437
  let runningServer;
@@ -5536,12 +5565,47 @@ program.command("dev").description("Run development server with auto-reload and
5536
5565
  isReloading = false;
5537
5566
  return;
5538
5567
  }
5539
- runningServer.syncRegistrationsFrom(newServer);
5540
- console.log(
5541
- source_default.green(
5542
- `[HMR] \u2713 Reloaded: ${runningServer.registeredTools?.length || 0} tools, ${runningServer.registeredPrompts?.length || 0} prompts, ${runningServer.registeredResources?.length || 0} resources`
5543
- )
5544
- );
5568
+ const syncResult = runningServer.syncRegistrationsFrom(newServer);
5569
+ if (syncResult && syncResult.totalChanges > 0) {
5570
+ const parts = [];
5571
+ if (syncResult.tools.updated > 0 || syncResult.tools.added > 0 || syncResult.tools.removed > 0) {
5572
+ const details = [];
5573
+ if (syncResult.tools.updated > 0)
5574
+ details.push(`${syncResult.tools.updated} updated`);
5575
+ if (syncResult.tools.added > 0)
5576
+ details.push(`${syncResult.tools.added} added`);
5577
+ if (syncResult.tools.removed > 0)
5578
+ details.push(`${syncResult.tools.removed} removed`);
5579
+ parts.push(`tools (${details.join(", ")})`);
5580
+ }
5581
+ if (syncResult.prompts.updated > 0 || syncResult.prompts.added > 0 || syncResult.prompts.removed > 0) {
5582
+ const details = [];
5583
+ if (syncResult.prompts.updated > 0)
5584
+ details.push(`${syncResult.prompts.updated} updated`);
5585
+ if (syncResult.prompts.added > 0)
5586
+ details.push(`${syncResult.prompts.added} added`);
5587
+ if (syncResult.prompts.removed > 0)
5588
+ details.push(`${syncResult.prompts.removed} removed`);
5589
+ parts.push(`prompts (${details.join(", ")})`);
5590
+ }
5591
+ if (syncResult.resources.updated > 0 || syncResult.resources.added > 0 || syncResult.resources.removed > 0) {
5592
+ const details = [];
5593
+ if (syncResult.resources.updated > 0)
5594
+ details.push(`${syncResult.resources.updated} updated`);
5595
+ if (syncResult.resources.added > 0)
5596
+ details.push(`${syncResult.resources.added} added`);
5597
+ if (syncResult.resources.removed > 0)
5598
+ details.push(`${syncResult.resources.removed} removed`);
5599
+ parts.push(`resources (${details.join(", ")})`);
5600
+ }
5601
+ console.log(source_default.green(`[HMR] \u2713 Reloaded: ${parts.join(", ")}`));
5602
+ } else {
5603
+ console.log(
5604
+ source_default.gray(
5605
+ `[HMR] No changes detected (${runningServer.registeredTools?.length || 0} tools, ${runningServer.registeredPrompts?.length || 0} prompts, ${runningServer.registeredResources?.length || 0} resources registered)`
5606
+ )
5607
+ );
5608
+ }
5545
5609
  } catch (error) {
5546
5610
  console.error(source_default.red(`[HMR] Reload failed: ${error.message}`));
5547
5611
  }