@mcp-use/cli 2.11.0-canary.11 → 2.11.0-canary.13
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 +36 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +36 -13
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -528,6 +528,7 @@ var import_config5 = require("dotenv/config");
|
|
|
528
528
|
var import_node_child_process9 = require("child_process");
|
|
529
529
|
var import_node_fs8 = require("fs");
|
|
530
530
|
var import_promises5 = require("fs/promises");
|
|
531
|
+
var import_node_module = require("module");
|
|
531
532
|
var import_node_path6 = __toESM(require("path"), 1);
|
|
532
533
|
|
|
533
534
|
// ../../node_modules/.pnpm/open@11.0.0/node_modules/open/index.js
|
|
@@ -4452,24 +4453,43 @@ var packageContent = (0, import_node_fs8.readFileSync)(
|
|
|
4452
4453
|
var packageJson = JSON.parse(packageContent);
|
|
4453
4454
|
var packageVersion = packageJson.version || "unknown";
|
|
4454
4455
|
program.name("mcp-use").description("Create and run MCP servers with ui resources widgets").version(packageVersion);
|
|
4455
|
-
function displayPackageVersions() {
|
|
4456
|
+
function displayPackageVersions(projectPath) {
|
|
4456
4457
|
const packages = [
|
|
4457
|
-
{ name: "@mcp-use/cli",
|
|
4458
|
-
{
|
|
4458
|
+
{ name: "@mcp-use/cli", relativePath: "../package.json" },
|
|
4459
|
+
{
|
|
4460
|
+
name: "@mcp-use/inspector",
|
|
4461
|
+
relativePath: "../../inspector/package.json"
|
|
4462
|
+
},
|
|
4459
4463
|
{
|
|
4460
4464
|
name: "create-mcp-use-app",
|
|
4461
|
-
|
|
4465
|
+
relativePath: "../../create-mcp-use-app/package.json"
|
|
4462
4466
|
},
|
|
4463
|
-
{
|
|
4467
|
+
{
|
|
4468
|
+
name: "mcp-use",
|
|
4469
|
+
relativePath: "../../mcp-use/package.json",
|
|
4470
|
+
highlight: true
|
|
4471
|
+
}
|
|
4464
4472
|
];
|
|
4465
4473
|
console.log(source_default.gray("mcp-use packages:"));
|
|
4466
4474
|
for (const pkg of packages) {
|
|
4475
|
+
const paddedName = pkg.name.padEnd(22);
|
|
4467
4476
|
try {
|
|
4468
|
-
|
|
4477
|
+
let pkgPath;
|
|
4478
|
+
if (projectPath) {
|
|
4479
|
+
try {
|
|
4480
|
+
const projectRequire = (0, import_node_module.createRequire)(
|
|
4481
|
+
import_node_path6.default.join(projectPath, "package.json")
|
|
4482
|
+
);
|
|
4483
|
+
pkgPath = projectRequire.resolve(`${pkg.name}/package.json`);
|
|
4484
|
+
} catch (resolveError) {
|
|
4485
|
+
pkgPath = import_node_path6.default.join(__dirname, pkg.relativePath);
|
|
4486
|
+
}
|
|
4487
|
+
} else {
|
|
4488
|
+
pkgPath = import_node_path6.default.join(__dirname, pkg.relativePath);
|
|
4489
|
+
}
|
|
4469
4490
|
const pkgContent = (0, import_node_fs8.readFileSync)(pkgPath, "utf-8");
|
|
4470
4491
|
const pkgJson = JSON.parse(pkgContent);
|
|
4471
4492
|
const version = pkgJson.version || "unknown";
|
|
4472
|
-
const paddedName = pkg.name.padEnd(22);
|
|
4473
4493
|
if (pkg.highlight) {
|
|
4474
4494
|
console.log(
|
|
4475
4495
|
` ${source_default.cyan.bold(paddedName)} ${source_default.cyan.bold(`v${version}`)}`
|
|
@@ -4478,6 +4498,9 @@ function displayPackageVersions() {
|
|
|
4478
4498
|
console.log(source_default.gray(` ${paddedName} v${version}`));
|
|
4479
4499
|
}
|
|
4480
4500
|
} catch (error) {
|
|
4501
|
+
if (process.env.DEBUG || process.env.VERBOSE) {
|
|
4502
|
+
console.log(source_default.dim(` ${paddedName} (not found)`));
|
|
4503
|
+
}
|
|
4481
4504
|
}
|
|
4482
4505
|
}
|
|
4483
4506
|
}
|
|
@@ -5037,7 +5060,7 @@ program.command("build").description("Build TypeScript and MCP UI widgets").opti
|
|
|
5037
5060
|
try {
|
|
5038
5061
|
const projectPath = import_node_path6.default.resolve(options.path);
|
|
5039
5062
|
const { promises: fs10 } = await import("fs");
|
|
5040
|
-
displayPackageVersions();
|
|
5063
|
+
displayPackageVersions(projectPath);
|
|
5041
5064
|
const builtWidgets = await buildWidgets(projectPath);
|
|
5042
5065
|
console.log(source_default.gray("Building TypeScript..."));
|
|
5043
5066
|
await runCommand("npx", ["tsc"], projectPath);
|
|
@@ -5101,7 +5124,7 @@ program.command("dev").description("Run development server with auto-reload and
|
|
|
5101
5124
|
let port = parseInt(options.port, 10);
|
|
5102
5125
|
const host = options.host;
|
|
5103
5126
|
const useHmr = options.hmr !== false;
|
|
5104
|
-
displayPackageVersions();
|
|
5127
|
+
displayPackageVersions(projectPath);
|
|
5105
5128
|
if (!await isPortAvailable(port, host)) {
|
|
5106
5129
|
console.log(source_default.yellow.bold(`\u26A0\uFE0F Port ${port} is already in use`));
|
|
5107
5130
|
const availablePort = await findAvailablePort2(port, host);
|
|
@@ -5124,11 +5147,11 @@ program.command("dev").description("Run development server with auto-reload and
|
|
|
5124
5147
|
NODE_ENV: "development",
|
|
5125
5148
|
MCP_URL: mcpUrl2
|
|
5126
5149
|
};
|
|
5127
|
-
const { createRequire:
|
|
5150
|
+
const { createRequire: createRequire3 } = await import("module");
|
|
5128
5151
|
let cmd;
|
|
5129
5152
|
let args;
|
|
5130
5153
|
try {
|
|
5131
|
-
const projectRequire =
|
|
5154
|
+
const projectRequire = createRequire3(
|
|
5132
5155
|
import_node_path6.default.join(projectPath, "package.json")
|
|
5133
5156
|
);
|
|
5134
5157
|
const tsxPkgPath = projectRequire.resolve("tsx/package.json");
|
|
@@ -5194,10 +5217,10 @@ program.command("dev").description("Run development server with auto-reload and
|
|
|
5194
5217
|
const chokidarModule = await import("chokidar");
|
|
5195
5218
|
const chokidar = chokidarModule.default || chokidarModule;
|
|
5196
5219
|
const { pathToFileURL } = await import("url");
|
|
5197
|
-
const { createRequire } = await import("module");
|
|
5220
|
+
const { createRequire: createRequire2 } = await import("module");
|
|
5198
5221
|
let tsImport = null;
|
|
5199
5222
|
try {
|
|
5200
|
-
const projectRequire =
|
|
5223
|
+
const projectRequire = createRequire2(
|
|
5201
5224
|
import_node_path6.default.join(projectPath, "package.json")
|
|
5202
5225
|
);
|
|
5203
5226
|
const tsxApiPath = projectRequire.resolve("tsx/esm/api");
|