@mcp-use/cli 3.5.2-canary.8 → 3.5.2
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 +1 -1
- package/dist/commands/client.d.ts.map +1 -1
- package/dist/commands/deploy.d.ts +2 -0
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/env.d.ts.map +1 -1
- package/dist/index.cjs +83 -67
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +83 -67
- 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 +4 -4
package/dist/index.js
CHANGED
|
@@ -1136,7 +1136,7 @@ import os3 from "os";
|
|
|
1136
1136
|
import path3 from "path";
|
|
1137
1137
|
var CONFIG_DIR = path3.join(os3.homedir(), ".mcp-use");
|
|
1138
1138
|
var CONFIG_FILE = path3.join(CONFIG_DIR, "config.json");
|
|
1139
|
-
var DEFAULT_API_URL = process.env.MCP_API_URL ? process.env.MCP_API_URL.replace(/\/api\/v1$/, "") + "/api/v1" : "https://cloud.
|
|
1139
|
+
var DEFAULT_API_URL = process.env.MCP_API_URL ? process.env.MCP_API_URL.replace(/\/api\/v1$/, "") + "/api/v1" : "https://cloud.manufact.com/api/v1";
|
|
1140
1140
|
var DEFAULT_WEB_URL = process.env.MCP_WEB_URL ? process.env.MCP_WEB_URL : "https://manufact.com";
|
|
1141
1141
|
async function ensureConfigDir() {
|
|
1142
1142
|
try {
|
|
@@ -4031,6 +4031,71 @@ async function describeToolCommand(name, toolName) {
|
|
|
4031
4031
|
}
|
|
4032
4032
|
await cleanupAndExit(0);
|
|
4033
4033
|
}
|
|
4034
|
+
async function processToolScreenshot(session, toolName, args, callResult, options) {
|
|
4035
|
+
const toolWithMeta = session.tools.find((t) => t.name === toolName);
|
|
4036
|
+
const resourceUri = detectToolResourceUri(toolWithMeta);
|
|
4037
|
+
const wantsScreenshot = options?.screenshot === true || options?.screenshotOutput !== void 0 || options?.screenshotDeviceScaleFactor !== void 0;
|
|
4038
|
+
let screenshot = null;
|
|
4039
|
+
let screenshotError = null;
|
|
4040
|
+
let widgetHintUri = null;
|
|
4041
|
+
if (resourceUri) {
|
|
4042
|
+
if (wantsScreenshot) {
|
|
4043
|
+
console.error(
|
|
4044
|
+
formatInfo(`Capturing widget screenshot (${resourceUri})...`)
|
|
4045
|
+
);
|
|
4046
|
+
try {
|
|
4047
|
+
const screenshotOpts = {};
|
|
4048
|
+
if (options?.screenshotOutput) {
|
|
4049
|
+
screenshotOpts.output = options.screenshotOutput;
|
|
4050
|
+
}
|
|
4051
|
+
if (options?.screenshotDeviceScaleFactor) {
|
|
4052
|
+
screenshotOpts.deviceScaleFactor = parseDeviceScaleFactor(
|
|
4053
|
+
options.screenshotDeviceScaleFactor
|
|
4054
|
+
);
|
|
4055
|
+
}
|
|
4056
|
+
const shot = await captureToolScreenshot(
|
|
4057
|
+
{
|
|
4058
|
+
session,
|
|
4059
|
+
toolName,
|
|
4060
|
+
toolArgs: args,
|
|
4061
|
+
toolOutput: callResult,
|
|
4062
|
+
resourceUri
|
|
4063
|
+
},
|
|
4064
|
+
screenshotOpts
|
|
4065
|
+
);
|
|
4066
|
+
screenshot = {
|
|
4067
|
+
path: shot.outputPath,
|
|
4068
|
+
width: shot.width,
|
|
4069
|
+
height: shot.height,
|
|
4070
|
+
view: shot.view
|
|
4071
|
+
};
|
|
4072
|
+
} catch (err) {
|
|
4073
|
+
screenshotError = err?.message ?? String(err);
|
|
4074
|
+
}
|
|
4075
|
+
} else {
|
|
4076
|
+
widgetHintUri = resourceUri;
|
|
4077
|
+
}
|
|
4078
|
+
}
|
|
4079
|
+
if (screenshot) {
|
|
4080
|
+
console.error(
|
|
4081
|
+
formatSuccess(
|
|
4082
|
+
`Saved widget screenshot: ${screenshot.path} (${screenshot.width}\xD7${screenshot.height})`
|
|
4083
|
+
)
|
|
4084
|
+
);
|
|
4085
|
+
}
|
|
4086
|
+
if (screenshotError) {
|
|
4087
|
+
console.error(
|
|
4088
|
+
formatWarning(`Skipped widget screenshot: ${screenshotError}`)
|
|
4089
|
+
);
|
|
4090
|
+
}
|
|
4091
|
+
if (widgetHintUri) {
|
|
4092
|
+
console.error(
|
|
4093
|
+
formatInfo(
|
|
4094
|
+
`This tool renders a widget (${widgetHintUri}). Re-run with --screenshot to save a PNG of it.`
|
|
4095
|
+
)
|
|
4096
|
+
);
|
|
4097
|
+
}
|
|
4098
|
+
}
|
|
4034
4099
|
async function callToolCommand(name, toolName, argsList, options) {
|
|
4035
4100
|
try {
|
|
4036
4101
|
const result = await getOrRestoreSession(name);
|
|
@@ -4080,74 +4145,12 @@ async function callToolCommand(name, toolName, argsList, options) {
|
|
|
4080
4145
|
const callResult = await session.callTool(toolName, args, {
|
|
4081
4146
|
timeout: options?.timeout
|
|
4082
4147
|
});
|
|
4083
|
-
|
|
4084
|
-
const resourceUri = detectToolResourceUri(toolWithMeta);
|
|
4085
|
-
const wantsScreenshot = options?.screenshot === true || options?.screenshotOutput !== void 0 || options?.screenshotDeviceScaleFactor !== void 0;
|
|
4086
|
-
let screenshot = null;
|
|
4087
|
-
let screenshotError = null;
|
|
4088
|
-
let widgetHintUri = null;
|
|
4089
|
-
if (resourceUri) {
|
|
4090
|
-
if (wantsScreenshot) {
|
|
4091
|
-
console.error(
|
|
4092
|
-
formatInfo(`Capturing widget screenshot (${resourceUri})...`)
|
|
4093
|
-
);
|
|
4094
|
-
try {
|
|
4095
|
-
const screenshotOpts = {};
|
|
4096
|
-
if (options?.screenshotOutput) {
|
|
4097
|
-
screenshotOpts.output = options.screenshotOutput;
|
|
4098
|
-
}
|
|
4099
|
-
if (options?.screenshotDeviceScaleFactor) {
|
|
4100
|
-
screenshotOpts.deviceScaleFactor = parseDeviceScaleFactor(
|
|
4101
|
-
options.screenshotDeviceScaleFactor
|
|
4102
|
-
);
|
|
4103
|
-
}
|
|
4104
|
-
const shot = await captureToolScreenshot(
|
|
4105
|
-
{
|
|
4106
|
-
session,
|
|
4107
|
-
toolName,
|
|
4108
|
-
toolArgs: args,
|
|
4109
|
-
toolOutput: callResult,
|
|
4110
|
-
resourceUri
|
|
4111
|
-
},
|
|
4112
|
-
screenshotOpts
|
|
4113
|
-
);
|
|
4114
|
-
screenshot = {
|
|
4115
|
-
path: shot.outputPath,
|
|
4116
|
-
width: shot.width,
|
|
4117
|
-
height: shot.height,
|
|
4118
|
-
view: shot.view
|
|
4119
|
-
};
|
|
4120
|
-
} catch (err) {
|
|
4121
|
-
screenshotError = err?.message ?? String(err);
|
|
4122
|
-
}
|
|
4123
|
-
} else {
|
|
4124
|
-
widgetHintUri = resourceUri;
|
|
4125
|
-
}
|
|
4126
|
-
}
|
|
4148
|
+
await processToolScreenshot(session, toolName, args, callResult, options);
|
|
4127
4149
|
if (options?.json) {
|
|
4128
4150
|
console.log(formatJson(callResult));
|
|
4129
4151
|
} else {
|
|
4130
4152
|
console.log(formatToolCall(callResult));
|
|
4131
4153
|
}
|
|
4132
|
-
if (screenshot) {
|
|
4133
|
-
console.error(
|
|
4134
|
-
formatSuccess(
|
|
4135
|
-
`Saved widget screenshot: ${screenshot.path} (${screenshot.width}\xD7${screenshot.height})`
|
|
4136
|
-
)
|
|
4137
|
-
);
|
|
4138
|
-
}
|
|
4139
|
-
if (screenshotError) {
|
|
4140
|
-
console.error(
|
|
4141
|
-
formatWarning(`Skipped widget screenshot: ${screenshotError}`)
|
|
4142
|
-
);
|
|
4143
|
-
}
|
|
4144
|
-
if (widgetHintUri) {
|
|
4145
|
-
console.error(
|
|
4146
|
-
formatInfo(
|
|
4147
|
-
`This tool renders a widget (${widgetHintUri}). Re-run with --screenshot to save a PNG of it.`
|
|
4148
|
-
)
|
|
4149
|
-
);
|
|
4150
|
-
}
|
|
4151
4154
|
if (callResult.isError) {
|
|
4152
4155
|
await cleanupAndExit(1);
|
|
4153
4156
|
}
|
|
@@ -4377,7 +4380,7 @@ async function interactiveCommand(name) {
|
|
|
4377
4380
|
console.log(source_default.gray(" tools list - List available tools"));
|
|
4378
4381
|
console.log(
|
|
4379
4382
|
source_default.gray(
|
|
4380
|
-
" tools call <name>
|
|
4383
|
+
" tools call <name> [--screenshot] - Call a tool (will prompt for args)"
|
|
4381
4384
|
)
|
|
4382
4385
|
);
|
|
4383
4386
|
console.log(source_default.gray(" tools describe <name> - Show tool details"));
|
|
@@ -4424,6 +4427,7 @@ async function interactiveCommand(name) {
|
|
|
4424
4427
|
)
|
|
4425
4428
|
);
|
|
4426
4429
|
} else if (command === "call" && arg) {
|
|
4430
|
+
const wantsScreenshot = parts.includes("--screenshot");
|
|
4427
4431
|
rl.question(
|
|
4428
4432
|
"Arguments (JSON, or press Enter for none): ",
|
|
4429
4433
|
async (argsInput) => {
|
|
@@ -4431,6 +4435,9 @@ async function interactiveCommand(name) {
|
|
|
4431
4435
|
const args = argsInput.trim() ? JSON.parse(argsInput) : {};
|
|
4432
4436
|
const result2 = await session.callTool(arg, args);
|
|
4433
4437
|
console.log(formatToolCall(result2));
|
|
4438
|
+
await processToolScreenshot(session, arg, args, result2, {
|
|
4439
|
+
screenshot: wantsScreenshot
|
|
4440
|
+
});
|
|
4434
4441
|
} catch (error) {
|
|
4435
4442
|
console.error(formatError(error.message));
|
|
4436
4443
|
}
|
|
@@ -5963,6 +5970,10 @@ async function deployCommand(options) {
|
|
|
5963
5970
|
console.log(source_default.gray(` Port: `) + source_default.cyan(port));
|
|
5964
5971
|
if (options.region)
|
|
5965
5972
|
console.log(source_default.gray(` Region: `) + source_default.cyan(options.region));
|
|
5973
|
+
if (options.dockerfile)
|
|
5974
|
+
console.log(
|
|
5975
|
+
source_default.gray(` Dockerfile: `) + source_default.cyan(options.dockerfile)
|
|
5976
|
+
);
|
|
5966
5977
|
if (options.buildCommand)
|
|
5967
5978
|
console.log(
|
|
5968
5979
|
source_default.gray(` Build command: `) + source_default.cyan(options.buildCommand)
|
|
@@ -6131,7 +6142,8 @@ async function deployCommand(options) {
|
|
|
6131
6142
|
env: Object.keys(envVars).length > 0 ? envVars : void 0,
|
|
6132
6143
|
region: options.region,
|
|
6133
6144
|
buildCommand: options.buildCommand,
|
|
6134
|
-
startCommand: options.startCommand
|
|
6145
|
+
startCommand: options.startCommand,
|
|
6146
|
+
dockerfilePath: options.dockerfile
|
|
6135
6147
|
});
|
|
6136
6148
|
deploymentId = serverResult.deploymentId ?? "";
|
|
6137
6149
|
if (!deploymentId) {
|
|
@@ -6814,7 +6826,7 @@ async function addEnvCommand(assignment, options) {
|
|
|
6814
6826
|
async function updateEnvCommand(keyOrId, options) {
|
|
6815
6827
|
try {
|
|
6816
6828
|
await requireLogin();
|
|
6817
|
-
if (
|
|
6829
|
+
if (options.value === void 0 && !options.env && options.sensitive === void 0) {
|
|
6818
6830
|
console.error(
|
|
6819
6831
|
source_default.red(
|
|
6820
6832
|
"\u2717 Nothing to update. Provide at least one of --value, --env, --sensitive."
|
|
@@ -9875,6 +9887,9 @@ program.command("deploy").description("Deploy MCP server from GitHub to Manufact
|
|
|
9875
9887
|
).option(
|
|
9876
9888
|
"--start-command <cmd>",
|
|
9877
9889
|
"Custom start command (overrides auto-detection)"
|
|
9890
|
+
).option(
|
|
9891
|
+
"--dockerfile <path>",
|
|
9892
|
+
"Path to a non-default Dockerfile (relative to rootDir / repo root)"
|
|
9878
9893
|
).option(
|
|
9879
9894
|
"--no-github",
|
|
9880
9895
|
"Upload local source without connecting GitHub (repo hosted in the platform-managed org)"
|
|
@@ -9894,6 +9909,7 @@ program.command("deploy").description("Deploy MCP server from GitHub to Manufact
|
|
|
9894
9909
|
region: options.region,
|
|
9895
9910
|
buildCommand: options.buildCommand,
|
|
9896
9911
|
startCommand: options.startCommand,
|
|
9912
|
+
dockerfile: options.dockerfile,
|
|
9897
9913
|
noGithub: options.github === false
|
|
9898
9914
|
});
|
|
9899
9915
|
});
|