@mcp-use/cli 2.17.1-canary.1 → 2.18.0-canary.3

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.
@@ -6,6 +6,7 @@ interface DeployOptions {
6
6
  new?: boolean;
7
7
  env?: string[];
8
8
  envFile?: string;
9
+ rootDir?: string;
9
10
  }
10
11
  /**
11
12
  * Deploy command - deploys MCP server to Manufact cloud
@@ -1 +1 @@
1
- {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AA6KA,UAAU,aAAa;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC5B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAulBD;;GAEG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAibzE"}
1
+ {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AA6KA,UAAU,aAAa;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC5B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAulBD;;GAEG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAyczE"}
package/dist/index.cjs CHANGED
@@ -3647,7 +3647,19 @@ async function deployCommand(options) {
3647
3647
  }
3648
3648
  }
3649
3649
  console.log(source_default.cyan.bold("\u{1F680} Deploying to Manufact cloud...\n"));
3650
- const isMcp = await isMcpProject(cwd);
3650
+ const projectDir = options.rootDir ? import_node_path5.default.resolve(cwd, options.rootDir) : cwd;
3651
+ if (options.rootDir) {
3652
+ try {
3653
+ await import_node_fs7.promises.access(projectDir);
3654
+ } catch {
3655
+ console.log(
3656
+ source_default.red(`\u2717 Root directory not found: ${options.rootDir}`)
3657
+ );
3658
+ process.exit(1);
3659
+ }
3660
+ console.log(source_default.gray(` Root dir: `) + source_default.cyan(options.rootDir));
3661
+ }
3662
+ const isMcp = await isMcpProject(projectDir);
3651
3663
  if (!isMcp) {
3652
3664
  console.log(
3653
3665
  source_default.yellow(
@@ -3740,17 +3752,22 @@ async function deployCommand(options) {
3740
3752
  console.log(source_default.gray("Deployment cancelled."));
3741
3753
  process.exit(0);
3742
3754
  }
3743
- const projectName = options.name || await getProjectName(cwd);
3744
- const runtime = options.runtime || await detectRuntime(cwd);
3755
+ const projectName = options.name || await getProjectName(projectDir);
3756
+ const runtime = options.runtime || await detectRuntime(projectDir);
3745
3757
  const port = options.port || 3e3;
3746
- const buildCommand = await detectBuildCommand(cwd);
3747
- const startCommand = await detectStartCommand(cwd);
3758
+ const buildCommand = await detectBuildCommand(projectDir);
3759
+ const startCommand = await detectStartCommand(projectDir);
3748
3760
  const envVars = await buildEnvVars(options);
3749
3761
  console.log();
3750
3762
  console.log(source_default.white("Deployment configuration:"));
3751
3763
  console.log(source_default.gray(` Name: `) + source_default.cyan(projectName));
3752
3764
  console.log(source_default.gray(` Runtime: `) + source_default.cyan(runtime));
3753
3765
  console.log(source_default.gray(` Port: `) + source_default.cyan(port));
3766
+ if (options.rootDir) {
3767
+ console.log(
3768
+ source_default.gray(` Root dir: `) + source_default.cyan(options.rootDir)
3769
+ );
3770
+ }
3754
3771
  if (buildCommand) {
3755
3772
  console.log(source_default.gray(` Build command: `) + source_default.cyan(buildCommand));
3756
3773
  }
@@ -3888,7 +3905,8 @@ async function deployCommand(options) {
3888
3905
  buildCommand,
3889
3906
  startCommand,
3890
3907
  ...options.port !== void 0 ? { port: options.port } : {},
3891
- env: Object.keys(envVars).length > 0 ? envVars : void 0
3908
+ env: Object.keys(envVars).length > 0 ? envVars : void 0,
3909
+ rootDir: options.rootDir || void 0
3892
3910
  };
3893
3911
  const deployment2 = await api.redeployDeployment(
3894
3912
  existingLink.deploymentId,
@@ -3932,6 +3950,7 @@ async function deployCommand(options) {
3932
3950
  type: "github",
3933
3951
  repo: `${gitInfo.owner}/${gitInfo.repo}`,
3934
3952
  branch: gitInfo.branch || "main",
3953
+ rootDir: options.rootDir || void 0,
3935
3954
  runtime,
3936
3955
  port,
3937
3956
  buildCommand,
@@ -4950,6 +4969,37 @@ async function findServerFile(projectPath) {
4950
4969
  }
4951
4970
  throw new Error("No server file found");
4952
4971
  }
4972
+ async function generateToolRegistryTypesForServer(projectPath, serverFileRelative) {
4973
+ const serverFile = import_node_path8.default.join(projectPath, serverFileRelative);
4974
+ const serverFileExists = await (0, import_promises7.access)(serverFile).then(() => true).catch(() => false);
4975
+ if (!serverFileExists) {
4976
+ throw new Error(`Server file not found: ${serverFile}`);
4977
+ }
4978
+ const previousHmrMode = globalThis.__mcpUseHmrMode;
4979
+ try {
4980
+ globalThis.__mcpUseHmrMode = true;
4981
+ globalThis.__mcpUseLastServer = void 0;
4982
+ const { tsImport } = await import("tsx/esm/api");
4983
+ await tsImport(serverFile, {
4984
+ parentURL: importMetaUrl,
4985
+ tsconfig: import_node_path8.default.join(projectPath, "tsconfig.json")
4986
+ });
4987
+ const server = globalThis.__mcpUseLastServer;
4988
+ if (!server) {
4989
+ throw new Error(
4990
+ "No MCPServer instance found. Make sure your server file creates an MCPServer instance."
4991
+ );
4992
+ }
4993
+ const mcpUsePath = import_node_path8.default.join(projectPath, "node_modules", "mcp-use");
4994
+ const { generateToolRegistryTypes } = await import(import_node_path8.default.join(mcpUsePath, "dist", "src", "server", "index.js")).then((mod) => mod);
4995
+ if (!generateToolRegistryTypes) {
4996
+ throw new Error("generateToolRegistryTypes not found in mcp-use package");
4997
+ }
4998
+ await generateToolRegistryTypes(server.registrations.tools, projectPath);
4999
+ } finally {
5000
+ globalThis.__mcpUseHmrMode = previousHmrMode ?? false;
5001
+ }
5002
+ }
4953
5003
  async function buildWidgets(projectPath, options = {}) {
4954
5004
  const { inline = true } = options;
4955
5005
  const { promises: fs10 } = await import("fs");
@@ -5438,6 +5488,11 @@ program.command("build").description("Build TypeScript and MCP UI widgets").opti
5438
5488
  sourceServerFile = await findServerFile(projectPath);
5439
5489
  } catch {
5440
5490
  }
5491
+ if (sourceServerFile) {
5492
+ console.log(source_default.gray("Generating tool registry types..."));
5493
+ await generateToolRegistryTypesForServer(projectPath, sourceServerFile);
5494
+ console.log(source_default.green("\u2713 Tool registry types generated"));
5495
+ }
5441
5496
  console.log(source_default.gray("Building TypeScript..."));
5442
5497
  await runCommand(
5443
5498
  "node",
@@ -6190,7 +6245,10 @@ program.command("deploy").description("Deploy MCP server from GitHub to Manufact
6190
6245
  ).option(
6191
6246
  "--env <key=value...>",
6192
6247
  "Environment variables (can be used multiple times)"
6193
- ).option("--env-file <path>", "Path to .env file with environment variables").action(async (options) => {
6248
+ ).option("--env-file <path>", "Path to .env file with environment variables").option(
6249
+ "--root-dir <path>",
6250
+ "Root directory within repo to deploy from (for monorepos)"
6251
+ ).action(async (options) => {
6194
6252
  await deployCommand({
6195
6253
  open: options.open,
6196
6254
  name: options.name,
@@ -6198,7 +6256,8 @@ program.command("deploy").description("Deploy MCP server from GitHub to Manufact
6198
6256
  runtime: options.runtime,
6199
6257
  new: options.new,
6200
6258
  env: options.env,
6201
- envFile: options.envFile
6259
+ envFile: options.envFile,
6260
+ rootDir: options.rootDir
6202
6261
  });
6203
6262
  });
6204
6263
  program.addCommand(createClientCommand());
@@ -6208,36 +6267,9 @@ program.command("generate-types").description(
6208
6267
  "Generate TypeScript type definitions for tools (writes .mcp-use/tool-registry.d.ts)"
6209
6268
  ).option("-p, --path <path>", "Path to project directory", process.cwd()).option("--server <file>", "Server entry file", "index.ts").action(async (options) => {
6210
6269
  const projectPath = import_node_path8.default.resolve(options.path);
6211
- const serverFile = import_node_path8.default.join(projectPath, options.server);
6212
6270
  try {
6213
- if (!await (0, import_promises7.access)(serverFile).then(() => true).catch(() => false)) {
6214
- console.error(source_default.red(`Server file not found: ${serverFile}`));
6215
- process.exit(1);
6216
- }
6217
6271
  console.log(source_default.blue("Generating tool registry types..."));
6218
- globalThis.__mcpUseHmrMode = true;
6219
- const { tsImport } = await import("tsx/esm/api");
6220
- await tsImport(serverFile, {
6221
- parentURL: importMetaUrl,
6222
- tsconfig: import_node_path8.default.join(projectPath, "tsconfig.json")
6223
- });
6224
- const server = globalThis.__mcpUseLastServer;
6225
- if (!server) {
6226
- console.error(
6227
- source_default.red(
6228
- "No MCPServer instance found. Make sure your server file creates an MCPServer instance."
6229
- )
6230
- );
6231
- process.exit(1);
6232
- }
6233
- const mcpUsePath = import_node_path8.default.join(projectPath, "node_modules", "mcp-use");
6234
- const { generateToolRegistryTypes } = await import(import_node_path8.default.join(mcpUsePath, "dist", "src", "server", "index.js")).then((mod) => mod);
6235
- if (!generateToolRegistryTypes) {
6236
- throw new Error(
6237
- "generateToolRegistryTypes not found in mcp-use package"
6238
- );
6239
- }
6240
- await generateToolRegistryTypes(server.registrations.tools, projectPath);
6272
+ await generateToolRegistryTypesForServer(projectPath, options.server);
6241
6273
  console.log(source_default.green("\u2713 Tool registry types generated successfully"));
6242
6274
  process.exit(0);
6243
6275
  } catch (error) {
@@ -6249,8 +6281,6 @@ program.command("generate-types").description(
6249
6281
  console.error(source_default.gray(error.stack));
6250
6282
  }
6251
6283
  process.exit(1);
6252
- } finally {
6253
- globalThis.__mcpUseHmrMode = false;
6254
6284
  }
6255
6285
  });
6256
6286
  program.hook("preAction", async (_thisCommand, actionCommand) => {