@mcpjam/cli 3.17.0 → 3.19.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 +366 -106
- 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, redactSensitiveValue, runServerDoctor, collectServerSnapshot, serializeStableServerSnapshot, serializeServerSnapshot, buildServerDiffReport, validateToolCallResult, isCallToolResultError, buildToolCallValidationReport, listResources, readResource, SubscriptionCoordinator, listTools, listPrompts, getPrompt, MCPAppsConformanceTest, MCPAppsConformanceSuite, MCPTasksConformanceTest, runOAuthLogin, OAuthConformanceTest, OAuthConformanceSuite, runXaaFlow, MCPConformanceTest, MCPConformanceSuite, withEphemeralClient, diffServerSnapshots, ServerSnapshotFormatError, renderStructuredRunJUnitXml, renderStructuredRunJson, DEFAULT_SUBSCRIPTION_RECONNECT_POLICY, isKnownProtocolVersion, 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, 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, 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';
|
|
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, 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 { 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';
|
|
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,46 @@ import { WebSocket } from 'ws';
|
|
|
25
25
|
|
|
26
26
|
// package.json
|
|
27
27
|
var package_default = {
|
|
28
|
-
version: "3.
|
|
28
|
+
version: "3.19.0"};
|
|
29
|
+
function conformanceExitCode(result) {
|
|
30
|
+
if (result.outcome === "incomplete") return 3;
|
|
31
|
+
if (result.outcome === "failed") return 1;
|
|
32
|
+
return result.passed ? 0 : 1;
|
|
33
|
+
}
|
|
34
|
+
function conformanceSuiteExitCode(results) {
|
|
35
|
+
const codes = results.map(conformanceExitCode);
|
|
36
|
+
if (codes.includes(1)) return 1;
|
|
37
|
+
if (codes.includes(3)) return 3;
|
|
38
|
+
return 0;
|
|
39
|
+
}
|
|
40
|
+
function reportScore(score, command, label) {
|
|
41
|
+
if (score.score === null) return;
|
|
42
|
+
if (command.optsWithGlobals().quiet) return;
|
|
43
|
+
process.stderr.write(
|
|
44
|
+
`Score${label ? ` [${label}]` : ""}: ${describeConformanceScore(score)}
|
|
45
|
+
`
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
function reportReadiness(result, command) {
|
|
49
|
+
const readiness = result.readiness ?? [];
|
|
50
|
+
if (readiness.length === 0) return;
|
|
51
|
+
if (command.optsWithGlobals().quiet) return;
|
|
52
|
+
process.stderr.write(`Advice (${readiness.length}):
|
|
53
|
+
`);
|
|
54
|
+
for (const advice of readiness) {
|
|
55
|
+
process.stderr.write(
|
|
56
|
+
` [${advice.specStrength}] ${advice.title}: ${advice.message}
|
|
57
|
+
`
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function reportIncomplete(result, command) {
|
|
62
|
+
const reason = result.incompleteReason;
|
|
63
|
+
if (!reason) return;
|
|
64
|
+
if (command.optsWithGlobals().quiet) return;
|
|
65
|
+
process.stderr.write(`Run incomplete: ${reason}
|
|
66
|
+
`);
|
|
67
|
+
}
|
|
29
68
|
|
|
30
69
|
// src/lib/output.ts
|
|
31
70
|
var DEFAULT_OUTPUT_FORMAT = "json";
|
|
@@ -841,6 +880,23 @@ function addHostOption(command) {
|
|
|
841
880
|
"Connect as this host (e.g. claude, chatgpt, cursor) \u2014 sends its identity/capabilities/protocol and applies its tool visibility"
|
|
842
881
|
);
|
|
843
882
|
}
|
|
883
|
+
function addConformanceOptions(command) {
|
|
884
|
+
return command.option(
|
|
885
|
+
"--first-page-only",
|
|
886
|
+
"Read only the first page of paginated lists, like the real hosts that never follow nextCursor. On 2026-07-28 this also stops SEP-2243 Mcp-Param-* mirroring for tools past page one, because the mirroring source is the page-one-only list the client cached."
|
|
887
|
+
).option(
|
|
888
|
+
"--no-mrtr",
|
|
889
|
+
"Do NOT drive MRTR (resultType: input_required) rounds \u2014 call as a client that never implemented the 2026 pattern. Stops advertising elicitation on a modern connection, so a server that would have elicited answers -32021 instead."
|
|
890
|
+
);
|
|
891
|
+
}
|
|
892
|
+
function conformanceConfigFromOptions(options) {
|
|
893
|
+
return {
|
|
894
|
+
...options.firstPageOnly === true ? { firstPageOnly: true } : {},
|
|
895
|
+
// Commander defaults a `--no-x` flag to `true`, so only an explicit
|
|
896
|
+
// `false` means the user asked to disable MRTR.
|
|
897
|
+
...options.mrtr === false ? { supportsMrtr: false } : {}
|
|
898
|
+
};
|
|
899
|
+
}
|
|
844
900
|
function getGlobalOptions(command) {
|
|
845
901
|
const options = command.optsWithGlobals();
|
|
846
902
|
return {
|
|
@@ -2698,8 +2754,11 @@ function registerAppsCommands(program) {
|
|
|
2698
2754
|
writeConformanceOutput(
|
|
2699
2755
|
renderConformanceForCli(outputResult, reporter, globalOptions.format)
|
|
2700
2756
|
);
|
|
2701
|
-
|
|
2702
|
-
|
|
2757
|
+
reportScore(scoreFromAppsResult(result), command);
|
|
2758
|
+
reportIncomplete(result, command);
|
|
2759
|
+
const exitCode = conformanceExitCode(result);
|
|
2760
|
+
if (exitCode !== 0) {
|
|
2761
|
+
setProcessExitCode(exitCode);
|
|
2703
2762
|
}
|
|
2704
2763
|
});
|
|
2705
2764
|
addSharedServerOptions(
|
|
@@ -2947,8 +3006,13 @@ function registerAppsCommands(program) {
|
|
|
2947
3006
|
writeConformanceOutput(
|
|
2948
3007
|
renderConformanceForCli(outputResult, reporter, globalOptions.format)
|
|
2949
3008
|
);
|
|
2950
|
-
|
|
2951
|
-
|
|
3009
|
+
for (const run of result.results) {
|
|
3010
|
+
reportScore(scoreFromAppsResult(run), command, run.label);
|
|
3011
|
+
reportIncomplete(run, command);
|
|
3012
|
+
}
|
|
3013
|
+
const exitCode = conformanceSuiteExitCode(result.results);
|
|
3014
|
+
if (exitCode !== 0) {
|
|
3015
|
+
setProcessExitCode(exitCode);
|
|
2952
3016
|
}
|
|
2953
3017
|
});
|
|
2954
3018
|
}
|
|
@@ -3453,8 +3517,20 @@ function applyHostToConfig(config, host) {
|
|
|
3453
3517
|
...host.clientCapabilities ? { clientCapabilities: host.clientCapabilities } : {},
|
|
3454
3518
|
...host.supportedProtocolVersions ? { supportedProtocolVersions: host.supportedProtocolVersions } : {}
|
|
3455
3519
|
};
|
|
3456
|
-
const httpOnly = "url" in config
|
|
3457
|
-
|
|
3520
|
+
const httpOnly = "url" in config ? {
|
|
3521
|
+
...host.mcpProtocolVersion ? { mcpProtocolVersion: host.mcpProtocolVersion } : {},
|
|
3522
|
+
...host.mirrorToolParamHeaders === false ? { mirrorToolParamHeaders: false } : {}
|
|
3523
|
+
} : {};
|
|
3524
|
+
const conformance = {
|
|
3525
|
+
...host.firstPageOnly ? { firstPageOnly: true } : {},
|
|
3526
|
+
...host.supportsMrtr === false ? { supportsMrtr: false } : {}
|
|
3527
|
+
};
|
|
3528
|
+
return {
|
|
3529
|
+
...config,
|
|
3530
|
+
...identity,
|
|
3531
|
+
...httpOnly,
|
|
3532
|
+
...conformance
|
|
3533
|
+
};
|
|
3458
3534
|
}
|
|
3459
3535
|
function applyHostVisibility(tools, manager, serverId, policy) {
|
|
3460
3536
|
const record = {};
|
|
@@ -5062,8 +5138,11 @@ function registerEvalCommands(program) {
|
|
|
5062
5138
|
"--project <id-or-name>",
|
|
5063
5139
|
"Project name or ID (defaults to the most recently updated project)"
|
|
5064
5140
|
).option(
|
|
5065
|
-
"--server <name...>",
|
|
5141
|
+
"--server <id-or-name...>",
|
|
5066
5142
|
"Override the suite's saved server selection (HTTP servers only)"
|
|
5143
|
+
).option(
|
|
5144
|
+
"--environment <id-or-name>",
|
|
5145
|
+
"Project environment to run against (must be attached to the suite; optional when it has exactly one)"
|
|
5067
5146
|
)
|
|
5068
5147
|
).action(
|
|
5069
5148
|
async (options, command) => {
|
|
@@ -5075,7 +5154,8 @@ function registerEvalCommands(program) {
|
|
|
5075
5154
|
{
|
|
5076
5155
|
project: options.project,
|
|
5077
5156
|
suite: options.suite,
|
|
5078
|
-
...options.server ? { servers: options.server } : {}
|
|
5157
|
+
...options.server ? { servers: options.server } : {},
|
|
5158
|
+
...options.environment ? { environment: options.environment } : {}
|
|
5079
5159
|
},
|
|
5080
5160
|
{ client, signal }
|
|
5081
5161
|
)
|
|
@@ -5391,7 +5471,10 @@ function registerEvalCommands(program) {
|
|
|
5391
5471
|
}
|
|
5392
5472
|
);
|
|
5393
5473
|
addPlatformOptions3(
|
|
5394
|
-
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)")
|
|
5474
|
+
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
|
+
"--environment <id-or-name>",
|
|
5476
|
+
"Project environment the scheduled runs launch (only with --enable)"
|
|
5477
|
+
)
|
|
5395
5478
|
).action(
|
|
5396
5479
|
async (options, command) => {
|
|
5397
5480
|
if (options.enable && options.disable) {
|
|
@@ -5404,11 +5487,54 @@ function registerEvalCommands(program) {
|
|
|
5404
5487
|
project: options.project,
|
|
5405
5488
|
suite: options.suite,
|
|
5406
5489
|
enabled: Boolean(options.enable),
|
|
5407
|
-
...options.interval !== void 0 ? { intervalMinutes: Number(options.interval) } : {}
|
|
5490
|
+
...options.interval !== void 0 ? { intervalMinutes: Number(options.interval) } : {},
|
|
5491
|
+
...options.environment ? { environment: options.environment } : {}
|
|
5408
5492
|
});
|
|
5409
5493
|
await executeOp(setEvalSuiteScheduleOperation, input, options, command);
|
|
5410
5494
|
}
|
|
5411
5495
|
);
|
|
5496
|
+
const environments = evals.command("environments").description(
|
|
5497
|
+
"Attach or detach the project environments an eval suite runs against"
|
|
5498
|
+
);
|
|
5499
|
+
addPlatformOptions3(
|
|
5500
|
+
environments.command("set").description(
|
|
5501
|
+
"Replace the suite's attached environments (this sets the whole list)"
|
|
5502
|
+
).requiredOption("--suite <id-or-name>", "Eval suite name or ID").requiredOption(
|
|
5503
|
+
"--environment <id-or-name...>",
|
|
5504
|
+
"Project environments to attach, in order"
|
|
5505
|
+
).option("--project <id-or-name>", PROJECT_OPT)
|
|
5506
|
+
).action(
|
|
5507
|
+
async (options, command) => {
|
|
5508
|
+
await executeOp(
|
|
5509
|
+
setEvalSuiteEnvironmentsOperation,
|
|
5510
|
+
{
|
|
5511
|
+
project: options.project,
|
|
5512
|
+
suite: options.suite,
|
|
5513
|
+
environments: options.environment
|
|
5514
|
+
},
|
|
5515
|
+
options,
|
|
5516
|
+
command
|
|
5517
|
+
);
|
|
5518
|
+
}
|
|
5519
|
+
);
|
|
5520
|
+
addPlatformOptions3(
|
|
5521
|
+
environments.command("clear").description(
|
|
5522
|
+
"Detach every environment, reverting the suite to its saved server selection"
|
|
5523
|
+
).requiredOption("--suite <id-or-name>", "Eval suite name or ID").option("--project <id-or-name>", PROJECT_OPT)
|
|
5524
|
+
).action(
|
|
5525
|
+
async (options, command) => {
|
|
5526
|
+
await executeOp(
|
|
5527
|
+
setEvalSuiteEnvironmentsOperation,
|
|
5528
|
+
{
|
|
5529
|
+
project: options.project,
|
|
5530
|
+
suite: options.suite,
|
|
5531
|
+
environments: null
|
|
5532
|
+
},
|
|
5533
|
+
options,
|
|
5534
|
+
command
|
|
5535
|
+
);
|
|
5536
|
+
}
|
|
5537
|
+
);
|
|
5412
5538
|
const cases = evals.command("cases").description("List, author, and edit an eval suite's test cases");
|
|
5413
5539
|
addPlatformOptions3(
|
|
5414
5540
|
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)
|
|
@@ -5440,6 +5566,9 @@ function registerEvalCommands(program) {
|
|
|
5440
5566
|
).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(
|
|
5441
5567
|
"--server <id-or-name...>",
|
|
5442
5568
|
"Override the suite's saved servers for this run"
|
|
5569
|
+
).option(
|
|
5570
|
+
"--environment <id-or-name>",
|
|
5571
|
+
"Project environment to run against (must be attached to the suite)"
|
|
5443
5572
|
)
|
|
5444
5573
|
).action(
|
|
5445
5574
|
async (options, command) => {
|
|
@@ -5449,7 +5578,8 @@ function registerEvalCommands(program) {
|
|
|
5449
5578
|
project: options.project,
|
|
5450
5579
|
suite: options.suite,
|
|
5451
5580
|
case: options.case,
|
|
5452
|
-
...options.server?.length ? { servers: options.server } : {}
|
|
5581
|
+
...options.server?.length ? { servers: options.server } : {},
|
|
5582
|
+
...options.environment ? { environment: options.environment } : {}
|
|
5453
5583
|
},
|
|
5454
5584
|
options,
|
|
5455
5585
|
command
|
|
@@ -5490,8 +5620,11 @@ function registerEvalCommands(program) {
|
|
|
5490
5620
|
cases.command("generate").description(
|
|
5491
5621
|
"AI-generate test cases from the suite's tools (spends credits)"
|
|
5492
5622
|
).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(
|
|
5493
|
-
"--server <name...>",
|
|
5623
|
+
"--server <id-or-name...>",
|
|
5494
5624
|
"Servers to discover tools from (default: suite's)"
|
|
5625
|
+
).option(
|
|
5626
|
+
"--environment <id-or-name>",
|
|
5627
|
+
"Discover tools from this attached environment's server set"
|
|
5495
5628
|
).option(
|
|
5496
5629
|
"--case-model <id...>",
|
|
5497
5630
|
"Execution model(s) for the generated cases"
|
|
@@ -5526,6 +5659,7 @@ function registerEvalCommands(program) {
|
|
|
5526
5659
|
suite: options.suite,
|
|
5527
5660
|
...options.mode ? { mode: options.mode } : {},
|
|
5528
5661
|
...options.server ? { servers: options.server } : {},
|
|
5662
|
+
...options.environment ? { environment: options.environment } : {},
|
|
5529
5663
|
...options.caseModel ? { caseModels: options.caseModel.map((model) => ({ model })) } : {},
|
|
5530
5664
|
...Object.keys(caseMix).length > 0 ? { caseMix } : {},
|
|
5531
5665
|
...options.varyUserStyles ? { varyUserStyles: true } : {}
|
|
@@ -6593,8 +6727,12 @@ function registerProtocolCommands(program) {
|
|
|
6593
6727
|
const config = buildConfig(options);
|
|
6594
6728
|
const result = await new MCPConformanceTest(config).run();
|
|
6595
6729
|
writeConformanceOutput2(renderConformanceForCli(result, reporter, format));
|
|
6596
|
-
|
|
6597
|
-
|
|
6730
|
+
reportScore(scoreFromProtocolResult(result), command);
|
|
6731
|
+
reportReadiness(result, command);
|
|
6732
|
+
reportIncomplete(result, command);
|
|
6733
|
+
const exitCode = conformanceExitCode(result);
|
|
6734
|
+
if (exitCode !== 0) {
|
|
6735
|
+
setProcessExitCode(exitCode);
|
|
6598
6736
|
}
|
|
6599
6737
|
});
|
|
6600
6738
|
protocol.command("conformance-suite").description(
|
|
@@ -6608,8 +6746,14 @@ function registerProtocolCommands(program) {
|
|
|
6608
6746
|
const config = loadProtocolSuiteConfig(options.config);
|
|
6609
6747
|
const result = await new MCPConformanceSuite(config).run();
|
|
6610
6748
|
writeConformanceOutput2(renderConformanceForCli(result, reporter, format));
|
|
6611
|
-
|
|
6612
|
-
|
|
6749
|
+
for (const run of result.results) {
|
|
6750
|
+
reportScore(scoreFromProtocolResult(run), command, run.label);
|
|
6751
|
+
reportReadiness(run, command);
|
|
6752
|
+
reportIncomplete(run, command);
|
|
6753
|
+
}
|
|
6754
|
+
const exitCode = conformanceSuiteExitCode(result.results);
|
|
6755
|
+
if (exitCode !== 0) {
|
|
6756
|
+
setProcessExitCode(exitCode);
|
|
6613
6757
|
}
|
|
6614
6758
|
});
|
|
6615
6759
|
}
|
|
@@ -6970,8 +7114,12 @@ function registerOAuthCommands(program) {
|
|
|
6970
7114
|
if (credentialsFileError) {
|
|
6971
7115
|
throw credentialsFileError;
|
|
6972
7116
|
}
|
|
6973
|
-
|
|
7117
|
+
reportScore(scoreFromOAuthResult(result), command);
|
|
7118
|
+
reportIncomplete(result, command);
|
|
7119
|
+
if (result.outcome === "failed") {
|
|
6974
7120
|
setProcessExitCode(1);
|
|
7121
|
+
} else if (result.outcome === "incomplete") {
|
|
7122
|
+
setProcessExitCode(3);
|
|
6975
7123
|
}
|
|
6976
7124
|
});
|
|
6977
7125
|
oauth.command("conformance-suite").description(
|
|
@@ -7029,8 +7177,17 @@ function registerOAuthCommands(program) {
|
|
|
7029
7177
|
if (credentialsFileError) {
|
|
7030
7178
|
throw credentialsFileError;
|
|
7031
7179
|
}
|
|
7032
|
-
|
|
7180
|
+
for (const run of result.results) {
|
|
7181
|
+
reportScore(scoreFromOAuthResult(run), command, run.label);
|
|
7182
|
+
reportIncomplete(run, command);
|
|
7183
|
+
}
|
|
7184
|
+
const flowOutcomes = result.results.map(
|
|
7185
|
+
(run) => run.outcome ?? (run.passed ? "passed" : "failed")
|
|
7186
|
+
);
|
|
7187
|
+
if (flowOutcomes.includes("failed")) {
|
|
7033
7188
|
setProcessExitCode(1);
|
|
7189
|
+
} else if (flowOutcomes.includes("incomplete")) {
|
|
7190
|
+
setProcessExitCode(3);
|
|
7034
7191
|
}
|
|
7035
7192
|
});
|
|
7036
7193
|
oauth.command("metadata").description("Fetch OAuth metadata from a URL").requiredOption("--url <url>", "OAuth metadata URL").action(async (options, command) => {
|
|
@@ -9759,11 +9916,7 @@ var TASKS_CHECK_IDS_BY_CATEGORY = {
|
|
|
9759
9916
|
"tasks-undeclared-capability-rejected"
|
|
9760
9917
|
]
|
|
9761
9918
|
};
|
|
9762
|
-
|
|
9763
|
-
if (result.outcome === "incomplete") return 3;
|
|
9764
|
-
if (result.outcome === "failed") return 1;
|
|
9765
|
-
return result.passed ? 0 : 1;
|
|
9766
|
-
}
|
|
9919
|
+
var tasksConformanceExitCode = conformanceExitCode;
|
|
9767
9920
|
function collectInvalidEntries3(values, allowed) {
|
|
9768
9921
|
return (values ?? []).filter((value) => !allowed.includes(value));
|
|
9769
9922
|
}
|
|
@@ -10199,6 +10352,7 @@ function registerTasksCommands(program) {
|
|
|
10199
10352
|
const output = renderConformanceForCli(outputResult, reporter, format);
|
|
10200
10353
|
process.stdout.write(output.endsWith("\n") ? output : `${output}
|
|
10201
10354
|
`);
|
|
10355
|
+
reportScore(scoreFromTasksResult(result), command);
|
|
10202
10356
|
const incompleteReason = result.incompleteReason;
|
|
10203
10357
|
if (incompleteReason && !globalOptions.quiet) {
|
|
10204
10358
|
process.stderr.write(`Run incomplete: ${incompleteReason}
|
|
@@ -10210,6 +10364,55 @@ function registerTasksCommands(program) {
|
|
|
10210
10364
|
}
|
|
10211
10365
|
});
|
|
10212
10366
|
}
|
|
10367
|
+
function parseMcpHeaderOption(values) {
|
|
10368
|
+
if (!values || values.length === 0) return void 0;
|
|
10369
|
+
const out = {};
|
|
10370
|
+
for (const entry of values) {
|
|
10371
|
+
const index = entry.indexOf("=");
|
|
10372
|
+
if (index <= 0) {
|
|
10373
|
+
throw usageError(
|
|
10374
|
+
`--mcp-header must be in "Name=Value" format (got "${entry}").`
|
|
10375
|
+
);
|
|
10376
|
+
}
|
|
10377
|
+
const name = entry.slice(0, index).trim();
|
|
10378
|
+
if (name === "") {
|
|
10379
|
+
throw usageError(
|
|
10380
|
+
`--mcp-header must be in "Name=Value" format (got "${entry}").`
|
|
10381
|
+
);
|
|
10382
|
+
}
|
|
10383
|
+
out[name] = entry.slice(index + 1);
|
|
10384
|
+
}
|
|
10385
|
+
return out;
|
|
10386
|
+
}
|
|
10387
|
+
function createMcpParamHeaderProbe() {
|
|
10388
|
+
let captured;
|
|
10389
|
+
return {
|
|
10390
|
+
httpLogger: (event) => {
|
|
10391
|
+
if (captured !== void 0) return;
|
|
10392
|
+
if (event.bodyValues?.method !== "tools/call") return;
|
|
10393
|
+
const params = {};
|
|
10394
|
+
for (const [name, value] of Object.entries(event.request.headers)) {
|
|
10395
|
+
if (classifyMcpHeader(name) === "param") {
|
|
10396
|
+
const decoded = decodeMcpHeaderValue(value);
|
|
10397
|
+
params[name] = decoded.decodeError ? value : decoded.value;
|
|
10398
|
+
}
|
|
10399
|
+
}
|
|
10400
|
+
captured = params;
|
|
10401
|
+
},
|
|
10402
|
+
mirrored: () => captured
|
|
10403
|
+
};
|
|
10404
|
+
}
|
|
10405
|
+
function reportMirroredParamHeaders(probe, globalOptions) {
|
|
10406
|
+
if (!probe || globalOptions.quiet) return;
|
|
10407
|
+
process.stderr.write(`${describeMirroredParamHeaders(probe.mirrored())}
|
|
10408
|
+
`);
|
|
10409
|
+
}
|
|
10410
|
+
function describeMirroredParamHeaders(mirrored) {
|
|
10411
|
+
if (mirrored === void 0) return "Mcp-Param-*: none (no HTTP tools/call observed)";
|
|
10412
|
+
const entries = Object.entries(mirrored);
|
|
10413
|
+
if (entries.length === 0) return "Mcp-Param-*: none sent";
|
|
10414
|
+
return `Mcp-Param-*: ${entries.map(([name, value]) => `${name}=${value}`).join(", ")}`;
|
|
10415
|
+
}
|
|
10213
10416
|
async function runTaskAugmentedToolCall(args) {
|
|
10214
10417
|
const {
|
|
10215
10418
|
options,
|
|
@@ -10378,7 +10581,9 @@ function registerToolsCommands(program) {
|
|
|
10378
10581
|
addHostOption(
|
|
10379
10582
|
addRetryOptions(
|
|
10380
10583
|
addSharedServerOptions(
|
|
10381
|
-
|
|
10584
|
+
addConformanceOptions(
|
|
10585
|
+
tools.command("list").description("List tools exposed by an MCP server").option("--cursor <cursor>", "Pagination cursor").option("--model-id <model>", "Model id used for token counting")
|
|
10586
|
+
)
|
|
10382
10587
|
)
|
|
10383
10588
|
)
|
|
10384
10589
|
).action(async (options, command) => {
|
|
@@ -10387,10 +10592,13 @@ function registerToolsCommands(program) {
|
|
|
10387
10592
|
const host = resolveHostFromOptions(options);
|
|
10388
10593
|
const target = describeTarget(options);
|
|
10389
10594
|
const collector = globalOptions.rpc ? createCliRpcLogCollector({ __cli__: target }) : void 0;
|
|
10390
|
-
const config =
|
|
10391
|
-
...
|
|
10392
|
-
|
|
10393
|
-
|
|
10595
|
+
const config = {
|
|
10596
|
+
...parseServerConfig({
|
|
10597
|
+
...options,
|
|
10598
|
+
timeout: globalOptions.timeout
|
|
10599
|
+
}),
|
|
10600
|
+
...conformanceConfigFromOptions(options)
|
|
10601
|
+
};
|
|
10394
10602
|
const result = await withEphemeralManager(
|
|
10395
10603
|
config,
|
|
10396
10604
|
async (manager, serverId) => {
|
|
@@ -10437,68 +10645,78 @@ function registerToolsCommands(program) {
|
|
|
10437
10645
|
addHostOption(
|
|
10438
10646
|
addSharedServerOptions(
|
|
10439
10647
|
addTaskWatchTuningOptions(
|
|
10440
|
-
|
|
10441
|
-
"--
|
|
10442
|
-
|
|
10443
|
-
|
|
10444
|
-
|
|
10445
|
-
|
|
10446
|
-
|
|
10447
|
-
|
|
10448
|
-
|
|
10449
|
-
|
|
10450
|
-
"--
|
|
10451
|
-
|
|
10452
|
-
|
|
10453
|
-
|
|
10454
|
-
|
|
10455
|
-
|
|
10456
|
-
|
|
10457
|
-
|
|
10458
|
-
|
|
10459
|
-
|
|
10460
|
-
|
|
10461
|
-
|
|
10462
|
-
|
|
10463
|
-
|
|
10464
|
-
|
|
10465
|
-
|
|
10466
|
-
|
|
10467
|
-
|
|
10468
|
-
|
|
10469
|
-
|
|
10470
|
-
|
|
10471
|
-
|
|
10472
|
-
|
|
10473
|
-
|
|
10474
|
-
|
|
10475
|
-
|
|
10476
|
-
|
|
10477
|
-
|
|
10478
|
-
|
|
10479
|
-
|
|
10480
|
-
|
|
10481
|
-
|
|
10482
|
-
|
|
10483
|
-
|
|
10484
|
-
|
|
10485
|
-
|
|
10486
|
-
|
|
10487
|
-
|
|
10488
|
-
|
|
10489
|
-
|
|
10490
|
-
|
|
10491
|
-
|
|
10492
|
-
|
|
10493
|
-
|
|
10494
|
-
|
|
10495
|
-
|
|
10496
|
-
|
|
10497
|
-
"
|
|
10498
|
-
|
|
10499
|
-
|
|
10500
|
-
|
|
10501
|
-
|
|
10648
|
+
addConformanceOptions(
|
|
10649
|
+
tools.command("call").description("Call an MCP tool").option("--tool-name <tool>", "Tool name").option("--name <tool>", "Alias for --tool-name").option(
|
|
10650
|
+
"--interactive",
|
|
10651
|
+
"Drive the modern input_required (multi-round-trip) loop: render embedded elicitations to the terminal and collect responses from stdin"
|
|
10652
|
+
).option(
|
|
10653
|
+
"--yes",
|
|
10654
|
+
"With --interactive, run non-interactively: decline every embedded input request instead of prompting"
|
|
10655
|
+
).option(
|
|
10656
|
+
"--tool-args <json>",
|
|
10657
|
+
"Tool parameter object as JSON, @path, or - for stdin"
|
|
10658
|
+
).option("--params <json>", "Alias for --tool-args").option("--tool-args-stdin", "Read tool parameter JSON from stdin").option(
|
|
10659
|
+
"--no-param-headers",
|
|
10660
|
+
"Do NOT mirror x-mcp-header tool arguments into Mcp-Param-* request headers (SEP-2243). Calls the tool as a client that has not implemented the mirroring \u2014 a conforming 2026-07-28 server should answer -32020 HeaderMismatch."
|
|
10661
|
+
).option(
|
|
10662
|
+
"--mcp-header <Name=Value>",
|
|
10663
|
+
"Send a raw MCP request header on the tools/call. Repeat for several. Use it to reproduce a header mismatch on purpose. Supplying any Mcp-Param-* header turns OFF the automatic mirroring for that call, so the headers you pass are the only Mcp-Param-* ones sent.",
|
|
10664
|
+
(value, previous = []) => [...previous, value],
|
|
10665
|
+
[]
|
|
10666
|
+
).option(
|
|
10667
|
+
"--validate-response",
|
|
10668
|
+
"Validate the MCP tool-call envelope returned by the server"
|
|
10669
|
+
).option(
|
|
10670
|
+
"--expect-success",
|
|
10671
|
+
"Evaluate the tool-call outcome policy against isError"
|
|
10672
|
+
).option(
|
|
10673
|
+
"--reporter <reporter>",
|
|
10674
|
+
"Structured reporter output: json-summary or junit-xml"
|
|
10675
|
+
).option(
|
|
10676
|
+
"--debug-out <path>",
|
|
10677
|
+
"Write a structured debug artifact to a file"
|
|
10678
|
+
).option(
|
|
10679
|
+
"--ui",
|
|
10680
|
+
"Render the tool result in Inspector Playground; opens a browser by default in a TTY"
|
|
10681
|
+
).option(
|
|
10682
|
+
"--require-render",
|
|
10683
|
+
"Treat skipped Inspector renders as errors (with --ui)"
|
|
10684
|
+
).option(
|
|
10685
|
+
"--open",
|
|
10686
|
+
"Open Inspector in the system browser before rendering (default with --ui in a TTY)"
|
|
10687
|
+
).option(
|
|
10688
|
+
"--no-open",
|
|
10689
|
+
"Start/use Inspector without opening a system browser"
|
|
10690
|
+
).option(
|
|
10691
|
+
"--attach-only",
|
|
10692
|
+
"Require an already-running Inspector browser client; do not start or open Inspector"
|
|
10693
|
+
).option("--inspector-url <url>", "Local Inspector base URL (with --ui)").option(
|
|
10694
|
+
"--frontend-url <url>",
|
|
10695
|
+
"Inspector frontend URL (with --ui; overrides health-advertised frontend and skips discovery)"
|
|
10696
|
+
).option(
|
|
10697
|
+
"--server-name <name>",
|
|
10698
|
+
"Server name inside Inspector (with --ui)"
|
|
10699
|
+
).option(
|
|
10700
|
+
"--protocol <protocol>",
|
|
10701
|
+
'Render protocol: "mcp-apps" or "openai-sdk" (with --ui)'
|
|
10702
|
+
).option(
|
|
10703
|
+
"--device <device>",
|
|
10704
|
+
'Render device: "mobile", "tablet", "desktop", or "custom" (with --ui)'
|
|
10705
|
+
).option("--theme <theme>", 'Render theme: "light" or "dark" (with --ui)').option("--locale <locale>", "Render locale (with --ui)").option("--time-zone <iana>", "Render IANA timezone (with --ui)").option(
|
|
10706
|
+
"--task",
|
|
10707
|
+
"Invite the server to answer with a task instead of a result. Uses whichever tasks wire the connection resolves to."
|
|
10708
|
+
).option(
|
|
10709
|
+
"--task-ttl <ms>",
|
|
10710
|
+
"Requested task TTL (2025-11-25 wire only; the extension server owns its TTL). Requires --task.",
|
|
10711
|
+
(value) => parsePositiveInteger(value, "Task TTL")
|
|
10712
|
+
).option(
|
|
10713
|
+
"--task-watch",
|
|
10714
|
+
"After creating the task, poll it to a terminal status in the same connection. Requires --task."
|
|
10715
|
+
).option(
|
|
10716
|
+
"--wire <wire>",
|
|
10717
|
+
"Assert the connection resolves to this tasks wire: legacy or extension (with --task)",
|
|
10718
|
+
parseTasksWireOption
|
|
10719
|
+
)
|
|
10502
10720
|
)
|
|
10503
10721
|
)
|
|
10504
10722
|
)
|
|
@@ -10508,10 +10726,30 @@ function registerToolsCommands(program) {
|
|
|
10508
10726
|
const target = describeTarget(options);
|
|
10509
10727
|
const primaryCollector = globalOptions.rpc || options.debugOut ? createCliRpcLogCollector({ __cli__: target }) : void 0;
|
|
10510
10728
|
const snapshotCollector = options.debugOut ? createCliRpcLogCollector({ __cli__: target }) : void 0;
|
|
10511
|
-
const
|
|
10729
|
+
const baseConfig = parseServerConfig({
|
|
10512
10730
|
...options,
|
|
10513
10731
|
timeout: globalOptions.timeout
|
|
10514
10732
|
});
|
|
10733
|
+
const mcpHeaders = parseMcpHeaderOption(options.mcpHeader);
|
|
10734
|
+
const overridesParamHeader = Object.keys(mcpHeaders ?? {}).some(
|
|
10735
|
+
// The SDK's classifier, not a local prefix literal — "what counts as a
|
|
10736
|
+
// mirrored param header" has one definition and it lives on the wire.
|
|
10737
|
+
(name) => classifyMcpHeader(name) === "param"
|
|
10738
|
+
);
|
|
10739
|
+
const suppressParamHeaders = options.paramHeaders === false || overridesParamHeader;
|
|
10740
|
+
const headerDebugging = suppressParamHeaders || mcpHeaders !== void 0 || globalOptions.rpc;
|
|
10741
|
+
if ((suppressParamHeaders || mcpHeaders) && !("url" in baseConfig)) {
|
|
10742
|
+
throw usageError(
|
|
10743
|
+
"--no-param-headers and --mcp-header apply to HTTP servers only (SEP-2243 mirroring is Streamable HTTP); they cannot be used with --command."
|
|
10744
|
+
);
|
|
10745
|
+
}
|
|
10746
|
+
const paramHeaderProbe = headerDebugging ? createMcpParamHeaderProbe() : void 0;
|
|
10747
|
+
const config = {
|
|
10748
|
+
...baseConfig,
|
|
10749
|
+
...suppressParamHeaders ? { mirrorToolParamHeaders: false } : {},
|
|
10750
|
+
...conformanceConfigFromOptions(options),
|
|
10751
|
+
...paramHeaderProbe ? { httpLogger: paramHeaderProbe.httpLogger } : {}
|
|
10752
|
+
};
|
|
10515
10753
|
const reporter = parseReporterFormat(options.reporter);
|
|
10516
10754
|
const toolName = resolveAliasedStringOption(
|
|
10517
10755
|
options,
|
|
@@ -10559,6 +10797,11 @@ function registerToolsCommands(program) {
|
|
|
10559
10797
|
"--reporter requires --validate-response and/or --expect-success."
|
|
10560
10798
|
);
|
|
10561
10799
|
}
|
|
10800
|
+
if (options.task && mcpHeaders) {
|
|
10801
|
+
throw usageError(
|
|
10802
|
+
"--mcp-header cannot be used together with --task: the task-augmented call path does not carry per-request headers. Drop --task to reproduce a header mismatch, or drop --mcp-header."
|
|
10803
|
+
);
|
|
10804
|
+
}
|
|
10562
10805
|
const watchTuningFlags = [
|
|
10563
10806
|
["--duration-ms", options.durationMs],
|
|
10564
10807
|
["--poll-interval-ms", options.pollIntervalMs],
|
|
@@ -10599,17 +10842,23 @@ function registerToolsCommands(program) {
|
|
|
10599
10842
|
"--task cannot be used together with --validate-response or --expect-success: a task-creation envelope is not a tool result. Validate the result of `tasks watch` instead."
|
|
10600
10843
|
);
|
|
10601
10844
|
}
|
|
10602
|
-
|
|
10603
|
-
|
|
10604
|
-
|
|
10605
|
-
|
|
10606
|
-
|
|
10607
|
-
|
|
10608
|
-
|
|
10609
|
-
|
|
10610
|
-
|
|
10611
|
-
|
|
10612
|
-
|
|
10845
|
+
try {
|
|
10846
|
+
await runTaskAugmentedToolCall({
|
|
10847
|
+
options,
|
|
10848
|
+
globalOptions,
|
|
10849
|
+
// Carries `mirrorToolParamHeaders` and the mirrored-header probe,
|
|
10850
|
+
// both of which live on the config and therefore apply here too.
|
|
10851
|
+
config,
|
|
10852
|
+
host,
|
|
10853
|
+
toolName,
|
|
10854
|
+
params,
|
|
10855
|
+
collector: primaryCollector,
|
|
10856
|
+
targetSummary,
|
|
10857
|
+
snapshotCollector
|
|
10858
|
+
});
|
|
10859
|
+
} finally {
|
|
10860
|
+
reportMirroredParamHeaders(paramHeaderProbe, globalOptions);
|
|
10861
|
+
}
|
|
10613
10862
|
return;
|
|
10614
10863
|
}
|
|
10615
10864
|
const renderContext = options.ui ? {
|
|
@@ -10628,7 +10877,16 @@ function registerToolsCommands(program) {
|
|
|
10628
10877
|
config,
|
|
10629
10878
|
async (manager, serverId) => {
|
|
10630
10879
|
if (host) await assertToolVisibleToHost(manager, serverId, toolName, host);
|
|
10631
|
-
return manager.executeTool(
|
|
10880
|
+
return manager.executeTool(
|
|
10881
|
+
serverId,
|
|
10882
|
+
toolName,
|
|
10883
|
+
params,
|
|
10884
|
+
// Caller-supplied headers WIN over the mirrored ones (the seam in
|
|
10885
|
+
// `MCPClientManager`), which is the whole point of `--mcp-header`:
|
|
10886
|
+
// sending a deliberately wrong value is how you exercise a
|
|
10887
|
+
// server's -32020.
|
|
10888
|
+
mcpHeaders ? { headers: mcpHeaders } : void 0
|
|
10889
|
+
);
|
|
10632
10890
|
},
|
|
10633
10891
|
{
|
|
10634
10892
|
timeout: globalOptions.timeout,
|
|
@@ -10666,6 +10924,7 @@ function registerToolsCommands(program) {
|
|
|
10666
10924
|
} : void 0,
|
|
10667
10925
|
collectors: [primaryCollector]
|
|
10668
10926
|
});
|
|
10927
|
+
reportMirroredParamHeaders(paramHeaderProbe, globalOptions);
|
|
10669
10928
|
throw commandError;
|
|
10670
10929
|
}
|
|
10671
10930
|
const validationResult = shouldValidateResponse || shouldExpectSuccess ? validateToolCallResult(result, {
|
|
@@ -10823,6 +11082,7 @@ function registerToolsCommands(program) {
|
|
|
10823
11082
|
globalOptions.format
|
|
10824
11083
|
);
|
|
10825
11084
|
}
|
|
11085
|
+
reportMirroredParamHeaders(paramHeaderProbe, globalOptions);
|
|
10826
11086
|
if (validationResult && !validationResult.passed) {
|
|
10827
11087
|
setProcessExitCode(1);
|
|
10828
11088
|
}
|