@mcp-use/cli 2.19.0-canary.1 → 2.19.0-canary.3
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 +35 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +33 -8
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -530,6 +530,7 @@ var import_node_fs10 = require("fs");
|
|
|
530
530
|
var import_promises7 = require("fs/promises");
|
|
531
531
|
var import_node_module2 = require("module");
|
|
532
532
|
var import_node_path8 = __toESM(require("path"), 1);
|
|
533
|
+
var import_node_url2 = require("url");
|
|
533
534
|
|
|
534
535
|
// ../../node_modules/.pnpm/open@11.0.0/node_modules/open/index.js
|
|
535
536
|
var import_node_process8 = __toESM(require("process"), 1);
|
|
@@ -4980,7 +4981,7 @@ async function generateToolRegistryTypesForServer(projectPath, serverFileRelativ
|
|
|
4980
4981
|
globalThis.__mcpUseHmrMode = true;
|
|
4981
4982
|
globalThis.__mcpUseLastServer = void 0;
|
|
4982
4983
|
const { tsImport } = await import("tsx/esm/api");
|
|
4983
|
-
await tsImport(serverFile, {
|
|
4984
|
+
await tsImport((0, import_node_url2.pathToFileURL)(serverFile).href, {
|
|
4984
4985
|
parentURL: importMetaUrl,
|
|
4985
4986
|
tsconfig: import_node_path8.default.join(projectPath, "tsconfig.json")
|
|
4986
4987
|
});
|
|
@@ -4995,7 +4996,11 @@ async function generateToolRegistryTypesForServer(projectPath, serverFileRelativ
|
|
|
4995
4996
|
if (!generateToolRegistryTypes) {
|
|
4996
4997
|
throw new Error("generateToolRegistryTypes not found in mcp-use package");
|
|
4997
4998
|
}
|
|
4998
|
-
await generateToolRegistryTypes(
|
|
4999
|
+
const success = await generateToolRegistryTypes(
|
|
5000
|
+
server.registrations.tools,
|
|
5001
|
+
projectPath
|
|
5002
|
+
);
|
|
5003
|
+
return success;
|
|
4999
5004
|
} finally {
|
|
5000
5005
|
globalThis.__mcpUseHmrMode = previousHmrMode ?? false;
|
|
5001
5006
|
}
|
|
@@ -5577,8 +5582,19 @@ program.command("build").description("Build TypeScript and MCP UI widgets").opti
|
|
|
5577
5582
|
}
|
|
5578
5583
|
if (sourceServerFile) {
|
|
5579
5584
|
console.log(source_default.gray("Generating tool registry types..."));
|
|
5580
|
-
await generateToolRegistryTypesForServer(
|
|
5581
|
-
|
|
5585
|
+
const typeGenOk = await generateToolRegistryTypesForServer(
|
|
5586
|
+
projectPath,
|
|
5587
|
+
sourceServerFile
|
|
5588
|
+
);
|
|
5589
|
+
if (typeGenOk) {
|
|
5590
|
+
console.log(source_default.green("\u2713 Tool registry types generated"));
|
|
5591
|
+
} else {
|
|
5592
|
+
console.log(
|
|
5593
|
+
source_default.yellow(
|
|
5594
|
+
"\u26A0 Tool registry type generation had errors (non-blocking)"
|
|
5595
|
+
)
|
|
5596
|
+
);
|
|
5597
|
+
}
|
|
5582
5598
|
}
|
|
5583
5599
|
console.log(source_default.gray("Building TypeScript..."));
|
|
5584
5600
|
await transpileWithEsbuild(projectPath);
|
|
@@ -5868,7 +5884,7 @@ program.command("dev").description("Run development server with auto-reload and
|
|
|
5868
5884
|
);
|
|
5869
5885
|
const chokidarModule = await import("chokidar");
|
|
5870
5886
|
const chokidar = chokidarModule.default || chokidarModule;
|
|
5871
|
-
const {
|
|
5887
|
+
const { fileURLToPath: fileURLToPath2 } = await import("url");
|
|
5872
5888
|
const { createRequire: createRequire3 } = await import("module");
|
|
5873
5889
|
let tsImport = null;
|
|
5874
5890
|
try {
|
|
@@ -5876,7 +5892,7 @@ program.command("dev").description("Run development server with auto-reload and
|
|
|
5876
5892
|
import_node_path8.default.join(projectPath, "package.json")
|
|
5877
5893
|
);
|
|
5878
5894
|
const tsxApiPath = projectRequire.resolve("tsx/esm/api");
|
|
5879
|
-
const tsxApi = await import(pathToFileURL(tsxApiPath).href);
|
|
5895
|
+
const tsxApi = await import((0, import_node_url2.pathToFileURL)(tsxApiPath).href);
|
|
5880
5896
|
tsImport = tsxApi.tsImport;
|
|
5881
5897
|
} catch {
|
|
5882
5898
|
console.log(
|
|
@@ -5886,13 +5902,13 @@ program.command("dev").description("Run development server with auto-reload and
|
|
|
5886
5902
|
);
|
|
5887
5903
|
}
|
|
5888
5904
|
const serverFilePath = import_node_path8.default.join(projectPath, serverFile);
|
|
5889
|
-
const serverFileUrl = pathToFileURL(serverFilePath).href;
|
|
5905
|
+
const serverFileUrl = (0, import_node_url2.pathToFileURL)(serverFilePath).href;
|
|
5890
5906
|
globalThis.__mcpUseHmrMode = true;
|
|
5891
5907
|
const importServerModule = async () => {
|
|
5892
5908
|
const previousServer = globalThis.__mcpUseLastServer;
|
|
5893
5909
|
globalThis.__mcpUseLastServer = null;
|
|
5894
5910
|
if (tsImport) {
|
|
5895
|
-
await tsImport(`${
|
|
5911
|
+
await tsImport(`${serverFileUrl}?t=${Date.now()}`, {
|
|
5896
5912
|
parentURL: importMetaUrl,
|
|
5897
5913
|
onImport: (file) => {
|
|
5898
5914
|
const filePath = file.startsWith("file://") ? fileURLToPath2(file) : file;
|
|
@@ -6376,8 +6392,17 @@ program.command("generate-types").description(
|
|
|
6376
6392
|
const projectPath = import_node_path8.default.resolve(options.path);
|
|
6377
6393
|
try {
|
|
6378
6394
|
console.log(source_default.blue("Generating tool registry types..."));
|
|
6379
|
-
await generateToolRegistryTypesForServer(
|
|
6380
|
-
|
|
6395
|
+
const success = await generateToolRegistryTypesForServer(
|
|
6396
|
+
projectPath,
|
|
6397
|
+
options.server
|
|
6398
|
+
);
|
|
6399
|
+
if (success) {
|
|
6400
|
+
console.log(
|
|
6401
|
+
source_default.green("\u2713 Tool registry types generated successfully")
|
|
6402
|
+
);
|
|
6403
|
+
} else {
|
|
6404
|
+
console.log(source_default.yellow("\u26A0 Tool registry type generation had errors"));
|
|
6405
|
+
}
|
|
6381
6406
|
process.exit(0);
|
|
6382
6407
|
} catch (error) {
|
|
6383
6408
|
console.error(
|