@mcp-use/cli 3.2.0-canary.10 → 3.2.0-canary.11

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.
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/commands/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA+CpC;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,aAKtC,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,aAO5B,CAAC;AAEH,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,OAAO,EAAE;IACP,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GACA,OAAO,CAAC,IAAI,CAAC,CAmMf;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAenE;AAED,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA8DrE;AAED,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CA6CxD;AAED,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAC1B,OAAO,CAAC,IAAI,CAAC,CA0Df;AAED,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CAoCf;AAED,wBAAsB,eAAe,CACnC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,QAAQ,CAAC,EAAE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wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAuH5D"}
@@ -6,7 +6,6 @@ interface ScreenshotOptions {
6
6
  height: string;
7
7
  inspector?: string;
8
8
  mcp?: string;
9
- session?: string;
10
9
  theme: "light" | "dark";
11
10
  output?: string;
12
11
  waitFor?: string;
@@ -16,6 +15,10 @@ interface ScreenshotOptions {
16
15
  cdpUrl?: string;
17
16
  header?: string[];
18
17
  }
18
+ interface ScreenshotContext {
19
+ sessionName?: string;
20
+ usagePrefix: string;
21
+ }
19
22
  /**
20
23
  * Curl-style `Key: Value` parser. Splits on the first `:` so values may
21
24
  * contain colons, and trims both sides so `Authorization:Bearer xyz` and
@@ -74,7 +77,20 @@ export declare function captureToolScreenshot(inputs: CaptureToolScreenshotInput
74
77
  export declare function timestampSuffix(date?: Date): string;
75
78
  export declare function extractViewName(resourceUri: string): string;
76
79
  export declare function parseDimension(raw: string, name: string): number;
77
- export declare function screenshotCommand(options: ScreenshotOptions, argsList: string[] | undefined): Promise<void>;
78
- export declare function createScreenshotCommand(): Command;
80
+ export declare function screenshotCommand(options: ScreenshotOptions, argsList: string[] | undefined, context: ScreenshotContext): Promise<void>;
81
+ /**
82
+ * Top-level ad-hoc form: `mcp-use client screenshot --mcp <url> --tool <name>`.
83
+ *
84
+ * Doesn't take a saved-server positional. The MCP server is supplied inline
85
+ * via `--mcp`, and authenticated servers can be reached with repeatable
86
+ * `-H, --header` flags. This is the programmatic entry point for one-off or
87
+ * automated screenshot runs that don't want to first `mcp-use client connect`.
88
+ */
89
+ export declare function createClientScreenshotCommand(): Command;
90
+ /**
91
+ * Per-server form: `mcp-use client <name> screenshot --tool <name>`. The saved
92
+ * server's auth (OAuth or bearer) is reused — no `--mcp`/`--header` flags.
93
+ */
94
+ export declare function createPerClientScreenshotCommand(name: string): Command;
79
95
  export {};
80
96
  //# sourceMappingURL=screenshot.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"screenshot.d.ts","sourceRoot":"","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E"}
package/dist/index.cjs CHANGED
@@ -3260,9 +3260,9 @@ function parseDimension(raw, name) {
3260
3260
  return n;
3261
3261
  }
3262
3262
  var AD_HOC_SESSION_NAME = "__screenshot_ad_hoc__";
3263
- async function resolveSessionForScreenshot(options, headers) {
3264
- if (options.session) {
3265
- const result = await getOrRestoreSession(options.session);
3263
+ async function resolveSessionForScreenshot(options, sessionName, headers) {
3264
+ if (sessionName) {
3265
+ const result = await getOrRestoreSession(sessionName);
3266
3266
  return result?.session ?? null;
3267
3267
  }
3268
3268
  if (options.mcp) {
@@ -3284,12 +3284,12 @@ async function resolveSessionForScreenshot(options, headers) {
3284
3284
  }
3285
3285
  console.error(
3286
3286
  formatError(
3287
- "No MCP target. Pass --session <name> (a saved server) or --mcp <url> (ad-hoc)."
3287
+ "No MCP target. Pass --mcp <url> for an ad-hoc connection, or use `mcp-use client <name> screenshot` for a saved server."
3288
3288
  )
3289
3289
  );
3290
3290
  return null;
3291
3291
  }
3292
- async function screenshotCommand(options, argsList) {
3292
+ async function screenshotCommand(options, argsList, context) {
3293
3293
  let exitCode = 0;
3294
3294
  try {
3295
3295
  if (!options.tool) {
@@ -3306,7 +3306,7 @@ async function screenshotCommand(options, argsList) {
3306
3306
  if (!options.mcp) {
3307
3307
  console.error(
3308
3308
  formatError(
3309
- "--header is only supported with --mcp <url>. Saved sessions (use --session) carry their own auth from `mcp-use client connect`."
3309
+ "--header is only supported with --mcp <url>. Saved servers carry their own auth from `mcp-use client connect`."
3310
3310
  )
3311
3311
  );
3312
3312
  exitCode = 1;
@@ -3335,7 +3335,11 @@ async function screenshotCommand(options, argsList) {
3335
3335
  const height = parseDimension(options.height, "height");
3336
3336
  const navTimeout = parseInt(options.timeout, 10) || 3e4;
3337
3337
  const delayMs = options.delay ? parseInt(options.delay, 10) : 0;
3338
- const session = await resolveSessionForScreenshot(options, headers);
3338
+ const session = await resolveSessionForScreenshot(
3339
+ options,
3340
+ context.sessionName,
3341
+ headers
3342
+ );
3339
3343
  if (!session) {
3340
3344
  exitCode = 1;
3341
3345
  return;
@@ -3366,13 +3370,13 @@ async function screenshotCommand(options, argsList) {
3366
3370
  console.log("");
3367
3371
  console.log(formatInfo("Usage:"));
3368
3372
  console.log(
3369
- ` npx mcp-use screenshot --tool ${options.tool} key=value [key2=value2 ...]`
3373
+ ` npx ${context.usagePrefix} --tool ${options.tool} key=value [key2=value2 ...]`
3370
3374
  );
3371
3375
  console.log(
3372
- ` npx mcp-use screenshot --tool ${options.tool} nested:='{"a":1}' # JSON value`
3376
+ ` npx ${context.usagePrefix} --tool ${options.tool} nested:='{"a":1}' # JSON value`
3373
3377
  );
3374
3378
  console.log(
3375
- ` npx mcp-use screenshot --tool ${options.tool} '{"key":"value"}' # full JSON object`
3379
+ ` npx ${context.usagePrefix} --tool ${options.tool} '{"key":"value"}' # full JSON object`
3376
3380
  );
3377
3381
  if (tool.inputSchema) {
3378
3382
  console.log("");
@@ -3416,10 +3420,8 @@ async function screenshotCommand(options, argsList) {
3416
3420
  await cleanupAndExit(exitCode);
3417
3421
  }
3418
3422
  }
3419
- function createScreenshotCommand() {
3420
- return new import_commander.Command("screenshot").description(
3421
- "Render an MCP Apps view headlessly and save a PNG by calling a tool and rendering its UI resource with the result."
3422
- ).argument(
3423
+ function withCommonScreenshotOptions(cmd) {
3424
+ return cmd.argument(
3423
3425
  "[args...]",
3424
3426
  "Tool args as key=value pairs (use key:=<json> for nested values, or pass a single JSON object)."
3425
3427
  ).option(
@@ -3427,18 +3429,7 @@ function createScreenshotCommand() {
3427
3429
  "Tool to call. Its UI resource is rendered with the result."
3428
3430
  ).option("--width <px>", "Browser viewport width in pixels.", "800").option("--height <px>", "Browser viewport height in pixels.", "600").option(
3429
3431
  "--inspector <url>",
3430
- "Inspector host that serves /inspector/preview/:view. When omitted, probes localhost:3000 then auto-spawns `mcp-use dev`."
3431
- ).option(
3432
- "--session <name>",
3433
- "Saved server name (from `mcp-use client connect <name> <url>`)."
3434
- ).option(
3435
- "--mcp <url>",
3436
- "Ad-hoc MCP server URL (escape hatch). Use when you don't have a saved server. No authentication unless --header is supplied."
3437
- ).option(
3438
- "-H, --header <header>",
3439
- 'HTTP header to send to the --mcp <url> server, formatted "Key: Value". Repeatable. Use to pass an Authorization bearer token or other auth headers when screenshotting an authenticated MCP server.',
3440
- collectHeader,
3441
- []
3432
+ "Inspector host that serves /inspector/preview/:view. When omitted, auto-spawns `@mcp-use/inspector` on a free port."
3442
3433
  ).option(
3443
3434
  "--theme <light|dark>",
3444
3435
  "Color scheme to render the view in.",
@@ -3456,9 +3447,42 @@ function createScreenshotCommand() {
3456
3447
  ).option("--timeout <ms>", "Navigation + readiness timeout in ms.", "30000").option(
3457
3448
  "--cdp-url <url>",
3458
3449
  "Connect to an existing CDP WebSocket (ws:// or wss://) instead of spawning local Chrome. Useful for hosted browsers like Notte."
3459
- ).option("--quiet", "Suppress dev-server output.").action(async (args, opts) => {
3460
- await screenshotCommand(opts, args);
3450
+ ).option("--quiet", "Suppress dev-server output.");
3451
+ }
3452
+ function createClientScreenshotCommand() {
3453
+ const cmd = withCommonScreenshotOptions(
3454
+ new import_commander.Command("screenshot").description(
3455
+ "Render an MCP Apps view headlessly and save a PNG. Connects to an MCP server inline via --mcp; for a saved server, use `mcp-use client <name> screenshot`."
3456
+ )
3457
+ ).option(
3458
+ "--mcp <url>",
3459
+ "Ad-hoc MCP server URL. Required for the top-level form. No authentication unless --header is supplied."
3460
+ ).option(
3461
+ "-H, --header <header>",
3462
+ 'HTTP header to send to the --mcp <url> server, formatted "Key: Value". Repeatable. Use to pass an Authorization bearer token or other auth headers when screenshotting an authenticated MCP server.',
3463
+ collectHeader,
3464
+ []
3465
+ );
3466
+ cmd.action(async (args, opts) => {
3467
+ await screenshotCommand(opts, args, {
3468
+ usagePrefix: "mcp-use client screenshot"
3469
+ });
3461
3470
  });
3471
+ return cmd;
3472
+ }
3473
+ function createPerClientScreenshotCommand(name) {
3474
+ const cmd = withCommonScreenshotOptions(
3475
+ new import_commander.Command("screenshot").description(
3476
+ `Render an MCP Apps view headlessly using the saved server '${name}'.`
3477
+ )
3478
+ );
3479
+ cmd.action(async (args, opts) => {
3480
+ await screenshotCommand(opts, args, {
3481
+ sessionName: name,
3482
+ usagePrefix: `mcp-use client ${name} screenshot`
3483
+ });
3484
+ });
3485
+ return cmd;
3462
3486
  }
3463
3487
 
3464
3488
  // src/commands/client.ts
@@ -3466,6 +3490,7 @@ var RESERVED_CLIENT_SUBCOMMANDS = /* @__PURE__ */ new Set([
3466
3490
  "connect",
3467
3491
  "list",
3468
3492
  "remove",
3493
+ "screenshot",
3469
3494
  "help"
3470
3495
  ]);
3471
3496
  var PER_CLIENT_SCOPES = /* @__PURE__ */ new Set([
@@ -3474,7 +3499,8 @@ var PER_CLIENT_SCOPES = /* @__PURE__ */ new Set([
3474
3499
  "prompts",
3475
3500
  "auth",
3476
3501
  "disconnect",
3477
- "interactive"
3502
+ "interactive",
3503
+ "screenshot"
3478
3504
  ]);
3479
3505
  async function connectCommand(name, urlOrCommand, options) {
3480
3506
  if (!name || !urlOrCommand) {
@@ -4312,6 +4338,7 @@ function createClientCommand() {
4312
4338
  clientCommand.command("remove <name>").description(
4313
4339
  "Remove a saved server. Also clears any OAuth tokens for that URL, unless another saved server still uses it."
4314
4340
  ).action(removeClientCommand);
4341
+ clientCommand.addCommand(createClientScreenshotCommand());
4315
4342
  return clientCommand;
4316
4343
  }
4317
4344
  function createPerClientCommand(name) {
@@ -4362,6 +4389,7 @@ function createPerClientCommand(name) {
4362
4389
  authCommand.command("refresh").description("Force-refresh the OAuth access token").action(() => authRefreshCommand(name));
4363
4390
  authCommand.command("logout").description("Remove stored OAuth tokens for this server's URL").action(() => authLogoutCommand(name));
4364
4391
  cmd.addCommand(authCommand);
4392
+ cmd.addCommand(createPerClientScreenshotCommand(name));
4365
4393
  return cmd;
4366
4394
  }
4367
4395
 
@@ -9223,7 +9251,6 @@ program.addCommand(createClientCommand());
9223
9251
  program.addCommand(createDeploymentsCommand());
9224
9252
  program.addCommand(createServersCommand());
9225
9253
  program.addCommand(createSkillsCommand());
9226
- program.addCommand(createScreenshotCommand());
9227
9254
  program.command("generate-types").description(
9228
9255
  "Generate TypeScript type definitions for tools (writes .mcp-use/tool-registry.d.ts)"
9229
9256
  ).option("-p, --path <path>", "Path to project directory", process.cwd()).option("--server <file>", "Server entry file", "index.ts").action(async (options) => {