@mcp-use/cli 2.2.3-canary.2 → 2.2.3-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.
- package/dist/index.js +43 -9
- package/dist/index.mjs +43 -9
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1227,9 +1227,13 @@ async function startTunnel(port, subdomain) {
|
|
|
1227
1227
|
shell: false
|
|
1228
1228
|
});
|
|
1229
1229
|
let resolved = false;
|
|
1230
|
+
let isShuttingDown = false;
|
|
1230
1231
|
proc.stdout?.on("data", (data) => {
|
|
1231
1232
|
const text = data.toString();
|
|
1232
|
-
|
|
1233
|
+
const isShutdownMessage = text.includes("Shutting down") || text.includes("\u{1F6D1}");
|
|
1234
|
+
if (!isShuttingDown && !isShutdownMessage) {
|
|
1235
|
+
process.stdout.write(text);
|
|
1236
|
+
}
|
|
1233
1237
|
const urlMatch = text.match(/https?:\/\/([a-z0-9-]+\.[a-z0-9.-]+)/i);
|
|
1234
1238
|
if (urlMatch && !resolved) {
|
|
1235
1239
|
const url = urlMatch[0];
|
|
@@ -1243,7 +1247,10 @@ async function startTunnel(port, subdomain) {
|
|
|
1243
1247
|
}
|
|
1244
1248
|
});
|
|
1245
1249
|
proc.stderr?.on("data", (data) => {
|
|
1246
|
-
|
|
1250
|
+
const text = data.toString();
|
|
1251
|
+
if (!isShuttingDown && !text.includes("INFO") && !text.includes("bore_cli") && !text.includes("Shutting down")) {
|
|
1252
|
+
process.stderr.write(data);
|
|
1253
|
+
}
|
|
1247
1254
|
});
|
|
1248
1255
|
proc.on("error", (error) => {
|
|
1249
1256
|
if (!resolved) {
|
|
@@ -1257,6 +1264,9 @@ async function startTunnel(port, subdomain) {
|
|
|
1257
1264
|
reject(new Error(`Tunnel process exited with code ${code}`));
|
|
1258
1265
|
}
|
|
1259
1266
|
});
|
|
1267
|
+
proc.markShutdown = () => {
|
|
1268
|
+
isShuttingDown = true;
|
|
1269
|
+
};
|
|
1260
1270
|
const setupTimeout = setTimeout(() => {
|
|
1261
1271
|
if (!resolved) {
|
|
1262
1272
|
proc.kill();
|
|
@@ -1476,12 +1486,20 @@ program.command("build").description("Build TypeScript and MCP UI widgets").opti
|
|
|
1476
1486
|
await runCommand("npx", ["tsc"], projectPath);
|
|
1477
1487
|
console.log(import_chalk3.default.green("\u2713 TypeScript build complete!"));
|
|
1478
1488
|
const manifestPath = import_node_path3.default.join(projectPath, "dist", "mcp-use.json");
|
|
1489
|
+
let existingManifest = {};
|
|
1490
|
+
try {
|
|
1491
|
+
const existingContent = await fs3.readFile(manifestPath, "utf-8");
|
|
1492
|
+
existingManifest = JSON.parse(existingContent);
|
|
1493
|
+
} catch {
|
|
1494
|
+
}
|
|
1479
1495
|
const widgetsData = {};
|
|
1480
1496
|
for (const widget of builtWidgets) {
|
|
1481
1497
|
widgetsData[widget.name] = widget.metadata;
|
|
1482
1498
|
}
|
|
1483
1499
|
const includeInspector = !!options.withInspector;
|
|
1484
1500
|
const manifest = {
|
|
1501
|
+
...existingManifest,
|
|
1502
|
+
// Preserve existing fields like tunnel
|
|
1485
1503
|
includeInspector,
|
|
1486
1504
|
buildTime: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1487
1505
|
widgets: widgetsData
|
|
@@ -1595,6 +1613,7 @@ program.command("start").description("Start production server").option("-p, --pa
|
|
|
1595
1613
|
);
|
|
1596
1614
|
let mcpUrl;
|
|
1597
1615
|
let tunnelProcess = void 0;
|
|
1616
|
+
let tunnelSubdomain = void 0;
|
|
1598
1617
|
if (options.tunnel) {
|
|
1599
1618
|
try {
|
|
1600
1619
|
const manifestPath = import_node_path3.default.join(projectPath, "dist", "mcp-use.json");
|
|
@@ -1614,6 +1633,7 @@ program.command("start").description("Start production server").option("-p, --pa
|
|
|
1614
1633
|
mcpUrl = tunnelInfo.url;
|
|
1615
1634
|
tunnelProcess = tunnelInfo.process;
|
|
1616
1635
|
const subdomain = tunnelInfo.subdomain;
|
|
1636
|
+
tunnelSubdomain = subdomain;
|
|
1617
1637
|
try {
|
|
1618
1638
|
let manifest = {};
|
|
1619
1639
|
try {
|
|
@@ -1631,9 +1651,6 @@ program.command("start").description("Start production server").option("-p, --pa
|
|
|
1631
1651
|
JSON.stringify(manifest, null, 2),
|
|
1632
1652
|
"utf-8"
|
|
1633
1653
|
);
|
|
1634
|
-
console.log(
|
|
1635
|
-
import_chalk3.default.green(`\u2713 Subdomain saved to mcp-use.json: ${subdomain}`)
|
|
1636
|
-
);
|
|
1637
1654
|
} catch (error) {
|
|
1638
1655
|
console.warn(
|
|
1639
1656
|
import_chalk3.default.yellow(
|
|
@@ -1667,8 +1684,25 @@ program.command("start").description("Start production server").option("-p, --pa
|
|
|
1667
1684
|
stdio: "inherit",
|
|
1668
1685
|
env
|
|
1669
1686
|
});
|
|
1670
|
-
|
|
1671
|
-
|
|
1687
|
+
let cleanupInProgress = false;
|
|
1688
|
+
const cleanup = async () => {
|
|
1689
|
+
if (cleanupInProgress) {
|
|
1690
|
+
return;
|
|
1691
|
+
}
|
|
1692
|
+
cleanupInProgress = true;
|
|
1693
|
+
console.log(import_chalk3.default.gray("\n\nShutting down..."));
|
|
1694
|
+
if (tunnelProcess && typeof tunnelProcess.markShutdown === "function") {
|
|
1695
|
+
tunnelProcess.markShutdown();
|
|
1696
|
+
}
|
|
1697
|
+
if (tunnelSubdomain) {
|
|
1698
|
+
try {
|
|
1699
|
+
const apiBase = process.env.MCP_USE_API || "https://local.mcp-use.run";
|
|
1700
|
+
await fetch(`${apiBase}/api/tunnels/${tunnelSubdomain}`, {
|
|
1701
|
+
method: "DELETE"
|
|
1702
|
+
});
|
|
1703
|
+
} catch (err) {
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1672
1706
|
const processesToKill = 1 + (tunnelProcess ? 1 : 0);
|
|
1673
1707
|
let killedCount = 0;
|
|
1674
1708
|
const checkAndExit = () => {
|
|
@@ -1681,7 +1715,7 @@ program.command("start").description("Start production server").option("-p, --pa
|
|
|
1681
1715
|
serverProc.kill("SIGTERM");
|
|
1682
1716
|
if (tunnelProcess && typeof tunnelProcess.kill === "function") {
|
|
1683
1717
|
tunnelProcess.on("exit", checkAndExit);
|
|
1684
|
-
tunnelProcess.kill("
|
|
1718
|
+
tunnelProcess.kill("SIGINT");
|
|
1685
1719
|
} else {
|
|
1686
1720
|
checkAndExit();
|
|
1687
1721
|
}
|
|
@@ -1693,7 +1727,7 @@ program.command("start").description("Start production server").option("-p, --pa
|
|
|
1693
1727
|
tunnelProcess.kill("SIGKILL");
|
|
1694
1728
|
}
|
|
1695
1729
|
process.exit(0);
|
|
1696
|
-
},
|
|
1730
|
+
}, 2e3);
|
|
1697
1731
|
};
|
|
1698
1732
|
process.on("SIGINT", cleanup);
|
|
1699
1733
|
process.on("SIGTERM", cleanup);
|
package/dist/index.mjs
CHANGED
|
@@ -1206,9 +1206,13 @@ async function startTunnel(port, subdomain) {
|
|
|
1206
1206
|
shell: false
|
|
1207
1207
|
});
|
|
1208
1208
|
let resolved = false;
|
|
1209
|
+
let isShuttingDown = false;
|
|
1209
1210
|
proc.stdout?.on("data", (data) => {
|
|
1210
1211
|
const text = data.toString();
|
|
1211
|
-
|
|
1212
|
+
const isShutdownMessage = text.includes("Shutting down") || text.includes("\u{1F6D1}");
|
|
1213
|
+
if (!isShuttingDown && !isShutdownMessage) {
|
|
1214
|
+
process.stdout.write(text);
|
|
1215
|
+
}
|
|
1212
1216
|
const urlMatch = text.match(/https?:\/\/([a-z0-9-]+\.[a-z0-9.-]+)/i);
|
|
1213
1217
|
if (urlMatch && !resolved) {
|
|
1214
1218
|
const url = urlMatch[0];
|
|
@@ -1222,7 +1226,10 @@ async function startTunnel(port, subdomain) {
|
|
|
1222
1226
|
}
|
|
1223
1227
|
});
|
|
1224
1228
|
proc.stderr?.on("data", (data) => {
|
|
1225
|
-
|
|
1229
|
+
const text = data.toString();
|
|
1230
|
+
if (!isShuttingDown && !text.includes("INFO") && !text.includes("bore_cli") && !text.includes("Shutting down")) {
|
|
1231
|
+
process.stderr.write(data);
|
|
1232
|
+
}
|
|
1226
1233
|
});
|
|
1227
1234
|
proc.on("error", (error) => {
|
|
1228
1235
|
if (!resolved) {
|
|
@@ -1236,6 +1243,9 @@ async function startTunnel(port, subdomain) {
|
|
|
1236
1243
|
reject(new Error(`Tunnel process exited with code ${code}`));
|
|
1237
1244
|
}
|
|
1238
1245
|
});
|
|
1246
|
+
proc.markShutdown = () => {
|
|
1247
|
+
isShuttingDown = true;
|
|
1248
|
+
};
|
|
1239
1249
|
const setupTimeout = setTimeout(() => {
|
|
1240
1250
|
if (!resolved) {
|
|
1241
1251
|
proc.kill();
|
|
@@ -1455,12 +1465,20 @@ program.command("build").description("Build TypeScript and MCP UI widgets").opti
|
|
|
1455
1465
|
await runCommand("npx", ["tsc"], projectPath);
|
|
1456
1466
|
console.log(chalk3.green("\u2713 TypeScript build complete!"));
|
|
1457
1467
|
const manifestPath = path3.join(projectPath, "dist", "mcp-use.json");
|
|
1468
|
+
let existingManifest = {};
|
|
1469
|
+
try {
|
|
1470
|
+
const existingContent = await fs3.readFile(manifestPath, "utf-8");
|
|
1471
|
+
existingManifest = JSON.parse(existingContent);
|
|
1472
|
+
} catch {
|
|
1473
|
+
}
|
|
1458
1474
|
const widgetsData = {};
|
|
1459
1475
|
for (const widget of builtWidgets) {
|
|
1460
1476
|
widgetsData[widget.name] = widget.metadata;
|
|
1461
1477
|
}
|
|
1462
1478
|
const includeInspector = !!options.withInspector;
|
|
1463
1479
|
const manifest = {
|
|
1480
|
+
...existingManifest,
|
|
1481
|
+
// Preserve existing fields like tunnel
|
|
1464
1482
|
includeInspector,
|
|
1465
1483
|
buildTime: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1466
1484
|
widgets: widgetsData
|
|
@@ -1574,6 +1592,7 @@ program.command("start").description("Start production server").option("-p, --pa
|
|
|
1574
1592
|
);
|
|
1575
1593
|
let mcpUrl;
|
|
1576
1594
|
let tunnelProcess = void 0;
|
|
1595
|
+
let tunnelSubdomain = void 0;
|
|
1577
1596
|
if (options.tunnel) {
|
|
1578
1597
|
try {
|
|
1579
1598
|
const manifestPath = path3.join(projectPath, "dist", "mcp-use.json");
|
|
@@ -1593,6 +1612,7 @@ program.command("start").description("Start production server").option("-p, --pa
|
|
|
1593
1612
|
mcpUrl = tunnelInfo.url;
|
|
1594
1613
|
tunnelProcess = tunnelInfo.process;
|
|
1595
1614
|
const subdomain = tunnelInfo.subdomain;
|
|
1615
|
+
tunnelSubdomain = subdomain;
|
|
1596
1616
|
try {
|
|
1597
1617
|
let manifest = {};
|
|
1598
1618
|
try {
|
|
@@ -1610,9 +1630,6 @@ program.command("start").description("Start production server").option("-p, --pa
|
|
|
1610
1630
|
JSON.stringify(manifest, null, 2),
|
|
1611
1631
|
"utf-8"
|
|
1612
1632
|
);
|
|
1613
|
-
console.log(
|
|
1614
|
-
chalk3.green(`\u2713 Subdomain saved to mcp-use.json: ${subdomain}`)
|
|
1615
|
-
);
|
|
1616
1633
|
} catch (error) {
|
|
1617
1634
|
console.warn(
|
|
1618
1635
|
chalk3.yellow(
|
|
@@ -1646,8 +1663,25 @@ program.command("start").description("Start production server").option("-p, --pa
|
|
|
1646
1663
|
stdio: "inherit",
|
|
1647
1664
|
env
|
|
1648
1665
|
});
|
|
1649
|
-
|
|
1650
|
-
|
|
1666
|
+
let cleanupInProgress = false;
|
|
1667
|
+
const cleanup = async () => {
|
|
1668
|
+
if (cleanupInProgress) {
|
|
1669
|
+
return;
|
|
1670
|
+
}
|
|
1671
|
+
cleanupInProgress = true;
|
|
1672
|
+
console.log(chalk3.gray("\n\nShutting down..."));
|
|
1673
|
+
if (tunnelProcess && typeof tunnelProcess.markShutdown === "function") {
|
|
1674
|
+
tunnelProcess.markShutdown();
|
|
1675
|
+
}
|
|
1676
|
+
if (tunnelSubdomain) {
|
|
1677
|
+
try {
|
|
1678
|
+
const apiBase = process.env.MCP_USE_API || "https://local.mcp-use.run";
|
|
1679
|
+
await fetch(`${apiBase}/api/tunnels/${tunnelSubdomain}`, {
|
|
1680
|
+
method: "DELETE"
|
|
1681
|
+
});
|
|
1682
|
+
} catch (err) {
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1651
1685
|
const processesToKill = 1 + (tunnelProcess ? 1 : 0);
|
|
1652
1686
|
let killedCount = 0;
|
|
1653
1687
|
const checkAndExit = () => {
|
|
@@ -1660,7 +1694,7 @@ program.command("start").description("Start production server").option("-p, --pa
|
|
|
1660
1694
|
serverProc.kill("SIGTERM");
|
|
1661
1695
|
if (tunnelProcess && typeof tunnelProcess.kill === "function") {
|
|
1662
1696
|
tunnelProcess.on("exit", checkAndExit);
|
|
1663
|
-
tunnelProcess.kill("
|
|
1697
|
+
tunnelProcess.kill("SIGINT");
|
|
1664
1698
|
} else {
|
|
1665
1699
|
checkAndExit();
|
|
1666
1700
|
}
|
|
@@ -1672,7 +1706,7 @@ program.command("start").description("Start production server").option("-p, --pa
|
|
|
1672
1706
|
tunnelProcess.kill("SIGKILL");
|
|
1673
1707
|
}
|
|
1674
1708
|
process.exit(0);
|
|
1675
|
-
},
|
|
1709
|
+
}, 2e3);
|
|
1676
1710
|
};
|
|
1677
1711
|
process.on("SIGINT", cleanup);
|
|
1678
1712
|
process.on("SIGTERM", cleanup);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcp-use/cli",
|
|
3
|
-
"version": "2.2.3-canary.
|
|
3
|
+
"version": "2.2.3-canary.4",
|
|
4
4
|
"description": "Build tool for MCP UI widgets - bundles React components into standalone HTML pages for Model Context Protocol servers",
|
|
5
5
|
"author": "mcp-use, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"tsx": "^4.0.0",
|
|
45
45
|
"vite": "^6.0.0",
|
|
46
46
|
"ws": "^8.18.0",
|
|
47
|
-
"@mcp-use/inspector": "0.5.3-canary.
|
|
48
|
-
"mcp-use": "1.3.3-canary.
|
|
47
|
+
"@mcp-use/inspector": "0.5.3-canary.4",
|
|
48
|
+
"mcp-use": "1.3.3-canary.4"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/node": "^20.0.0",
|