@mcp-use/cli 2.13.5 → 2.13.6-canary.0

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
@@ -5054,6 +5054,8 @@ export default {
5054
5054
  sourcemap: false,
5055
5055
  // Minify for smaller bundle size
5056
5056
  minify: "esbuild",
5057
+ // Widgets bundle React+Zod; suppress expected chunk size warning
5058
+ chunkSizeWarningLimit: 1024,
5057
5059
  // For inline builds, disable CSS code splitting and inline all assets
5058
5060
  ...inline ? {
5059
5061
  cssCodeSplit: false,
@@ -5357,7 +5359,7 @@ program.command("dev").description("Run development server with auto-reload and
5357
5359
  );
5358
5360
  const chokidarModule = await import("chokidar");
5359
5361
  const chokidar = chokidarModule.default || chokidarModule;
5360
- const { pathToFileURL } = await import("url");
5362
+ const { pathToFileURL, fileURLToPath: fileURLToPath3 } = await import("url");
5361
5363
  const { createRequire: createRequire2 } = await import("module");
5362
5364
  let tsImport = null;
5363
5365
  try {
@@ -5378,13 +5380,40 @@ program.command("dev").description("Run development server with auto-reload and
5378
5380
  const serverFileUrl = pathToFileURL(serverFilePath).href;
5379
5381
  globalThis.__mcpUseHmrMode = true;
5380
5382
  const importServerModule = async () => {
5383
+ const previousServer = globalThis.__mcpUseLastServer;
5384
+ globalThis.__mcpUseLastServer = null;
5381
5385
  if (tsImport) {
5382
- await tsImport(`${serverFilePath}?t=${Date.now()}`, import.meta.url);
5386
+ await tsImport(`${serverFilePath}?t=${Date.now()}`, {
5387
+ parentURL: import.meta.url,
5388
+ onImport: (file) => {
5389
+ const filePath = file.startsWith("file://") ? fileURLToPath3(file) : file;
5390
+ if (!filePath.includes("node_modules") && filePath.startsWith(projectPath)) {
5391
+ console.debug(`[HMR] Loaded: ${file}`);
5392
+ }
5393
+ }
5394
+ });
5383
5395
  } else {
5384
5396
  await import(`${serverFileUrl}?t=${Date.now()}`);
5385
5397
  }
5386
5398
  const instance = globalThis.__mcpUseLastServer;
5387
- return instance || null;
5399
+ if (!instance) {
5400
+ globalThis.__mcpUseLastServer = previousServer;
5401
+ console.warn(
5402
+ source_default.yellow(
5403
+ "[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."
5404
+ )
5405
+ );
5406
+ return null;
5407
+ }
5408
+ if (instance === previousServer) {
5409
+ console.warn(
5410
+ source_default.yellow(
5411
+ "[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.")
5412
+ )
5413
+ );
5414
+ return null;
5415
+ }
5416
+ return instance;
5388
5417
  };
5389
5418
  console.log(source_default.gray(`Loading server from ${serverFile}...`));
5390
5419
  let runningServer;
@@ -5518,12 +5547,47 @@ program.command("dev").description("Run development server with auto-reload and
5518
5547
  isReloading = false;
5519
5548
  return;
5520
5549
  }
5521
- runningServer.syncRegistrationsFrom(newServer);
5522
- console.log(
5523
- source_default.green(
5524
- `[HMR] \u2713 Reloaded: ${runningServer.registeredTools?.length || 0} tools, ${runningServer.registeredPrompts?.length || 0} prompts, ${runningServer.registeredResources?.length || 0} resources`
5525
- )
5526
- );
5550
+ const syncResult = runningServer.syncRegistrationsFrom(newServer);
5551
+ if (syncResult && syncResult.totalChanges > 0) {
5552
+ const parts = [];
5553
+ if (syncResult.tools.updated > 0 || syncResult.tools.added > 0 || syncResult.tools.removed > 0) {
5554
+ const details = [];
5555
+ if (syncResult.tools.updated > 0)
5556
+ details.push(`${syncResult.tools.updated} updated`);
5557
+ if (syncResult.tools.added > 0)
5558
+ details.push(`${syncResult.tools.added} added`);
5559
+ if (syncResult.tools.removed > 0)
5560
+ details.push(`${syncResult.tools.removed} removed`);
5561
+ parts.push(`tools (${details.join(", ")})`);
5562
+ }
5563
+ if (syncResult.prompts.updated > 0 || syncResult.prompts.added > 0 || syncResult.prompts.removed > 0) {
5564
+ const details = [];
5565
+ if (syncResult.prompts.updated > 0)
5566
+ details.push(`${syncResult.prompts.updated} updated`);
5567
+ if (syncResult.prompts.added > 0)
5568
+ details.push(`${syncResult.prompts.added} added`);
5569
+ if (syncResult.prompts.removed > 0)
5570
+ details.push(`${syncResult.prompts.removed} removed`);
5571
+ parts.push(`prompts (${details.join(", ")})`);
5572
+ }
5573
+ if (syncResult.resources.updated > 0 || syncResult.resources.added > 0 || syncResult.resources.removed > 0) {
5574
+ const details = [];
5575
+ if (syncResult.resources.updated > 0)
5576
+ details.push(`${syncResult.resources.updated} updated`);
5577
+ if (syncResult.resources.added > 0)
5578
+ details.push(`${syncResult.resources.added} added`);
5579
+ if (syncResult.resources.removed > 0)
5580
+ details.push(`${syncResult.resources.removed} removed`);
5581
+ parts.push(`resources (${details.join(", ")})`);
5582
+ }
5583
+ console.log(source_default.green(`[HMR] \u2713 Reloaded: ${parts.join(", ")}`));
5584
+ } else {
5585
+ console.log(
5586
+ source_default.gray(
5587
+ `[HMR] No changes detected (${runningServer.registeredTools?.length || 0} tools, ${runningServer.registeredPrompts?.length || 0} prompts, ${runningServer.registeredResources?.length || 0} resources registered)`
5588
+ )
5589
+ );
5590
+ }
5527
5591
  } catch (error) {
5528
5592
  console.error(source_default.red(`[HMR] Reload failed: ${error.message}`));
5529
5593
  }