@mcp-use/cli 3.1.0 → 3.1.1-canary.1
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 +45 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +45 -27
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -5816,12 +5816,28 @@ To fix:
|
|
|
5816
5816
|
async function findServerFile(projectPath, cliEntry, cliMcpDir) {
|
|
5817
5817
|
return resolveEntryFile(projectPath, cliEntry, cliMcpDir);
|
|
5818
5818
|
}
|
|
5819
|
+
function isBunRuntime() {
|
|
5820
|
+
return typeof globalThis.Bun !== "undefined" || typeof process.versions.bun === "string";
|
|
5821
|
+
}
|
|
5819
5822
|
async function generateToolRegistryTypesForServer(projectPath, serverFileRelative) {
|
|
5820
5823
|
const serverFile = path8.join(projectPath, serverFileRelative);
|
|
5821
5824
|
const serverFileExists = await access(serverFile).then(() => true).catch(() => false);
|
|
5822
5825
|
if (!serverFileExists) {
|
|
5823
5826
|
throw new Error(`Server file not found: ${serverFile}`);
|
|
5824
5827
|
}
|
|
5828
|
+
if (isBunRuntime()) {
|
|
5829
|
+
console.log(
|
|
5830
|
+
source_default.yellow(
|
|
5831
|
+
"\u26A0 Skipping tool registry type generation under bun runtime (requires Node.js loader hooks)."
|
|
5832
|
+
)
|
|
5833
|
+
);
|
|
5834
|
+
console.log(
|
|
5835
|
+
source_default.gray(
|
|
5836
|
+
" Run `mcp-use generate-types` with node to refresh .mcp-use/tool-registry.d.ts."
|
|
5837
|
+
)
|
|
5838
|
+
);
|
|
5839
|
+
return "skipped";
|
|
5840
|
+
}
|
|
5825
5841
|
const previousHmrMode = globalThis.__mcpUseHmrMode;
|
|
5826
5842
|
try {
|
|
5827
5843
|
globalThis.__mcpUseHmrMode = true;
|
|
@@ -5875,7 +5891,7 @@ async function generateToolRegistryTypesForServer(projectPath, serverFileRelativ
|
|
|
5875
5891
|
server.registrations.tools,
|
|
5876
5892
|
projectPath
|
|
5877
5893
|
);
|
|
5878
|
-
return success;
|
|
5894
|
+
return success ? "ok" : "failed";
|
|
5879
5895
|
} finally {
|
|
5880
5896
|
globalThis.__mcpUseHmrMode = previousHmrMode ?? false;
|
|
5881
5897
|
}
|
|
@@ -6513,16 +6529,24 @@ program.command("build").description("Build TypeScript and MCP UI widgets").opti
|
|
|
6513
6529
|
}
|
|
6514
6530
|
if (sourceServerFile) {
|
|
6515
6531
|
console.log(source_default.gray("Generating tool registry types..."));
|
|
6516
|
-
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
|
|
6522
|
-
|
|
6532
|
+
try {
|
|
6533
|
+
const typeGenResult = await generateToolRegistryTypesForServer(
|
|
6534
|
+
projectPath,
|
|
6535
|
+
sourceServerFile
|
|
6536
|
+
);
|
|
6537
|
+
if (typeGenResult === "ok") {
|
|
6538
|
+
console.log(source_default.green("\u2713 Tool registry types generated"));
|
|
6539
|
+
} else if (typeGenResult === "failed") {
|
|
6540
|
+
console.log(
|
|
6541
|
+
source_default.yellow(
|
|
6542
|
+
"\u26A0 Tool registry type generation had errors (non-blocking)"
|
|
6543
|
+
)
|
|
6544
|
+
);
|
|
6545
|
+
}
|
|
6546
|
+
} catch (err) {
|
|
6523
6547
|
console.log(
|
|
6524
6548
|
source_default.yellow(
|
|
6525
|
-
"\u26A0 Tool registry type generation
|
|
6549
|
+
"\u26A0 Tool registry type generation failed (non-blocking): " + (err instanceof Error ? err.message : String(err))
|
|
6526
6550
|
)
|
|
6527
6551
|
);
|
|
6528
6552
|
}
|
|
@@ -6540,22 +6564,16 @@ program.command("build").description("Build TypeScript and MCP UI widgets").opti
|
|
|
6540
6564
|
}
|
|
6541
6565
|
if (options.typecheck !== false && !mcpDir) {
|
|
6542
6566
|
console.log(source_default.gray("Type checking..."));
|
|
6567
|
+
const tscBin = path8.join(
|
|
6568
|
+
projectPath,
|
|
6569
|
+
"node_modules",
|
|
6570
|
+
"typescript",
|
|
6571
|
+
"bin",
|
|
6572
|
+
"tsc"
|
|
6573
|
+
);
|
|
6574
|
+
const tscArgs = isBunRuntime() ? [tscBin, "--noEmit"] : ["--max-old-space-size=4096", tscBin, "--noEmit"];
|
|
6543
6575
|
try {
|
|
6544
|
-
await runCommand(
|
|
6545
|
-
"node",
|
|
6546
|
-
[
|
|
6547
|
-
"--max-old-space-size=4096",
|
|
6548
|
-
path8.join(
|
|
6549
|
-
projectPath,
|
|
6550
|
-
"node_modules",
|
|
6551
|
-
"typescript",
|
|
6552
|
-
"bin",
|
|
6553
|
-
"tsc"
|
|
6554
|
-
),
|
|
6555
|
-
"--noEmit"
|
|
6556
|
-
],
|
|
6557
|
-
projectPath
|
|
6558
|
-
).promise;
|
|
6576
|
+
await runCommand(process.execPath, tscArgs, projectPath).promise;
|
|
6559
6577
|
console.log(source_default.green("\u2713 Type check passed!"));
|
|
6560
6578
|
} catch {
|
|
6561
6579
|
console.error(
|
|
@@ -7685,15 +7703,15 @@ program.command("generate-types").description(
|
|
|
7685
7703
|
const projectPath = path8.resolve(options.path);
|
|
7686
7704
|
try {
|
|
7687
7705
|
console.log(source_default.blue("Generating tool registry types..."));
|
|
7688
|
-
const
|
|
7706
|
+
const result = await generateToolRegistryTypesForServer(
|
|
7689
7707
|
projectPath,
|
|
7690
7708
|
options.server
|
|
7691
7709
|
);
|
|
7692
|
-
if (
|
|
7710
|
+
if (result === "ok") {
|
|
7693
7711
|
console.log(
|
|
7694
7712
|
source_default.green("\u2713 Tool registry types generated successfully")
|
|
7695
7713
|
);
|
|
7696
|
-
} else {
|
|
7714
|
+
} else if (result === "failed") {
|
|
7697
7715
|
console.log(source_default.yellow("\u26A0 Tool registry type generation had errors"));
|
|
7698
7716
|
}
|
|
7699
7717
|
process.exit(0);
|