@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.
- package/dist/commands/deploy.d.ts +1 -0
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/index.cjs +68 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +68 -38
- package/dist/index.js.map +1 -1
- package/dist/utils/api.d.ts +2 -0
- package/dist/utils/api.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -3629,7 +3629,19 @@ async function deployCommand(options) {
|
|
|
3629
3629
|
}
|
|
3630
3630
|
}
|
|
3631
3631
|
console.log(source_default.cyan.bold("\u{1F680} Deploying to Manufact cloud...\n"));
|
|
3632
|
-
const
|
|
3632
|
+
const projectDir = options.rootDir ? path5.resolve(cwd, options.rootDir) : cwd;
|
|
3633
|
+
if (options.rootDir) {
|
|
3634
|
+
try {
|
|
3635
|
+
await fs9.access(projectDir);
|
|
3636
|
+
} catch {
|
|
3637
|
+
console.log(
|
|
3638
|
+
source_default.red(`\u2717 Root directory not found: ${options.rootDir}`)
|
|
3639
|
+
);
|
|
3640
|
+
process.exit(1);
|
|
3641
|
+
}
|
|
3642
|
+
console.log(source_default.gray(` Root dir: `) + source_default.cyan(options.rootDir));
|
|
3643
|
+
}
|
|
3644
|
+
const isMcp = await isMcpProject(projectDir);
|
|
3633
3645
|
if (!isMcp) {
|
|
3634
3646
|
console.log(
|
|
3635
3647
|
source_default.yellow(
|
|
@@ -3722,17 +3734,22 @@ async function deployCommand(options) {
|
|
|
3722
3734
|
console.log(source_default.gray("Deployment cancelled."));
|
|
3723
3735
|
process.exit(0);
|
|
3724
3736
|
}
|
|
3725
|
-
const projectName = options.name || await getProjectName(
|
|
3726
|
-
const runtime = options.runtime || await detectRuntime(
|
|
3737
|
+
const projectName = options.name || await getProjectName(projectDir);
|
|
3738
|
+
const runtime = options.runtime || await detectRuntime(projectDir);
|
|
3727
3739
|
const port = options.port || 3e3;
|
|
3728
|
-
const buildCommand = await detectBuildCommand(
|
|
3729
|
-
const startCommand = await detectStartCommand(
|
|
3740
|
+
const buildCommand = await detectBuildCommand(projectDir);
|
|
3741
|
+
const startCommand = await detectStartCommand(projectDir);
|
|
3730
3742
|
const envVars = await buildEnvVars(options);
|
|
3731
3743
|
console.log();
|
|
3732
3744
|
console.log(source_default.white("Deployment configuration:"));
|
|
3733
3745
|
console.log(source_default.gray(` Name: `) + source_default.cyan(projectName));
|
|
3734
3746
|
console.log(source_default.gray(` Runtime: `) + source_default.cyan(runtime));
|
|
3735
3747
|
console.log(source_default.gray(` Port: `) + source_default.cyan(port));
|
|
3748
|
+
if (options.rootDir) {
|
|
3749
|
+
console.log(
|
|
3750
|
+
source_default.gray(` Root dir: `) + source_default.cyan(options.rootDir)
|
|
3751
|
+
);
|
|
3752
|
+
}
|
|
3736
3753
|
if (buildCommand) {
|
|
3737
3754
|
console.log(source_default.gray(` Build command: `) + source_default.cyan(buildCommand));
|
|
3738
3755
|
}
|
|
@@ -3870,7 +3887,8 @@ async function deployCommand(options) {
|
|
|
3870
3887
|
buildCommand,
|
|
3871
3888
|
startCommand,
|
|
3872
3889
|
...options.port !== void 0 ? { port: options.port } : {},
|
|
3873
|
-
env: Object.keys(envVars).length > 0 ? envVars : void 0
|
|
3890
|
+
env: Object.keys(envVars).length > 0 ? envVars : void 0,
|
|
3891
|
+
rootDir: options.rootDir || void 0
|
|
3874
3892
|
};
|
|
3875
3893
|
const deployment2 = await api.redeployDeployment(
|
|
3876
3894
|
existingLink.deploymentId,
|
|
@@ -3914,6 +3932,7 @@ async function deployCommand(options) {
|
|
|
3914
3932
|
type: "github",
|
|
3915
3933
|
repo: `${gitInfo.owner}/${gitInfo.repo}`,
|
|
3916
3934
|
branch: gitInfo.branch || "main",
|
|
3935
|
+
rootDir: options.rootDir || void 0,
|
|
3917
3936
|
runtime,
|
|
3918
3937
|
port,
|
|
3919
3938
|
buildCommand,
|
|
@@ -4932,6 +4951,37 @@ async function findServerFile(projectPath) {
|
|
|
4932
4951
|
}
|
|
4933
4952
|
throw new Error("No server file found");
|
|
4934
4953
|
}
|
|
4954
|
+
async function generateToolRegistryTypesForServer(projectPath, serverFileRelative) {
|
|
4955
|
+
const serverFile = path7.join(projectPath, serverFileRelative);
|
|
4956
|
+
const serverFileExists = await access(serverFile).then(() => true).catch(() => false);
|
|
4957
|
+
if (!serverFileExists) {
|
|
4958
|
+
throw new Error(`Server file not found: ${serverFile}`);
|
|
4959
|
+
}
|
|
4960
|
+
const previousHmrMode = globalThis.__mcpUseHmrMode;
|
|
4961
|
+
try {
|
|
4962
|
+
globalThis.__mcpUseHmrMode = true;
|
|
4963
|
+
globalThis.__mcpUseLastServer = void 0;
|
|
4964
|
+
const { tsImport } = await import("tsx/esm/api");
|
|
4965
|
+
await tsImport(serverFile, {
|
|
4966
|
+
parentURL: import.meta.url,
|
|
4967
|
+
tsconfig: path7.join(projectPath, "tsconfig.json")
|
|
4968
|
+
});
|
|
4969
|
+
const server = globalThis.__mcpUseLastServer;
|
|
4970
|
+
if (!server) {
|
|
4971
|
+
throw new Error(
|
|
4972
|
+
"No MCPServer instance found. Make sure your server file creates an MCPServer instance."
|
|
4973
|
+
);
|
|
4974
|
+
}
|
|
4975
|
+
const mcpUsePath = path7.join(projectPath, "node_modules", "mcp-use");
|
|
4976
|
+
const { generateToolRegistryTypes } = await import(path7.join(mcpUsePath, "dist", "src", "server", "index.js")).then((mod) => mod);
|
|
4977
|
+
if (!generateToolRegistryTypes) {
|
|
4978
|
+
throw new Error("generateToolRegistryTypes not found in mcp-use package");
|
|
4979
|
+
}
|
|
4980
|
+
await generateToolRegistryTypes(server.registrations.tools, projectPath);
|
|
4981
|
+
} finally {
|
|
4982
|
+
globalThis.__mcpUseHmrMode = previousHmrMode ?? false;
|
|
4983
|
+
}
|
|
4984
|
+
}
|
|
4935
4985
|
async function buildWidgets(projectPath, options = {}) {
|
|
4936
4986
|
const { inline = true } = options;
|
|
4937
4987
|
const { promises: fs10 } = await import("fs");
|
|
@@ -5420,6 +5470,11 @@ program.command("build").description("Build TypeScript and MCP UI widgets").opti
|
|
|
5420
5470
|
sourceServerFile = await findServerFile(projectPath);
|
|
5421
5471
|
} catch {
|
|
5422
5472
|
}
|
|
5473
|
+
if (sourceServerFile) {
|
|
5474
|
+
console.log(source_default.gray("Generating tool registry types..."));
|
|
5475
|
+
await generateToolRegistryTypesForServer(projectPath, sourceServerFile);
|
|
5476
|
+
console.log(source_default.green("\u2713 Tool registry types generated"));
|
|
5477
|
+
}
|
|
5423
5478
|
console.log(source_default.gray("Building TypeScript..."));
|
|
5424
5479
|
await runCommand(
|
|
5425
5480
|
"node",
|
|
@@ -6172,7 +6227,10 @@ program.command("deploy").description("Deploy MCP server from GitHub to Manufact
|
|
|
6172
6227
|
).option(
|
|
6173
6228
|
"--env <key=value...>",
|
|
6174
6229
|
"Environment variables (can be used multiple times)"
|
|
6175
|
-
).option("--env-file <path>", "Path to .env file with environment variables").
|
|
6230
|
+
).option("--env-file <path>", "Path to .env file with environment variables").option(
|
|
6231
|
+
"--root-dir <path>",
|
|
6232
|
+
"Root directory within repo to deploy from (for monorepos)"
|
|
6233
|
+
).action(async (options) => {
|
|
6176
6234
|
await deployCommand({
|
|
6177
6235
|
open: options.open,
|
|
6178
6236
|
name: options.name,
|
|
@@ -6180,7 +6238,8 @@ program.command("deploy").description("Deploy MCP server from GitHub to Manufact
|
|
|
6180
6238
|
runtime: options.runtime,
|
|
6181
6239
|
new: options.new,
|
|
6182
6240
|
env: options.env,
|
|
6183
|
-
envFile: options.envFile
|
|
6241
|
+
envFile: options.envFile,
|
|
6242
|
+
rootDir: options.rootDir
|
|
6184
6243
|
});
|
|
6185
6244
|
});
|
|
6186
6245
|
program.addCommand(createClientCommand());
|
|
@@ -6190,36 +6249,9 @@ program.command("generate-types").description(
|
|
|
6190
6249
|
"Generate TypeScript type definitions for tools (writes .mcp-use/tool-registry.d.ts)"
|
|
6191
6250
|
).option("-p, --path <path>", "Path to project directory", process.cwd()).option("--server <file>", "Server entry file", "index.ts").action(async (options) => {
|
|
6192
6251
|
const projectPath = path7.resolve(options.path);
|
|
6193
|
-
const serverFile = path7.join(projectPath, options.server);
|
|
6194
6252
|
try {
|
|
6195
|
-
if (!await access(serverFile).then(() => true).catch(() => false)) {
|
|
6196
|
-
console.error(source_default.red(`Server file not found: ${serverFile}`));
|
|
6197
|
-
process.exit(1);
|
|
6198
|
-
}
|
|
6199
6253
|
console.log(source_default.blue("Generating tool registry types..."));
|
|
6200
|
-
|
|
6201
|
-
const { tsImport } = await import("tsx/esm/api");
|
|
6202
|
-
await tsImport(serverFile, {
|
|
6203
|
-
parentURL: import.meta.url,
|
|
6204
|
-
tsconfig: path7.join(projectPath, "tsconfig.json")
|
|
6205
|
-
});
|
|
6206
|
-
const server = globalThis.__mcpUseLastServer;
|
|
6207
|
-
if (!server) {
|
|
6208
|
-
console.error(
|
|
6209
|
-
source_default.red(
|
|
6210
|
-
"No MCPServer instance found. Make sure your server file creates an MCPServer instance."
|
|
6211
|
-
)
|
|
6212
|
-
);
|
|
6213
|
-
process.exit(1);
|
|
6214
|
-
}
|
|
6215
|
-
const mcpUsePath = path7.join(projectPath, "node_modules", "mcp-use");
|
|
6216
|
-
const { generateToolRegistryTypes } = await import(path7.join(mcpUsePath, "dist", "src", "server", "index.js")).then((mod) => mod);
|
|
6217
|
-
if (!generateToolRegistryTypes) {
|
|
6218
|
-
throw new Error(
|
|
6219
|
-
"generateToolRegistryTypes not found in mcp-use package"
|
|
6220
|
-
);
|
|
6221
|
-
}
|
|
6222
|
-
await generateToolRegistryTypes(server.registrations.tools, projectPath);
|
|
6254
|
+
await generateToolRegistryTypesForServer(projectPath, options.server);
|
|
6223
6255
|
console.log(source_default.green("\u2713 Tool registry types generated successfully"));
|
|
6224
6256
|
process.exit(0);
|
|
6225
6257
|
} catch (error) {
|
|
@@ -6231,8 +6263,6 @@ program.command("generate-types").description(
|
|
|
6231
6263
|
console.error(source_default.gray(error.stack));
|
|
6232
6264
|
}
|
|
6233
6265
|
process.exit(1);
|
|
6234
|
-
} finally {
|
|
6235
|
-
globalThis.__mcpUseHmrMode = false;
|
|
6236
6266
|
}
|
|
6237
6267
|
});
|
|
6238
6268
|
program.hook("preAction", async (_thisCommand, actionCommand) => {
|