@mcpjam/cli 3.12.0 → 3.14.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 +266 -8
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
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, validateToolCallResult, isCallToolResultError, buildToolCallValidationReport, listResources, readResource, listTools, listPrompts, getPrompt, MCPAppsConformanceTest, MCPAppsConformanceSuite, runOAuthLogin, OAuthConformanceTest, OAuthConformanceSuite, MCPConformanceTest, MCPConformanceSuite, withEphemeralClient, diffServerSnapshots, ServerSnapshotFormatError, renderStructuredRunJUnitXml, renderStructuredRunJson, toConformanceReport, renderConformanceReportJUnitXml, renderConformanceReportJson, formatOAuthConformanceHuman, formatOAuthConformanceSuiteHuman, fetchOAuthMetadata, executeOAuthProxy, executeDebugOAuthProxy, generateRandomString, generateCodeChallenge, createInteractiveAuthorizationSession, openUrlInBrowser, MCPClientManager, MCP_APPS_CHECK_CATEGORIES, MCP_APPS_CHECK_IDS, OAuthProxyError, MCP_CHECK_CATEGORIES, MCP_CHECK_IDS } from '@mcpjam/sdk';
|
|
5
|
+
import { probeMcpServer, redactSensitiveValue, runServerDoctor, collectServerSnapshot, serializeStableServerSnapshot, serializeServerSnapshot, buildServerDiffReport, validateToolCallResult, isCallToolResultError, buildToolCallValidationReport, listResources, readResource, listTools, listPrompts, getPrompt, MCPAppsConformanceTest, MCPAppsConformanceSuite, runOAuthLogin, OAuthConformanceTest, OAuthConformanceSuite, runXaaFlow, MCPConformanceTest, MCPConformanceSuite, withEphemeralClient, diffServerSnapshots, ServerSnapshotFormatError, renderStructuredRunJUnitXml, renderStructuredRunJson, toConformanceReport, renderConformanceReportJUnitXml, renderConformanceReportJson, formatOAuthConformanceHuman, formatOAuthConformanceSuiteHuman, fetchOAuthMetadata, executeOAuthProxy, executeDebugOAuthProxy, normalizeRegistrationStrategy, normalizeIdentityAssertionFormat, IDENTITY_ASSERTION_FORMATS, generateRandomString, generateCodeChallenge, createInteractiveAuthorizationSession, openUrlInBrowser, MCPClientManager, MCP_APPS_CHECK_CATEGORIES, MCP_APPS_CHECK_IDS, OAuthProxyError, MCP_CHECK_CATEGORIES, MCP_CHECK_IDS } 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';
|
|
@@ -10,7 +10,7 @@ import { spawn } from 'child_process';
|
|
|
10
10
|
import { createRequire } from 'module';
|
|
11
11
|
import os, { homedir } from 'os';
|
|
12
12
|
import { cancelEvalRunOperation, listEvalRunIterationsOperation, getEvalIterationTraceOperation, getEvalRunStepsOperation, getEvalSuiteOperation, updateEvalSuiteOperation, deleteEvalSuiteOperation, setEvalSuiteScheduleOperation, listEvalCasesOperation, getEvalCaseOperation, runEvalCaseOperation, createEvalCaseOperation, updateEvalCaseOperation, deleteEvalCaseOperation, generateEvalCasesOperation, createHostOperation, updateHostOperation, createEnvironmentOperation, updateEnvironmentOperation, createTunnelOperation, DEFAULT_PLATFORM_API_BASE_URL, PlatformApiClient, isPlatformApiError, PlatformApiError, listProjectsOperation, listProjectServersOperation, showServersOperation, createEvalSuiteOperation, listEvalSuitesOperation, runEvalSuiteOperation, getEvalRunOperation, listHostsOperation, getHostOperation, deleteHostOperation, listEnvironmentsOperation, getEnvironmentOperation, buildEnvironmentOperation, listEnvironmentBuildsOperation, useEnvironmentOperation, resetComputerOperation, promoteEnvironmentOperation, deleteEnvironmentOperation } from '@mcpjam/sdk/platform';
|
|
13
|
-
import { buildMarketHostProfiles, scanWidgetUsage, evaluateMarketHosts } from '@mcpjam/sdk/host-compat';
|
|
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';
|
|
16
16
|
import { StdioServerTransport, McpServer } from '@modelcontextprotocol/server';
|
|
@@ -23,7 +23,7 @@ import { WebSocket } from 'ws';
|
|
|
23
23
|
|
|
24
24
|
// package.json
|
|
25
25
|
var package_default = {
|
|
26
|
-
version: "3.
|
|
26
|
+
version: "3.14.0"};
|
|
27
27
|
|
|
28
28
|
// src/lib/output.ts
|
|
29
29
|
var DEFAULT_OUTPUT_FORMAT = "json";
|
|
@@ -3486,6 +3486,14 @@ async function withEphemeralManager(config, fn, options) {
|
|
|
3486
3486
|
|
|
3487
3487
|
// src/commands/compat.ts
|
|
3488
3488
|
var TOOLS_PAGE_CAP2 = 50;
|
|
3489
|
+
var CATALOG_FETCH_TIMEOUT_MS = 2500;
|
|
3490
|
+
async function resolveHostCatalog(options) {
|
|
3491
|
+
if (options.offline) return null;
|
|
3492
|
+
return fetchHostCompatCatalog({
|
|
3493
|
+
baseUrl: options.catalogUrl,
|
|
3494
|
+
timeoutMs: CATALOG_FETCH_TIMEOUT_MS
|
|
3495
|
+
});
|
|
3496
|
+
}
|
|
3489
3497
|
function registerCompatCommands(program) {
|
|
3490
3498
|
addRetryOptions(
|
|
3491
3499
|
addSharedServerOptions(
|
|
@@ -3496,21 +3504,28 @@ function registerCompatCommands(program) {
|
|
|
3496
3504
|
"Only report this host id. Repeat for several. Default: all.",
|
|
3497
3505
|
(value, previous = []) => [...previous, value],
|
|
3498
3506
|
[]
|
|
3507
|
+
).option(
|
|
3508
|
+
"--offline",
|
|
3509
|
+
"Skip the live host-catalog fetch and use the bundled catalog (zero MCPJam network)."
|
|
3510
|
+
).option(
|
|
3511
|
+
"--catalog-url <url>",
|
|
3512
|
+
"Base URL to fetch the live host catalog from. Default: the hosted MCPJam API."
|
|
3499
3513
|
)
|
|
3500
3514
|
)
|
|
3501
3515
|
).action(async (options, command) => {
|
|
3502
3516
|
const globalOptions = getGlobalOptions(command);
|
|
3503
3517
|
const retryPolicy = parseRetryPolicy(options);
|
|
3504
|
-
const
|
|
3518
|
+
const catalogResult = await resolveHostCatalog(options);
|
|
3519
|
+
const liveCatalog = catalogResult?.ok && catalogResult.source === "live" ? catalogResult.catalog : void 0;
|
|
3520
|
+
const catalogSource = liveCatalog ? "live" : "bundled";
|
|
3521
|
+
const validHostIds = (liveCatalog ? buildHostProfilesFromCatalog(liveCatalog) : buildMarketHostProfiles()).map((p) => p.id);
|
|
3505
3522
|
const requestedHosts = options.host;
|
|
3506
3523
|
const unknownHosts = requestedHosts.filter(
|
|
3507
3524
|
(id) => !validHostIds.includes(id)
|
|
3508
3525
|
);
|
|
3509
3526
|
if (unknownHosts.length > 0) {
|
|
3510
3527
|
throw usageError(
|
|
3511
|
-
`Unknown host id${unknownHosts.length === 1 ? "" : "s"}: ${unknownHosts.join(
|
|
3512
|
-
", "
|
|
3513
|
-
)}. Valid: ${validHostIds.join(", ")}`
|
|
3528
|
+
`Unknown host id${unknownHosts.length === 1 ? "" : "s"}: ${unknownHosts.join(", ")}. Valid: ${validHostIds.join(", ")}`
|
|
3514
3529
|
);
|
|
3515
3530
|
}
|
|
3516
3531
|
const config = parseServerConfig({
|
|
@@ -3539,7 +3554,8 @@ function registerCompatCommands(program) {
|
|
|
3539
3554
|
});
|
|
3540
3555
|
const { requirements, reports } = evaluateMarketHosts(toolsData, {
|
|
3541
3556
|
widgetUsage,
|
|
3542
|
-
toolsTruncated: truncated
|
|
3557
|
+
toolsTruncated: truncated,
|
|
3558
|
+
catalog: liveCatalog
|
|
3543
3559
|
});
|
|
3544
3560
|
const hostFilter = new Set(options.host);
|
|
3545
3561
|
const hosts = (hostFilter.size > 0 ? reports.filter((r) => hostFilter.has(r.hostId)) : reports).map((r) => ({
|
|
@@ -3553,6 +3569,11 @@ function registerCompatCommands(program) {
|
|
|
3553
3569
|
for (const h of hosts) summary[h.verdict] += 1;
|
|
3554
3570
|
return {
|
|
3555
3571
|
target: describeTarget(options),
|
|
3572
|
+
catalogSource,
|
|
3573
|
+
// Always present for a stable contract: the backend publish version
|
|
3574
|
+
// when live, else 0 (the "not a backend publish" sentinel) for the
|
|
3575
|
+
// bundled/offline fallback.
|
|
3576
|
+
catalogVersion: liveCatalog && catalogResult?.ok ? catalogResult.version : 0,
|
|
3556
3577
|
widgets: {
|
|
3557
3578
|
total: requirements.widgets.mcpAppsOnly.length + requirements.widgets.openaiAppsOnly.length + requirements.widgets.dual.length,
|
|
3558
3579
|
appOnly: requirements.appOnlyWidgets.length
|
|
@@ -3567,6 +3588,11 @@ function registerCompatCommands(program) {
|
|
|
3567
3588
|
retryPolicy
|
|
3568
3589
|
}
|
|
3569
3590
|
);
|
|
3591
|
+
if (!globalOptions.quiet) {
|
|
3592
|
+
const catalogNote = liveCatalog && catalogResult?.ok ? `host catalog: live v${catalogResult.version}` : `host catalog: bundled${options.offline ? " (--offline)" : ""}`;
|
|
3593
|
+
process.stderr.write(`\x1B[2m${catalogNote}\x1B[0m
|
|
3594
|
+
`);
|
|
3595
|
+
}
|
|
3570
3596
|
writeResult(result, globalOptions.format);
|
|
3571
3597
|
});
|
|
3572
3598
|
}
|
|
@@ -6517,6 +6543,237 @@ function statusToErrorCode(status) {
|
|
|
6517
6543
|
if (status === 504) return "TIMEOUT";
|
|
6518
6544
|
return "INTERNAL_ERROR";
|
|
6519
6545
|
}
|
|
6546
|
+
function registerXaaCommands(program) {
|
|
6547
|
+
const xaa = program.command("xaa").description(
|
|
6548
|
+
"Run the Cross-App Access (ID-JAG) debugger against an MCP server"
|
|
6549
|
+
);
|
|
6550
|
+
xaa.command("run").description(
|
|
6551
|
+
"Self-issue an ID-JAG, redeem it at the target authorization server (RFC 7523), and call the MCP server with the resulting access token"
|
|
6552
|
+
).requiredOption("--url <url>", "Target MCP server URL (the protected resource)").requiredOption(
|
|
6553
|
+
"--issuer-base-url <url>",
|
|
6554
|
+
"Origin the local mock IdP issues from (the AS must be able to fetch its JWKS from here to validate the ID-JAG)"
|
|
6555
|
+
).requiredOption("--sub <subject>", "Simulated end-user subject identifier").option(
|
|
6556
|
+
"--client-id <id>",
|
|
6557
|
+
"OAuth client the ID-JAG is issued for; also presented at redemption. Required for --registration preregistered (the default); rejected for dcr/cimd (the identity is derived)"
|
|
6558
|
+
).option(
|
|
6559
|
+
"--registration <method>",
|
|
6560
|
+
"Client-registration strategy: preregistered (default); dcr (RFC 7591 dynamic registration at the RAS \u2014 a diagnostic that simulates the IdP\u2192RAS client_id mapping and may leave a registration behind each run); or cimd (Client ID Metadata Document \u2014 public client, interop-only, not a recommended production posture)",
|
|
6561
|
+
parseRegistration
|
|
6562
|
+
).option(
|
|
6563
|
+
"--client-metadata-url <url>",
|
|
6564
|
+
"CIMD only: the Client ID Metadata Document URL to present as the client_id (default: the hosted XAA debugger document)"
|
|
6565
|
+
).option(
|
|
6566
|
+
"--authz-server-issuer <issuer>",
|
|
6567
|
+
"Target authorization-server issuer. When set, protected-resource metadata discovery is skipped"
|
|
6568
|
+
).option(
|
|
6569
|
+
"--token-endpoint <url>",
|
|
6570
|
+
"Authorization-server token endpoint. When set, AS-metadata discovery is skipped"
|
|
6571
|
+
).option("--email <email>", "Simulated end-user email claim").option("--client-secret <secret>", "OAuth client secret presented at redemption").option(
|
|
6572
|
+
"--token-endpoint-auth-method <method>",
|
|
6573
|
+
"Token endpoint client authentication: client_secret_basic, client_secret_post, or none (default: infer from metadata)",
|
|
6574
|
+
parseTokenEndpointAuthMethod
|
|
6575
|
+
).option(
|
|
6576
|
+
"--assertion-format <format>",
|
|
6577
|
+
"Identity assertion format the mock IdP mints: oidc (ID token, default) or saml (SAML 2.0 assertion)",
|
|
6578
|
+
parseAssertionFormat
|
|
6579
|
+
).option("--scopes <scopes>", "Space-separated scope string").option(
|
|
6580
|
+
"--https-only",
|
|
6581
|
+
"Reject non-HTTPS / private targets (default: allow http/localhost for local dev)"
|
|
6582
|
+
).action(async (options, command) => {
|
|
6583
|
+
const globalOptions = getGlobalOptions(command);
|
|
6584
|
+
const format = globalOptions.format;
|
|
6585
|
+
const config = buildXaaConfig(
|
|
6586
|
+
options,
|
|
6587
|
+
globalOptions.timeout
|
|
6588
|
+
);
|
|
6589
|
+
const isTTY = process.stderr.isTTY && !globalOptions.quiet;
|
|
6590
|
+
if (isTTY) {
|
|
6591
|
+
config.onProgress = (message) => {
|
|
6592
|
+
process.stderr.write(`\r\x1B[K${message}`);
|
|
6593
|
+
};
|
|
6594
|
+
}
|
|
6595
|
+
let result;
|
|
6596
|
+
try {
|
|
6597
|
+
result = await runXaaFlow(config);
|
|
6598
|
+
} finally {
|
|
6599
|
+
if (isTTY) {
|
|
6600
|
+
process.stderr.write("\r\x1B[K");
|
|
6601
|
+
}
|
|
6602
|
+
}
|
|
6603
|
+
if (!result) {
|
|
6604
|
+
throw cliError("INTERNAL_ERROR", "XAA flow did not return a result.");
|
|
6605
|
+
}
|
|
6606
|
+
writeResult(redactXaaResult(result), format);
|
|
6607
|
+
printRegistrationNotes(result, globalOptions.quiet);
|
|
6608
|
+
if (!result.completed) {
|
|
6609
|
+
setProcessExitCode(1);
|
|
6610
|
+
}
|
|
6611
|
+
});
|
|
6612
|
+
}
|
|
6613
|
+
function printRegistrationNotes(result, quiet) {
|
|
6614
|
+
if (quiet) return;
|
|
6615
|
+
const reg = result.registration;
|
|
6616
|
+
if (!reg) return;
|
|
6617
|
+
if (reg.strategy === "dcr" && reg.clientId) {
|
|
6618
|
+
const safeClientId = reg.clientId.replace(/[\u0000-\u001f\u007f-\u009f]/g, "");
|
|
6619
|
+
process.stderr.write(
|
|
6620
|
+
`Note: DCR is a RAS diagnostic \u2014 the CLI supplies the IdP\u2192RAS client_id mapping itself (simulated IdP), so a real enterprise IdP would still need to be told the RAS-minted client_id ("${safeClientId}"). Each run may leave another registration behind (no RFC 7592 cleanup).
|
|
6621
|
+
`
|
|
6622
|
+
);
|
|
6623
|
+
}
|
|
6624
|
+
if (reg.strategy === "cimd" && reg.warnings.some((w) => w.code === "public_client")) {
|
|
6625
|
+
process.stderr.write(
|
|
6626
|
+
`Note: public-client CIMD \u2014 interoperability passed, but the security posture is not recommended (ID-JAG draft-04 \xA79.1 recommends confidential clients / private_key_jwt).
|
|
6627
|
+
`
|
|
6628
|
+
);
|
|
6629
|
+
}
|
|
6630
|
+
}
|
|
6631
|
+
function redactXaaResult(result) {
|
|
6632
|
+
const rawIdJag = result.idJag?.token;
|
|
6633
|
+
const masked = result.idJag ? { ...result, idJag: { ...result.idJag, token: "[REDACTED]" } } : result;
|
|
6634
|
+
const scrubbed = redactSensitiveValue(masked);
|
|
6635
|
+
const afterRaw = rawIdJag ? replaceRawValue(scrubbed, rawIdJag) : scrubbed;
|
|
6636
|
+
return result.registration ? { ...afterRaw, registration: result.registration } : afterRaw;
|
|
6637
|
+
}
|
|
6638
|
+
function replaceRawValue(value, secret) {
|
|
6639
|
+
if (typeof value === "string") {
|
|
6640
|
+
return value.includes(secret) ? value.split(secret).join("[REDACTED]") : value;
|
|
6641
|
+
}
|
|
6642
|
+
if (Array.isArray(value)) {
|
|
6643
|
+
return value.map((entry) => replaceRawValue(entry, secret));
|
|
6644
|
+
}
|
|
6645
|
+
if (value && typeof value === "object") {
|
|
6646
|
+
return Object.fromEntries(
|
|
6647
|
+
Object.entries(value).map(([key, entryValue]) => [
|
|
6648
|
+
key,
|
|
6649
|
+
replaceRawValue(entryValue, secret)
|
|
6650
|
+
])
|
|
6651
|
+
);
|
|
6652
|
+
}
|
|
6653
|
+
return value;
|
|
6654
|
+
}
|
|
6655
|
+
function buildXaaConfig(options, timeoutMs) {
|
|
6656
|
+
const serverUrl = options.url.trim();
|
|
6657
|
+
assertValidUrl3(serverUrl, "server URL");
|
|
6658
|
+
const issuerBaseUrl = options.issuerBaseUrl.trim();
|
|
6659
|
+
assertValidUrl3(issuerBaseUrl, "issuer base URL");
|
|
6660
|
+
const subject = options.sub.trim();
|
|
6661
|
+
if (!subject) {
|
|
6662
|
+
throw usageError("--sub must not be empty.");
|
|
6663
|
+
}
|
|
6664
|
+
const strategy = options.registration ?? "preregistered";
|
|
6665
|
+
const isDynamic = strategy === "dcr" || strategy === "cimd";
|
|
6666
|
+
const clientId = options.clientId?.trim() || void 0;
|
|
6667
|
+
if (strategy === "preregistered" && !clientId) {
|
|
6668
|
+
throw usageError(
|
|
6669
|
+
"--client-id is required for the preregistered strategy (the default). Use --registration dcr or --registration cimd to obtain the client identity dynamically."
|
|
6670
|
+
);
|
|
6671
|
+
}
|
|
6672
|
+
if (isDynamic && clientId) {
|
|
6673
|
+
throw usageError(
|
|
6674
|
+
`--client-id must not be set with --registration ${strategy}: the client identity is ${strategy === "dcr" ? "minted by dynamic registration" : "the client-metadata-document URL"}.`
|
|
6675
|
+
);
|
|
6676
|
+
}
|
|
6677
|
+
if (isDynamic && options.clientSecret) {
|
|
6678
|
+
throw usageError(
|
|
6679
|
+
`--client-secret must not be set with --registration ${strategy}.`
|
|
6680
|
+
);
|
|
6681
|
+
}
|
|
6682
|
+
if (isDynamic && options.tokenEndpointAuthMethod) {
|
|
6683
|
+
throw usageError(
|
|
6684
|
+
`--token-endpoint-auth-method must not be set with --registration ${strategy}: the auth method is derived from ${strategy === "dcr" ? "the registration response" : "the metadata document"}.`
|
|
6685
|
+
);
|
|
6686
|
+
}
|
|
6687
|
+
const clientMetadataUrl = options.clientMetadataUrl?.trim() || void 0;
|
|
6688
|
+
if (clientMetadataUrl) {
|
|
6689
|
+
assertValidUrl3(clientMetadataUrl, "client metadata URL");
|
|
6690
|
+
if (strategy !== "cimd") {
|
|
6691
|
+
throw usageError(
|
|
6692
|
+
"--client-metadata-url is only valid with --registration cimd."
|
|
6693
|
+
);
|
|
6694
|
+
}
|
|
6695
|
+
}
|
|
6696
|
+
const authzServerIssuer = options.authzServerIssuer?.trim() || void 0;
|
|
6697
|
+
if (authzServerIssuer) {
|
|
6698
|
+
assertValidUrl3(authzServerIssuer, "authorization server issuer");
|
|
6699
|
+
}
|
|
6700
|
+
const tokenEndpoint = options.tokenEndpoint?.trim() || void 0;
|
|
6701
|
+
if (tokenEndpoint) {
|
|
6702
|
+
assertValidUrl3(tokenEndpoint, "token endpoint");
|
|
6703
|
+
if (isDynamic) {
|
|
6704
|
+
throw usageError(
|
|
6705
|
+
`--token-endpoint must not be set with --registration ${strategy}: it skips the authorization-server metadata discovery that ${strategy === "dcr" ? "DCR needs (registration_endpoint)" : "CIMD needs (client_id_metadata_document_supported)"}.`
|
|
6706
|
+
);
|
|
6707
|
+
}
|
|
6708
|
+
}
|
|
6709
|
+
if (timeoutMs !== void 0 && (!Number.isFinite(timeoutMs) || timeoutMs <= 0)) {
|
|
6710
|
+
throw usageError("--timeout must be a positive number.");
|
|
6711
|
+
}
|
|
6712
|
+
if (options.tokenEndpointAuthMethod !== "none" && options.tokenEndpointAuthMethod !== void 0 && !options.clientSecret) {
|
|
6713
|
+
throw usageError(
|
|
6714
|
+
`--token-endpoint-auth-method ${options.tokenEndpointAuthMethod} requires --client-secret.`
|
|
6715
|
+
);
|
|
6716
|
+
}
|
|
6717
|
+
return {
|
|
6718
|
+
serverUrl,
|
|
6719
|
+
issuerBaseUrl,
|
|
6720
|
+
subject,
|
|
6721
|
+
...clientId ? { clientId } : {},
|
|
6722
|
+
...strategy !== "preregistered" ? { registrationStrategy: strategy } : {},
|
|
6723
|
+
...clientMetadataUrl ? { clientIdMetadataUrl: clientMetadataUrl } : {},
|
|
6724
|
+
...authzServerIssuer ? { authzServerIssuer } : {},
|
|
6725
|
+
...tokenEndpoint ? { tokenEndpoint } : {},
|
|
6726
|
+
...options.email?.trim() ? { email: options.email.trim() } : {},
|
|
6727
|
+
...options.clientSecret ? { clientSecret: options.clientSecret } : {},
|
|
6728
|
+
...options.tokenEndpointAuthMethod ? { tokenEndpointAuthMethod: options.tokenEndpointAuthMethod } : {},
|
|
6729
|
+
// --assertion-format is a PRESET setting both identity axes together:
|
|
6730
|
+
// "saml" mints a SAML 2.0 assertion AND a saml-nameid `sub_id` in the
|
|
6731
|
+
// ID-JAG. "oidc" (the default) leaves both fields unset so the SDK's own
|
|
6732
|
+
// defaults ("oidc" / "oauth-sub") apply, matching how the other optionals
|
|
6733
|
+
// preserve undefined. Programmatic users can still mix the axes on
|
|
6734
|
+
// XaaFlowConfig directly.
|
|
6735
|
+
...options.assertionFormat === "saml" ? {
|
|
6736
|
+
identityAssertionFormat: "saml",
|
|
6737
|
+
subjectIdentifierFormat: "saml-nameid"
|
|
6738
|
+
} : {},
|
|
6739
|
+
...options.scopes?.trim() ? { scope: options.scopes.trim() } : {},
|
|
6740
|
+
...timeoutMs !== void 0 ? { timeoutMs } : {},
|
|
6741
|
+
httpsOnly: options.httpsOnly ?? false
|
|
6742
|
+
};
|
|
6743
|
+
}
|
|
6744
|
+
function parseRegistration(value) {
|
|
6745
|
+
const strategy = normalizeRegistrationStrategy(value);
|
|
6746
|
+
if (!strategy) {
|
|
6747
|
+
throw usageError(
|
|
6748
|
+
"--registration must be preregistered, dcr, or cimd."
|
|
6749
|
+
);
|
|
6750
|
+
}
|
|
6751
|
+
return strategy;
|
|
6752
|
+
}
|
|
6753
|
+
function parseTokenEndpointAuthMethod(value) {
|
|
6754
|
+
if (value === "client_secret_basic" || value === "client_secret_post" || value === "none") {
|
|
6755
|
+
return value;
|
|
6756
|
+
}
|
|
6757
|
+
throw usageError(
|
|
6758
|
+
"--token-endpoint-auth-method must be client_secret_basic, client_secret_post, or none."
|
|
6759
|
+
);
|
|
6760
|
+
}
|
|
6761
|
+
function parseAssertionFormat(value) {
|
|
6762
|
+
const normalized = normalizeIdentityAssertionFormat(value);
|
|
6763
|
+
if (normalized) {
|
|
6764
|
+
return normalized;
|
|
6765
|
+
}
|
|
6766
|
+
throw usageError(
|
|
6767
|
+
`--assertion-format must be ${IDENTITY_ASSERTION_FORMATS.join(" or ")}.`
|
|
6768
|
+
);
|
|
6769
|
+
}
|
|
6770
|
+
function assertValidUrl3(value, label) {
|
|
6771
|
+
try {
|
|
6772
|
+
new URL(value);
|
|
6773
|
+
} catch {
|
|
6774
|
+
throw usageError(`Invalid ${label}: ${value}`);
|
|
6775
|
+
}
|
|
6776
|
+
}
|
|
6520
6777
|
function registerPromptCommands(program) {
|
|
6521
6778
|
const prompts = program.command("prompts").description("List and fetch MCP prompts");
|
|
6522
6779
|
addHostOption(
|
|
@@ -9579,6 +9836,7 @@ async function main(argv = process.argv, dependencies = {}) {
|
|
|
9579
9836
|
registerPromptCommands(program);
|
|
9580
9837
|
registerAppsCommands(program);
|
|
9581
9838
|
registerOAuthCommands(program);
|
|
9839
|
+
registerXaaCommands(program);
|
|
9582
9840
|
registerProtocolCommands(program);
|
|
9583
9841
|
registerAuthCommands(program);
|
|
9584
9842
|
registerProjectsCommands(program);
|