@mcp-use/cli 2.1.22 → 2.1.23-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.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import 'dotenv/config';
2
+ import "dotenv/config";
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,eAAe,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,eAAe,CAAC"}
package/dist/index.js CHANGED
@@ -33,7 +33,10 @@ var import_node_path = __toESM(require("path"));
33
33
  var import_open = __toESM(require("open"));
34
34
  var import_chalk = __toESM(require("chalk"));
35
35
  var program = new import_commander.Command();
36
- var packageContent = (0, import_node_fs.readFileSync)(import_node_path.default.join(__dirname, "../package.json"), "utf-8");
36
+ var packageContent = (0, import_node_fs.readFileSync)(
37
+ import_node_path.default.join(__dirname, "../package.json"),
38
+ "utf-8"
39
+ );
37
40
  var packageJson = JSON.parse(packageContent);
38
41
  var packageVersion = packageJson.version || "unknown";
39
42
  program.name("mcp-use").description("Create and run MCP servers with ui resources widgets").version(packageVersion);
@@ -155,13 +158,23 @@ async function buildWidgets(projectPath) {
155
158
  const resourcesDir = import_node_path.default.join(projectPath, "resources");
156
159
  const mcpUrl = process.env.MCP_URL;
157
160
  if (!mcpUrl) {
158
- console.log(import_chalk.default.yellow("\u26A0\uFE0F MCP_URL not set - using relative paths (widgets may not work correctly)"));
159
- console.log(import_chalk.default.gray(" Set MCP_URL environment variable for production builds (e.g., https://myserver.com)"));
161
+ console.log(
162
+ import_chalk.default.yellow(
163
+ "\u26A0\uFE0F MCP_URL not set - using relative paths (widgets may not work correctly)"
164
+ )
165
+ );
166
+ console.log(
167
+ import_chalk.default.gray(
168
+ " Set MCP_URL environment variable for production builds (e.g., https://myserver.com)"
169
+ )
170
+ );
160
171
  }
161
172
  try {
162
173
  await (0, import_promises.access)(resourcesDir);
163
174
  } catch {
164
- console.log(import_chalk.default.gray("No resources/ directory found - skipping widget build"));
175
+ console.log(
176
+ import_chalk.default.gray("No resources/ directory found - skipping widget build")
177
+ );
165
178
  return [];
166
179
  }
167
180
  let entries = [];
@@ -218,11 +231,21 @@ if (container && Component) {
218
231
  </html>`;
219
232
  await fs.writeFile(import_node_path.default.join(tempDir, "entry.tsx"), entryContent, "utf8");
220
233
  await fs.writeFile(import_node_path.default.join(tempDir, "index.html"), htmlContent, "utf8");
221
- const outDir = import_node_path.default.join(projectPath, "dist", "resources", "widgets", widgetName);
234
+ const outDir = import_node_path.default.join(
235
+ projectPath,
236
+ "dist",
237
+ "resources",
238
+ "widgets",
239
+ widgetName
240
+ );
222
241
  const baseUrl = `/mcp-use/widgets/${widgetName}/`;
223
242
  let widgetMetadata = {};
224
243
  try {
225
- const metadataTempDir = import_node_path.default.join(projectPath, ".mcp-use", `${widgetName}-metadata`);
244
+ const metadataTempDir = import_node_path.default.join(
245
+ projectPath,
246
+ ".mcp-use",
247
+ `${widgetName}-metadata`
248
+ );
226
249
  await fs.mkdir(metadataTempDir, { recursive: true });
227
250
  const { createServer } = await import("vite");
228
251
  const metadataServer = await createServer({
@@ -266,7 +289,9 @@ if (container && Component) {
266
289
  }
267
290
  await new Promise((resolve) => setTimeout(resolve, 50));
268
291
  } catch (error) {
269
- console.warn(import_chalk.default.yellow(` \u26A0 Could not extract metadata for ${widgetName}`));
292
+ console.warn(
293
+ import_chalk.default.yellow(` \u26A0 Could not extract metadata for ${widgetName}`)
294
+ );
270
295
  } finally {
271
296
  await metadataServer.close();
272
297
  try {
@@ -284,7 +309,9 @@ if (container && Component) {
284
309
  experimental: {
285
310
  renderBuiltUrl: (filename, { hostType }) => {
286
311
  if (["js", "css"].includes(hostType)) {
287
- return { runtime: `window.__getFile(${JSON.stringify(filename)})` };
312
+ return {
313
+ runtime: `window.__getFile(${JSON.stringify(filename)})`
314
+ };
288
315
  } else {
289
316
  return { relative: true };
290
317
  }
@@ -304,7 +331,11 @@ if (container && Component) {
304
331
  }
305
332
  });
306
333
  const metadataPath = import_node_path.default.join(outDir, "metadata.json");
307
- await fs.writeFile(metadataPath, JSON.stringify(widgetMetadata, null, 2), "utf8");
334
+ await fs.writeFile(
335
+ metadataPath,
336
+ JSON.stringify(widgetMetadata, null, 2),
337
+ "utf8"
338
+ );
308
339
  builtWidgets.push(widgetName);
309
340
  console.log(import_chalk.default.green(` \u2713 Built ${widgetName}`));
310
341
  } catch (error) {
@@ -322,14 +353,22 @@ program.command("build").description("Build TypeScript and MCP UI widgets").opti
322
353
  console.log(import_chalk.default.gray("Building TypeScript..."));
323
354
  await runCommand("npx", ["tsc"], projectPath);
324
355
  console.log(import_chalk.default.green("\u2713 TypeScript build complete!"));
325
- const manifestPath = import_node_path.default.join(projectPath, "dist", ".mcp-use-manifest.json");
356
+ const manifestPath = import_node_path.default.join(
357
+ projectPath,
358
+ "dist",
359
+ ".mcp-use-manifest.json"
360
+ );
326
361
  const manifest = {
327
362
  includeInspector: options.withInspector || false,
328
363
  buildTime: (/* @__PURE__ */ new Date()).toISOString(),
329
364
  widgets: builtWidgets
330
365
  };
331
366
  await fs.mkdir(import_node_path.default.dirname(manifestPath), { recursive: true });
332
- await fs.writeFile(manifestPath, JSON.stringify(manifest, null, 2), "utf8");
367
+ await fs.writeFile(
368
+ manifestPath,
369
+ JSON.stringify(manifest, null, 2),
370
+ "utf8"
371
+ );
333
372
  console.log(import_chalk.default.green("\u2713 Build manifest created"));
334
373
  console.log(import_chalk.default.green.bold(`
335
374
  \u2713 Build complete!`));
@@ -367,7 +406,13 @@ program.command("dev").description("Run development server with auto-reload and
367
406
  if (mcpUrl) {
368
407
  env.MCP_URL = mcpUrl;
369
408
  }
370
- const serverCommand = runCommand("npx", ["tsx", "watch", serverFile], projectPath, env, true);
409
+ const serverCommand = runCommand(
410
+ "npx",
411
+ ["tsx", "watch", serverFile],
412
+ projectPath,
413
+ env,
414
+ true
415
+ );
371
416
  processes.push(serverCommand.process);
372
417
  if (options.open !== false) {
373
418
  const startTime = Date.now();
@@ -431,8 +476,10 @@ program.command("start").description("Start production server").option("-p, --pa
431
476
  try {
432
477
  const projectPath = import_node_path.default.resolve(options.path);
433
478
  const port = parseInt(options.port, 10);
434
- console.log(`\x1B[36m\x1B[1mmcp-use\x1B[0m \x1B[90mVersion: ${packageJson.version}\x1B[0m
435
- `);
479
+ console.log(
480
+ `\x1B[36m\x1B[1mmcp-use\x1B[0m \x1B[90mVersion: ${packageJson.version}\x1B[0m
481
+ `
482
+ );
436
483
  let mcpUrl;
437
484
  let tunnelProcess = void 0;
438
485
  if (options.tunnel) {
package/dist/index.mjs CHANGED
@@ -10,7 +10,10 @@ import path from "path";
10
10
  import open from "open";
11
11
  import chalk from "chalk";
12
12
  var program = new Command();
13
- var packageContent = readFileSync(path.join(__dirname, "../package.json"), "utf-8");
13
+ var packageContent = readFileSync(
14
+ path.join(__dirname, "../package.json"),
15
+ "utf-8"
16
+ );
14
17
  var packageJson = JSON.parse(packageContent);
15
18
  var packageVersion = packageJson.version || "unknown";
16
19
  program.name("mcp-use").description("Create and run MCP servers with ui resources widgets").version(packageVersion);
@@ -132,13 +135,23 @@ async function buildWidgets(projectPath) {
132
135
  const resourcesDir = path.join(projectPath, "resources");
133
136
  const mcpUrl = process.env.MCP_URL;
134
137
  if (!mcpUrl) {
135
- console.log(chalk.yellow("\u26A0\uFE0F MCP_URL not set - using relative paths (widgets may not work correctly)"));
136
- console.log(chalk.gray(" Set MCP_URL environment variable for production builds (e.g., https://myserver.com)"));
138
+ console.log(
139
+ chalk.yellow(
140
+ "\u26A0\uFE0F MCP_URL not set - using relative paths (widgets may not work correctly)"
141
+ )
142
+ );
143
+ console.log(
144
+ chalk.gray(
145
+ " Set MCP_URL environment variable for production builds (e.g., https://myserver.com)"
146
+ )
147
+ );
137
148
  }
138
149
  try {
139
150
  await access(resourcesDir);
140
151
  } catch {
141
- console.log(chalk.gray("No resources/ directory found - skipping widget build"));
152
+ console.log(
153
+ chalk.gray("No resources/ directory found - skipping widget build")
154
+ );
142
155
  return [];
143
156
  }
144
157
  let entries = [];
@@ -195,11 +208,21 @@ if (container && Component) {
195
208
  </html>`;
196
209
  await fs.writeFile(path.join(tempDir, "entry.tsx"), entryContent, "utf8");
197
210
  await fs.writeFile(path.join(tempDir, "index.html"), htmlContent, "utf8");
198
- const outDir = path.join(projectPath, "dist", "resources", "widgets", widgetName);
211
+ const outDir = path.join(
212
+ projectPath,
213
+ "dist",
214
+ "resources",
215
+ "widgets",
216
+ widgetName
217
+ );
199
218
  const baseUrl = `/mcp-use/widgets/${widgetName}/`;
200
219
  let widgetMetadata = {};
201
220
  try {
202
- const metadataTempDir = path.join(projectPath, ".mcp-use", `${widgetName}-metadata`);
221
+ const metadataTempDir = path.join(
222
+ projectPath,
223
+ ".mcp-use",
224
+ `${widgetName}-metadata`
225
+ );
203
226
  await fs.mkdir(metadataTempDir, { recursive: true });
204
227
  const { createServer } = await import("vite");
205
228
  const metadataServer = await createServer({
@@ -243,7 +266,9 @@ if (container && Component) {
243
266
  }
244
267
  await new Promise((resolve) => setTimeout(resolve, 50));
245
268
  } catch (error) {
246
- console.warn(chalk.yellow(` \u26A0 Could not extract metadata for ${widgetName}`));
269
+ console.warn(
270
+ chalk.yellow(` \u26A0 Could not extract metadata for ${widgetName}`)
271
+ );
247
272
  } finally {
248
273
  await metadataServer.close();
249
274
  try {
@@ -261,7 +286,9 @@ if (container && Component) {
261
286
  experimental: {
262
287
  renderBuiltUrl: (filename, { hostType }) => {
263
288
  if (["js", "css"].includes(hostType)) {
264
- return { runtime: `window.__getFile(${JSON.stringify(filename)})` };
289
+ return {
290
+ runtime: `window.__getFile(${JSON.stringify(filename)})`
291
+ };
265
292
  } else {
266
293
  return { relative: true };
267
294
  }
@@ -281,7 +308,11 @@ if (container && Component) {
281
308
  }
282
309
  });
283
310
  const metadataPath = path.join(outDir, "metadata.json");
284
- await fs.writeFile(metadataPath, JSON.stringify(widgetMetadata, null, 2), "utf8");
311
+ await fs.writeFile(
312
+ metadataPath,
313
+ JSON.stringify(widgetMetadata, null, 2),
314
+ "utf8"
315
+ );
285
316
  builtWidgets.push(widgetName);
286
317
  console.log(chalk.green(` \u2713 Built ${widgetName}`));
287
318
  } catch (error) {
@@ -299,14 +330,22 @@ program.command("build").description("Build TypeScript and MCP UI widgets").opti
299
330
  console.log(chalk.gray("Building TypeScript..."));
300
331
  await runCommand("npx", ["tsc"], projectPath);
301
332
  console.log(chalk.green("\u2713 TypeScript build complete!"));
302
- const manifestPath = path.join(projectPath, "dist", ".mcp-use-manifest.json");
333
+ const manifestPath = path.join(
334
+ projectPath,
335
+ "dist",
336
+ ".mcp-use-manifest.json"
337
+ );
303
338
  const manifest = {
304
339
  includeInspector: options.withInspector || false,
305
340
  buildTime: (/* @__PURE__ */ new Date()).toISOString(),
306
341
  widgets: builtWidgets
307
342
  };
308
343
  await fs.mkdir(path.dirname(manifestPath), { recursive: true });
309
- await fs.writeFile(manifestPath, JSON.stringify(manifest, null, 2), "utf8");
344
+ await fs.writeFile(
345
+ manifestPath,
346
+ JSON.stringify(manifest, null, 2),
347
+ "utf8"
348
+ );
310
349
  console.log(chalk.green("\u2713 Build manifest created"));
311
350
  console.log(chalk.green.bold(`
312
351
  \u2713 Build complete!`));
@@ -344,7 +383,13 @@ program.command("dev").description("Run development server with auto-reload and
344
383
  if (mcpUrl) {
345
384
  env.MCP_URL = mcpUrl;
346
385
  }
347
- const serverCommand = runCommand("npx", ["tsx", "watch", serverFile], projectPath, env, true);
386
+ const serverCommand = runCommand(
387
+ "npx",
388
+ ["tsx", "watch", serverFile],
389
+ projectPath,
390
+ env,
391
+ true
392
+ );
348
393
  processes.push(serverCommand.process);
349
394
  if (options.open !== false) {
350
395
  const startTime = Date.now();
@@ -408,8 +453,10 @@ program.command("start").description("Start production server").option("-p, --pa
408
453
  try {
409
454
  const projectPath = path.resolve(options.path);
410
455
  const port = parseInt(options.port, 10);
411
- console.log(`\x1B[36m\x1B[1mmcp-use\x1B[0m \x1B[90mVersion: ${packageJson.version}\x1B[0m
412
- `);
456
+ console.log(
457
+ `\x1B[36m\x1B[1mmcp-use\x1B[0m \x1B[90mVersion: ${packageJson.version}\x1B[0m
458
+ `
459
+ );
413
460
  let mcpUrl;
414
461
  let tunnelProcess = void 0;
415
462
  if (options.tunnel) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-use/cli",
3
- "version": "2.1.22",
3
+ "version": "2.1.23-canary.1",
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.4.10",
48
- "mcp-use": "1.2.1"
47
+ "@mcp-use/inspector": "0.4.11-canary.1",
48
+ "mcp-use": "1.2.2-canary.1"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/node": "^20.0.0",