@mcp-use/cli 2.11.0-canary.8 → 2.11.0
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/README.md +0 -2
- package/dist/index.cjs +63 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +63 -7
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
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,6 +4453,57 @@ 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);
|
|
4456
|
+
function displayPackageVersions(projectPath) {
|
|
4457
|
+
const packages = [
|
|
4458
|
+
{ name: "@mcp-use/cli", relativePath: "../package.json" },
|
|
4459
|
+
{
|
|
4460
|
+
name: "@mcp-use/inspector",
|
|
4461
|
+
relativePath: "../../inspector/package.json"
|
|
4462
|
+
},
|
|
4463
|
+
{
|
|
4464
|
+
name: "create-mcp-use-app",
|
|
4465
|
+
relativePath: "../../create-mcp-use-app/package.json"
|
|
4466
|
+
},
|
|
4467
|
+
{
|
|
4468
|
+
name: "mcp-use",
|
|
4469
|
+
relativePath: "../../mcp-use/package.json",
|
|
4470
|
+
highlight: true
|
|
4471
|
+
}
|
|
4472
|
+
];
|
|
4473
|
+
console.log(source_default.gray("mcp-use packages:"));
|
|
4474
|
+
for (const pkg of packages) {
|
|
4475
|
+
const paddedName = pkg.name.padEnd(22);
|
|
4476
|
+
try {
|
|
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
|
+
}
|
|
4490
|
+
const pkgContent = (0, import_node_fs8.readFileSync)(pkgPath, "utf-8");
|
|
4491
|
+
const pkgJson = JSON.parse(pkgContent);
|
|
4492
|
+
const version = pkgJson.version || "unknown";
|
|
4493
|
+
if (pkg.highlight) {
|
|
4494
|
+
console.log(
|
|
4495
|
+
` ${source_default.cyan.bold(paddedName)} ${source_default.cyan.bold(`v${version}`)}`
|
|
4496
|
+
);
|
|
4497
|
+
} else {
|
|
4498
|
+
console.log(source_default.gray(` ${paddedName} v${version}`));
|
|
4499
|
+
}
|
|
4500
|
+
} catch (error) {
|
|
4501
|
+
if (process.env.DEBUG || process.env.VERBOSE) {
|
|
4502
|
+
console.log(source_default.dim(` ${paddedName} (not found)`));
|
|
4503
|
+
}
|
|
4504
|
+
}
|
|
4505
|
+
}
|
|
4506
|
+
}
|
|
4455
4507
|
async function isPortAvailable(port, host = "localhost") {
|
|
4456
4508
|
try {
|
|
4457
4509
|
await fetch(`http://${host}:${port}`);
|
|
@@ -5008,7 +5060,7 @@ program.command("build").description("Build TypeScript and MCP UI widgets").opti
|
|
|
5008
5060
|
try {
|
|
5009
5061
|
const projectPath = import_node_path6.default.resolve(options.path);
|
|
5010
5062
|
const { promises: fs10 } = await import("fs");
|
|
5011
|
-
|
|
5063
|
+
displayPackageVersions(projectPath);
|
|
5012
5064
|
const builtWidgets = await buildWidgets(projectPath);
|
|
5013
5065
|
console.log(source_default.gray("Building TypeScript..."));
|
|
5014
5066
|
await runCommand("npx", ["tsc"], projectPath);
|
|
@@ -5072,7 +5124,7 @@ program.command("dev").description("Run development server with auto-reload and
|
|
|
5072
5124
|
let port = parseInt(options.port, 10);
|
|
5073
5125
|
const host = options.host;
|
|
5074
5126
|
const useHmr = options.hmr !== false;
|
|
5075
|
-
|
|
5127
|
+
displayPackageVersions(projectPath);
|
|
5076
5128
|
if (!await isPortAvailable(port, host)) {
|
|
5077
5129
|
console.log(source_default.yellow.bold(`\u26A0\uFE0F Port ${port} is already in use`));
|
|
5078
5130
|
const availablePort = await findAvailablePort2(port, host);
|
|
@@ -5080,22 +5132,26 @@ program.command("dev").description("Run development server with auto-reload and
|
|
|
5080
5132
|
port = availablePort;
|
|
5081
5133
|
}
|
|
5082
5134
|
const serverFile = await findServerFile(projectPath);
|
|
5135
|
+
const mcpUrl = `http://${host}:${port}`;
|
|
5083
5136
|
process.env.PORT = String(port);
|
|
5084
5137
|
process.env.HOST = host;
|
|
5085
5138
|
process.env.NODE_ENV = "development";
|
|
5139
|
+
process.env.MCP_URL = mcpUrl;
|
|
5086
5140
|
if (!useHmr) {
|
|
5087
5141
|
console.log(source_default.gray("HMR disabled, using tsx watch (full restart)"));
|
|
5088
5142
|
const processes = [];
|
|
5143
|
+
const mcpUrl2 = `http://${host}:${port}`;
|
|
5089
5144
|
const env2 = {
|
|
5090
5145
|
PORT: String(port),
|
|
5091
5146
|
HOST: host,
|
|
5092
|
-
NODE_ENV: "development"
|
|
5147
|
+
NODE_ENV: "development",
|
|
5148
|
+
MCP_URL: mcpUrl2
|
|
5093
5149
|
};
|
|
5094
|
-
const { createRequire:
|
|
5150
|
+
const { createRequire: createRequire3 } = await import("module");
|
|
5095
5151
|
let cmd;
|
|
5096
5152
|
let args;
|
|
5097
5153
|
try {
|
|
5098
|
-
const projectRequire =
|
|
5154
|
+
const projectRequire = createRequire3(
|
|
5099
5155
|
import_node_path6.default.join(projectPath, "package.json")
|
|
5100
5156
|
);
|
|
5101
5157
|
const tsxPkgPath = projectRequire.resolve("tsx/package.json");
|
|
@@ -5161,10 +5217,10 @@ program.command("dev").description("Run development server with auto-reload and
|
|
|
5161
5217
|
const chokidarModule = await import("chokidar");
|
|
5162
5218
|
const chokidar = chokidarModule.default || chokidarModule;
|
|
5163
5219
|
const { pathToFileURL } = await import("url");
|
|
5164
|
-
const { createRequire } = await import("module");
|
|
5220
|
+
const { createRequire: createRequire2 } = await import("module");
|
|
5165
5221
|
let tsImport = null;
|
|
5166
5222
|
try {
|
|
5167
|
-
const projectRequire =
|
|
5223
|
+
const projectRequire = createRequire2(
|
|
5168
5224
|
import_node_path6.default.join(projectPath, "package.json")
|
|
5169
5225
|
);
|
|
5170
5226
|
const tsxApiPath = projectRequire.resolve("tsx/esm/api");
|