@mcpjam/cli 3.19.0 → 3.20.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.js CHANGED
@@ -2,14 +2,14 @@
2
2
  import { Command, CommanderError } from 'commander';
3
3
  import { realpathSync, mkdirSync, writeFileSync, readFileSync, existsSync, statSync, closeSync, renameSync, openSync } from 'fs';
4
4
  import { pathToFileURL } from 'url';
5
- import { probeMcpServer, redactSensitiveValue, runServerDoctor, collectServerSnapshot, serializeStableServerSnapshot, serializeServerSnapshot, buildServerDiffReport, classifyMcpHeader, validateToolCallResult, isCallToolResultError, buildToolCallValidationReport, listResources, readResource, SubscriptionCoordinator, listTools, listPrompts, getPrompt, MCPAppsConformanceTest, scoreFromAppsResult, MCPAppsConformanceSuite, MCPTasksConformanceTest, scoreFromTasksResult, runOAuthLogin, OAuthConformanceTest, scoreFromOAuthResult, OAuthConformanceSuite, runXaaFlow, MCPConformanceTest, scoreFromProtocolResult, MCPConformanceSuite, withEphemeralClient, diffServerSnapshots, ServerSnapshotFormatError, renderStructuredRunJUnitXml, renderStructuredRunJson, DEFAULT_SUBSCRIPTION_RECONNECT_POLICY, isKnownProtocolVersion, describeConformanceScore, toConformanceReport, renderConformanceReportJUnitXml, renderConformanceReportJson, formatOAuthConformanceHuman, formatOAuthConformanceSuiteHuman, fetchOAuthMetadata, executeOAuthProxy, executeDebugOAuthProxy, normalizeRegistrationStrategy, normalizeXaaClientAuth, normalizeIdentityAssertionFormat, IDENTITY_ASSERTION_FORMATS, XAA_CONFIDENTIAL_CIMD_ORIGIN, getLocalConfidentialCimdProvider, MCP_PROTOCOL_VERSIONS, generateRandomString, generateCodeChallenge, createInteractiveAuthorizationSession, openUrlInBrowser, MCPClientManager, decodeMcpHeaderValue, canDeclareTasksExtension, createStrictElicitationContentValidator, MCP_APPS_CHECK_CATEGORIES, MCP_APPS_CHECK_IDS, MCP_TASKS_CHECK_CATEGORIES, MCP_TASKS_CHECK_IDS, OAuthProxyError, isLoopbackHost, MCP_CHECK_CATEGORIES, MCP_CHECK_IDS, TaskLifecycleEngine, driveTaskToTerminal, extensionTaskToObservation, legacyTaskToObservation, isUnknownTaskError, isMCPTasksWireError, LEGACY_TASK_STATUSES } from '@mcpjam/sdk';
5
+ import { probeMcpServer, redactForTelemetry, runServerDoctor, collectServerSnapshot, serializeStableServerSnapshot, serializeServerSnapshot, buildServerDiffReport, classifyMcpHeader, validateToolCallResult, isCallToolResultError, buildToolCallValidationReport, listResources, readResource, SubscriptionCoordinator, listTools, listPrompts, getPrompt, MCPAppsConformanceTest, scoreFromAppsResult, MCPAppsConformanceSuite, MCPTasksConformanceTest, scoreFromTasksResult, runOAuthLogin, OAuthConformanceTest, scoreFromOAuthResult, OAuthConformanceSuite, runXaaFlow, MCPConformanceTest, scoreFromProtocolResult, MCPConformanceSuite, withEphemeralClient, diffServerSnapshots, ServerSnapshotFormatError, renderStructuredRunJUnitXml, renderStructuredRunJson, DEFAULT_SUBSCRIPTION_RECONNECT_POLICY, isKnownProtocolVersion, describeConformanceScore, toConformanceReport, renderConformanceReportJUnitXml, renderConformanceReportJson, formatOAuthConformanceHuman, formatOAuthConformanceSuiteHuman, fetchOAuthMetadata, executeOAuthProxy, executeDebugOAuthProxy, normalizeRegistrationStrategy, normalizeXaaClientAuth, normalizeIdentityAssertionFormat, IDENTITY_ASSERTION_FORMATS, XAA_CONFIDENTIAL_CIMD_ORIGIN, getLocalConfidentialCimdProvider, MCP_PROTOCOL_VERSIONS, generateRandomString, generateCodeChallenge, createInteractiveAuthorizationSession, openUrlInBrowser, MCPClientManager, decodeMcpHeaderValue, canDeclareTasksExtension, createStrictElicitationContentValidator, MCP_APPS_CHECK_CATEGORIES, MCP_APPS_CHECK_IDS, MCP_TASKS_CHECK_CATEGORIES, MCP_TASKS_CHECK_IDS, OAuthProxyError, isLoopbackHost, MCP_CHECK_CATEGORIES, MCP_CHECK_IDS, TaskLifecycleEngine, driveTaskToTerminal, extensionTaskToObservation, legacyTaskToObservation, isUnknownTaskError, isMCPTasksWireError, LEGACY_TASK_STATUSES } from '@mcpjam/sdk';
6
6
  import { mkdir, writeFile, readFile, chmod, rename, rm } from 'fs/promises';
7
7
  import path2, { dirname, join, basename } from 'path';
8
8
  import { randomUUID } from 'crypto';
9
9
  import { spawn } from 'child_process';
10
10
  import { createRequire } from 'module';
11
11
  import os, { homedir } from 'os';
12
- import { cancelEvalRunOperation, listEvalRunIterationsOperation, getEvalIterationTraceOperation, getEvalRunStepsOperation, getEvalSuiteOperation, updateEvalSuiteOperation, deleteEvalSuiteOperation, setEvalSuiteScheduleOperation, setEvalSuiteEnvironmentsOperation, listEvalCasesOperation, getEvalCaseOperation, runEvalCaseOperation, createEvalCaseOperation, updateEvalCaseOperation, deleteEvalCaseOperation, generateEvalCasesOperation, createHostOperation, updateHostOperation, createEnvironmentOperation, updateEnvironmentOperation, createImageOperation, validateImageBlueprintOperation, updateImageOperation, createTunnelOperation, DEFAULT_PLATFORM_API_BASE_URL, PlatformApiClient, isPlatformApiError, PlatformApiError, listProjectsOperation, listProjectServersOperation, showServersOperation, createEvalSuiteOperation, listEvalSuitesOperation, runEvalSuiteOperation, getEvalRunOperation, listHostsOperation, getHostOperation, deleteHostOperation, listEnvironmentsOperation, getEnvironmentOperation, resolveEnvironmentOperation, archiveEnvironmentOperation, restoreEnvironmentOperation, listImagesOperation, getImageOperation, buildImageOperation, listImageBuildsOperation, useImageOperation, resetComputerOperation, promoteImageOperation, deleteImageOperation } from '@mcpjam/sdk/platform';
12
+ import { createProjectOperation, updateProjectOperation, deleteProjectOperation, listEvalSuiteRunsOperation, cancelEvalRunOperation, listEvalRunIterationsOperation, getEvalIterationTraceOperation, getEvalRunStepsOperation, getEvalSuiteOperation, updateEvalSuiteOperation, deleteEvalSuiteOperation, setEvalSuiteScheduleOperation, setEvalSuiteEnvironmentsOperation, listEvalCasesOperation, getEvalCaseOperation, runEvalCaseOperation, createEvalCaseOperation, updateEvalCaseOperation, deleteEvalCaseOperation, generateEvalCasesOperation, listChatboxesOperation, getChatboxOperation, listChatSessionsOperation, createHostOperation, updateHostOperation, setHostServersOperation, duplicateHostOperation, createEnvironmentOperation, updateEnvironmentOperation, createImageOperation, validateImageBlueprintOperation, updateImageOperation, createTunnelOperation, DEFAULT_PLATFORM_API_BASE_URL, PlatformApiClient, isPlatformApiError, PlatformApiError, listProjectsOperation, listProjectServersOperation, createProjectServerOperation, getProjectServerOperation, updateProjectServerOperation, deleteProjectServerOperation, showServersOperation, createEvalSuiteOperation, listEvalSuitesOperation, runEvalSuiteOperation, getEvalRunOperation, listHostsOperation, getHostOperation, deleteHostOperation, listEnvironmentsOperation, getEnvironmentOperation, resolveEnvironmentOperation, archiveEnvironmentOperation, restoreEnvironmentOperation, listJourneysOperation, listJourneyRunsOperation, getJourneyRunOperation, launchJourneyRunOperation, cancelJourneyRunOperation, listJourneyRunSessionsOperation, publishScenarioOperation, unpublishScenarioOperation, listImagesOperation, getImageOperation, buildImageOperation, listImageBuildsOperation, useImageOperation, resetComputerOperation, promoteImageOperation, deleteImageOperation } from '@mcpjam/sdk/platform';
13
13
  import { buildHostProfilesFromCatalog, buildMarketHostProfiles, scanWidgetUsage, evaluateMarketHosts, fetchHostCompatCatalog } from '@mcpjam/sdk/host-compat';
14
14
  import { HOST_TEMPLATES as HOST_TEMPLATES$1, HOST_TEMPLATE_IDS, seedHostTemplate } from '@mcpjam/sdk/host-config/templates';
15
15
  import { applyVisibilityPolicyAndCountSignals, isAppOnlyTool, extractHostExecutionPolicy, hostConnectionProfile } from '@mcpjam/sdk/host-config/internal';
@@ -25,7 +25,7 @@ import { WebSocket } from 'ws';
25
25
 
26
26
  // package.json
27
27
  var package_default = {
28
- version: "3.19.0"};
28
+ version: "3.20.1"};
29
29
  function conformanceExitCode(result) {
30
30
  if (result.outcome === "incomplete") return 3;
31
31
  if (result.outcome === "failed") return 1;
@@ -532,7 +532,7 @@ function getCliRpcLogEvents(collectors) {
532
532
  function redactCliRpcLogs(logs) {
533
533
  return logs.map((event) => ({
534
534
  ...event,
535
- message: redactSensitiveValue(event.message)
535
+ message: redactForTelemetry(event.message)
536
536
  }));
537
537
  }
538
538
 
@@ -642,7 +642,7 @@ function assertNoCredentialsFileAuthConflicts(options) {
642
642
  );
643
643
  }
644
644
  function redactCredentialsFromResult(result, credentialsFilePath) {
645
- const redacted = redactSensitiveValue(result);
645
+ const redacted = redactForTelemetry(result);
646
646
  const credentials = result.credentials ?? {};
647
647
  const hasCredentials = Object.keys(credentials).length > 0;
648
648
  const secretMarker = credentialsFilePath ? "[SAVED_TO_FILE]" : "[REDACTED]";
@@ -2259,7 +2259,7 @@ function buildDebugArtifactEnvelope(options) {
2259
2259
  if (rpcLogs.length > 0) {
2260
2260
  payload._rpcLogs = rpcLogs;
2261
2261
  }
2262
- return redactSensitiveValue(payload);
2262
+ return redactForTelemetry(payload);
2263
2263
  }
2264
2264
  function buildCommandArtifactError(code, message, details) {
2265
2265
  return {
@@ -2282,7 +2282,7 @@ async function writeBinaryArtifact(outputPath, data) {
2282
2282
  }
2283
2283
  async function writeDebugArtifact(outputPath, payload) {
2284
2284
  const resolvedPath = path2.resolve(process.cwd(), outputPath);
2285
- const redactedPayload = redactSensitiveValue(payload);
2285
+ const redactedPayload = redactForTelemetry(payload);
2286
2286
  try {
2287
2287
  await mkdir(path2.dirname(resolvedPath), { recursive: true });
2288
2288
  await writeFile(
@@ -3148,6 +3148,7 @@ async function clearStoredAuth(filePath) {
3148
3148
  }
3149
3149
 
3150
3150
  // src/lib/platform-auth.ts
3151
+ var DEFAULT_PLATFORM_ORIGIN = "https://app.mcpjam.com";
3151
3152
  var LEGACY_API_KEY_PREFIX = "mcpjam_";
3152
3153
  var TOKEN_REFRESH_SKEW_MS = 6e4;
3153
3154
  var DEFAULT_LOGIN_TIMEOUT_MS = 5 * 6e4;
@@ -3394,14 +3395,22 @@ function buildPlatformClient(options, deps = {}) {
3394
3395
  const stored = readStoredAuth(deps.authFilePath ?? getAuthFilePath({ env }));
3395
3396
  baseUrl = stored?.apiUrl;
3396
3397
  }
3398
+ const resolvedBaseUrl = baseUrl ?? DEFAULT_PLATFORM_API_BASE_URL;
3397
3399
  const client = new PlatformApiClient({
3398
- baseUrl: baseUrl ?? DEFAULT_PLATFORM_API_BASE_URL,
3400
+ baseUrl: resolvedBaseUrl,
3399
3401
  getAuth: credential.getAuth,
3400
3402
  ...deps.fetchFn ? { fetch: deps.fetchFn } : {},
3401
3403
  ...options.timeoutMs !== void 0 ? { timeoutMs: options.timeoutMs } : {},
3402
3404
  userAgent: `mcpjam-cli/${package_default.version}`
3403
3405
  });
3404
- return { client, credentialKind: credential.kind };
3406
+ return { client, credentialKind: credential.kind, baseUrl: resolvedBaseUrl };
3407
+ }
3408
+ function webOriginForApiBaseUrl(baseUrl) {
3409
+ try {
3410
+ return new URL(baseUrl).origin;
3411
+ } catch {
3412
+ return DEFAULT_PLATFORM_ORIGIN;
3413
+ }
3405
3414
  }
3406
3415
  function toCliError(error) {
3407
3416
  if (error instanceof CliError) {
@@ -4524,6 +4533,106 @@ async function runPlatformCommand2(options, timeoutMs, execute) {
4524
4533
  clearTimeout(timeoutHandle);
4525
4534
  }
4526
4535
  }
4536
+ function validateOpInput(op, raw) {
4537
+ const parsed = op.inputSchema.safeParse(raw);
4538
+ if (!parsed.success) {
4539
+ const detail = parsed.error.issues.map((issue) => `${issue.path.join(".") || "(root)"}: ${issue.message}`).join("; ");
4540
+ const error = new Error(`Invalid input: ${detail}`);
4541
+ error.exitCode = 2;
4542
+ throw error;
4543
+ }
4544
+ return parsed.data;
4545
+ }
4546
+ async function executeOp(op, input, options, command) {
4547
+ const globalOptions = getGlobalOptions(command);
4548
+ const result = await runPlatformCommand2(
4549
+ options,
4550
+ globalOptions.timeout,
4551
+ ({ client, signal }) => op.execute(input, { client, signal })
4552
+ );
4553
+ writeResult(result, globalOptions.format);
4554
+ }
4555
+ function registerChatCommands(program) {
4556
+ const chatboxes = program.command("chatboxes").description("Inspect the chatboxes published from a hosted project");
4557
+ addPlatformOptions2(
4558
+ chatboxes.command("list").description("List the chatboxes published from a project").option(
4559
+ "--project <id-or-name>",
4560
+ "Project name or ID (defaults to the most recently updated project)"
4561
+ )
4562
+ ).action(async (options, command) => {
4563
+ const input = validateOpInput(listChatboxesOperation, {
4564
+ ...options.project === void 0 ? {} : { project: options.project }
4565
+ });
4566
+ await executeOp(listChatboxesOperation, input, options, command);
4567
+ });
4568
+ addPlatformOptions2(
4569
+ chatboxes.command("get").description(
4570
+ "Show one chatbox: access mode, attached servers, share link"
4571
+ ).requiredOption("--chatbox <id-or-name>", "Chatbox name or ID").option(
4572
+ "--project <id-or-name>",
4573
+ "Project name or ID (defaults to the most recently updated project)"
4574
+ )
4575
+ ).action(
4576
+ async (options, command) => {
4577
+ const input = validateOpInput(getChatboxOperation, {
4578
+ chatbox: options.chatbox,
4579
+ ...options.project === void 0 ? {} : { project: options.project }
4580
+ });
4581
+ await executeOp(getChatboxOperation, input, options, command);
4582
+ }
4583
+ );
4584
+ const sessions = program.command("chat-sessions").description("Inspect saved chat sessions");
4585
+ addPlatformOptions2(
4586
+ sessions.command("list").description(
4587
+ "List chat sessions, newest first (all accessible projects unless --project is given)"
4588
+ ).option("--project <id-or-name>", "Restrict to one project").option("--status <status>", "Filter by session status").option(
4589
+ "--limit <n>",
4590
+ "Maximum sessions to return (1-200)",
4591
+ (value) => Number.parseInt(value, 10)
4592
+ )
4593
+ ).action(
4594
+ async (options, command) => {
4595
+ const input = validateOpInput(listChatSessionsOperation, {
4596
+ ...options.project === void 0 ? {} : { project: options.project },
4597
+ ...options.status === void 0 ? {} : { status: options.status },
4598
+ ...options.limit === void 0 ? {} : { limit: options.limit }
4599
+ });
4600
+ await executeOp(listChatSessionsOperation, input, options, command);
4601
+ }
4602
+ );
4603
+ }
4604
+ function addPlatformOptions3(command) {
4605
+ return command.option("--api-key <key>", "MCPJam sk_ API key (overrides MCPJAM_API_KEY)").option(
4606
+ "--api-url <url>",
4607
+ "MCPJam API base URL (defaults to https://app.mcpjam.com/api/v1)"
4608
+ );
4609
+ }
4610
+ async function runPlatformCommand3(options, timeoutMs, execute) {
4611
+ const controller = new AbortController();
4612
+ const timeoutHandle = setTimeout(() => {
4613
+ controller.abort(
4614
+ new PlatformApiError(
4615
+ `Request timed out after ${timeoutMs}ms`,
4616
+ "TIMEOUT",
4617
+ {
4618
+ status: 0
4619
+ }
4620
+ )
4621
+ );
4622
+ }, timeoutMs);
4623
+ timeoutHandle.unref?.();
4624
+ try {
4625
+ const { client } = buildPlatformClient({ ...options, timeoutMs });
4626
+ return await execute({ client, signal: controller.signal });
4627
+ } catch (error) {
4628
+ if (controller.signal.aborted && controller.signal.reason instanceof PlatformApiError) {
4629
+ throw toCliError(controller.signal.reason);
4630
+ }
4631
+ throw toCliError(error);
4632
+ } finally {
4633
+ clearTimeout(timeoutHandle);
4634
+ }
4635
+ }
4527
4636
  function validateInput2(op, raw) {
4528
4637
  const parsed = op.inputSchema.safeParse(raw);
4529
4638
  if (!parsed.success) {
@@ -4577,7 +4686,7 @@ function registerEnvironmentsCommands(program) {
4577
4686
  const environments = program.command("environments").description(
4578
4687
  "List, create, and manage the project environments (host + servers + pinned skills/plugins) in your hosted MCPJam projects"
4579
4688
  );
4580
- addPlatformOptions2(
4689
+ addPlatformOptions3(
4581
4690
  environments.command("list").description("List the project environments in a project").option(
4582
4691
  "--project <id-or-name>",
4583
4692
  "Project name or ID (defaults to the most recently updated project)"
@@ -4588,7 +4697,7 @@ function registerEnvironmentsCommands(program) {
4588
4697
  ).action(
4589
4698
  async (options, command) => {
4590
4699
  const globalOptions = getGlobalOptions(command);
4591
- const result = await runPlatformCommand2(
4700
+ const result = await runPlatformCommand3(
4592
4701
  options,
4593
4702
  globalOptions.timeout,
4594
4703
  ({ client, signal }) => listEnvironmentsOperation.execute(
@@ -4602,14 +4711,14 @@ function registerEnvironmentsCommands(program) {
4602
4711
  writeResult(result, globalOptions.format);
4603
4712
  }
4604
4713
  );
4605
- addPlatformOptions2(
4714
+ addPlatformOptions3(
4606
4715
  environments.command("get").description(
4607
4716
  "Show one environment's settings and its current revision (pass that revision to update/archive/restore)"
4608
4717
  ).requiredOption("--environment <id-or-name>", "Environment name or ID").option("--project <id-or-name>", "Project name or ID")
4609
4718
  ).action(
4610
4719
  async (options, command) => {
4611
4720
  const globalOptions = getGlobalOptions(command);
4612
- const result = await runPlatformCommand2(
4721
+ const result = await runPlatformCommand3(
4613
4722
  options,
4614
4723
  globalOptions.timeout,
4615
4724
  ({ client, signal }) => getEnvironmentOperation.execute(
@@ -4620,14 +4729,14 @@ function registerEnvironmentsCommands(program) {
4620
4729
  writeResult(result, globalOptions.format);
4621
4730
  }
4622
4731
  );
4623
- addPlatformOptions2(
4732
+ addPlatformOptions3(
4624
4733
  environments.command("resolve").description(
4625
4734
  "Preview what an environment resolves to right now: host config, closed server set, and pinned plugin versions"
4626
4735
  ).requiredOption("--environment <id-or-name>", "Environment name or ID").option("--project <id-or-name>", "Project name or ID")
4627
4736
  ).action(
4628
4737
  async (options, command) => {
4629
4738
  const globalOptions = getGlobalOptions(command);
4630
- const result = await runPlatformCommand2(
4739
+ const result = await runPlatformCommand3(
4631
4740
  options,
4632
4741
  globalOptions.timeout,
4633
4742
  ({ client, signal }) => resolveEnvironmentOperation.execute(
@@ -4638,7 +4747,7 @@ function registerEnvironmentsCommands(program) {
4638
4747
  writeResult(result, globalOptions.format);
4639
4748
  }
4640
4749
  );
4641
- addPlatformOptions2(
4750
+ addPlatformOptions3(
4642
4751
  environments.command("create").description(
4643
4752
  "Create a project environment (requires project admin). Body fields may be supplied via --file/--json"
4644
4753
  ).option("--project <id-or-name>", "Project name or ID").option("--name <name>", "Display name for the new environment").option("--host-id <id>", "ID of the host this environment runs against").option("--description <text>", "Optional description").option(
@@ -4660,7 +4769,7 @@ function registerEnvironmentsCommands(program) {
4660
4769
  ...options.description !== void 0 ? { description: options.description } : {},
4661
4770
  ...options.sandboxImage !== void 0 ? { sandboxImageId: options.sandboxImage } : {}
4662
4771
  });
4663
- const result = await runPlatformCommand2(
4772
+ const result = await runPlatformCommand3(
4664
4773
  options,
4665
4774
  globalOptions.timeout,
4666
4775
  ({ client, signal }) => createEnvironmentOperation.execute(input, { client, signal })
@@ -4668,7 +4777,7 @@ function registerEnvironmentsCommands(program) {
4668
4777
  writeResult(result, globalOptions.format);
4669
4778
  }
4670
4779
  );
4671
- addPlatformOptions2(
4780
+ addPlatformOptions3(
4672
4781
  environments.command("update").description(
4673
4782
  "Edit an environment. Only the fields you pass change; use --file/--json with a null value to clear serverAttachmentId, skillSelection, pluginVersionIds, or sandboxImageId"
4674
4783
  ).requiredOption("--environment <id-or-name>", "Environment name or ID").requiredOption(
@@ -4698,7 +4807,7 @@ function registerEnvironmentsCommands(program) {
4698
4807
  ...options.description !== void 0 ? { description: options.description } : {},
4699
4808
  ...options.sandboxImage !== void 0 ? { sandboxImageId: options.sandboxImage } : {}
4700
4809
  });
4701
- const result = await runPlatformCommand2(
4810
+ const result = await runPlatformCommand3(
4702
4811
  options,
4703
4812
  globalOptions.timeout,
4704
4813
  ({ client, signal }) => updateEnvironmentOperation.execute(input, { client, signal })
@@ -4706,7 +4815,7 @@ function registerEnvironmentsCommands(program) {
4706
4815
  writeResult(result, globalOptions.format);
4707
4816
  }
4708
4817
  );
4709
- addPlatformOptions2(
4818
+ addPlatformOptions3(
4710
4819
  environments.command("archive").description(
4711
4820
  "Archive an environment (reversible; frees its name for a new one)"
4712
4821
  ).requiredOption("--environment <id-or-name>", "Environment name or ID").requiredOption(
@@ -4716,7 +4825,7 @@ function registerEnvironmentsCommands(program) {
4716
4825
  ).action(
4717
4826
  async (options, command) => {
4718
4827
  const globalOptions = getGlobalOptions(command);
4719
- const result = await runPlatformCommand2(
4828
+ const result = await runPlatformCommand3(
4720
4829
  options,
4721
4830
  globalOptions.timeout,
4722
4831
  ({ client, signal }) => archiveEnvironmentOperation.execute(
@@ -4731,7 +4840,7 @@ function registerEnvironmentsCommands(program) {
4731
4840
  writeResult(result, globalOptions.format);
4732
4841
  }
4733
4842
  );
4734
- addPlatformOptions2(
4843
+ addPlatformOptions3(
4735
4844
  environments.command("restore").description(
4736
4845
  "Restore an archived environment. Plugin pins whose version no longer exists are dropped \u2014 check the returned pluginVersionIds"
4737
4846
  ).requiredOption("--environment <id-or-name>", "Environment name or ID").requiredOption(
@@ -4741,7 +4850,7 @@ function registerEnvironmentsCommands(program) {
4741
4850
  ).action(
4742
4851
  async (options, command) => {
4743
4852
  const globalOptions = getGlobalOptions(command);
4744
- const result = await runPlatformCommand2(
4853
+ const result = await runPlatformCommand3(
4745
4854
  options,
4746
4855
  globalOptions.timeout,
4747
4856
  ({ client, signal }) => restoreEnvironmentOperation.execute(
@@ -4757,6 +4866,276 @@ function registerEnvironmentsCommands(program) {
4757
4866
  }
4758
4867
  );
4759
4868
  }
4869
+ function addPlatformOptions4(command) {
4870
+ return command.option("--api-key <key>", "MCPJam sk_ API key (overrides MCPJAM_API_KEY)").option(
4871
+ "--api-url <url>",
4872
+ "MCPJam API base URL (defaults to https://app.mcpjam.com/api/v1)"
4873
+ );
4874
+ }
4875
+ async function runPlatformCommand4(options, timeoutMs, execute) {
4876
+ const controller = new AbortController();
4877
+ const timeoutHandle = setTimeout(() => {
4878
+ controller.abort(
4879
+ new PlatformApiError(
4880
+ `Request timed out after ${timeoutMs}ms`,
4881
+ "TIMEOUT",
4882
+ {
4883
+ status: 0
4884
+ }
4885
+ )
4886
+ );
4887
+ }, timeoutMs);
4888
+ timeoutHandle.unref?.();
4889
+ try {
4890
+ const { client } = buildPlatformClient({ ...options, timeoutMs });
4891
+ return await execute({ client, signal: controller.signal });
4892
+ } catch (error) {
4893
+ if (controller.signal.aborted && controller.signal.reason instanceof PlatformApiError) {
4894
+ throw toCliError(controller.signal.reason);
4895
+ }
4896
+ throw toCliError(error);
4897
+ } finally {
4898
+ clearTimeout(timeoutHandle);
4899
+ }
4900
+ }
4901
+ function collectRepeatable(value, previous) {
4902
+ return [...previous, value];
4903
+ }
4904
+ var LIMIT_MIN = 1;
4905
+ var LIMIT_MAX = 200;
4906
+ function pageArgs(options) {
4907
+ let limit;
4908
+ if (options.limit !== void 0) {
4909
+ limit = Number(options.limit);
4910
+ if (!Number.isInteger(limit) || limit < LIMIT_MIN || limit > LIMIT_MAX) {
4911
+ throw usageError(
4912
+ `--limit must be a whole number between ${LIMIT_MIN} and ${LIMIT_MAX} (got "${options.limit}")`
4913
+ );
4914
+ }
4915
+ }
4916
+ return {
4917
+ ...options.cursor !== void 0 ? { cursor: options.cursor } : {},
4918
+ ...limit !== void 0 ? { limit } : {}
4919
+ };
4920
+ }
4921
+ function addPageOptions(command) {
4922
+ return command.option("--cursor <cursor>", "Page cursor from a previous response").option("--limit <n>", "Items per page (1-200)");
4923
+ }
4924
+ function registerJourneysCommands(program) {
4925
+ const journeys = program.command("journeys").description(
4926
+ "List journeys and inspect their runs (the Swarms product) in your hosted MCPJam projects"
4927
+ );
4928
+ addPlatformOptions4(
4929
+ journeys.command("list").description("List the journeys in a project").option(
4930
+ "--project <id-or-name>",
4931
+ "Project name or ID (defaults to the most recently updated project)"
4932
+ )
4933
+ ).action(async (options, command) => {
4934
+ const globalOptions = getGlobalOptions(command);
4935
+ const result = await runPlatformCommand4(
4936
+ options,
4937
+ globalOptions.timeout,
4938
+ ({ client, signal }) => listJourneysOperation.execute(
4939
+ { project: options.project },
4940
+ { client, signal }
4941
+ )
4942
+ );
4943
+ writeResult(result, globalOptions.format);
4944
+ });
4945
+ addPlatformOptions4(
4946
+ addPageOptions(
4947
+ journeys.command("runs").description("List a journey's runs, newest first").requiredOption("--journey <id>", "Journey ID (from `journeys list`)").option("--project <id-or-name>", "Project name or ID")
4948
+ )
4949
+ ).action(
4950
+ async (options, command) => {
4951
+ const globalOptions = getGlobalOptions(command);
4952
+ const result = await runPlatformCommand4(
4953
+ options,
4954
+ globalOptions.timeout,
4955
+ ({ client, signal }) => listJourneyRunsOperation.execute(
4956
+ {
4957
+ project: options.project,
4958
+ journey: options.journey,
4959
+ ...pageArgs(options)
4960
+ },
4961
+ { client, signal }
4962
+ )
4963
+ );
4964
+ writeResult(result, globalOptions.format);
4965
+ }
4966
+ );
4967
+ addPlatformOptions4(
4968
+ journeys.command("status").description(
4969
+ "Show one run's status, target rollups, and per-session attempts. Poll this after launching; `status` leaves 'running' once every attempt has settled. A run someone stopped reports 'failed' with canceled: true."
4970
+ ).requiredOption("--run <id>", "Journey run ID").option("--project <id-or-name>", "Project name or ID")
4971
+ ).action(
4972
+ async (options, command) => {
4973
+ const globalOptions = getGlobalOptions(command);
4974
+ const result = await runPlatformCommand4(
4975
+ options,
4976
+ globalOptions.timeout,
4977
+ ({ client, signal }) => getJourneyRunOperation.execute(
4978
+ { project: options.project, run: options.run },
4979
+ { client, signal }
4980
+ )
4981
+ );
4982
+ writeResult(result, globalOptions.format);
4983
+ }
4984
+ );
4985
+ addPlatformOptions4(
4986
+ journeys.command("run").description(
4987
+ "Launch a journey. Returns as soon as the run exists \u2014 poll `journeys status` for progress."
4988
+ ).requiredOption("--journey <id>", "Journey ID to launch").option("--project <id-or-name>", "Project name or ID").option(
4989
+ "--idempotency-key <key>",
4990
+ "Retry key. Pass one: a launch spends model credits, so a retry after a dropped response must not run the journey twice. Replaying a key returns the original run."
4991
+ ).option(
4992
+ "--wave <id>",
4993
+ "Opaque id linking the sibling runs of one co-launched batch"
4994
+ ).option(
4995
+ "--environment <id>",
4996
+ "Fan out across this project environment instead of the journey's authored targets (repeatable)",
4997
+ collectRepeatable,
4998
+ []
4999
+ )
5000
+ ).action(
5001
+ async (options, command) => {
5002
+ const globalOptions = getGlobalOptions(command);
5003
+ const result = await runPlatformCommand4(
5004
+ options,
5005
+ globalOptions.timeout,
5006
+ ({ client, signal }) => launchJourneyRunOperation.execute(
5007
+ {
5008
+ project: options.project,
5009
+ journey: options.journey,
5010
+ ...options.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : {},
5011
+ ...options.wave ? { waveId: options.wave } : {},
5012
+ ...options.environment?.length ? { environmentIds: options.environment } : {}
5013
+ },
5014
+ { client, signal }
5015
+ )
5016
+ );
5017
+ writeResult(result, globalOptions.format);
5018
+ }
5019
+ );
5020
+ addPlatformOptions4(
5021
+ journeys.command("cancel").description(
5022
+ "Stop a running journey run. Idempotent \u2014 cancelling an already-cancelled run succeeds; a run that finished on its own conflicts instead."
5023
+ ).requiredOption("--run <id>", "Journey run ID").option("--project <id-or-name>", "Project name or ID")
5024
+ ).action(
5025
+ async (options, command) => {
5026
+ const globalOptions = getGlobalOptions(command);
5027
+ const result = await runPlatformCommand4(
5028
+ options,
5029
+ globalOptions.timeout,
5030
+ ({ client, signal }) => cancelJourneyRunOperation.execute(
5031
+ { project: options.project, run: options.run },
5032
+ { client, signal }
5033
+ )
5034
+ );
5035
+ writeResult(result, globalOptions.format);
5036
+ }
5037
+ );
5038
+ addPlatformOptions4(
5039
+ addPageOptions(
5040
+ journeys.command("sessions").description(
5041
+ "List the chat sessions a run produced, with readiness and goal scores"
5042
+ ).requiredOption("--run <id>", "Journey run ID").option("--project <id-or-name>", "Project name or ID")
5043
+ )
5044
+ ).action(
5045
+ async (options, command) => {
5046
+ const globalOptions = getGlobalOptions(command);
5047
+ const result = await runPlatformCommand4(
5048
+ options,
5049
+ globalOptions.timeout,
5050
+ ({ client, signal }) => listJourneyRunSessionsOperation.execute(
5051
+ {
5052
+ project: options.project,
5053
+ run: options.run,
5054
+ ...pageArgs(options)
5055
+ },
5056
+ { client, signal }
5057
+ )
5058
+ );
5059
+ writeResult(result, globalOptions.format);
5060
+ }
5061
+ );
5062
+ }
5063
+ function addPlatformOptions5(command) {
5064
+ return command.option("--api-key <key>", "MCPJam sk_ API key (overrides MCPJAM_API_KEY)").option(
5065
+ "--api-url <url>",
5066
+ "MCPJam API base URL (defaults to https://app.mcpjam.com/api/v1)"
5067
+ );
5068
+ }
5069
+ async function runPlatformCommand5(options, timeoutMs, execute) {
5070
+ const controller = new AbortController();
5071
+ const timeoutHandle = setTimeout(() => {
5072
+ controller.abort(
5073
+ new PlatformApiError(
5074
+ `Request timed out after ${timeoutMs}ms`,
5075
+ "TIMEOUT",
5076
+ {
5077
+ status: 0
5078
+ }
5079
+ )
5080
+ );
5081
+ }, timeoutMs);
5082
+ timeoutHandle.unref?.();
5083
+ try {
5084
+ const { client } = buildPlatformClient({ ...options, timeoutMs });
5085
+ return await execute({ client, signal: controller.signal });
5086
+ } catch (error) {
5087
+ if (controller.signal.aborted && controller.signal.reason instanceof PlatformApiError) {
5088
+ throw toCliError(controller.signal.reason);
5089
+ }
5090
+ throw toCliError(error);
5091
+ } finally {
5092
+ clearTimeout(timeoutHandle);
5093
+ }
5094
+ }
5095
+ function registerScenariosCommands(program) {
5096
+ const scenarios = program.command("scenarios").description(
5097
+ "Publish project environments for user testing, and take them down again"
5098
+ );
5099
+ addPlatformOptions5(
5100
+ scenarios.command("publish").description(
5101
+ "Publish an environment as a scenario and print its share link. Idempotent \u2014 re-publishing returns the existing scenario, with created: false."
5102
+ ).requiredOption("--environment <id>", "Project environment ID").option(
5103
+ "--project <id-or-name>",
5104
+ "Project name or ID (defaults to the most recently updated project)"
5105
+ )
5106
+ ).action(
5107
+ async (options, command) => {
5108
+ const globalOptions = getGlobalOptions(command);
5109
+ const result = await runPlatformCommand5(
5110
+ options,
5111
+ globalOptions.timeout,
5112
+ ({ client, signal }) => publishScenarioOperation.execute(
5113
+ { project: options.project, environment: options.environment },
5114
+ { client, signal }
5115
+ )
5116
+ );
5117
+ writeResult(result, globalOptions.format);
5118
+ }
5119
+ );
5120
+ addPlatformOptions5(
5121
+ scenarios.command("unpublish").description(
5122
+ "Take an environment's scenario down, invalidating its share link and any live guest sessions. Idempotent."
5123
+ ).requiredOption("--environment <id>", "Project environment ID").option("--project <id-or-name>", "Project name or ID")
5124
+ ).action(
5125
+ async (options, command) => {
5126
+ const globalOptions = getGlobalOptions(command);
5127
+ const result = await runPlatformCommand5(
5128
+ options,
5129
+ globalOptions.timeout,
5130
+ ({ client, signal }) => unpublishScenarioOperation.execute(
5131
+ { project: options.project, environment: options.environment },
5132
+ { client, signal }
5133
+ )
5134
+ );
5135
+ writeResult(result, globalOptions.format);
5136
+ }
5137
+ );
5138
+ }
4760
5139
 
4761
5140
  // src/lib/eval-screenshots.ts
4762
5141
  function asRecord(value) {
@@ -4868,13 +5247,26 @@ function encodeInlineImage(data, protocol) {
4868
5247
  }
4869
5248
 
4870
5249
  // src/commands/eval.ts
4871
- function addPlatformOptions3(command) {
5250
+ function addPlatformOptions6(command) {
4872
5251
  return command.option("--api-key <key>", "MCPJam sk_ API key (overrides MCPJAM_API_KEY)").option(
4873
5252
  "--api-url <url>",
4874
5253
  "MCPJam API base URL (defaults to https://app.mcpjam.com/api/v1)"
4875
5254
  );
4876
5255
  }
4877
- async function runPlatformCommand3(options, timeoutMs, execute) {
5256
+ function writeRunLink(format, webOrigin, run) {
5257
+ if (format !== "human") return;
5258
+ const suiteId = run.suiteId?.trim();
5259
+ const runId = run.runId?.trim();
5260
+ if (!suiteId || !runId) return;
5261
+ const query = run.projectId?.trim() ? `?project=${encodeURIComponent(run.projectId.trim())}` : "";
5262
+ process.stdout.write(
5263
+ `View: ${webOrigin}/evals/suite/${encodeURIComponent(
5264
+ suiteId
5265
+ )}/runs/${encodeURIComponent(runId)}${query}
5266
+ `
5267
+ );
5268
+ }
5269
+ async function runPlatformCommand6(options, timeoutMs, execute) {
4878
5270
  const controller = new AbortController();
4879
5271
  const timeoutHandle = setTimeout(() => {
4880
5272
  controller.abort(
@@ -4889,8 +5281,12 @@ async function runPlatformCommand3(options, timeoutMs, execute) {
4889
5281
  }, timeoutMs);
4890
5282
  timeoutHandle.unref?.();
4891
5283
  try {
4892
- const { client } = buildPlatformClient({ ...options, timeoutMs });
4893
- return await execute({ client, signal: controller.signal });
5284
+ const { client, baseUrl } = buildPlatformClient({ ...options, timeoutMs });
5285
+ return await execute({
5286
+ client,
5287
+ signal: controller.signal,
5288
+ webOrigin: webOriginForApiBaseUrl(baseUrl)
5289
+ });
4894
5290
  } catch (error) {
4895
5291
  if (controller.signal.aborted && controller.signal.reason instanceof PlatformApiError) {
4896
5292
  throw toCliError(controller.signal.reason);
@@ -4974,7 +5370,7 @@ function loadBodyObject(options) {
4974
5370
  }
4975
5371
  return base;
4976
5372
  }
4977
- function validateOpInput(op, raw) {
5373
+ function validateOpInput2(op, raw) {
4978
5374
  const parsed = op.inputSchema.safeParse(raw);
4979
5375
  if (!parsed.success) {
4980
5376
  const detail = parsed.error.issues.map((issue) => `${issue.path.join(".") || "(root)"}: ${issue.message}`).join("; ");
@@ -4982,9 +5378,9 @@ function validateOpInput(op, raw) {
4982
5378
  }
4983
5379
  return parsed.data;
4984
5380
  }
4985
- async function executeOp(op, input, options, command) {
5381
+ async function executeOp2(op, input, options, command) {
4986
5382
  const globalOptions = getGlobalOptions(command);
4987
- const result = await runPlatformCommand3(
5383
+ const result = await runPlatformCommand6(
4988
5384
  options,
4989
5385
  globalOptions.timeout,
4990
5386
  ({ client, signal }) => op.execute(input, { client, signal })
@@ -5084,7 +5480,7 @@ function resolveScreenshotPath(out, shot, index, total) {
5084
5480
  }
5085
5481
  function registerEvalCommands(program) {
5086
5482
  const evals = program.command("eval").description("Author and run eval suites in your hosted MCPJam projects");
5087
- addPlatformOptions3(
5483
+ addPlatformOptions6(
5088
5484
  evals.command("create").description(
5089
5485
  "Create a runnable eval suite from authored test cases (does not run it)"
5090
5486
  ).option(
@@ -5109,21 +5505,21 @@ function registerEvalCommands(program) {
5109
5505
  ).action(async (options, command) => {
5110
5506
  const globalOptions = getGlobalOptions(command);
5111
5507
  const input = loadSuiteDefinition(options);
5112
- const result = await runPlatformCommand3(
5508
+ const result = await runPlatformCommand6(
5113
5509
  options,
5114
5510
  globalOptions.timeout,
5115
5511
  ({ client, signal }) => createEvalSuiteOperation.execute(input, { client, signal })
5116
5512
  );
5117
5513
  writeResult(result, globalOptions.format);
5118
5514
  });
5119
- addPlatformOptions3(
5515
+ addPlatformOptions6(
5120
5516
  evals.command("list").description("List the eval suites saved in a project").option(
5121
5517
  "--project <id-or-name>",
5122
5518
  "Project name or ID (defaults to the most recently updated project)"
5123
5519
  )
5124
5520
  ).action(async (options, command) => {
5125
5521
  const globalOptions = getGlobalOptions(command);
5126
- const result = await runPlatformCommand3(
5522
+ const result = await runPlatformCommand6(
5127
5523
  options,
5128
5524
  globalOptions.timeout,
5129
5525
  ({ client, signal }) => listEvalSuitesOperation.execute(
@@ -5133,7 +5529,26 @@ function registerEvalCommands(program) {
5133
5529
  );
5134
5530
  writeResult(result, globalOptions.format);
5135
5531
  });
5136
- addPlatformOptions3(
5532
+ addPlatformOptions6(
5533
+ evals.command("runs").description("List a suite's run history, newest first").requiredOption("--suite <id-or-name>", "Eval suite name or ID").option(
5534
+ "--project <id-or-name>",
5535
+ "Project name or ID (defaults to the most recently updated project)"
5536
+ ).option(
5537
+ "--limit <n>",
5538
+ "Maximum number of runs to return (1-100)",
5539
+ (value) => Number.parseInt(value, 10)
5540
+ )
5541
+ ).action(
5542
+ async (options, command) => {
5543
+ const input = validateOpInput2(listEvalSuiteRunsOperation, {
5544
+ suite: options.suite,
5545
+ ...options.project === void 0 ? {} : { project: options.project },
5546
+ ...options.limit === void 0 ? {} : { limit: options.limit }
5547
+ });
5548
+ await executeOp2(listEvalSuiteRunsOperation, input, options, command);
5549
+ }
5550
+ );
5551
+ addPlatformOptions6(
5137
5552
  evals.command("run").description("Start an eval run of an existing suite (asynchronous)").requiredOption("--suite <id-or-name>", "Eval suite name or ID").option(
5138
5553
  "--project <id-or-name>",
5139
5554
  "Project name or ID (defaults to the most recently updated project)"
@@ -5147,45 +5562,63 @@ function registerEvalCommands(program) {
5147
5562
  ).action(
5148
5563
  async (options, command) => {
5149
5564
  const globalOptions = getGlobalOptions(command);
5150
- const result = await runPlatformCommand3(
5565
+ let webOrigin = DEFAULT_PLATFORM_ORIGIN;
5566
+ const result = await runPlatformCommand6(
5151
5567
  options,
5152
5568
  globalOptions.timeout,
5153
- ({ client, signal }) => runEvalSuiteOperation.execute(
5154
- {
5155
- project: options.project,
5156
- suite: options.suite,
5157
- ...options.server ? { servers: options.server } : {},
5158
- ...options.environment ? { environment: options.environment } : {}
5159
- },
5160
- { client, signal }
5161
- )
5569
+ (context) => {
5570
+ webOrigin = context.webOrigin;
5571
+ return runEvalSuiteOperation.execute(
5572
+ {
5573
+ project: options.project,
5574
+ suite: options.suite,
5575
+ ...options.server ? { servers: options.server } : {},
5576
+ ...options.environment ? { environment: options.environment } : {}
5577
+ },
5578
+ { client: context.client, signal: context.signal }
5579
+ );
5580
+ }
5162
5581
  );
5163
5582
  writeResult(result, globalOptions.format);
5583
+ writeRunLink(globalOptions.format, webOrigin, {
5584
+ projectId: result.project.id,
5585
+ suiteId: result.suite.id,
5586
+ runId: result.runId
5587
+ });
5164
5588
  }
5165
5589
  );
5166
- addPlatformOptions3(
5590
+ addPlatformOptions6(
5167
5591
  evals.command("status").description("Get the status and summary of an eval run").requiredOption("--run <id>", "Eval run ID (from `eval run`)").requiredOption("--project <id-or-name>", "Project name or ID")
5168
5592
  ).action(
5169
5593
  async (options, command) => {
5170
5594
  const globalOptions = getGlobalOptions(command);
5171
- const result = await runPlatformCommand3(
5595
+ let webOrigin = DEFAULT_PLATFORM_ORIGIN;
5596
+ const result = await runPlatformCommand6(
5172
5597
  options,
5173
5598
  globalOptions.timeout,
5174
- ({ client, signal }) => getEvalRunOperation.execute(
5175
- { project: options.project, runId: options.run },
5176
- { client, signal }
5177
- )
5599
+ (context) => {
5600
+ webOrigin = context.webOrigin;
5601
+ return getEvalRunOperation.execute(
5602
+ { project: options.project, runId: options.run },
5603
+ { client: context.client, signal: context.signal }
5604
+ );
5605
+ }
5178
5606
  );
5179
5607
  writeResult(result, globalOptions.format);
5608
+ writeRunLink(globalOptions.format, webOrigin, {
5609
+ projectId: result.project.id,
5610
+ suiteId: result.run.suiteId,
5611
+ runId: result.run.id
5612
+ });
5180
5613
  }
5181
5614
  );
5182
- addPlatformOptions3(
5615
+ addPlatformOptions6(
5183
5616
  evals.command("cancel").description(
5184
5617
  "Cancel an in-flight eval run (no-op if already cancelled; errors if it already finished)"
5185
5618
  ).requiredOption("--run <id>", "Eval run ID (from `eval run`)").requiredOption("--project <id-or-name>", "Project name or ID")
5186
5619
  ).action(
5187
5620
  async (options, command) => {
5188
- await executeOp(
5621
+ await executeOp2(
5189
5622
  cancelEvalRunOperation,
5190
5623
  { project: options.project, runId: options.run },
5191
5624
  options,
@@ -5194,7 +5627,7 @@ function registerEvalCommands(program) {
5194
5627
  }
5195
5628
  );
5196
5629
  const PROJECT_OPT = "Project name or ID (defaults to most recently updated)";
5197
- addPlatformOptions3(
5630
+ addPlatformOptions6(
5198
5631
  evals.command("iterations").description(
5199
5632
  "List per-iteration results for an eval run (pass/fail, tool calls, tokens, latency)"
5200
5633
  ).requiredOption("--run <id>", "Eval run ID (from `eval run`)").requiredOption(
@@ -5203,16 +5636,16 @@ function registerEvalCommands(program) {
5203
5636
  ).option("--cursor <cursor>", "Pagination cursor from a previous response").option("--limit <n>", "Max iterations per page (1\u2013200)")
5204
5637
  ).action(
5205
5638
  async (options, command) => {
5206
- const input = validateOpInput(listEvalRunIterationsOperation, {
5639
+ const input = validateOpInput2(listEvalRunIterationsOperation, {
5207
5640
  project: options.project,
5208
5641
  runId: options.run,
5209
5642
  ...options.cursor !== void 0 ? { cursor: options.cursor } : {},
5210
5643
  ...options.limit !== void 0 ? { limit: Number(options.limit) } : {}
5211
5644
  });
5212
- await executeOp(listEvalRunIterationsOperation, input, options, command);
5645
+ await executeOp2(listEvalRunIterationsOperation, input, options, command);
5213
5646
  }
5214
5647
  );
5215
- addPlatformOptions3(
5648
+ addPlatformOptions6(
5216
5649
  evals.command("trace").description(
5217
5650
  "Fetch the full trace for one eval iteration (large: full message history + spans)"
5218
5651
  ).requiredOption("--run <id>", "Eval run ID (from `eval run`)").requiredOption(
@@ -5224,7 +5657,7 @@ function registerEvalCommands(program) {
5224
5657
  )
5225
5658
  ).action(
5226
5659
  async (options, command) => {
5227
- await executeOp(
5660
+ await executeOp2(
5228
5661
  getEvalIterationTraceOperation,
5229
5662
  {
5230
5663
  project: options.project,
@@ -5236,7 +5669,7 @@ function registerEvalCommands(program) {
5236
5669
  );
5237
5670
  }
5238
5671
  );
5239
- addPlatformOptions3(
5672
+ addPlatformOptions6(
5240
5673
  evals.command("steps").description(
5241
5674
  "Per-authored-step results for one eval iteration: status (ok/fail/skipped/pending), reason, and evidence (screenshot/video URLs). The fastest way to see WHICH step failed and why."
5242
5675
  ).requiredOption("--run <id>", "Eval run ID (from `eval run`)").requiredOption(
@@ -5248,7 +5681,7 @@ function registerEvalCommands(program) {
5248
5681
  )
5249
5682
  ).action(
5250
5683
  async (options, command) => {
5251
- await executeOp(
5684
+ await executeOp2(
5252
5685
  getEvalRunStepsOperation,
5253
5686
  {
5254
5687
  project: options.project,
@@ -5260,7 +5693,7 @@ function registerEvalCommands(program) {
5260
5693
  );
5261
5694
  }
5262
5695
  );
5263
- addPlatformOptions3(
5696
+ addPlatformOptions6(
5264
5697
  evals.command("screenshot").description(
5265
5698
  "Show the widget screenshot(s) an eval iteration rendered \u2014 inline when the terminal supports it, otherwise the image URL"
5266
5699
  ).requiredOption("--run <id>", "Eval run ID (from `eval run`)").requiredOption(
@@ -5277,7 +5710,7 @@ function registerEvalCommands(program) {
5277
5710
  async (options, command) => {
5278
5711
  const globalOptions = getGlobalOptions(command);
5279
5712
  const index = options.index !== void 0 ? parsePositiveInteger(options.index, "--index") : void 0;
5280
- const result = await runPlatformCommand3(
5713
+ const result = await runPlatformCommand6(
5281
5714
  options,
5282
5715
  globalOptions.timeout,
5283
5716
  ({ client, signal }) => getEvalIterationTraceOperation.execute(
@@ -5368,7 +5801,7 @@ function registerEvalCommands(program) {
5368
5801
  }
5369
5802
  }
5370
5803
  );
5371
- addPlatformOptions3(
5804
+ addPlatformOptions6(
5372
5805
  evals.command("video").description(
5373
5806
  "Get the Playwright replay video (.webm) an eval iteration recorded \u2014 prints the URL, or downloads it with --out"
5374
5807
  ).requiredOption("--run <id>", "Eval run ID (from `eval run`)").requiredOption(
@@ -5381,7 +5814,7 @@ function registerEvalCommands(program) {
5381
5814
  ).action(
5382
5815
  async (options, command) => {
5383
5816
  const globalOptions = getGlobalOptions(command);
5384
- const result = await runPlatformCommand3(
5817
+ const result = await runPlatformCommand6(
5385
5818
  options,
5386
5819
  globalOptions.timeout,
5387
5820
  ({ client, signal }) => getEvalIterationTraceOperation.execute(
@@ -5432,11 +5865,11 @@ function registerEvalCommands(program) {
5432
5865
  `);
5433
5866
  }
5434
5867
  );
5435
- addPlatformOptions3(
5868
+ addPlatformOptions6(
5436
5869
  evals.command("get").description("Show an eval suite's full settings").requiredOption("--suite <id-or-name>", "Eval suite name or ID").option("--project <id-or-name>", PROJECT_OPT)
5437
5870
  ).action(
5438
5871
  async (options, command) => {
5439
- await executeOp(
5872
+ await executeOp2(
5440
5873
  getEvalSuiteOperation,
5441
5874
  { project: options.project, suite: options.suite },
5442
5875
  options,
@@ -5444,7 +5877,7 @@ function registerEvalCommands(program) {
5444
5877
  );
5445
5878
  }
5446
5879
  );
5447
- addPlatformOptions3(
5880
+ addPlatformOptions6(
5448
5881
  evals.command("update").description(
5449
5882
  "Edit an eval suite's settings (only the flags you pass change)"
5450
5883
  ).requiredOption("--suite <id-or-name>", "Eval suite name or ID").option("--project <id-or-name>", PROJECT_OPT).option("--file <path>", "Suite-update JSON body (or - for stdin)").option("--json <json>", "Inline suite-update JSON (or @file, or -)").option("--name <name>", "Rename the suite").option("--description <text>", "Suite description").option(
@@ -5452,17 +5885,17 @@ function registerEvalCommands(program) {
5452
5885
  "Replace the suite's server selection (project server names)"
5453
5886
  ).option("--host <name...>", "Replace host attachments (by name/ID)").option("--model <id>", "Execution model id").option("--system-prompt <text>", "Execution system prompt").option("--temperature <n>", "Execution temperature").option("--min-accuracy <pct>", "Minimum accuracy, 0\u2013100").option("--tool-call-order <any|in-order|exact>", "Tool call order").option("--arguments <ignore|partial|exact>", "Argument matching").option("--extra-tool-calls <unlimited|N>", "Allowed extra tool calls").option("--judge <on|off>", "Enable/disable LLM-as-judge grading").option("--judge-model <id>", "Judge model id")
5454
5887
  ).action(async (options, command) => {
5455
- const input = validateOpInput(
5888
+ const input = validateOpInput2(
5456
5889
  updateEvalSuiteOperation,
5457
5890
  buildSuiteUpdateInput(options)
5458
5891
  );
5459
- await executeOp(updateEvalSuiteOperation, input, options, command);
5892
+ await executeOp2(updateEvalSuiteOperation, input, options, command);
5460
5893
  });
5461
- addPlatformOptions3(
5894
+ addPlatformOptions6(
5462
5895
  evals.command("delete").description("Permanently delete an eval suite (and its cases and runs)").requiredOption("--suite <id-or-name>", "Eval suite name or ID").option("--project <id-or-name>", PROJECT_OPT)
5463
5896
  ).action(
5464
5897
  async (options, command) => {
5465
- await executeOp(
5898
+ await executeOp2(
5466
5899
  deleteEvalSuiteOperation,
5467
5900
  { project: options.project, suite: options.suite },
5468
5901
  options,
@@ -5470,7 +5903,7 @@ function registerEvalCommands(program) {
5470
5903
  );
5471
5904
  }
5472
5905
  );
5473
- addPlatformOptions3(
5906
+ addPlatformOptions6(
5474
5907
  evals.command("schedule").description("Enable or disable scheduled runs for a suite").requiredOption("--suite <id-or-name>", "Eval suite name or ID").option("--project <id-or-name>", PROJECT_OPT).option("--enable", "Enable scheduled runs").option("--disable", "Disable scheduled runs").option("--interval <minutes>", "Run interval in minutes (5\u201310080)").option(
5475
5908
  "--environment <id-or-name>",
5476
5909
  "Project environment the scheduled runs launch (only with --enable)"
@@ -5483,20 +5916,20 @@ function registerEvalCommands(program) {
5483
5916
  if (!options.enable && !options.disable) {
5484
5917
  throw usageError("Pass --enable or --disable.");
5485
5918
  }
5486
- const input = validateOpInput(setEvalSuiteScheduleOperation, {
5919
+ const input = validateOpInput2(setEvalSuiteScheduleOperation, {
5487
5920
  project: options.project,
5488
5921
  suite: options.suite,
5489
5922
  enabled: Boolean(options.enable),
5490
5923
  ...options.interval !== void 0 ? { intervalMinutes: Number(options.interval) } : {},
5491
5924
  ...options.environment ? { environment: options.environment } : {}
5492
5925
  });
5493
- await executeOp(setEvalSuiteScheduleOperation, input, options, command);
5926
+ await executeOp2(setEvalSuiteScheduleOperation, input, options, command);
5494
5927
  }
5495
5928
  );
5496
5929
  const environments = evals.command("environments").description(
5497
5930
  "Attach or detach the project environments an eval suite runs against"
5498
5931
  );
5499
- addPlatformOptions3(
5932
+ addPlatformOptions6(
5500
5933
  environments.command("set").description(
5501
5934
  "Replace the suite's attached environments (this sets the whole list)"
5502
5935
  ).requiredOption("--suite <id-or-name>", "Eval suite name or ID").requiredOption(
@@ -5505,7 +5938,7 @@ function registerEvalCommands(program) {
5505
5938
  ).option("--project <id-or-name>", PROJECT_OPT)
5506
5939
  ).action(
5507
5940
  async (options, command) => {
5508
- await executeOp(
5941
+ await executeOp2(
5509
5942
  setEvalSuiteEnvironmentsOperation,
5510
5943
  {
5511
5944
  project: options.project,
@@ -5517,13 +5950,13 @@ function registerEvalCommands(program) {
5517
5950
  );
5518
5951
  }
5519
5952
  );
5520
- addPlatformOptions3(
5953
+ addPlatformOptions6(
5521
5954
  environments.command("clear").description(
5522
5955
  "Detach every environment, reverting the suite to its saved server selection"
5523
5956
  ).requiredOption("--suite <id-or-name>", "Eval suite name or ID").option("--project <id-or-name>", PROJECT_OPT)
5524
5957
  ).action(
5525
5958
  async (options, command) => {
5526
- await executeOp(
5959
+ await executeOp2(
5527
5960
  setEvalSuiteEnvironmentsOperation,
5528
5961
  {
5529
5962
  project: options.project,
@@ -5536,11 +5969,11 @@ function registerEvalCommands(program) {
5536
5969
  }
5537
5970
  );
5538
5971
  const cases = evals.command("cases").description("List, author, and edit an eval suite's test cases");
5539
- addPlatformOptions3(
5972
+ addPlatformOptions6(
5540
5973
  cases.command("list").description("List a suite's test cases").requiredOption("--suite <id-or-name>", "Eval suite name or ID").option("--project <id-or-name>", PROJECT_OPT)
5541
5974
  ).action(
5542
5975
  async (options, command) => {
5543
- await executeOp(
5976
+ await executeOp2(
5544
5977
  listEvalCasesOperation,
5545
5978
  { project: options.project, suite: options.suite },
5546
5979
  options,
@@ -5548,11 +5981,11 @@ function registerEvalCommands(program) {
5548
5981
  );
5549
5982
  }
5550
5983
  );
5551
- addPlatformOptions3(
5984
+ addPlatformOptions6(
5552
5985
  cases.command("get").description("Show one test case").requiredOption("--suite <id-or-name>", "Eval suite name or ID").requiredOption("--case <id-or-title>", "Eval case title or ID").option("--project <id-or-name>", PROJECT_OPT)
5553
5986
  ).action(
5554
5987
  async (options, command) => {
5555
- await executeOp(
5988
+ await executeOp2(
5556
5989
  getEvalCaseOperation,
5557
5990
  { project: options.project, suite: options.suite, case: options.case },
5558
5991
  options,
@@ -5560,7 +5993,7 @@ function registerEvalCommands(program) {
5560
5993
  );
5561
5994
  }
5562
5995
  );
5563
- addPlatformOptions3(
5996
+ addPlatformOptions6(
5564
5997
  cases.command("run").description(
5565
5998
  "Run a single case as a persisted, fully-queryable run (inspect it with `eval iterations` / `eval steps` like any run)"
5566
5999
  ).requiredOption("--suite <id-or-name>", "Eval suite name or ID").requiredOption("--case <id-or-title>", "Eval case title or ID").option("--project <id-or-name>", PROJECT_OPT).option(
@@ -5572,7 +6005,7 @@ function registerEvalCommands(program) {
5572
6005
  )
5573
6006
  ).action(
5574
6007
  async (options, command) => {
5575
- await executeOp(
6008
+ await executeOp2(
5576
6009
  runEvalCaseOperation,
5577
6010
  {
5578
6011
  project: options.project,
@@ -5586,29 +6019,29 @@ function registerEvalCommands(program) {
5586
6019
  );
5587
6020
  }
5588
6021
  );
5589
- addPlatformOptions3(
6022
+ addPlatformOptions6(
5590
6023
  cases.command("create").description("Add a test case to a suite (definition via --file/--json)").requiredOption("--suite <id-or-name>", "Eval suite name or ID").option("--project <id-or-name>", PROJECT_OPT).option("--file <path>", "Case JSON body (or - for stdin)").option("--json <json>", "Inline case JSON (or @file, or -)").option("--title <title>", "Case title (overrides the body)")
5591
6024
  ).action(async (options, command) => {
5592
- const input = validateOpInput(
6025
+ const input = validateOpInput2(
5593
6026
  createEvalCaseOperation,
5594
6027
  buildCaseInput(options, { requireCase: false })
5595
6028
  );
5596
- await executeOp(createEvalCaseOperation, input, options, command);
6029
+ await executeOp2(createEvalCaseOperation, input, options, command);
5597
6030
  });
5598
- addPlatformOptions3(
6031
+ addPlatformOptions6(
5599
6032
  cases.command("update").description("Edit a test case (definition via --file/--json)").requiredOption("--suite <id-or-name>", "Eval suite name or ID").requiredOption("--case <id-or-title>", "Eval case title or ID").option("--project <id-or-name>", PROJECT_OPT).option("--file <path>", "Case JSON body (or - for stdin)").option("--json <json>", "Inline case JSON (or @file, or -)").option("--title <title>", "Rename the case")
5600
6033
  ).action(async (options, command) => {
5601
- const input = validateOpInput(
6034
+ const input = validateOpInput2(
5602
6035
  updateEvalCaseOperation,
5603
6036
  buildCaseInput(options, { requireCase: true })
5604
6037
  );
5605
- await executeOp(updateEvalCaseOperation, input, options, command);
6038
+ await executeOp2(updateEvalCaseOperation, input, options, command);
5606
6039
  });
5607
- addPlatformOptions3(
6040
+ addPlatformOptions6(
5608
6041
  cases.command("delete").description("Permanently delete a test case").requiredOption("--suite <id-or-name>", "Eval suite name or ID").requiredOption("--case <id-or-title>", "Eval case title or ID").option("--project <id-or-name>", PROJECT_OPT)
5609
6042
  ).action(
5610
6043
  async (options, command) => {
5611
- await executeOp(
6044
+ await executeOp2(
5612
6045
  deleteEvalCaseOperation,
5613
6046
  { project: options.project, suite: options.suite, case: options.case },
5614
6047
  options,
@@ -5616,7 +6049,7 @@ function registerEvalCommands(program) {
5616
6049
  );
5617
6050
  }
5618
6051
  );
5619
- addPlatformOptions3(
6052
+ addPlatformOptions6(
5620
6053
  cases.command("generate").description(
5621
6054
  "AI-generate test cases from the suite's tools (spends credits)"
5622
6055
  ).requiredOption("--suite <id-or-name>", "Eval suite name or ID").option("--project <id-or-name>", PROJECT_OPT).option("--mode <normal|negative>", "Generation mode (default normal)").option(
@@ -5654,7 +6087,7 @@ function registerEvalCommands(program) {
5654
6087
  caseMix[key] = parsed;
5655
6088
  }
5656
6089
  }
5657
- const input = validateOpInput(generateEvalCasesOperation, {
6090
+ const input = validateOpInput2(generateEvalCasesOperation, {
5658
6091
  project: options.project,
5659
6092
  suite: options.suite,
5660
6093
  ...options.mode ? { mode: options.mode } : {},
@@ -5664,24 +6097,28 @@ function registerEvalCommands(program) {
5664
6097
  ...Object.keys(caseMix).length > 0 ? { caseMix } : {},
5665
6098
  ...options.varyUserStyles ? { varyUserStyles: true } : {}
5666
6099
  });
5667
- await executeOp(generateEvalCasesOperation, input, options, command);
6100
+ await executeOp2(generateEvalCasesOperation, input, options, command);
5668
6101
  }
5669
6102
  );
5670
6103
  }
5671
6104
  var HOST_TEMPLATES = HOST_TEMPLATES$1.map(({ id, label }) => ({ id, label }));
5672
- function addPlatformOptions4(command) {
6105
+ function addPlatformOptions7(command) {
5673
6106
  return command.option("--api-key <key>", "MCPJam sk_ API key (overrides MCPJAM_API_KEY)").option(
5674
6107
  "--api-url <url>",
5675
6108
  "MCPJam API base URL (defaults to https://app.mcpjam.com/api/v1)"
5676
6109
  );
5677
6110
  }
5678
- async function runPlatformCommand4(options, timeoutMs, execute) {
6111
+ async function runPlatformCommand7(options, timeoutMs, execute) {
5679
6112
  const controller = new AbortController();
5680
6113
  const timeoutHandle = setTimeout(() => {
5681
6114
  controller.abort(
5682
- new PlatformApiError(`Request timed out after ${timeoutMs}ms`, "TIMEOUT", {
5683
- status: 0
5684
- })
6115
+ new PlatformApiError(
6116
+ `Request timed out after ${timeoutMs}ms`,
6117
+ "TIMEOUT",
6118
+ {
6119
+ status: 0
6120
+ }
6121
+ )
5685
6122
  );
5686
6123
  }, timeoutMs);
5687
6124
  timeoutHandle.unref?.();
@@ -5730,31 +6167,38 @@ function loadConfigObject(options) {
5730
6167
  return base;
5731
6168
  }
5732
6169
  function registerHostsCommands(program) {
5733
- const hosts = program.command("hosts").description("List, create, and manage the hosts in your hosted MCPJam projects");
5734
- hosts.command("templates").description("List the built-in host templates usable with `hosts create --template`").action((_options, command) => {
6170
+ const hosts = program.command("hosts").description(
6171
+ "List, create, and manage the hosts in your hosted MCPJam projects"
6172
+ );
6173
+ hosts.command("templates").description(
6174
+ "List the built-in host templates usable with `hosts create --template`"
6175
+ ).action((_options, command) => {
5735
6176
  const globalOptions = getGlobalOptions(command);
5736
6177
  writeResult({ items: HOST_TEMPLATES }, globalOptions.format);
5737
6178
  });
5738
- addPlatformOptions4(
6179
+ addPlatformOptions7(
5739
6180
  hosts.command("list").description("List the hosts saved in a project").option(
5740
6181
  "--project <id-or-name>",
5741
6182
  "Project name or ID (defaults to the most recently updated project)"
5742
6183
  )
5743
6184
  ).action(async (options, command) => {
5744
6185
  const globalOptions = getGlobalOptions(command);
5745
- const result = await runPlatformCommand4(
6186
+ const result = await runPlatformCommand7(
5746
6187
  options,
5747
6188
  globalOptions.timeout,
5748
- ({ client, signal }) => listHostsOperation.execute({ project: options.project }, { client, signal })
6189
+ ({ client, signal }) => listHostsOperation.execute(
6190
+ { project: options.project },
6191
+ { client, signal }
6192
+ )
5749
6193
  );
5750
6194
  writeResult(result, globalOptions.format);
5751
6195
  });
5752
- addPlatformOptions4(
6196
+ addPlatformOptions7(
5753
6197
  hosts.command("get").description("Show one host's full settings, including its host config").requiredOption("--host <id-or-name>", "Host name or ID").option("--project <id-or-name>", "Project name or ID")
5754
6198
  ).action(
5755
6199
  async (options, command) => {
5756
6200
  const globalOptions = getGlobalOptions(command);
5757
- const result = await runPlatformCommand4(
6201
+ const result = await runPlatformCommand7(
5758
6202
  options,
5759
6203
  globalOptions.timeout,
5760
6204
  ({ client, signal }) => getHostOperation.execute(
@@ -5765,7 +6209,7 @@ function registerHostsCommands(program) {
5765
6209
  writeResult(result, globalOptions.format);
5766
6210
  }
5767
6211
  );
5768
- addPlatformOptions4(
6212
+ addPlatformOptions7(
5769
6213
  hosts.command("create").description(
5770
6214
  "Create a host from a built-in template (--template) or a full host config (--file/--json)"
5771
6215
  ).requiredOption("--name <name>", "Display name for the new host").option("--project <id-or-name>", "Project name or ID").option(
@@ -5786,7 +6230,7 @@ function registerHostsCommands(program) {
5786
6230
  ...options.theme !== void 0 ? { theme: options.theme } : {},
5787
6231
  ...config !== void 0 ? { config } : {}
5788
6232
  });
5789
- const result = await runPlatformCommand4(
6233
+ const result = await runPlatformCommand7(
5790
6234
  options,
5791
6235
  globalOptions.timeout,
5792
6236
  ({ client, signal }) => createHostOperation.execute(input, { client, signal })
@@ -5794,8 +6238,14 @@ function registerHostsCommands(program) {
5794
6238
  writeResult(result, globalOptions.format);
5795
6239
  }
5796
6240
  );
5797
- addPlatformOptions4(
5798
- hosts.command("update").description("Edit a host's name and/or its host config").requiredOption("--host <id-or-name>", "Host name or ID").option("--project <id-or-name>", "Project name or ID").option("--name <name>", "New display name").option("--file <path>", "Replacement host config v2 JSON (or - for stdin)").option("--json <json>", "Inline replacement host config v2 JSON (or @file, or -)")
6241
+ addPlatformOptions7(
6242
+ hosts.command("update").description("Edit a host's name and/or its host config").requiredOption("--host <id-or-name>", "Host name or ID").option("--project <id-or-name>", "Project name or ID").option("--name <name>", "New display name").option(
6243
+ "--file <path>",
6244
+ "Replacement host config v2 JSON (or - for stdin)"
6245
+ ).option(
6246
+ "--json <json>",
6247
+ "Inline replacement host config v2 JSON (or @file, or -)"
6248
+ )
5799
6249
  ).action(
5800
6250
  async (options, command) => {
5801
6251
  const globalOptions = getGlobalOptions(command);
@@ -5806,7 +6256,7 @@ function registerHostsCommands(program) {
5806
6256
  ...options.name !== void 0 ? { name: options.name } : {},
5807
6257
  ...config !== void 0 ? { config } : {}
5808
6258
  });
5809
- const result = await runPlatformCommand4(
6259
+ const result = await runPlatformCommand7(
5810
6260
  options,
5811
6261
  globalOptions.timeout,
5812
6262
  ({ client, signal }) => updateHostOperation.execute(input, { client, signal })
@@ -5814,12 +6264,12 @@ function registerHostsCommands(program) {
5814
6264
  writeResult(result, globalOptions.format);
5815
6265
  }
5816
6266
  );
5817
- addPlatformOptions4(
6267
+ addPlatformOptions7(
5818
6268
  hosts.command("delete").description("Permanently delete a host from a project").requiredOption("--host <id-or-name>", "Host name or ID").option("--project <id-or-name>", "Project name or ID")
5819
6269
  ).action(
5820
6270
  async (options, command) => {
5821
6271
  const globalOptions = getGlobalOptions(command);
5822
- const result = await runPlatformCommand4(
6272
+ const result = await runPlatformCommand7(
5823
6273
  options,
5824
6274
  globalOptions.timeout,
5825
6275
  ({ client, signal }) => deleteHostOperation.execute(
@@ -5833,6 +6283,50 @@ function registerHostsCommands(program) {
5833
6283
  writeResult(result, globalOptions.format);
5834
6284
  }
5835
6285
  );
6286
+ addPlatformOptions7(
6287
+ hosts.command("servers").description("Replace a host's required and optional server attachments").requiredOption("--host <id-or-name>", "Host name or ID").requiredOption(
6288
+ "--server-ids <ids>",
6289
+ "Comma-separated required server IDs"
6290
+ ).option(
6291
+ "--optional-server-ids <ids>",
6292
+ "Comma-separated optional server IDs"
6293
+ ).option("--project <id-or-name>", "Project name or ID")
6294
+ ).action(
6295
+ async (options, command) => {
6296
+ const globalOptions = getGlobalOptions(command);
6297
+ const splitIds = (value) => value.split(",").map((id) => id.trim()).filter(Boolean);
6298
+ const input = validateInput3(setHostServersOperation, {
6299
+ project: options.project,
6300
+ host: options.host,
6301
+ serverIds: splitIds(options.serverIds),
6302
+ ...options.optionalServerIds ? { optionalServerIds: splitIds(options.optionalServerIds) } : {}
6303
+ });
6304
+ const result = await runPlatformCommand7(
6305
+ options,
6306
+ globalOptions.timeout,
6307
+ ({ client, signal }) => setHostServersOperation.execute(input, { client, signal })
6308
+ );
6309
+ writeResult(result, globalOptions.format);
6310
+ }
6311
+ );
6312
+ addPlatformOptions7(
6313
+ hosts.command("duplicate").description("Duplicate a host's current config").requiredOption("--host <id-or-name>", "Host name or ID").option("--name <name>", "Name for the new host").option("--project <id-or-name>", "Project name or ID")
6314
+ ).action(
6315
+ async (options, command) => {
6316
+ const globalOptions = getGlobalOptions(command);
6317
+ const input = validateInput3(duplicateHostOperation, {
6318
+ project: options.project,
6319
+ host: options.host,
6320
+ ...options.name === void 0 ? {} : { name: options.name }
6321
+ });
6322
+ const result = await runPlatformCommand7(
6323
+ options,
6324
+ globalOptions.timeout,
6325
+ ({ client, signal }) => duplicateHostOperation.execute(input, { client, signal })
6326
+ );
6327
+ writeResult(result, globalOptions.format);
6328
+ }
6329
+ );
5836
6330
  }
5837
6331
  function validateInput3(op, raw) {
5838
6332
  const parsed = op.inputSchema.safeParse(raw);
@@ -6411,7 +6905,7 @@ function createMcpJamMcpServer(options) {
6411
6905
  target: summarizeServerDoctorTarget(target, config),
6412
6906
  timeout: input.timeoutMs ?? defaultTimeoutMs
6413
6907
  });
6414
- return redactSensitiveValue(result);
6908
+ return redactForTelemetry(result);
6415
6909
  })
6416
6910
  );
6417
6911
  server.registerTool(
@@ -6435,7 +6929,7 @@ function createMcpJamMcpServer(options) {
6435
6929
  headers,
6436
6930
  timeoutMs: timeoutMs ?? defaultTimeoutMs
6437
6931
  });
6438
- return redactSensitiveValue(result);
6932
+ return redactForTelemetry(result);
6439
6933
  })
6440
6934
  );
6441
6935
  let closed = false;
@@ -6593,13 +7087,13 @@ function statusGlyph(status) {
6593
7087
  }
6594
7088
 
6595
7089
  // src/commands/projects.ts
6596
- function addPlatformOptions5(command) {
7090
+ function addPlatformOptions8(command) {
6597
7091
  return command.option("--api-key <key>", "MCPJam sk_ API key (overrides MCPJAM_API_KEY)").option(
6598
7092
  "--api-url <url>",
6599
7093
  "MCPJam API base URL (defaults to https://app.mcpjam.com/api/v1)"
6600
7094
  );
6601
7095
  }
6602
- async function runPlatformCommand5(options, timeoutMs, execute) {
7096
+ async function runPlatformCommand8(options, timeoutMs, execute) {
6603
7097
  const controller = new AbortController();
6604
7098
  const timeoutHandle = setTimeout(() => {
6605
7099
  controller.abort(
@@ -6626,12 +7120,14 @@ async function runPlatformCommand5(options, timeoutMs, execute) {
6626
7120
  }
6627
7121
  }
6628
7122
  function registerProjectsCommands(program) {
6629
- const projects = program.command("projects").description("Operate the MCP servers saved in your hosted MCPJam projects");
6630
- addPlatformOptions5(
7123
+ const projects = program.command("projects").description(
7124
+ "Operate the MCP servers saved in your hosted MCPJam projects"
7125
+ );
7126
+ addPlatformOptions8(
6631
7127
  projects.command("list").description("List the projects you can access")
6632
7128
  ).action(async (options, command) => {
6633
7129
  const globalOptions = getGlobalOptions(command);
6634
- const result = await runPlatformCommand5(
7130
+ const result = await runPlatformCommand8(
6635
7131
  options,
6636
7132
  globalOptions.timeout,
6637
7133
  ({ client, signal }) => listProjectsOperation.execute({}, { client, signal })
@@ -6643,14 +7139,67 @@ function registerProjectsCommands(program) {
6643
7139
  writeResult(result, globalOptions.format);
6644
7140
  }
6645
7141
  });
6646
- addPlatformOptions5(
6647
- projects.command("servers").description("List the servers saved in a project").option(
6648
- "--project <id-or-name>",
6649
- "Project name or ID (defaults to the most recently updated project)"
6650
- )
7142
+ addPlatformOptions8(
7143
+ projects.command("create").description("Create a hosted MCPJam project").requiredOption("--name <name>", "Project name").option("--description <text>", "Project description").option("--organization-id <id>", "Organization ID").option("--visibility <visibility>", "public or private")
7144
+ ).action(
7145
+ async (options, command) => {
7146
+ const globalOptions = getGlobalOptions(command);
7147
+ const input = createProjectOperation.inputSchema.parse({
7148
+ name: options.name,
7149
+ ...options.description === void 0 ? {} : { description: options.description },
7150
+ ...options.organizationId === void 0 ? {} : { organizationId: options.organizationId },
7151
+ ...options.visibility === void 0 ? {} : { visibility: options.visibility }
7152
+ });
7153
+ const result = await runPlatformCommand8(
7154
+ options,
7155
+ globalOptions.timeout,
7156
+ ({ client, signal }) => createProjectOperation.execute(input, { client, signal })
7157
+ );
7158
+ writeResult(result, globalOptions.format);
7159
+ }
7160
+ );
7161
+ addPlatformOptions8(
7162
+ projects.command("update").description("Update project metadata").requiredOption("--project <id-or-name>", "Project name or ID").option("--name <name>", "New project name").option("--description <text>", "New project description").option("--visibility <visibility>", "public or private")
7163
+ ).action(
7164
+ async (options, command) => {
7165
+ const globalOptions = getGlobalOptions(command);
7166
+ const input = updateProjectOperation.inputSchema.parse({
7167
+ project: options.project,
7168
+ ...options.name === void 0 ? {} : { name: options.name },
7169
+ ...options.description === void 0 ? {} : { description: options.description },
7170
+ ...options.visibility === void 0 ? {} : { visibility: options.visibility }
7171
+ });
7172
+ const result = await runPlatformCommand8(
7173
+ options,
7174
+ globalOptions.timeout,
7175
+ ({ client, signal }) => updateProjectOperation.execute(input, { client, signal })
7176
+ );
7177
+ writeResult(result, globalOptions.format);
7178
+ }
7179
+ );
7180
+ addPlatformOptions8(
7181
+ projects.command("delete").description("Delete a project and its project-owned resources").requiredOption("--project <id-or-name>", "Project name or ID")
6651
7182
  ).action(async (options, command) => {
6652
7183
  const globalOptions = getGlobalOptions(command);
6653
- const result = await runPlatformCommand5(
7184
+ const input = deleteProjectOperation.inputSchema.parse({
7185
+ project: options.project
7186
+ });
7187
+ const result = await runPlatformCommand8(
7188
+ options,
7189
+ globalOptions.timeout,
7190
+ ({ client, signal }) => deleteProjectOperation.execute(input, { client, signal })
7191
+ );
7192
+ writeResult(result, globalOptions.format);
7193
+ });
7194
+ const servers = addPlatformOptions8(
7195
+ projects.command("servers").alias("server").description("List and manage the servers saved in a project")
7196
+ ).option(
7197
+ "--project <id-or-name>",
7198
+ "Project name or ID (defaults to the most recently updated project)"
7199
+ );
7200
+ servers.action(async (options, command) => {
7201
+ const globalOptions = getGlobalOptions(command);
7202
+ const result = await runPlatformCommand8(
6654
7203
  options,
6655
7204
  globalOptions.timeout,
6656
7205
  ({ client, signal }) => listProjectServersOperation.execute(
@@ -6665,7 +7214,76 @@ function registerProjectsCommands(program) {
6665
7214
  writeResult(result, globalOptions.format);
6666
7215
  }
6667
7216
  });
6668
- addPlatformOptions5(
7217
+ const parseBody = (raw) => {
7218
+ const parsed = JSON.parse(raw);
7219
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
7220
+ throw new Error("--body must be a JSON object");
7221
+ }
7222
+ return parsed;
7223
+ };
7224
+ addPlatformOptions8(
7225
+ servers.command("create").alias("add").description("Create a saved MCP server").requiredOption("--project <id-or-name>", "Project name or ID").requiredOption("--body <json>", "Server JSON body")
7226
+ ).action(async (options, command) => {
7227
+ const globalOptions = getGlobalOptions(command);
7228
+ const result = await runPlatformCommand8(
7229
+ options,
7230
+ globalOptions.timeout,
7231
+ ({ client, signal }) => createProjectServerOperation.execute(
7232
+ { project: options.project, body: parseBody(options.body) },
7233
+ { client, signal }
7234
+ )
7235
+ );
7236
+ writeResult(result, globalOptions.format);
7237
+ });
7238
+ addPlatformOptions8(
7239
+ servers.command("get").description("Get one saved MCP server").requiredOption("--project <id-or-name>", "Project name or ID").requiredOption("--server <id>", "Server ID")
7240
+ ).action(async (options, command) => {
7241
+ const globalOptions = getGlobalOptions(command);
7242
+ const result = await runPlatformCommand8(
7243
+ options,
7244
+ globalOptions.timeout,
7245
+ ({ client, signal }) => getProjectServerOperation.execute(
7246
+ { project: options.project, serverId: options.server },
7247
+ { client, signal }
7248
+ )
7249
+ );
7250
+ writeResult(result, globalOptions.format);
7251
+ });
7252
+ addPlatformOptions8(
7253
+ servers.command("update").description("Update one saved MCP server").requiredOption("--project <id-or-name>", "Project name or ID").requiredOption("--server <id>", "Server ID").requiredOption("--body <json>", "Patch JSON body")
7254
+ ).action(
7255
+ async (options, command) => {
7256
+ const globalOptions = getGlobalOptions(command);
7257
+ const result = await runPlatformCommand8(
7258
+ options,
7259
+ globalOptions.timeout,
7260
+ ({ client, signal }) => updateProjectServerOperation.execute(
7261
+ {
7262
+ project: options.project,
7263
+ serverId: options.server,
7264
+ body: parseBody(options.body)
7265
+ },
7266
+ { client, signal }
7267
+ )
7268
+ );
7269
+ writeResult(result, globalOptions.format);
7270
+ }
7271
+ );
7272
+ addPlatformOptions8(
7273
+ servers.command("delete").alias("remove").description("Delete one saved MCP server").requiredOption("--project <id-or-name>", "Project name or ID").requiredOption("--server <id>", "Server ID")
7274
+ ).action(async (options, command) => {
7275
+ const globalOptions = getGlobalOptions(command);
7276
+ const result = await runPlatformCommand8(
7277
+ options,
7278
+ globalOptions.timeout,
7279
+ ({ client, signal }) => deleteProjectServerOperation.execute(
7280
+ { project: options.project, serverId: options.server },
7281
+ { client, signal }
7282
+ )
7283
+ );
7284
+ writeResult(result, globalOptions.format);
7285
+ });
7286
+ addPlatformOptions8(
6669
7287
  projects.command("status").description(
6670
7288
  "Health-check every server in a project (hosted doctor per server)"
6671
7289
  ).option(
@@ -6674,7 +7292,7 @@ function registerProjectsCommands(program) {
6674
7292
  )
6675
7293
  ).action(async (options, command) => {
6676
7294
  const globalOptions = getGlobalOptions(command);
6677
- const payload = await runPlatformCommand5(
7295
+ const payload = await runPlatformCommand8(
6678
7296
  options,
6679
7297
  globalOptions.timeout,
6680
7298
  ({ client, signal }) => showServersOperation.execute(
@@ -6855,10 +7473,10 @@ function redactOAuthConformanceResult(result, options) {
6855
7473
  options.credentialsFilePath
6856
7474
  );
6857
7475
  }
6858
- return redactSensitiveValue(result);
7476
+ return redactForTelemetry(result);
6859
7477
  }
6860
7478
  function redactOAuthConformanceSuiteResult(result, options) {
6861
- const redacted = redactSensitiveValue(result);
7479
+ const redacted = redactForTelemetry(result);
6862
7480
  if (options.credentialsFilePath) {
6863
7481
  redacted.credentialsFile = options.credentialsFilePath;
6864
7482
  }
@@ -7669,7 +8287,7 @@ function printRegistrationNotes(result, quiet) {
7669
8287
  function redactXaaResult(result) {
7670
8288
  const rawIdJag = result.idJag?.token;
7671
8289
  const masked = result.idJag ? { ...result, idJag: { ...result.idJag, token: "[REDACTED]" } } : result;
7672
- const scrubbed = redactSensitiveValue(masked);
8290
+ const scrubbed = redactForTelemetry(masked);
7673
8291
  const afterRaw = rawIdJag ? replaceRawValue(scrubbed, rawIdJag) : scrubbed;
7674
8292
  return result.registration ? { ...afterRaw, registration: result.registration } : afterRaw;
7675
8293
  }
@@ -8194,7 +8812,7 @@ function registerServerCommands(program) {
8194
8812
  throw operationalError("Probe did not return a result.");
8195
8813
  }
8196
8814
  writeResult(
8197
- redactSensitiveValue(result),
8815
+ redactForTelemetry(result),
8198
8816
  globalOptions.format
8199
8817
  );
8200
8818
  if (result.status === "error") {
@@ -8223,7 +8841,7 @@ function registerServerCommands(program) {
8223
8841
  retryPolicy
8224
8842
  });
8225
8843
  const rawPayload = globalOptions.rpc ? attachCliRpcLogs(result, collector) : result;
8226
- const jsonPayload = redactSensitiveValue(rawPayload);
8844
+ const jsonPayload = redactForTelemetry(rawPayload);
8227
8845
  const artifactPath = options.out ? await writeDebugArtifact(options.out, jsonPayload) : void 0;
8228
8846
  if (globalOptions.format === "human") {
8229
8847
  process.stdout.write(
@@ -12430,8 +13048,11 @@ async function main(argv = process.argv, dependencies = {}) {
12430
13048
  registerAuthCommands(program);
12431
13049
  registerProjectsCommands(program);
12432
13050
  registerEvalCommands(program);
13051
+ registerChatCommands(program);
12433
13052
  registerHostsCommands(program);
12434
13053
  registerEnvironmentsCommands(program);
13054
+ registerJourneysCommands(program);
13055
+ registerScenariosCommands(program);
12435
13056
  registerImagesCommands(program);
12436
13057
  registerTunnelCommands(program);
12437
13058
  registerInspectorCommands(program);