@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.js
CHANGED
|
@@ -508,6 +508,7 @@ import "dotenv/config";
|
|
|
508
508
|
import { spawn } from "child_process";
|
|
509
509
|
import { readFileSync } from "fs";
|
|
510
510
|
import { access, mkdir as mkdir2, readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
|
|
511
|
+
import { createRequire } from "module";
|
|
511
512
|
import path6 from "path";
|
|
512
513
|
|
|
513
514
|
// ../../node_modules/.pnpm/open@11.0.0/node_modules/open/index.js
|
|
@@ -4434,24 +4435,43 @@ var packageContent = readFileSync(
|
|
|
4434
4435
|
var packageJson = JSON.parse(packageContent);
|
|
4435
4436
|
var packageVersion = packageJson.version || "unknown";
|
|
4436
4437
|
program.name("mcp-use").description("Create and run MCP servers with ui resources widgets").version(packageVersion);
|
|
4437
|
-
function displayPackageVersions() {
|
|
4438
|
+
function displayPackageVersions(projectPath) {
|
|
4438
4439
|
const packages = [
|
|
4439
|
-
{ name: "@mcp-use/cli",
|
|
4440
|
-
{
|
|
4440
|
+
{ name: "@mcp-use/cli", relativePath: "../package.json" },
|
|
4441
|
+
{
|
|
4442
|
+
name: "@mcp-use/inspector",
|
|
4443
|
+
relativePath: "../../inspector/package.json"
|
|
4444
|
+
},
|
|
4441
4445
|
{
|
|
4442
4446
|
name: "create-mcp-use-app",
|
|
4443
|
-
|
|
4447
|
+
relativePath: "../../create-mcp-use-app/package.json"
|
|
4444
4448
|
},
|
|
4445
|
-
{
|
|
4449
|
+
{
|
|
4450
|
+
name: "mcp-use",
|
|
4451
|
+
relativePath: "../../mcp-use/package.json",
|
|
4452
|
+
highlight: true
|
|
4453
|
+
}
|
|
4446
4454
|
];
|
|
4447
4455
|
console.log(source_default.gray("mcp-use packages:"));
|
|
4448
4456
|
for (const pkg of packages) {
|
|
4457
|
+
const paddedName = pkg.name.padEnd(22);
|
|
4449
4458
|
try {
|
|
4450
|
-
|
|
4459
|
+
let pkgPath;
|
|
4460
|
+
if (projectPath) {
|
|
4461
|
+
try {
|
|
4462
|
+
const projectRequire = createRequire(
|
|
4463
|
+
path6.join(projectPath, "package.json")
|
|
4464
|
+
);
|
|
4465
|
+
pkgPath = projectRequire.resolve(`${pkg.name}/package.json`);
|
|
4466
|
+
} catch (resolveError) {
|
|
4467
|
+
pkgPath = path6.join(__dirname, pkg.relativePath);
|
|
4468
|
+
}
|
|
4469
|
+
} else {
|
|
4470
|
+
pkgPath = path6.join(__dirname, pkg.relativePath);
|
|
4471
|
+
}
|
|
4451
4472
|
const pkgContent = readFileSync(pkgPath, "utf-8");
|
|
4452
4473
|
const pkgJson = JSON.parse(pkgContent);
|
|
4453
4474
|
const version = pkgJson.version || "unknown";
|
|
4454
|
-
const paddedName = pkg.name.padEnd(22);
|
|
4455
4475
|
if (pkg.highlight) {
|
|
4456
4476
|
console.log(
|
|
4457
4477
|
` ${source_default.cyan.bold(paddedName)} ${source_default.cyan.bold(`v${version}`)}`
|
|
@@ -4460,6 +4480,9 @@ function displayPackageVersions() {
|
|
|
4460
4480
|
console.log(source_default.gray(` ${paddedName} v${version}`));
|
|
4461
4481
|
}
|
|
4462
4482
|
} catch (error) {
|
|
4483
|
+
if (process.env.DEBUG || process.env.VERBOSE) {
|
|
4484
|
+
console.log(source_default.dim(` ${paddedName} (not found)`));
|
|
4485
|
+
}
|
|
4463
4486
|
}
|
|
4464
4487
|
}
|
|
4465
4488
|
}
|
|
@@ -5019,7 +5042,7 @@ program.command("build").description("Build TypeScript and MCP UI widgets").opti
|
|
|
5019
5042
|
try {
|
|
5020
5043
|
const projectPath = path6.resolve(options.path);
|
|
5021
5044
|
const { promises: fs10 } = await import("fs");
|
|
5022
|
-
displayPackageVersions();
|
|
5045
|
+
displayPackageVersions(projectPath);
|
|
5023
5046
|
const builtWidgets = await buildWidgets(projectPath);
|
|
5024
5047
|
console.log(source_default.gray("Building TypeScript..."));
|
|
5025
5048
|
await runCommand("npx", ["tsc"], projectPath);
|
|
@@ -5083,7 +5106,7 @@ program.command("dev").description("Run development server with auto-reload and
|
|
|
5083
5106
|
let port = parseInt(options.port, 10);
|
|
5084
5107
|
const host = options.host;
|
|
5085
5108
|
const useHmr = options.hmr !== false;
|
|
5086
|
-
displayPackageVersions();
|
|
5109
|
+
displayPackageVersions(projectPath);
|
|
5087
5110
|
if (!await isPortAvailable(port, host)) {
|
|
5088
5111
|
console.log(source_default.yellow.bold(`\u26A0\uFE0F Port ${port} is already in use`));
|
|
5089
5112
|
const availablePort = await findAvailablePort2(port, host);
|
|
@@ -5106,11 +5129,11 @@ program.command("dev").description("Run development server with auto-reload and
|
|
|
5106
5129
|
NODE_ENV: "development",
|
|
5107
5130
|
MCP_URL: mcpUrl2
|
|
5108
5131
|
};
|
|
5109
|
-
const { createRequire:
|
|
5132
|
+
const { createRequire: createRequire3 } = await import("module");
|
|
5110
5133
|
let cmd;
|
|
5111
5134
|
let args;
|
|
5112
5135
|
try {
|
|
5113
|
-
const projectRequire =
|
|
5136
|
+
const projectRequire = createRequire3(
|
|
5114
5137
|
path6.join(projectPath, "package.json")
|
|
5115
5138
|
);
|
|
5116
5139
|
const tsxPkgPath = projectRequire.resolve("tsx/package.json");
|
|
@@ -5176,10 +5199,10 @@ program.command("dev").description("Run development server with auto-reload and
|
|
|
5176
5199
|
const chokidarModule = await import("chokidar");
|
|
5177
5200
|
const chokidar = chokidarModule.default || chokidarModule;
|
|
5178
5201
|
const { pathToFileURL } = await import("url");
|
|
5179
|
-
const { createRequire } = await import("module");
|
|
5202
|
+
const { createRequire: createRequire2 } = await import("module");
|
|
5180
5203
|
let tsImport = null;
|
|
5181
5204
|
try {
|
|
5182
|
-
const projectRequire =
|
|
5205
|
+
const projectRequire = createRequire2(
|
|
5183
5206
|
path6.join(projectPath, "package.json")
|
|
5184
5207
|
);
|
|
5185
5208
|
const tsxApiPath = projectRequire.resolve("tsx/esm/api");
|