@mcpjam/cli 3.28.0 → 3.29.0
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 +569 -7
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
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, 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, openUrlInBrowser, 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, formatGateReport, detectFlakyCases, evaluateCompareGates, buildRunCompareReport, loadEvalSuiteFile, formatSuiteFileFindings, serializeEvalSuiteFile, MAX_SUITE_FILE_BYTES, buildCorpus, HostedOnlyCaseError, verifyCorpusLock, 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, evaluateGates, gateInputFromPlatformRun, calculateLatencyStats, CORPUS_LOCK_VERSION, TaskLifecycleEngine, driveTaskToTerminal, extensionTaskToObservation, legacyTaskToObservation, passRateFractionFromPercent, suiteFilePointer, isUnknownTaskError, isMCPTasksWireError, LEGACY_TASK_STATUSES } from '@mcpjam/sdk';
|
|
6
|
-
import { mkdir, writeFile, readFile, chmod, rename, rm, open, unlink } from 'fs/promises';
|
|
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, runConformance, isConformanceReportingConfigured, reportConformanceRun, reportConformanceRunSafely, OPENAI_SUBMISSION_MODES, openUrlInBrowser, withEphemeralClient, diffServerSnapshots, ServerSnapshotFormatError, renderStructuredRunJUnitXml, renderStructuredRunJson, DEFAULT_SUBSCRIPTION_RECONNECT_POLICY, isKnownProtocolVersion, describeConformanceScore, toConformanceReport, buildConformanceRunReport, renderConformanceReportJUnitXml, renderConformanceReportJson, formatOAuthConformanceHuman, formatOAuthConformanceSuiteHuman, fetchOAuthMetadata, executeOAuthProxy, executeDebugOAuthProxy, normalizeRegistrationStrategy, normalizeXaaClientAuth, normalizeIdentityAssertionFormat, IDENTITY_ASSERTION_FORMATS, XAA_CONFIDENTIAL_CIMD_ORIGIN, getLocalConfidentialCimdProvider, MCP_PROTOCOL_VERSIONS, gatherClaudeReadinessEvidence, gradeClaudeReadiness, gatherOpenAIReadinessEvidence, xmldomParseXml, gradeOpenAIReadiness, generateRandomString, generateCodeChallenge, createInteractiveAuthorizationSession, formatGateReport, detectFlakyCases, evaluateCompareGates, buildRunCompareReport, loadEvalSuiteFile, formatSuiteFileFindings, serializeEvalSuiteFile, MAX_SUITE_FILE_BYTES, buildCorpus, HostedOnlyCaseError, verifyCorpusLock, 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, OPENAI_SUBMISSION_MODE_SHAPES, createDirectoryPluginFileSource, collectZipArchiveObservations, createZipPluginFileSource, evaluateGates, gateInputFromPlatformRun, calculateLatencyStats, CORPUS_LOCK_VERSION, TaskLifecycleEngine, driveTaskToTerminal, extensionTaskToObservation, legacyTaskToObservation, passRateFractionFromPercent, suiteFilePointer, isUnknownTaskError, isMCPTasksWireError, LEGACY_TASK_STATUSES } from '@mcpjam/sdk';
|
|
6
|
+
import { mkdir, writeFile, readFile, chmod, rename, rm, stat, open, unlink } from 'fs/promises';
|
|
7
7
|
import path2, { dirname, join, basename } from 'path';
|
|
8
8
|
import { randomUUID, randomBytes } from 'crypto';
|
|
9
9
|
import { spawn } from 'child_process';
|
|
10
10
|
import { createRequire } from 'module';
|
|
11
11
|
import os, { homedir } from 'os';
|
|
12
|
-
import { createProjectOperation, updateProjectOperation, deleteProjectOperation, connectProjectServerOperation, getProjectServerConnectionStatusOperation, listEvalSuiteRunsOperation, cancelEvalRunOperation, requestEvalRunJudgeOperation, listEvalCheckReposOperation, connectEvalCheckRepoOperation, listEvalRunIterationsOperation, getEvalIterationTraceOperation, getEvalRunStepsOperation, getEvalSuiteOperation, updateEvalSuiteOperation, deleteEvalSuiteOperation, setEvalSuiteScheduleOperation, setEvalSuiteEnvironmentsOperation, listEvalCasesOperation, getEvalCaseOperation, runEvalCaseOperation, createEvalCaseOperation, updateEvalCaseOperation, deleteEvalCaseOperation, generateEvalCasesOperation, listChatSessionsOperation, createHostOperation, updateHostOperation, setHostServersOperation, duplicateHostOperation, createEnvironmentOperation, ensureAdhocEnvironmentOperation, nameEnvironmentOperation, updateEnvironmentOperation, createImageOperation, validateImageBlueprintOperation, updateImageOperation, createTunnelOperation, DEFAULT_PLATFORM_API_BASE_URL, PlatformApiClient, isPlatformApiError, PlatformApiError, listOrganizationsOperation, listProjectsOperation, listProjectServersOperation, createProjectServerOperation, getProjectServerOperation, updateProjectServerOperation, deleteProjectServerOperation, showServersOperation, createEvalSuiteOperation, listEvalSuitesOperation, runEvalSuiteOperation, getEvalRunOperation, resolveProject, listHostsOperation, getHostOperation, deleteHostOperation, listEnvironmentsOperation, getEnvironmentOperation, resolveEnvironmentOperation, getEnvironmentCapabilitiesOperation, archiveEnvironmentOperation, restoreEnvironmentOperation, listJourneysOperation, listJourneyRunsOperation, getJourneyRunOperation, launchJourneyRunOperation, cancelJourneyRunOperation, listJourneyRunSessionsOperation, listScenariosOperation, getScenarioOperation, publishScenarioOperation, unpublishScenarioOperation, listImagesOperation, getImageOperation, buildImageOperation, listImageBuildsOperation, useImageOperation, resetComputerOperation, promoteImageOperation, deleteImageOperation, getCapabilitiesOperation, listPersonasOperation, getPersonaOperation, createPersonaOperation, updatePersonaOperation, deletePersonaOperation, generatePersonasOperation, getJourneyOperation, createJourneyOperation, updateJourneyOperation, archiveJourneyOperation, generateJourneysOperation, getSwarmOverviewOperation, getJourneyRunScorecardOperation, listSwarmFindingsOperation, dismissSwarmFindingOperation, undismissSwarmFindingOperation, getWaveInsightsOperation, requestWaveInsightsOperation, cancelWaveInsightsOperation, listSwarmsOperation, getSwarmOperation, createSwarmOperation, updateSwarmOperation, archiveSwarmOperation, getUserTestingScenarioOperation, listUserTestingSessionsOperation, getUserTestingSessionOperation, getUserTestingMetricsOperation, getUserTestingUsageOperation, listUserTestingFindingsOperation, getUserTestingSignalsOperation, getUserTestingInsightsOperation, requestUserTestingInsightsOperation, cancelUserTestingInsightsOperation, dismissUserTestingFindingOperation, undismissUserTestingFindingOperation, updateUserTestingScenarioOperation, setUserTestingGuestExecutionOperation, rotateUserTestingLinkOperation, upsertUserTestingMemberOperation, removeUserTestingMemberOperation, rebindUserTestingScenarioOperation, searchSessionsOperation } from '@mcpjam/sdk/platform';
|
|
12
|
+
import { createProjectOperation, updateProjectOperation, deleteProjectOperation, connectProjectServerOperation, getProjectServerConnectionStatusOperation, listEvalSuiteRunsOperation, cancelEvalRunOperation, requestEvalRunJudgeOperation, listEvalCheckReposOperation, connectEvalCheckRepoOperation, listEvalRunIterationsOperation, getEvalIterationTraceOperation, getEvalRunStepsOperation, getEvalSuiteOperation, updateEvalSuiteOperation, deleteEvalSuiteOperation, setEvalSuiteScheduleOperation, setEvalSuiteEnvironmentsOperation, listEvalCasesOperation, getEvalCaseOperation, runEvalCaseOperation, createEvalCaseOperation, updateEvalCaseOperation, deleteEvalCaseOperation, generateEvalCasesOperation, listChatSessionsOperation, createHostOperation, updateHostOperation, setHostServersOperation, duplicateHostOperation, createEnvironmentOperation, ensureAdhocEnvironmentOperation, nameEnvironmentOperation, updateEnvironmentOperation, createImageOperation, validateImageBlueprintOperation, updateImageOperation, createTunnelOperation, DEFAULT_PLATFORM_API_BASE_URL, PlatformApiClient, isPlatformApiError, PlatformApiError, listOrganizationsOperation, listProjectsOperation, listProjectServersOperation, createProjectServerOperation, getProjectServerOperation, updateProjectServerOperation, deleteProjectServerOperation, showServersOperation, createEvalSuiteOperation, listEvalSuitesOperation, runEvalSuiteOperation, getEvalRunOperation, resolveProject, listHostsOperation, getHostOperation, deleteHostOperation, listEnvironmentsOperation, getEnvironmentOperation, resolveEnvironmentOperation, getEnvironmentCapabilitiesOperation, archiveEnvironmentOperation, restoreEnvironmentOperation, listJourneysOperation, listJourneyRunsOperation, getJourneyRunOperation, launchJourneyRunOperation, cancelJourneyRunOperation, listJourneyRunSessionsOperation, listScenariosOperation, getScenarioOperation, publishScenarioOperation, unpublishScenarioOperation, listImagesOperation, getImageOperation, buildImageOperation, listImageBuildsOperation, useImageOperation, resetComputerOperation, promoteImageOperation, deleteImageOperation, getCapabilitiesOperation, listPersonasOperation, getPersonaOperation, createPersonaOperation, updatePersonaOperation, deletePersonaOperation, generatePersonasOperation, getJourneyOperation, createJourneyOperation, updateJourneyOperation, archiveJourneyOperation, generateJourneysOperation, getSwarmOverviewOperation, getJourneyRunScorecardOperation, listSwarmFindingsOperation, dismissSwarmFindingOperation, undismissSwarmFindingOperation, getWaveInsightsOperation, requestWaveInsightsOperation, cancelWaveInsightsOperation, listSwarmsOperation, getSwarmOperation, createSwarmOperation, updateSwarmOperation, archiveSwarmOperation, getUserTestingScenarioOperation, listUserTestingSessionsOperation, getUserTestingSessionOperation, getUserTestingMetricsOperation, getUserTestingUsageOperation, listUserTestingFindingsOperation, getUserTestingSignalsOperation, getUserTestingInsightsOperation, requestUserTestingInsightsOperation, cancelUserTestingInsightsOperation, dismissUserTestingFindingOperation, undismissUserTestingFindingOperation, updateUserTestingScenarioOperation, setUserTestingGuestExecutionOperation, rotateUserTestingLinkOperation, upsertUserTestingMemberOperation, removeUserTestingMemberOperation, rebindUserTestingScenarioOperation, searchSessionsOperation, startClaudeReadinessRunOperation, startOpenAIReadinessRunOperation, getReadinessRunOperation, listReadinessRunsOperation, cancelReadinessRunOperation, getReadinessReportOperation } 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';
|
|
@@ -27,7 +27,7 @@ import { WebSocket } from 'ws';
|
|
|
27
27
|
|
|
28
28
|
// package.json
|
|
29
29
|
var package_default = {
|
|
30
|
-
version: "3.
|
|
30
|
+
version: "3.29.0"};
|
|
31
31
|
function conformanceExitCode(result) {
|
|
32
32
|
if (result.outcome === "incomplete") return 3;
|
|
33
33
|
if (result.outcome === "failed") return 1;
|
|
@@ -455,6 +455,37 @@ function renderConformanceReporterResult(result, reporter) {
|
|
|
455
455
|
function renderConformanceForCli(result, reporter, format) {
|
|
456
456
|
return reporter ? renderConformanceReporterResult(result, reporter) : renderConformanceResult(result, format);
|
|
457
457
|
}
|
|
458
|
+
async function maybeUploadSingleSuite(args) {
|
|
459
|
+
const shouldUpload = args.upload === true || args.requireUpload === true;
|
|
460
|
+
if (!shouldUpload) return;
|
|
461
|
+
const suiteReport = args.report ?? toConformanceReport(args.result);
|
|
462
|
+
const report = buildConformanceRunReport({
|
|
463
|
+
requestedSuites: [args.suiteKind],
|
|
464
|
+
reports: { [args.suiteKind]: suiteReport },
|
|
465
|
+
startedAt: Date.now() - (suiteReport.durationMs ?? 0)
|
|
466
|
+
});
|
|
467
|
+
try {
|
|
468
|
+
const uploaded = args.requireUpload ? await reportConformanceRun(report, {
|
|
469
|
+
serverUrl: args.serverUrl,
|
|
470
|
+
defaultSource: "cli"
|
|
471
|
+
}) : await reportConformanceRunSafely(report, {
|
|
472
|
+
serverUrl: args.serverUrl,
|
|
473
|
+
defaultSource: "cli"
|
|
474
|
+
});
|
|
475
|
+
if (uploaded?.runUrl && !args.command.optsWithGlobals().quiet) {
|
|
476
|
+
process.stderr.write(`Uploaded: ${uploaded.runUrl}
|
|
477
|
+
`);
|
|
478
|
+
}
|
|
479
|
+
if (args.requireUpload && !uploaded) {
|
|
480
|
+
throw new Error("Conformance upload did not return a run record");
|
|
481
|
+
}
|
|
482
|
+
} catch (error) {
|
|
483
|
+
if (args.requireUpload) throw error;
|
|
484
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
485
|
+
process.stderr.write(`Warning: conformance upload failed: ${message}
|
|
486
|
+
`);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
458
489
|
|
|
459
490
|
// src/lib/reporting.ts
|
|
460
491
|
function parseReporterFormat(value) {
|
|
@@ -766,8 +797,8 @@ function isAccessTokenUsable(contents, now) {
|
|
|
766
797
|
}
|
|
767
798
|
var readTextFile = (path8, encoding) => readFileSync(path8, encoding);
|
|
768
799
|
var JsonInputContext = class {
|
|
769
|
-
constructor(
|
|
770
|
-
this.readFile =
|
|
800
|
+
constructor(readFile3 = readTextFile) {
|
|
801
|
+
this.readFile = readFile3;
|
|
771
802
|
}
|
|
772
803
|
stdinConsumer;
|
|
773
804
|
readInputSource(value, label) {
|
|
@@ -2736,6 +2767,9 @@ function registerAppsCommands(program) {
|
|
|
2736
2767
|
).option(
|
|
2737
2768
|
"--protocol-version <version>",
|
|
2738
2769
|
"Pin the MCP protocol version for the conformance connection (e.g. 2026-07-28). HTTP targets only."
|
|
2770
|
+
).option("--upload", "Upload this suite's result into MCPJam run history").option(
|
|
2771
|
+
"--require-upload",
|
|
2772
|
+
"Fail if reporting is configured but the UI record cannot be written"
|
|
2739
2773
|
)
|
|
2740
2774
|
).action(async (options, command) => {
|
|
2741
2775
|
const reporter = parseReporterFormat(options.reporter);
|
|
@@ -2760,6 +2794,14 @@ function registerAppsCommands(program) {
|
|
|
2760
2794
|
);
|
|
2761
2795
|
reportScore(scoreFromAppsResult(result), command);
|
|
2762
2796
|
reportIncomplete(result, command);
|
|
2797
|
+
await maybeUploadSingleSuite({
|
|
2798
|
+
suiteKind: "apps",
|
|
2799
|
+
result,
|
|
2800
|
+
serverUrl: "url" in config && typeof config.url === "string" ? config.url : void 0,
|
|
2801
|
+
upload: Boolean(options.upload),
|
|
2802
|
+
requireUpload: Boolean(options.requireUpload),
|
|
2803
|
+
command
|
|
2804
|
+
});
|
|
2763
2805
|
const exitCode = conformanceExitCode(result);
|
|
2764
2806
|
if (exitCode !== 0) {
|
|
2765
2807
|
setProcessExitCode(exitCode);
|
|
@@ -8962,6 +9004,9 @@ function registerEvalCommands(program) {
|
|
|
8962
9004
|
).option("--simple <n>", "How many easy, single-tool cases").option("--multi-tool <n>", "How many medium, 2+ tool cases").option("--multi-turn <n>", "How many multi-turn follow-up cases").option("--complex <n>", "How many hard / cross-server cases").option("--negative <n>", "How many negative (no-tool) cases").option(
|
|
8963
9005
|
"--vary-user-styles",
|
|
8964
9006
|
"Vary query phrasing across a realistic range of user styles"
|
|
9007
|
+
).option(
|
|
9008
|
+
"--idempotency-key <key>",
|
|
9009
|
+
"Retry-safety key: repeating the call replays the first attempt's drafts instead of generating (and billing) again"
|
|
8965
9010
|
)
|
|
8966
9011
|
).action(
|
|
8967
9012
|
async (options, command) => {
|
|
@@ -8993,7 +9038,8 @@ function registerEvalCommands(program) {
|
|
|
8993
9038
|
...options.environment ? { environment: options.environment } : {},
|
|
8994
9039
|
...options.caseModel ? { caseModels: options.caseModel.map((model) => ({ model })) } : {},
|
|
8995
9040
|
...Object.keys(caseMix).length > 0 ? { caseMix } : {},
|
|
8996
|
-
...options.varyUserStyles ? { varyUserStyles: true } : {}
|
|
9041
|
+
...options.varyUserStyles ? { varyUserStyles: true } : {},
|
|
9042
|
+
...options.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : {}
|
|
8997
9043
|
});
|
|
8998
9044
|
await executeOp2(generateEvalCasesOperation, input, options, command);
|
|
8999
9045
|
}
|
|
@@ -10167,6 +10213,26 @@ async function runPlatformCommand10(options, timeoutMs, execute, externalSignal)
|
|
|
10167
10213
|
externalSignal?.removeEventListener("abort", onExternalAbort);
|
|
10168
10214
|
}
|
|
10169
10215
|
}
|
|
10216
|
+
async function resolveHandoffAudience(options, timeoutMs) {
|
|
10217
|
+
try {
|
|
10218
|
+
const { client, baseUrl } = buildPlatformClient({ ...options, timeoutMs });
|
|
10219
|
+
const origin = webOriginForApiBaseUrl(baseUrl);
|
|
10220
|
+
try {
|
|
10221
|
+
const me = await client.getMe();
|
|
10222
|
+
return { email: me.email ?? null, origin };
|
|
10223
|
+
} catch {
|
|
10224
|
+
return { email: null, origin };
|
|
10225
|
+
}
|
|
10226
|
+
} catch {
|
|
10227
|
+
return { email: null, origin: DEFAULT_PLATFORM_ORIGIN };
|
|
10228
|
+
}
|
|
10229
|
+
}
|
|
10230
|
+
function describeHandoffAudience(audience) {
|
|
10231
|
+
const host = new URL(audience.origin).host;
|
|
10232
|
+
return audience.email ? `This link belongs to ${audience.email} on ${host}. Open it in a browser signed in to that account.
|
|
10233
|
+
` : `This link belongs to the account this CLI is logged into, on ${host}. Open it in a browser signed in to that account \u2014 \`mcpjam whoami\` names it.
|
|
10234
|
+
`;
|
|
10235
|
+
}
|
|
10170
10236
|
function registerProjectsCommands(program) {
|
|
10171
10237
|
const projects = program.command("projects").description(
|
|
10172
10238
|
"Operate the MCP servers saved in your hosted MCPJam projects"
|
|
@@ -10388,6 +10454,11 @@ function registerProjectsCommands(program) {
|
|
|
10388
10454
|
${created.handoffUrl}
|
|
10389
10455
|
`
|
|
10390
10456
|
);
|
|
10457
|
+
process.stderr.write(
|
|
10458
|
+
describeHandoffAudience(
|
|
10459
|
+
await resolveHandoffAudience(platformOptions, globalOptions.timeout)
|
|
10460
|
+
)
|
|
10461
|
+
);
|
|
10391
10462
|
if (options.browser !== false) {
|
|
10392
10463
|
await openUrlInBrowser(created.handoffUrl).catch(() => {
|
|
10393
10464
|
process.stderr.write(
|
|
@@ -10570,6 +10641,9 @@ function registerProtocolCommands(program) {
|
|
|
10570
10641
|
).option(
|
|
10571
10642
|
"--reporter <reporter>",
|
|
10572
10643
|
"Structured reporter output: json-summary or junit-xml"
|
|
10644
|
+
).option("--upload", "Upload this suite's result into MCPJam run history").option(
|
|
10645
|
+
"--require-upload",
|
|
10646
|
+
"Fail if reporting is configured but the UI record cannot be written"
|
|
10573
10647
|
).action(async (options, command) => {
|
|
10574
10648
|
const reporter = parseReporterFormat(options.reporter);
|
|
10575
10649
|
const format = getFormat(command, reporter);
|
|
@@ -10579,6 +10653,14 @@ function registerProtocolCommands(program) {
|
|
|
10579
10653
|
reportScore(scoreFromProtocolResult(result), command);
|
|
10580
10654
|
reportReadiness(result, command);
|
|
10581
10655
|
reportIncomplete(result, command);
|
|
10656
|
+
await maybeUploadSingleSuite({
|
|
10657
|
+
suiteKind: "protocol",
|
|
10658
|
+
result,
|
|
10659
|
+
serverUrl: config.serverUrl,
|
|
10660
|
+
upload: Boolean(options.upload),
|
|
10661
|
+
requireUpload: Boolean(options.requireUpload),
|
|
10662
|
+
command
|
|
10663
|
+
});
|
|
10582
10664
|
const exitCode = conformanceExitCode(result);
|
|
10583
10665
|
if (exitCode !== 0) {
|
|
10584
10666
|
setProcessExitCode(exitCode);
|
|
@@ -10668,6 +10750,458 @@ function buildConfig(options) {
|
|
|
10668
10750
|
...protocolVersion ? { protocolVersion } : {}
|
|
10669
10751
|
};
|
|
10670
10752
|
}
|
|
10753
|
+
var SUITE_KINDS = [
|
|
10754
|
+
"protocol",
|
|
10755
|
+
"apps",
|
|
10756
|
+
"tasks",
|
|
10757
|
+
"oauth"
|
|
10758
|
+
];
|
|
10759
|
+
function writeConformanceOutput3(output) {
|
|
10760
|
+
process.stdout.write(output.endsWith("\n") ? output : `${output}
|
|
10761
|
+
`);
|
|
10762
|
+
}
|
|
10763
|
+
function registerConformanceRunCommand(program) {
|
|
10764
|
+
const conformance = program.command("conformance").description("Run MCPJam conformance suites and optionally upload results");
|
|
10765
|
+
addSharedServerOptions(
|
|
10766
|
+
conformance.command("run").description(
|
|
10767
|
+
"Run Protocol, Apps, and Tasks (default). OAuth is opt-in via --suite oauth."
|
|
10768
|
+
).option(
|
|
10769
|
+
"--suite <suite>",
|
|
10770
|
+
"Suite to run: protocol, apps, tasks, or oauth. Repeatable. Default: protocol, apps, tasks.",
|
|
10771
|
+
(value, previous = []) => [...previous, value],
|
|
10772
|
+
[]
|
|
10773
|
+
).option(
|
|
10774
|
+
"--upload",
|
|
10775
|
+
"Upload results even when MCPJAM_API_KEY is not otherwise implied"
|
|
10776
|
+
).option(
|
|
10777
|
+
"--require-upload",
|
|
10778
|
+
"Fail the process if reporting is configured but the UI record cannot be written"
|
|
10779
|
+
).option(
|
|
10780
|
+
"--oauth-strategy <strategy>",
|
|
10781
|
+
"Required when --suite oauth is set: client_credentials"
|
|
10782
|
+
).option("--reporter <reporter>", "json-summary or junit-xml")
|
|
10783
|
+
).action(async (options, command) => {
|
|
10784
|
+
const globalOptions = getGlobalOptions(command);
|
|
10785
|
+
const reporter = parseReporterFormat(
|
|
10786
|
+
options.reporter
|
|
10787
|
+
);
|
|
10788
|
+
const format = resolveConformanceOutputFormatForCli(
|
|
10789
|
+
globalOptions.format,
|
|
10790
|
+
process.stdout.isTTY,
|
|
10791
|
+
reporter
|
|
10792
|
+
);
|
|
10793
|
+
const suites = normalizeConformanceRunSuites(options.suite);
|
|
10794
|
+
const server = parseServerConfig({
|
|
10795
|
+
...options,
|
|
10796
|
+
timeout: globalOptions.timeout
|
|
10797
|
+
});
|
|
10798
|
+
if (!("url" in server) || typeof server.url !== "string") {
|
|
10799
|
+
throw usageError("conformance run requires an HTTP --url target");
|
|
10800
|
+
}
|
|
10801
|
+
let oauth;
|
|
10802
|
+
if (suites.includes("oauth")) {
|
|
10803
|
+
oauth = buildOAuthConfig(server, options);
|
|
10804
|
+
}
|
|
10805
|
+
const report = await runConformance({
|
|
10806
|
+
server,
|
|
10807
|
+
suites,
|
|
10808
|
+
oauth,
|
|
10809
|
+
engineVersion: package_default.version
|
|
10810
|
+
});
|
|
10811
|
+
if (reporter === "json-summary" || format === "json") {
|
|
10812
|
+
writeConformanceOutput3(JSON.stringify(report, null, 2));
|
|
10813
|
+
} else if (reporter === "junit-xml") {
|
|
10814
|
+
const { renderConformanceReportJUnitXml: renderConformanceReportJUnitXml2 } = await import('@mcpjam/sdk');
|
|
10815
|
+
const xml = Object.values(report.reports).map((suiteReport) => renderConformanceReportJUnitXml2(suiteReport)).join("\n");
|
|
10816
|
+
writeConformanceOutput3(xml);
|
|
10817
|
+
} else {
|
|
10818
|
+
for (const [kind, suiteReport] of Object.entries(report.reports)) {
|
|
10819
|
+
process.stderr.write(`
|
|
10820
|
+
== ${kind} ==
|
|
10821
|
+
`);
|
|
10822
|
+
writeConformanceOutput3(
|
|
10823
|
+
renderConformanceForCli(suiteReport, void 0, format)
|
|
10824
|
+
);
|
|
10825
|
+
}
|
|
10826
|
+
}
|
|
10827
|
+
reportScore(report.score, command);
|
|
10828
|
+
for (const suiteReport of Object.values(report.reports)) {
|
|
10829
|
+
reportIncomplete(suiteReport, command);
|
|
10830
|
+
}
|
|
10831
|
+
const shouldUpload = options.upload === true || options.requireUpload === true || isConformanceReportingConfigured();
|
|
10832
|
+
if (shouldUpload) {
|
|
10833
|
+
const serverUrl = String(server.url);
|
|
10834
|
+
try {
|
|
10835
|
+
const uploaded = options.requireUpload ? await reportConformanceRun(report, { serverUrl, defaultSource: "cli" }) : await reportConformanceRunSafely(report, {
|
|
10836
|
+
serverUrl,
|
|
10837
|
+
defaultSource: "cli"
|
|
10838
|
+
});
|
|
10839
|
+
if (uploaded?.runUrl && !command.optsWithGlobals().quiet) {
|
|
10840
|
+
process.stderr.write(`Uploaded: ${uploaded.runUrl}
|
|
10841
|
+
`);
|
|
10842
|
+
}
|
|
10843
|
+
if (options.requireUpload && !uploaded) {
|
|
10844
|
+
throw new Error("Conformance upload did not return a run record");
|
|
10845
|
+
}
|
|
10846
|
+
} catch (error) {
|
|
10847
|
+
if (options.requireUpload) {
|
|
10848
|
+
throw error;
|
|
10849
|
+
}
|
|
10850
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
10851
|
+
process.stderr.write(`Warning: conformance upload failed: ${message}
|
|
10852
|
+
`);
|
|
10853
|
+
}
|
|
10854
|
+
}
|
|
10855
|
+
const exitCode = conformanceExitCode({
|
|
10856
|
+
passed: report.outcome === "passed",
|
|
10857
|
+
outcome: report.outcome
|
|
10858
|
+
});
|
|
10859
|
+
if (exitCode !== 0) {
|
|
10860
|
+
setProcessExitCode(exitCode);
|
|
10861
|
+
}
|
|
10862
|
+
});
|
|
10863
|
+
}
|
|
10864
|
+
function normalizeConformanceRunSuites(raw) {
|
|
10865
|
+
if (!raw || raw.length === 0) return ["protocol", "apps", "tasks"];
|
|
10866
|
+
const out = [];
|
|
10867
|
+
for (const value of raw) {
|
|
10868
|
+
const suite = value.trim().toLowerCase();
|
|
10869
|
+
if (!SUITE_KINDS.includes(suite)) {
|
|
10870
|
+
throw usageError(
|
|
10871
|
+
`Unknown suite "${value}". Use protocol, apps, tasks, or oauth.`
|
|
10872
|
+
);
|
|
10873
|
+
}
|
|
10874
|
+
if (!out.includes(suite)) {
|
|
10875
|
+
out.push(suite);
|
|
10876
|
+
}
|
|
10877
|
+
}
|
|
10878
|
+
return out;
|
|
10879
|
+
}
|
|
10880
|
+
function buildOAuthConfig(server, options) {
|
|
10881
|
+
const strategy = options.oauthStrategy?.trim();
|
|
10882
|
+
if (strategy !== "client_credentials") {
|
|
10883
|
+
throw usageError(
|
|
10884
|
+
"OAuth on `conformance run` requires --oauth-strategy client_credentials and noninteractive credentials"
|
|
10885
|
+
);
|
|
10886
|
+
}
|
|
10887
|
+
if (!("url" in server) || typeof server.url !== "string") {
|
|
10888
|
+
throw usageError("OAuth conformance requires an HTTP --url");
|
|
10889
|
+
}
|
|
10890
|
+
const clientId = options.clientId?.trim();
|
|
10891
|
+
const clientSecret = options.clientSecret?.trim();
|
|
10892
|
+
if (!clientId || !clientSecret) {
|
|
10893
|
+
throw usageError(
|
|
10894
|
+
"OAuth client_credentials requires --client-id and --client-secret"
|
|
10895
|
+
);
|
|
10896
|
+
}
|
|
10897
|
+
return {
|
|
10898
|
+
serverUrl: server.url,
|
|
10899
|
+
protocolVersion: "2025-11-25",
|
|
10900
|
+
registrationStrategy: "preregistered",
|
|
10901
|
+
auth: {
|
|
10902
|
+
mode: "client_credentials",
|
|
10903
|
+
clientId,
|
|
10904
|
+
clientSecret
|
|
10905
|
+
}
|
|
10906
|
+
};
|
|
10907
|
+
}
|
|
10908
|
+
|
|
10909
|
+
// src/lib/directory-readiness-exit-code.ts
|
|
10910
|
+
function directoryReadinessExitCode(result) {
|
|
10911
|
+
switch (result.status) {
|
|
10912
|
+
case "ready":
|
|
10913
|
+
return 0;
|
|
10914
|
+
case "not-ready":
|
|
10915
|
+
return 1;
|
|
10916
|
+
default:
|
|
10917
|
+
return 3;
|
|
10918
|
+
}
|
|
10919
|
+
}
|
|
10920
|
+
function reportReadinessVerdict(result, command) {
|
|
10921
|
+
if (command.optsWithGlobals().quiet) return;
|
|
10922
|
+
const status = result.status ?? "unknown";
|
|
10923
|
+
const label = status === "ready" ? "READY" : status === "not-ready" ? "NOT READY" : "INCOMPLETE";
|
|
10924
|
+
const summary = result.summary ? ` \u2014 ${result.summary}` : "";
|
|
10925
|
+
process.stderr.write(`${label}${summary}
|
|
10926
|
+
`);
|
|
10927
|
+
}
|
|
10928
|
+
function reportReadinessGaps(result, command) {
|
|
10929
|
+
if (command.optsWithGlobals().quiet) return;
|
|
10930
|
+
const gaps = (result.lanes ?? []).filter(
|
|
10931
|
+
(lane) => (lane.coverage?.missingInputs?.length ?? 0) > 0 || (lane.coverage?.notEvaluated ?? 0) > 0
|
|
10932
|
+
);
|
|
10933
|
+
if (gaps.length === 0) return;
|
|
10934
|
+
process.stderr.write(`Gaps (${gaps.length}):
|
|
10935
|
+
`);
|
|
10936
|
+
for (const lane of gaps) {
|
|
10937
|
+
const inputs = lane.coverage?.missingInputs ?? [];
|
|
10938
|
+
const detail = inputs.length > 0 ? `supply ${inputs.join(", ")}` : `${lane.coverage?.notEvaluated} check(s) could not run`;
|
|
10939
|
+
process.stderr.write(` ${lane.lane}: ${detail}
|
|
10940
|
+
`);
|
|
10941
|
+
}
|
|
10942
|
+
}
|
|
10943
|
+
function getFormat2(command, reporter) {
|
|
10944
|
+
const opts = command.optsWithGlobals();
|
|
10945
|
+
return resolveConformanceOutputFormatForCli(
|
|
10946
|
+
opts.format,
|
|
10947
|
+
process.stdout.isTTY,
|
|
10948
|
+
reporter
|
|
10949
|
+
);
|
|
10950
|
+
}
|
|
10951
|
+
function writeReadinessOutput(output) {
|
|
10952
|
+
process.stdout.write(output.endsWith("\n") ? output : `${output}
|
|
10953
|
+
`);
|
|
10954
|
+
}
|
|
10955
|
+
function resolveAccessToken(options, target) {
|
|
10956
|
+
assertNoCredentialsFileAuthConflicts(options);
|
|
10957
|
+
if (options.credentialsFile) {
|
|
10958
|
+
return resolveCredentialsFileAccessToken(options.credentialsFile, target);
|
|
10959
|
+
}
|
|
10960
|
+
return options.accessToken?.trim() || void 0;
|
|
10961
|
+
}
|
|
10962
|
+
function requestHeaders(options, target) {
|
|
10963
|
+
const headers = { ...parseHeadersOption(options.header) ?? {} };
|
|
10964
|
+
const token = resolveAccessToken(options, target);
|
|
10965
|
+
if (token) headers.authorization = `Bearer ${token}`;
|
|
10966
|
+
return Object.keys(headers).length > 0 ? headers : void 0;
|
|
10967
|
+
}
|
|
10968
|
+
async function openPackage(path8) {
|
|
10969
|
+
let info;
|
|
10970
|
+
try {
|
|
10971
|
+
info = await stat(path8);
|
|
10972
|
+
} catch {
|
|
10973
|
+
throw usageError(`Package path "${path8}" does not exist.`);
|
|
10974
|
+
}
|
|
10975
|
+
if (info.isDirectory()) {
|
|
10976
|
+
return { source: createDirectoryPluginFileSource(path8) };
|
|
10977
|
+
}
|
|
10978
|
+
const bytes = new Uint8Array(await readFile(path8));
|
|
10979
|
+
return {
|
|
10980
|
+
source: await createZipPluginFileSource(bytes),
|
|
10981
|
+
// The RAW central directory, read before the zip library normalizes it:
|
|
10982
|
+
// the portal rejects backslashes, `..` and duplicate names, and a loader
|
|
10983
|
+
// that repairs those on the way in would grade a table with the
|
|
10984
|
+
// violations already fixed out of it.
|
|
10985
|
+
archive: await collectZipArchiveObservations(bytes)
|
|
10986
|
+
};
|
|
10987
|
+
}
|
|
10988
|
+
function assertModeInputs(mode, target, packagePath) {
|
|
10989
|
+
const shape = OPENAI_SUBMISSION_MODE_SHAPES[mode];
|
|
10990
|
+
if (shape.hasMcpServer && !target) {
|
|
10991
|
+
throw usageError(
|
|
10992
|
+
`Submission mode "${mode}" grades an MCP server; pass its URL as the argument.`
|
|
10993
|
+
);
|
|
10994
|
+
}
|
|
10995
|
+
if (!shape.hasMcpServer && target) {
|
|
10996
|
+
throw usageError(
|
|
10997
|
+
`Submission mode "${mode}" grades a package only; drop the URL argument.`
|
|
10998
|
+
);
|
|
10999
|
+
}
|
|
11000
|
+
if (shape.hasUploadedPackage && !packagePath) {
|
|
11001
|
+
throw usageError(
|
|
11002
|
+
`Submission mode "${mode}" grades an uploaded package; pass --package <dir|zip>.`
|
|
11003
|
+
);
|
|
11004
|
+
}
|
|
11005
|
+
if (!shape.hasUploadedPackage && packagePath) {
|
|
11006
|
+
throw usageError(
|
|
11007
|
+
`Submission mode "${mode}" does not upload a package; drop --package.`
|
|
11008
|
+
);
|
|
11009
|
+
}
|
|
11010
|
+
}
|
|
11011
|
+
async function runClaudeCheck(target, options, command) {
|
|
11012
|
+
const reporter = parseReporterFormat(options.reporter);
|
|
11013
|
+
const format = getFormat2(command, reporter);
|
|
11014
|
+
const evidence = await gatherClaudeReadinessEvidence({
|
|
11015
|
+
enteredUrl: target,
|
|
11016
|
+
// The global fetch, on purpose. A hosted run pins DNS because it dials on
|
|
11017
|
+
// somebody else's behalf from shared infrastructure; this one dials from
|
|
11018
|
+
// the developer's own machine, where pinning would only stop them from
|
|
11019
|
+
// grading a server on their own network.
|
|
11020
|
+
fetchFn: fetch,
|
|
11021
|
+
headers: requestHeaders(options, target),
|
|
11022
|
+
timeoutMs: options.timeout
|
|
11023
|
+
});
|
|
11024
|
+
const result = gradeClaudeReadiness(evidence);
|
|
11025
|
+
writeReadinessOutput(renderConformanceForCli(result, reporter, format));
|
|
11026
|
+
reportReadinessVerdict(result, command);
|
|
11027
|
+
reportReadinessGaps(result, command);
|
|
11028
|
+
const exitCode = directoryReadinessExitCode(result);
|
|
11029
|
+
if (exitCode !== 0) setProcessExitCode(exitCode);
|
|
11030
|
+
}
|
|
11031
|
+
async function runOpenAICheck(target, options, command) {
|
|
11032
|
+
const reporter = parseReporterFormat(options.reporter);
|
|
11033
|
+
const format = getFormat2(command, reporter);
|
|
11034
|
+
if (!options.submissionMode) {
|
|
11035
|
+
throw usageError(
|
|
11036
|
+
`--submission-mode is required and is never inferred. One of: ${OPENAI_SUBMISSION_MODES.join(
|
|
11037
|
+
", "
|
|
11038
|
+
)}.`
|
|
11039
|
+
);
|
|
11040
|
+
}
|
|
11041
|
+
if (!OPENAI_SUBMISSION_MODES.includes(
|
|
11042
|
+
options.submissionMode
|
|
11043
|
+
)) {
|
|
11044
|
+
throw usageError(
|
|
11045
|
+
`Unknown submission mode "${options.submissionMode}". One of: ${OPENAI_SUBMISSION_MODES.join(", ")}.`
|
|
11046
|
+
);
|
|
11047
|
+
}
|
|
11048
|
+
const mode = options.submissionMode;
|
|
11049
|
+
assertModeInputs(mode, target, options.package);
|
|
11050
|
+
const pkg = options.package ? await openPackage(options.package) : void 0;
|
|
11051
|
+
const evidence = await gatherOpenAIReadinessEvidence({
|
|
11052
|
+
// A package-only run has no server; the target names the artifact so the
|
|
11053
|
+
// report says what was graded.
|
|
11054
|
+
target: target ?? options.package ?? "package",
|
|
11055
|
+
mode,
|
|
11056
|
+
// Absent for a package-only run, and absent means "dialled nothing" rather
|
|
11057
|
+
// than "found nothing" — the wire lanes report their gaps.
|
|
11058
|
+
fetchFn: target ? fetch : void 0,
|
|
11059
|
+
headers: target ? requestHeaders(options, target) : void 0,
|
|
11060
|
+
timeoutMs: options.timeout,
|
|
11061
|
+
packageSource: pkg?.source,
|
|
11062
|
+
archive: pkg?.archive,
|
|
11063
|
+
// Without an XML parser the SVG assets are recorded as a gap rather than
|
|
11064
|
+
// graded, so it is passed even when no package is supplied — costing
|
|
11065
|
+
// nothing and removing one way to produce a quietly weaker grade.
|
|
11066
|
+
parseXml: xmldomParseXml
|
|
11067
|
+
});
|
|
11068
|
+
const result = gradeOpenAIReadiness(evidence);
|
|
11069
|
+
writeReadinessOutput(renderConformanceForCli(result, reporter, format));
|
|
11070
|
+
reportReadinessVerdict(result, command);
|
|
11071
|
+
reportReadinessGaps(result, command);
|
|
11072
|
+
const exitCode = directoryReadinessExitCode(result);
|
|
11073
|
+
if (exitCode !== 0) setProcessExitCode(exitCode);
|
|
11074
|
+
}
|
|
11075
|
+
function registerReadinessCommands(program) {
|
|
11076
|
+
const readiness = program.command("readiness").description("Grade a server or plugin against a publisher's directory");
|
|
11077
|
+
const check = readiness.command("check").description("Grade locally, without a MCPJam account (free)");
|
|
11078
|
+
check.command("claude").description("Grade an MCP server against Anthropic's connector directory").argument("<url>", "MCP server URL").option("--access-token <token>", "Bearer access token for the server").option(
|
|
11079
|
+
"--credentials-file <path>",
|
|
11080
|
+
"Load the access token from a file written by oauth login"
|
|
11081
|
+
).option(
|
|
11082
|
+
"--header <header>",
|
|
11083
|
+
'HTTP header in "Key: Value" format. Repeat to send multiple headers.',
|
|
11084
|
+
(value, previous = []) => [...previous, value],
|
|
11085
|
+
[]
|
|
11086
|
+
).option(
|
|
11087
|
+
"--timeout <ms>",
|
|
11088
|
+
"Per-request timeout in milliseconds",
|
|
11089
|
+
(value) => parsePositiveInteger(value, "Timeout")
|
|
11090
|
+
).option(
|
|
11091
|
+
"--reporter <reporter>",
|
|
11092
|
+
"Structured reporter output: json-summary or junit-xml"
|
|
11093
|
+
).action(async (url, options, command) => {
|
|
11094
|
+
await runClaudeCheck(url, options, command);
|
|
11095
|
+
});
|
|
11096
|
+
check.command("openai").description("Grade a server or plugin against OpenAI's app directory").argument(
|
|
11097
|
+
"[url]",
|
|
11098
|
+
"MCP server URL. Omit for a package-only submission shape."
|
|
11099
|
+
).requiredOption(
|
|
11100
|
+
"--submission-mode <mode>",
|
|
11101
|
+
`Declared submission shape: ${OPENAI_SUBMISSION_MODES.join(" | ")}`
|
|
11102
|
+
).option("--package <path>", "Plugin package directory or .zip to grade").option("--access-token <token>", "Bearer access token for the server").option(
|
|
11103
|
+
"--credentials-file <path>",
|
|
11104
|
+
"Load the access token from a file written by oauth login"
|
|
11105
|
+
).option(
|
|
11106
|
+
"--header <header>",
|
|
11107
|
+
'HTTP header in "Key: Value" format. Repeat to send multiple headers.',
|
|
11108
|
+
(value, previous = []) => [...previous, value],
|
|
11109
|
+
[]
|
|
11110
|
+
).option(
|
|
11111
|
+
"--timeout <ms>",
|
|
11112
|
+
"Per-request timeout in milliseconds",
|
|
11113
|
+
(value) => parsePositiveInteger(value, "Timeout")
|
|
11114
|
+
).option(
|
|
11115
|
+
"--reporter <reporter>",
|
|
11116
|
+
"Structured reporter output: json-summary or junit-xml"
|
|
11117
|
+
).action(
|
|
11118
|
+
async (url, options, command) => {
|
|
11119
|
+
await runOpenAICheck(url, options, command);
|
|
11120
|
+
}
|
|
11121
|
+
);
|
|
11122
|
+
registerHostedReadinessCommands(readiness);
|
|
11123
|
+
return readiness;
|
|
11124
|
+
}
|
|
11125
|
+
function registerHostedReadinessCommands(readiness) {
|
|
11126
|
+
const start = readiness.command("start").description("Start a hosted readiness run against a saved server");
|
|
11127
|
+
const startClaude = addProjectOption(
|
|
11128
|
+
start.command("claude").description("Grade a saved server against Anthropic's directory").requiredOption("--server <idOrName>", "Saved server to grade").option(
|
|
11129
|
+
"--ai-observations",
|
|
11130
|
+
"Add optional model observations. CONSUMES MCPJam credits."
|
|
11131
|
+
).option("--idempotency-key <key>", "Replay guard for a retried start")
|
|
11132
|
+
);
|
|
11133
|
+
bindOperation(
|
|
11134
|
+
startClaude,
|
|
11135
|
+
startClaudeReadinessRunOperation,
|
|
11136
|
+
(options) => ({
|
|
11137
|
+
project: options.project,
|
|
11138
|
+
server: options.server,
|
|
11139
|
+
...options.aiObservations ? { includeLlmObservations: true } : {},
|
|
11140
|
+
...options.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : {}
|
|
11141
|
+
})
|
|
11142
|
+
);
|
|
11143
|
+
const startOpenAI = addProjectOption(
|
|
11144
|
+
start.command("openai").description("Grade a saved server against OpenAI's directory").requiredOption("--server <idOrName>", "Saved server to grade").requiredOption(
|
|
11145
|
+
"--submission-mode <mode>",
|
|
11146
|
+
"Declared submission shape: mcp-only | mcp-imported-skills. Never inferred. Package shapes run locally \u2014 see `readiness check openai`."
|
|
11147
|
+
).option(
|
|
11148
|
+
"--ai-observations",
|
|
11149
|
+
"Add optional model observations. CONSUMES MCPJam credits."
|
|
11150
|
+
).option("--idempotency-key <key>", "Replay guard for a retried start")
|
|
11151
|
+
);
|
|
11152
|
+
bindOperation(
|
|
11153
|
+
startOpenAI,
|
|
11154
|
+
startOpenAIReadinessRunOperation,
|
|
11155
|
+
(options) => ({
|
|
11156
|
+
project: options.project,
|
|
11157
|
+
server: options.server,
|
|
11158
|
+
submissionMode: options.submissionMode,
|
|
11159
|
+
...options.aiObservations ? { includeLlmObservations: true } : {},
|
|
11160
|
+
...options.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : {}
|
|
11161
|
+
})
|
|
11162
|
+
);
|
|
11163
|
+
const status = addProjectOption(
|
|
11164
|
+
readiness.command("status").description("Read one hosted readiness run").requiredOption("--run <id>", "Readiness run id")
|
|
11165
|
+
);
|
|
11166
|
+
bindOperation(
|
|
11167
|
+
status,
|
|
11168
|
+
getReadinessRunOperation,
|
|
11169
|
+
(options) => ({ project: options.project, run: options.run })
|
|
11170
|
+
);
|
|
11171
|
+
const list = addProjectOption(
|
|
11172
|
+
readiness.command("list").description("List hosted readiness runs, newest first").option("--kind <publisher>", "Narrow to claude or openai").option("--server <idOrName>", "Narrow to one saved server").option(
|
|
11173
|
+
"--limit <n>",
|
|
11174
|
+
"Rows to return (1-100)",
|
|
11175
|
+
(value) => parsePositiveInteger(value, "Limit")
|
|
11176
|
+
)
|
|
11177
|
+
);
|
|
11178
|
+
bindOperation(
|
|
11179
|
+
list,
|
|
11180
|
+
listReadinessRunsOperation,
|
|
11181
|
+
(options) => ({
|
|
11182
|
+
project: options.project,
|
|
11183
|
+
...options.kind ? { readinessKind: options.kind } : {},
|
|
11184
|
+
...options.server ? { server: options.server } : {},
|
|
11185
|
+
...options.limit !== void 0 ? { limit: options.limit } : {}
|
|
11186
|
+
})
|
|
11187
|
+
);
|
|
11188
|
+
const cancel = addProjectOption(
|
|
11189
|
+
readiness.command("cancel").description("Stop a hosted readiness run that is still going").requiredOption("--run <id>", "Readiness run id")
|
|
11190
|
+
);
|
|
11191
|
+
bindOperation(
|
|
11192
|
+
cancel,
|
|
11193
|
+
cancelReadinessRunOperation,
|
|
11194
|
+
(options) => ({ project: options.project, run: options.run })
|
|
11195
|
+
);
|
|
11196
|
+
const report = addProjectOption(
|
|
11197
|
+
readiness.command("report").description("Read a finished hosted run's findings").requiredOption("--run <id>", "Readiness run id")
|
|
11198
|
+
);
|
|
11199
|
+
bindOperation(
|
|
11200
|
+
report,
|
|
11201
|
+
getReadinessReportOperation,
|
|
11202
|
+
(options) => ({ project: options.project, run: options.run })
|
|
11203
|
+
);
|
|
11204
|
+
}
|
|
10671
11205
|
function parseOAuthOutputFormat(value) {
|
|
10672
11206
|
if (value === "json" || value === "human") {
|
|
10673
11207
|
return value;
|
|
@@ -10932,6 +11466,9 @@ function registerOAuthCommands(program) {
|
|
|
10932
11466
|
).option(
|
|
10933
11467
|
"--credentials-out <path>",
|
|
10934
11468
|
"Write OAuth credentials to <path> (mode 0600); stdout output has secret fields redacted to [SAVED_TO_FILE]"
|
|
11469
|
+
).option("--upload", "Upload this suite's result into MCPJam run history").option(
|
|
11470
|
+
"--require-upload",
|
|
11471
|
+
"Fail if reporting is configured but the UI record cannot be written"
|
|
10935
11472
|
).option(
|
|
10936
11473
|
"--print-url",
|
|
10937
11474
|
"In interactive mode, print the consent URL to stderr instead of launching a browser"
|
|
@@ -10965,6 +11502,16 @@ function registerOAuthCommands(program) {
|
|
|
10965
11502
|
}
|
|
10966
11503
|
reportScore(scoreFromOAuthResult(result), command);
|
|
10967
11504
|
reportIncomplete(result, command);
|
|
11505
|
+
await maybeUploadSingleSuite({
|
|
11506
|
+
suiteKind: "oauth",
|
|
11507
|
+
result,
|
|
11508
|
+
serverUrl: options.url,
|
|
11509
|
+
upload: Boolean(options.upload),
|
|
11510
|
+
requireUpload: Boolean(
|
|
11511
|
+
options.requireUpload
|
|
11512
|
+
),
|
|
11513
|
+
command
|
|
11514
|
+
});
|
|
10968
11515
|
if (result.outcome === "failed") {
|
|
10969
11516
|
setProcessExitCode(1);
|
|
10970
11517
|
} else if (result.outcome === "incomplete") {
|
|
@@ -14173,6 +14720,9 @@ function registerTasksCommands(program) {
|
|
|
14173
14720
|
).option(
|
|
14174
14721
|
"--reporter <reporter>",
|
|
14175
14722
|
"Structured reporter output: json-summary or junit-xml"
|
|
14723
|
+
).option("--upload", "Upload this suite's result into MCPJam run history").option(
|
|
14724
|
+
"--require-upload",
|
|
14725
|
+
"Fail if reporting is configured but the UI record cannot be written"
|
|
14176
14726
|
)
|
|
14177
14727
|
).action(async (options, command) => {
|
|
14178
14728
|
const reporter = parseReporterFormat(
|
|
@@ -14208,6 +14758,16 @@ function registerTasksCommands(program) {
|
|
|
14208
14758
|
`);
|
|
14209
14759
|
}
|
|
14210
14760
|
const exitCode = tasksConformanceExitCode(result);
|
|
14761
|
+
await maybeUploadSingleSuite({
|
|
14762
|
+
suiteKind: "tasks",
|
|
14763
|
+
result,
|
|
14764
|
+
serverUrl: "url" in config && typeof config.url === "string" ? config.url : void 0,
|
|
14765
|
+
upload: Boolean(options.upload),
|
|
14766
|
+
requireUpload: Boolean(
|
|
14767
|
+
options.requireUpload
|
|
14768
|
+
),
|
|
14769
|
+
command
|
|
14770
|
+
});
|
|
14211
14771
|
if (exitCode !== 0) {
|
|
14212
14772
|
setProcessExitCode(exitCode);
|
|
14213
14773
|
}
|
|
@@ -16277,6 +16837,8 @@ async function main(argv = process.argv, dependencies = {}) {
|
|
|
16277
16837
|
registerOAuthCommands(program);
|
|
16278
16838
|
registerXaaCommands(program);
|
|
16279
16839
|
registerProtocolCommands(program);
|
|
16840
|
+
registerConformanceRunCommand(program);
|
|
16841
|
+
registerReadinessCommands(program);
|
|
16280
16842
|
registerAuthCommands(program);
|
|
16281
16843
|
registerOrganizationsCommands(program);
|
|
16282
16844
|
registerProjectsCommands(program);
|