@mcpjam/cli 3.11.1 → 3.12.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 +597 -145
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -2,15 +2,17 @@
|
|
|
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, 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, 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';
|
|
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, createTunnelOperation, DEFAULT_PLATFORM_API_BASE_URL, PlatformApiClient, isPlatformApiError, PlatformApiError, listProjectsOperation, listProjectServersOperation, showServersOperation, createEvalSuiteOperation, listEvalSuitesOperation, runEvalSuiteOperation, getEvalRunOperation, listHostsOperation, getHostOperation, deleteHostOperation } from '@mcpjam/sdk/platform';
|
|
13
|
-
import {
|
|
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';
|
|
14
|
+
import { HOST_TEMPLATES as HOST_TEMPLATES$1, HOST_TEMPLATE_IDS, seedHostTemplate } from '@mcpjam/sdk/host-config/templates';
|
|
15
|
+
import { applyVisibilityPolicyAndCountSignals, isAppOnlyTool, extractHostExecutionPolicy, hostConnectionProfile } from '@mcpjam/sdk/host-config/internal';
|
|
14
16
|
import { StdioServerTransport, McpServer } from '@modelcontextprotocol/server';
|
|
15
17
|
import { z } from 'zod';
|
|
16
18
|
import { PostHog } from 'posthog-node';
|
|
@@ -21,7 +23,7 @@ import { WebSocket } from 'ws';
|
|
|
21
23
|
|
|
22
24
|
// package.json
|
|
23
25
|
var package_default = {
|
|
24
|
-
version: "3.
|
|
26
|
+
version: "3.12.0"};
|
|
25
27
|
|
|
26
28
|
// src/lib/output.ts
|
|
27
29
|
var DEFAULT_OUTPUT_FORMAT = "json";
|
|
@@ -822,6 +824,12 @@ function addSharedServerOptions(command) {
|
|
|
822
824
|
'Stdio environment assignment in "KEY=VALUE" format. Pass multiple values or repeat the flag.'
|
|
823
825
|
).option("--cwd <path>", "Working directory for the stdio MCP server process");
|
|
824
826
|
}
|
|
827
|
+
function addHostOption(command) {
|
|
828
|
+
return command.option(
|
|
829
|
+
"--host <id>",
|
|
830
|
+
"Connect as this host (e.g. claude, chatgpt, cursor) \u2014 sends its identity/capabilities/protocol and applies its tool visibility"
|
|
831
|
+
);
|
|
832
|
+
}
|
|
825
833
|
function getGlobalOptions(command) {
|
|
826
834
|
const options = command.optsWithGlobals();
|
|
827
835
|
return {
|
|
@@ -3388,6 +3396,404 @@ function registerAuthCommands(program) {
|
|
|
3388
3396
|
}
|
|
3389
3397
|
});
|
|
3390
3398
|
}
|
|
3399
|
+
function resolveHostConnection(hostId) {
|
|
3400
|
+
if (!HOST_TEMPLATE_IDS.includes(hostId)) {
|
|
3401
|
+
throw usageError(
|
|
3402
|
+
`Unknown host "${hostId}". Valid hosts: ${HOST_TEMPLATE_IDS.join(", ")}.`
|
|
3403
|
+
);
|
|
3404
|
+
}
|
|
3405
|
+
const id = hostId;
|
|
3406
|
+
const seeded = seedHostTemplate(id);
|
|
3407
|
+
return {
|
|
3408
|
+
id,
|
|
3409
|
+
connection: hostConnectionProfile(seeded),
|
|
3410
|
+
policy: extractHostExecutionPolicy(seeded, id)
|
|
3411
|
+
};
|
|
3412
|
+
}
|
|
3413
|
+
function resolveHostFromOptions(options) {
|
|
3414
|
+
if (!options.host) return void 0;
|
|
3415
|
+
if (options.clientCapabilities !== void 0) {
|
|
3416
|
+
throw usageError(
|
|
3417
|
+
"--host advertises the host's client capabilities; pass --host or --client-capabilities, not both."
|
|
3418
|
+
);
|
|
3419
|
+
}
|
|
3420
|
+
return resolveHostConnection(options.host);
|
|
3421
|
+
}
|
|
3422
|
+
function applyHostToConfig(config, host) {
|
|
3423
|
+
const identity = {
|
|
3424
|
+
...host.clientInfo ? { clientInfo: host.clientInfo } : {},
|
|
3425
|
+
...host.clientCapabilities ? { clientCapabilities: host.clientCapabilities } : {},
|
|
3426
|
+
...host.supportedProtocolVersions ? { supportedProtocolVersions: host.supportedProtocolVersions } : {}
|
|
3427
|
+
};
|
|
3428
|
+
const httpOnly = "url" in config && host.mcpProtocolVersion ? { mcpProtocolVersion: host.mcpProtocolVersion } : {};
|
|
3429
|
+
return { ...config, ...identity, ...httpOnly };
|
|
3430
|
+
}
|
|
3431
|
+
function applyHostVisibility(tools, manager, serverId, policy) {
|
|
3432
|
+
const record = {};
|
|
3433
|
+
for (const tool of tools) {
|
|
3434
|
+
record[String(tool.name)] = { ...tool, _serverId: serverId };
|
|
3435
|
+
}
|
|
3436
|
+
const signals = applyVisibilityPolicyAndCountSignals(
|
|
3437
|
+
record,
|
|
3438
|
+
manager,
|
|
3439
|
+
policy
|
|
3440
|
+
);
|
|
3441
|
+
const visible = tools.filter((tool) => String(tool.name) in record);
|
|
3442
|
+
return { tools: visible, toolsDroppedVisibility: signals.toolsDroppedVisibility };
|
|
3443
|
+
}
|
|
3444
|
+
var TOOLS_PAGE_CAP = 50;
|
|
3445
|
+
async function assertToolVisibleToHost(manager, serverId, toolName, host) {
|
|
3446
|
+
if (host.policy.respectToolVisibility === false) return;
|
|
3447
|
+
const seenCursors = /* @__PURE__ */ new Set();
|
|
3448
|
+
let cursor;
|
|
3449
|
+
for (let page = 0; page < TOOLS_PAGE_CAP; page++) {
|
|
3450
|
+
const result = await manager.listTools(
|
|
3451
|
+
serverId,
|
|
3452
|
+
cursor ? { cursor } : void 0
|
|
3453
|
+
);
|
|
3454
|
+
const tool = (result.tools ?? []).find(
|
|
3455
|
+
(t) => t.name === toolName
|
|
3456
|
+
);
|
|
3457
|
+
if (tool) {
|
|
3458
|
+
if (isAppOnlyTool(tool._meta)) {
|
|
3459
|
+
throw usageError(
|
|
3460
|
+
`Tool "${toolName}" is app-only \u2014 not visible to host "${host.id}"'s model. Omit --host to call it as an operator.`
|
|
3461
|
+
);
|
|
3462
|
+
}
|
|
3463
|
+
return;
|
|
3464
|
+
}
|
|
3465
|
+
cursor = result.nextCursor;
|
|
3466
|
+
if (!cursor) return;
|
|
3467
|
+
if (seenCursors.has(cursor)) break;
|
|
3468
|
+
seenCursors.add(cursor);
|
|
3469
|
+
}
|
|
3470
|
+
throw usageError(
|
|
3471
|
+
`Could not verify "${toolName}" is visible to host "${host.id}" \u2014 the server's tool list is too long to page through. Omit --host to call it as an operator.`
|
|
3472
|
+
);
|
|
3473
|
+
}
|
|
3474
|
+
|
|
3475
|
+
// src/lib/ephemeral.ts
|
|
3476
|
+
async function withEphemeralManager(config, fn, options) {
|
|
3477
|
+
const resolvedConfig = options?.host ? applyHostToConfig(config, options.host) : config;
|
|
3478
|
+
return withEphemeralClient(resolvedConfig, fn, {
|
|
3479
|
+
serverId: "__cli__",
|
|
3480
|
+
clientName: "mcpjam",
|
|
3481
|
+
timeout: options?.timeout ?? 3e4,
|
|
3482
|
+
rpcLogger: options?.rpcLogger,
|
|
3483
|
+
retryPolicy: options?.retryPolicy
|
|
3484
|
+
});
|
|
3485
|
+
}
|
|
3486
|
+
|
|
3487
|
+
// src/commands/compat.ts
|
|
3488
|
+
var TOOLS_PAGE_CAP2 = 50;
|
|
3489
|
+
function registerCompatCommands(program) {
|
|
3490
|
+
addRetryOptions(
|
|
3491
|
+
addSharedServerOptions(
|
|
3492
|
+
program.command("compat").description(
|
|
3493
|
+
"Check whether an MCP server's tools and widgets work on each AI host (Claude, ChatGPT, Cursor, Copilot, Codex, Goose, \u2026)"
|
|
3494
|
+
).option(
|
|
3495
|
+
"--host <id>",
|
|
3496
|
+
"Only report this host id. Repeat for several. Default: all.",
|
|
3497
|
+
(value, previous = []) => [...previous, value],
|
|
3498
|
+
[]
|
|
3499
|
+
)
|
|
3500
|
+
)
|
|
3501
|
+
).action(async (options, command) => {
|
|
3502
|
+
const globalOptions = getGlobalOptions(command);
|
|
3503
|
+
const retryPolicy = parseRetryPolicy(options);
|
|
3504
|
+
const validHostIds = buildMarketHostProfiles().map((p) => p.id);
|
|
3505
|
+
const requestedHosts = options.host;
|
|
3506
|
+
const unknownHosts = requestedHosts.filter(
|
|
3507
|
+
(id) => !validHostIds.includes(id)
|
|
3508
|
+
);
|
|
3509
|
+
if (unknownHosts.length > 0) {
|
|
3510
|
+
throw usageError(
|
|
3511
|
+
`Unknown host id${unknownHosts.length === 1 ? "" : "s"}: ${unknownHosts.join(
|
|
3512
|
+
", "
|
|
3513
|
+
)}. Valid: ${validHostIds.join(", ")}`
|
|
3514
|
+
);
|
|
3515
|
+
}
|
|
3516
|
+
const config = parseServerConfig({
|
|
3517
|
+
...options,
|
|
3518
|
+
timeout: globalOptions.timeout
|
|
3519
|
+
});
|
|
3520
|
+
const result = await withEphemeralManager(
|
|
3521
|
+
config,
|
|
3522
|
+
async (manager, serverId) => {
|
|
3523
|
+
const tools = [];
|
|
3524
|
+
let cursor;
|
|
3525
|
+
let truncated = false;
|
|
3526
|
+
for (let page = 0; page < TOOLS_PAGE_CAP2; page++) {
|
|
3527
|
+
const result2 = await listTools(manager, { serverId, cursor });
|
|
3528
|
+
tools.push(
|
|
3529
|
+
...result2.tools
|
|
3530
|
+
);
|
|
3531
|
+
cursor = result2.nextCursor;
|
|
3532
|
+
if (!cursor) break;
|
|
3533
|
+
if (page === TOOLS_PAGE_CAP2 - 1) truncated = true;
|
|
3534
|
+
}
|
|
3535
|
+
const toolsData = { tools };
|
|
3536
|
+
const widgetUsage = await scanWidgetUsage(toolsData, async (uri) => {
|
|
3537
|
+
const { content } = await readResource(manager, { serverId, uri });
|
|
3538
|
+
return content;
|
|
3539
|
+
});
|
|
3540
|
+
const { requirements, reports } = evaluateMarketHosts(toolsData, {
|
|
3541
|
+
widgetUsage,
|
|
3542
|
+
toolsTruncated: truncated
|
|
3543
|
+
});
|
|
3544
|
+
const hostFilter = new Set(options.host);
|
|
3545
|
+
const hosts = (hostFilter.size > 0 ? reports.filter((r) => hostFilter.has(r.hostId)) : reports).map((r) => ({
|
|
3546
|
+
hostId: r.hostId,
|
|
3547
|
+
hostLabel: r.hostLabel,
|
|
3548
|
+
verdict: r.verdict,
|
|
3549
|
+
provenance: r.provenance,
|
|
3550
|
+
findings: r.findings
|
|
3551
|
+
}));
|
|
3552
|
+
const summary = { works: 0, degraded: 0, blocked: 0, unknown: 0 };
|
|
3553
|
+
for (const h of hosts) summary[h.verdict] += 1;
|
|
3554
|
+
return {
|
|
3555
|
+
target: describeTarget(options),
|
|
3556
|
+
widgets: {
|
|
3557
|
+
total: requirements.widgets.mcpAppsOnly.length + requirements.widgets.openaiAppsOnly.length + requirements.widgets.dual.length,
|
|
3558
|
+
appOnly: requirements.appOnlyWidgets.length
|
|
3559
|
+
},
|
|
3560
|
+
unknownDimensions: requirements.unknownDimensions,
|
|
3561
|
+
summary,
|
|
3562
|
+
hosts
|
|
3563
|
+
};
|
|
3564
|
+
},
|
|
3565
|
+
{
|
|
3566
|
+
timeout: globalOptions.timeout,
|
|
3567
|
+
retryPolicy
|
|
3568
|
+
}
|
|
3569
|
+
);
|
|
3570
|
+
writeResult(result, globalOptions.format);
|
|
3571
|
+
});
|
|
3572
|
+
}
|
|
3573
|
+
function addPlatformOptions(command) {
|
|
3574
|
+
return command.option("--api-key <key>", "MCPJam sk_ API key (overrides MCPJAM_API_KEY)").option(
|
|
3575
|
+
"--api-url <url>",
|
|
3576
|
+
"MCPJam API base URL (defaults to https://app.mcpjam.com/api/v1)"
|
|
3577
|
+
);
|
|
3578
|
+
}
|
|
3579
|
+
async function runPlatformCommand(options, timeoutMs, execute) {
|
|
3580
|
+
const controller = new AbortController();
|
|
3581
|
+
const timeoutHandle = setTimeout(() => {
|
|
3582
|
+
controller.abort(
|
|
3583
|
+
new PlatformApiError(`Request timed out after ${timeoutMs}ms`, "TIMEOUT", {
|
|
3584
|
+
status: 0
|
|
3585
|
+
})
|
|
3586
|
+
);
|
|
3587
|
+
}, timeoutMs);
|
|
3588
|
+
timeoutHandle.unref?.();
|
|
3589
|
+
try {
|
|
3590
|
+
const { client } = buildPlatformClient({ ...options, timeoutMs });
|
|
3591
|
+
return await execute({ client, signal: controller.signal });
|
|
3592
|
+
} catch (error) {
|
|
3593
|
+
if (controller.signal.aborted && controller.signal.reason instanceof PlatformApiError) {
|
|
3594
|
+
throw toCliError(controller.signal.reason);
|
|
3595
|
+
}
|
|
3596
|
+
throw toCliError(error);
|
|
3597
|
+
} finally {
|
|
3598
|
+
clearTimeout(timeoutHandle);
|
|
3599
|
+
}
|
|
3600
|
+
}
|
|
3601
|
+
function loadDockerfileText(file) {
|
|
3602
|
+
let text;
|
|
3603
|
+
try {
|
|
3604
|
+
text = file === "-" ? readFileSync(0, "utf8") : readFileSync(file, "utf8");
|
|
3605
|
+
} catch (error) {
|
|
3606
|
+
throw usageError(`Failed to read --file "${file}".`, {
|
|
3607
|
+
source: error instanceof Error ? error.message : String(error)
|
|
3608
|
+
});
|
|
3609
|
+
}
|
|
3610
|
+
if (text.trim() === "") throw usageError("--file input is empty.");
|
|
3611
|
+
return text;
|
|
3612
|
+
}
|
|
3613
|
+
function validateInput(op, raw) {
|
|
3614
|
+
const parsed = op.inputSchema.safeParse(raw);
|
|
3615
|
+
if (!parsed.success) {
|
|
3616
|
+
const detail = parsed.error.issues.map((issue) => `${issue.path.join(".") || "(root)"}: ${issue.message}`).join("; ");
|
|
3617
|
+
throw usageError(`Invalid input: ${detail}`);
|
|
3618
|
+
}
|
|
3619
|
+
return parsed.data;
|
|
3620
|
+
}
|
|
3621
|
+
function registerEnvironmentsCommands(program) {
|
|
3622
|
+
const env = program.command("env").description(
|
|
3623
|
+
"List, build, and manage custom Computer environments (Dockerfile images) in your hosted MCPJam projects"
|
|
3624
|
+
);
|
|
3625
|
+
addPlatformOptions(
|
|
3626
|
+
env.command("list").description("List the environments in a project").option(
|
|
3627
|
+
"--project <id-or-name>",
|
|
3628
|
+
"Project name or ID (defaults to the most recently updated project)"
|
|
3629
|
+
)
|
|
3630
|
+
).action(async (options, command) => {
|
|
3631
|
+
const globalOptions = getGlobalOptions(command);
|
|
3632
|
+
const result = await runPlatformCommand(
|
|
3633
|
+
options,
|
|
3634
|
+
globalOptions.timeout,
|
|
3635
|
+
({ client, signal }) => listEnvironmentsOperation.execute(
|
|
3636
|
+
{ project: options.project },
|
|
3637
|
+
{ client, signal }
|
|
3638
|
+
)
|
|
3639
|
+
);
|
|
3640
|
+
writeResult(result, globalOptions.format);
|
|
3641
|
+
});
|
|
3642
|
+
addPlatformOptions(
|
|
3643
|
+
env.command("get").description("Show one environment's Dockerfile and latest build status").requiredOption("--environment <id-or-name>", "Environment name or ID").option("--project <id-or-name>", "Project name or ID")
|
|
3644
|
+
).action(
|
|
3645
|
+
async (options, command) => {
|
|
3646
|
+
const globalOptions = getGlobalOptions(command);
|
|
3647
|
+
const result = await runPlatformCommand(
|
|
3648
|
+
options,
|
|
3649
|
+
globalOptions.timeout,
|
|
3650
|
+
({ client, signal }) => getEnvironmentOperation.execute(
|
|
3651
|
+
{ project: options.project, environment: options.environment },
|
|
3652
|
+
{ client, signal }
|
|
3653
|
+
)
|
|
3654
|
+
);
|
|
3655
|
+
writeResult(result, globalOptions.format);
|
|
3656
|
+
}
|
|
3657
|
+
);
|
|
3658
|
+
addPlatformOptions(
|
|
3659
|
+
env.command("create").description("Create an environment from a Dockerfile (--file, or - for stdin)").requiredOption("--name <name>", "Display name for the new environment").requiredOption(
|
|
3660
|
+
"--file <path>",
|
|
3661
|
+
"Dockerfile path, or - to read it from stdin"
|
|
3662
|
+
).option("--project <id-or-name>", "Project name or ID")
|
|
3663
|
+
).action(
|
|
3664
|
+
async (options, command) => {
|
|
3665
|
+
const globalOptions = getGlobalOptions(command);
|
|
3666
|
+
const dockerfile = loadDockerfileText(options.file);
|
|
3667
|
+
const input = validateInput(createEnvironmentOperation, {
|
|
3668
|
+
project: options.project,
|
|
3669
|
+
name: options.name,
|
|
3670
|
+
dockerfile
|
|
3671
|
+
});
|
|
3672
|
+
const result = await runPlatformCommand(
|
|
3673
|
+
options,
|
|
3674
|
+
globalOptions.timeout,
|
|
3675
|
+
({ client, signal }) => createEnvironmentOperation.execute(input, { client, signal })
|
|
3676
|
+
);
|
|
3677
|
+
writeResult(result, globalOptions.format);
|
|
3678
|
+
}
|
|
3679
|
+
);
|
|
3680
|
+
addPlatformOptions(
|
|
3681
|
+
env.command("edit").description("Edit an environment's name and/or Dockerfile").requiredOption("--environment <id-or-name>", "Environment name or ID").option("--project <id-or-name>", "Project name or ID").option("--name <name>", "New display name").option("--file <path>", "Replacement Dockerfile path (or - for stdin)")
|
|
3682
|
+
).action(
|
|
3683
|
+
async (options, command) => {
|
|
3684
|
+
const globalOptions = getGlobalOptions(command);
|
|
3685
|
+
const dockerfile = options.file !== void 0 ? loadDockerfileText(options.file) : void 0;
|
|
3686
|
+
const input = validateInput(updateEnvironmentOperation, {
|
|
3687
|
+
project: options.project,
|
|
3688
|
+
environment: options.environment,
|
|
3689
|
+
...options.name !== void 0 ? { name: options.name } : {},
|
|
3690
|
+
...dockerfile !== void 0 ? { dockerfile } : {}
|
|
3691
|
+
});
|
|
3692
|
+
const result = await runPlatformCommand(
|
|
3693
|
+
options,
|
|
3694
|
+
globalOptions.timeout,
|
|
3695
|
+
({ client, signal }) => updateEnvironmentOperation.execute(input, { client, signal })
|
|
3696
|
+
);
|
|
3697
|
+
writeResult(result, globalOptions.format);
|
|
3698
|
+
}
|
|
3699
|
+
);
|
|
3700
|
+
addPlatformOptions(
|
|
3701
|
+
env.command("build").description("Build the environment's image (async \u2014 poll `env logs` for status)").requiredOption("--environment <id-or-name>", "Environment name or ID").option("--project <id-or-name>", "Project name or ID")
|
|
3702
|
+
).action(
|
|
3703
|
+
async (options, command) => {
|
|
3704
|
+
const globalOptions = getGlobalOptions(command);
|
|
3705
|
+
const result = await runPlatformCommand(
|
|
3706
|
+
options,
|
|
3707
|
+
globalOptions.timeout,
|
|
3708
|
+
({ client, signal }) => buildEnvironmentOperation.execute(
|
|
3709
|
+
{ project: options.project, environment: options.environment },
|
|
3710
|
+
{ client, signal }
|
|
3711
|
+
)
|
|
3712
|
+
);
|
|
3713
|
+
writeResult(result, globalOptions.format);
|
|
3714
|
+
}
|
|
3715
|
+
);
|
|
3716
|
+
addPlatformOptions(
|
|
3717
|
+
env.command("logs").description("Show an environment's builds (newest first) with their log preview").requiredOption("--environment <id-or-name>", "Environment name or ID").option("--project <id-or-name>", "Project name or ID")
|
|
3718
|
+
).action(
|
|
3719
|
+
async (options, command) => {
|
|
3720
|
+
const globalOptions = getGlobalOptions(command);
|
|
3721
|
+
const result = await runPlatformCommand(
|
|
3722
|
+
options,
|
|
3723
|
+
globalOptions.timeout,
|
|
3724
|
+
({ client, signal }) => listEnvironmentBuildsOperation.execute(
|
|
3725
|
+
{ project: options.project, environment: options.environment },
|
|
3726
|
+
{ client, signal }
|
|
3727
|
+
)
|
|
3728
|
+
);
|
|
3729
|
+
writeResult(result, globalOptions.format);
|
|
3730
|
+
}
|
|
3731
|
+
);
|
|
3732
|
+
addPlatformOptions(
|
|
3733
|
+
env.command("use").description(
|
|
3734
|
+
"Boot your computer from this environment (rebuilds it \u2014 installed files are wiped)"
|
|
3735
|
+
).requiredOption("--environment <id-or-name>", "Environment name or ID").option("--project <id-or-name>", "Project name or ID")
|
|
3736
|
+
).action(
|
|
3737
|
+
async (options, command) => {
|
|
3738
|
+
const globalOptions = getGlobalOptions(command);
|
|
3739
|
+
const result = await runPlatformCommand(
|
|
3740
|
+
options,
|
|
3741
|
+
globalOptions.timeout,
|
|
3742
|
+
({ client, signal }) => useEnvironmentOperation.execute(
|
|
3743
|
+
{ project: options.project, environment: options.environment },
|
|
3744
|
+
{ client, signal }
|
|
3745
|
+
)
|
|
3746
|
+
);
|
|
3747
|
+
writeResult(result, globalOptions.format);
|
|
3748
|
+
}
|
|
3749
|
+
);
|
|
3750
|
+
addPlatformOptions(
|
|
3751
|
+
env.command("reset").description("Reset your computer to its current image (wipes mutable state)").option("--project <id-or-name>", "Project name or ID")
|
|
3752
|
+
).action(async (options, command) => {
|
|
3753
|
+
const globalOptions = getGlobalOptions(command);
|
|
3754
|
+
const result = await runPlatformCommand(
|
|
3755
|
+
options,
|
|
3756
|
+
globalOptions.timeout,
|
|
3757
|
+
({ client, signal }) => resetComputerOperation.execute(
|
|
3758
|
+
{ project: options.project },
|
|
3759
|
+
{ client, signal }
|
|
3760
|
+
)
|
|
3761
|
+
);
|
|
3762
|
+
writeResult(result, globalOptions.format);
|
|
3763
|
+
});
|
|
3764
|
+
addPlatformOptions(
|
|
3765
|
+
env.command("promote").description("Share a personal-draft environment with the whole project (admin only)").requiredOption("--environment <id-or-name>", "Environment name or ID").option("--project <id-or-name>", "Project name or ID")
|
|
3766
|
+
).action(
|
|
3767
|
+
async (options, command) => {
|
|
3768
|
+
const globalOptions = getGlobalOptions(command);
|
|
3769
|
+
const result = await runPlatformCommand(
|
|
3770
|
+
options,
|
|
3771
|
+
globalOptions.timeout,
|
|
3772
|
+
({ client, signal }) => promoteEnvironmentOperation.execute(
|
|
3773
|
+
{ project: options.project, environment: options.environment },
|
|
3774
|
+
{ client, signal }
|
|
3775
|
+
)
|
|
3776
|
+
);
|
|
3777
|
+
writeResult(result, globalOptions.format);
|
|
3778
|
+
}
|
|
3779
|
+
);
|
|
3780
|
+
addPlatformOptions(
|
|
3781
|
+
env.command("delete").description("Permanently delete an environment from a project").requiredOption("--environment <id-or-name>", "Environment name or ID").option("--project <id-or-name>", "Project name or ID")
|
|
3782
|
+
).action(
|
|
3783
|
+
async (options, command) => {
|
|
3784
|
+
const globalOptions = getGlobalOptions(command);
|
|
3785
|
+
const result = await runPlatformCommand(
|
|
3786
|
+
options,
|
|
3787
|
+
globalOptions.timeout,
|
|
3788
|
+
({ client, signal }) => deleteEnvironmentOperation.execute(
|
|
3789
|
+
{ project: options.project, environment: options.environment },
|
|
3790
|
+
{ client, signal }
|
|
3791
|
+
)
|
|
3792
|
+
);
|
|
3793
|
+
writeResult(result, globalOptions.format);
|
|
3794
|
+
}
|
|
3795
|
+
);
|
|
3796
|
+
}
|
|
3391
3797
|
|
|
3392
3798
|
// src/lib/eval-screenshots.ts
|
|
3393
3799
|
function asRecord(value) {
|
|
@@ -3499,13 +3905,13 @@ function encodeInlineImage(data, protocol) {
|
|
|
3499
3905
|
}
|
|
3500
3906
|
|
|
3501
3907
|
// src/commands/eval.ts
|
|
3502
|
-
function
|
|
3908
|
+
function addPlatformOptions2(command) {
|
|
3503
3909
|
return command.option("--api-key <key>", "MCPJam sk_ API key (overrides MCPJAM_API_KEY)").option(
|
|
3504
3910
|
"--api-url <url>",
|
|
3505
3911
|
"MCPJam API base URL (defaults to https://app.mcpjam.com/api/v1)"
|
|
3506
3912
|
);
|
|
3507
3913
|
}
|
|
3508
|
-
async function
|
|
3914
|
+
async function runPlatformCommand2(options, timeoutMs, execute) {
|
|
3509
3915
|
const controller = new AbortController();
|
|
3510
3916
|
const timeoutHandle = setTimeout(() => {
|
|
3511
3917
|
controller.abort(
|
|
@@ -3615,7 +4021,7 @@ function validateOpInput(op, raw) {
|
|
|
3615
4021
|
}
|
|
3616
4022
|
async function executeOp(op, input, options, command) {
|
|
3617
4023
|
const globalOptions = getGlobalOptions(command);
|
|
3618
|
-
const result = await
|
|
4024
|
+
const result = await runPlatformCommand2(
|
|
3619
4025
|
options,
|
|
3620
4026
|
globalOptions.timeout,
|
|
3621
4027
|
({ client, signal }) => op.execute(input, { client, signal })
|
|
@@ -3715,7 +4121,7 @@ function resolveScreenshotPath(out, shot, index, total) {
|
|
|
3715
4121
|
}
|
|
3716
4122
|
function registerEvalCommands(program) {
|
|
3717
4123
|
const evals = program.command("eval").description("Author and run eval suites in your hosted MCPJam projects");
|
|
3718
|
-
|
|
4124
|
+
addPlatformOptions2(
|
|
3719
4125
|
evals.command("create").description(
|
|
3720
4126
|
"Create a runnable eval suite from authored test cases (does not run it)"
|
|
3721
4127
|
).option(
|
|
@@ -3740,21 +4146,21 @@ function registerEvalCommands(program) {
|
|
|
3740
4146
|
).action(async (options, command) => {
|
|
3741
4147
|
const globalOptions = getGlobalOptions(command);
|
|
3742
4148
|
const input = loadSuiteDefinition(options);
|
|
3743
|
-
const result = await
|
|
4149
|
+
const result = await runPlatformCommand2(
|
|
3744
4150
|
options,
|
|
3745
4151
|
globalOptions.timeout,
|
|
3746
4152
|
({ client, signal }) => createEvalSuiteOperation.execute(input, { client, signal })
|
|
3747
4153
|
);
|
|
3748
4154
|
writeResult(result, globalOptions.format);
|
|
3749
4155
|
});
|
|
3750
|
-
|
|
4156
|
+
addPlatformOptions2(
|
|
3751
4157
|
evals.command("list").description("List the eval suites saved in a project").option(
|
|
3752
4158
|
"--project <id-or-name>",
|
|
3753
4159
|
"Project name or ID (defaults to the most recently updated project)"
|
|
3754
4160
|
)
|
|
3755
4161
|
).action(async (options, command) => {
|
|
3756
4162
|
const globalOptions = getGlobalOptions(command);
|
|
3757
|
-
const result = await
|
|
4163
|
+
const result = await runPlatformCommand2(
|
|
3758
4164
|
options,
|
|
3759
4165
|
globalOptions.timeout,
|
|
3760
4166
|
({ client, signal }) => listEvalSuitesOperation.execute(
|
|
@@ -3764,7 +4170,7 @@ function registerEvalCommands(program) {
|
|
|
3764
4170
|
);
|
|
3765
4171
|
writeResult(result, globalOptions.format);
|
|
3766
4172
|
});
|
|
3767
|
-
|
|
4173
|
+
addPlatformOptions2(
|
|
3768
4174
|
evals.command("run").description("Start an eval run of an existing suite (asynchronous)").requiredOption("--suite <id-or-name>", "Eval suite name or ID").option(
|
|
3769
4175
|
"--project <id-or-name>",
|
|
3770
4176
|
"Project name or ID (defaults to the most recently updated project)"
|
|
@@ -3775,7 +4181,7 @@ function registerEvalCommands(program) {
|
|
|
3775
4181
|
).action(
|
|
3776
4182
|
async (options, command) => {
|
|
3777
4183
|
const globalOptions = getGlobalOptions(command);
|
|
3778
|
-
const result = await
|
|
4184
|
+
const result = await runPlatformCommand2(
|
|
3779
4185
|
options,
|
|
3780
4186
|
globalOptions.timeout,
|
|
3781
4187
|
({ client, signal }) => runEvalSuiteOperation.execute(
|
|
@@ -3790,12 +4196,12 @@ function registerEvalCommands(program) {
|
|
|
3790
4196
|
writeResult(result, globalOptions.format);
|
|
3791
4197
|
}
|
|
3792
4198
|
);
|
|
3793
|
-
|
|
4199
|
+
addPlatformOptions2(
|
|
3794
4200
|
evals.command("status").description("Get the status and summary of an eval run").requiredOption("--run <id>", "Eval run ID (from `eval run`)").requiredOption("--project <id-or-name>", "Project name or ID")
|
|
3795
4201
|
).action(
|
|
3796
4202
|
async (options, command) => {
|
|
3797
4203
|
const globalOptions = getGlobalOptions(command);
|
|
3798
|
-
const result = await
|
|
4204
|
+
const result = await runPlatformCommand2(
|
|
3799
4205
|
options,
|
|
3800
4206
|
globalOptions.timeout,
|
|
3801
4207
|
({ client, signal }) => getEvalRunOperation.execute(
|
|
@@ -3806,7 +4212,7 @@ function registerEvalCommands(program) {
|
|
|
3806
4212
|
writeResult(result, globalOptions.format);
|
|
3807
4213
|
}
|
|
3808
4214
|
);
|
|
3809
|
-
|
|
4215
|
+
addPlatformOptions2(
|
|
3810
4216
|
evals.command("cancel").description(
|
|
3811
4217
|
"Cancel an in-flight eval run (no-op if already cancelled; errors if it already finished)"
|
|
3812
4218
|
).requiredOption("--run <id>", "Eval run ID (from `eval run`)").requiredOption("--project <id-or-name>", "Project name or ID")
|
|
@@ -3821,7 +4227,7 @@ function registerEvalCommands(program) {
|
|
|
3821
4227
|
}
|
|
3822
4228
|
);
|
|
3823
4229
|
const PROJECT_OPT = "Project name or ID (defaults to most recently updated)";
|
|
3824
|
-
|
|
4230
|
+
addPlatformOptions2(
|
|
3825
4231
|
evals.command("iterations").description(
|
|
3826
4232
|
"List per-iteration results for an eval run (pass/fail, tool calls, tokens, latency)"
|
|
3827
4233
|
).requiredOption("--run <id>", "Eval run ID (from `eval run`)").requiredOption(
|
|
@@ -3839,7 +4245,7 @@ function registerEvalCommands(program) {
|
|
|
3839
4245
|
await executeOp(listEvalRunIterationsOperation, input, options, command);
|
|
3840
4246
|
}
|
|
3841
4247
|
);
|
|
3842
|
-
|
|
4248
|
+
addPlatformOptions2(
|
|
3843
4249
|
evals.command("trace").description(
|
|
3844
4250
|
"Fetch the full trace for one eval iteration (large: full message history + spans)"
|
|
3845
4251
|
).requiredOption("--run <id>", "Eval run ID (from `eval run`)").requiredOption(
|
|
@@ -3863,7 +4269,7 @@ function registerEvalCommands(program) {
|
|
|
3863
4269
|
);
|
|
3864
4270
|
}
|
|
3865
4271
|
);
|
|
3866
|
-
|
|
4272
|
+
addPlatformOptions2(
|
|
3867
4273
|
evals.command("steps").description(
|
|
3868
4274
|
"Per-authored-step results for one eval iteration: status (ok/fail/skipped/pending), reason, and evidence (screenshot/video URLs). The fastest way to see WHICH step failed and why."
|
|
3869
4275
|
).requiredOption("--run <id>", "Eval run ID (from `eval run`)").requiredOption(
|
|
@@ -3887,7 +4293,7 @@ function registerEvalCommands(program) {
|
|
|
3887
4293
|
);
|
|
3888
4294
|
}
|
|
3889
4295
|
);
|
|
3890
|
-
|
|
4296
|
+
addPlatformOptions2(
|
|
3891
4297
|
evals.command("screenshot").description(
|
|
3892
4298
|
"Show the widget screenshot(s) an eval iteration rendered \u2014 inline when the terminal supports it, otherwise the image URL"
|
|
3893
4299
|
).requiredOption("--run <id>", "Eval run ID (from `eval run`)").requiredOption(
|
|
@@ -3904,7 +4310,7 @@ function registerEvalCommands(program) {
|
|
|
3904
4310
|
async (options, command) => {
|
|
3905
4311
|
const globalOptions = getGlobalOptions(command);
|
|
3906
4312
|
const index = options.index !== void 0 ? parsePositiveInteger(options.index, "--index") : void 0;
|
|
3907
|
-
const result = await
|
|
4313
|
+
const result = await runPlatformCommand2(
|
|
3908
4314
|
options,
|
|
3909
4315
|
globalOptions.timeout,
|
|
3910
4316
|
({ client, signal }) => getEvalIterationTraceOperation.execute(
|
|
@@ -3995,7 +4401,7 @@ function registerEvalCommands(program) {
|
|
|
3995
4401
|
}
|
|
3996
4402
|
}
|
|
3997
4403
|
);
|
|
3998
|
-
|
|
4404
|
+
addPlatformOptions2(
|
|
3999
4405
|
evals.command("video").description(
|
|
4000
4406
|
"Get the Playwright replay video (.webm) an eval iteration recorded \u2014 prints the URL, or downloads it with --out"
|
|
4001
4407
|
).requiredOption("--run <id>", "Eval run ID (from `eval run`)").requiredOption(
|
|
@@ -4008,7 +4414,7 @@ function registerEvalCommands(program) {
|
|
|
4008
4414
|
).action(
|
|
4009
4415
|
async (options, command) => {
|
|
4010
4416
|
const globalOptions = getGlobalOptions(command);
|
|
4011
|
-
const result = await
|
|
4417
|
+
const result = await runPlatformCommand2(
|
|
4012
4418
|
options,
|
|
4013
4419
|
globalOptions.timeout,
|
|
4014
4420
|
({ client, signal }) => getEvalIterationTraceOperation.execute(
|
|
@@ -4059,7 +4465,7 @@ function registerEvalCommands(program) {
|
|
|
4059
4465
|
`);
|
|
4060
4466
|
}
|
|
4061
4467
|
);
|
|
4062
|
-
|
|
4468
|
+
addPlatformOptions2(
|
|
4063
4469
|
evals.command("get").description("Show an eval suite's full settings").requiredOption("--suite <id-or-name>", "Eval suite name or ID").option("--project <id-or-name>", PROJECT_OPT)
|
|
4064
4470
|
).action(
|
|
4065
4471
|
async (options, command) => {
|
|
@@ -4071,7 +4477,7 @@ function registerEvalCommands(program) {
|
|
|
4071
4477
|
);
|
|
4072
4478
|
}
|
|
4073
4479
|
);
|
|
4074
|
-
|
|
4480
|
+
addPlatformOptions2(
|
|
4075
4481
|
evals.command("update").description(
|
|
4076
4482
|
"Edit an eval suite's settings (only the flags you pass change)"
|
|
4077
4483
|
).requiredOption("--suite <id-or-name>", "Eval suite name or ID").option("--project <id-or-name>", PROJECT_OPT).option("--file <path>", "Suite-update JSON body (or - for stdin)").option("--json <json>", "Inline suite-update JSON (or @file, or -)").option("--name <name>", "Rename the suite").option("--description <text>", "Suite description").option(
|
|
@@ -4085,7 +4491,7 @@ function registerEvalCommands(program) {
|
|
|
4085
4491
|
);
|
|
4086
4492
|
await executeOp(updateEvalSuiteOperation, input, options, command);
|
|
4087
4493
|
});
|
|
4088
|
-
|
|
4494
|
+
addPlatformOptions2(
|
|
4089
4495
|
evals.command("delete").description("Permanently delete an eval suite (and its cases and runs)").requiredOption("--suite <id-or-name>", "Eval suite name or ID").option("--project <id-or-name>", PROJECT_OPT)
|
|
4090
4496
|
).action(
|
|
4091
4497
|
async (options, command) => {
|
|
@@ -4097,7 +4503,7 @@ function registerEvalCommands(program) {
|
|
|
4097
4503
|
);
|
|
4098
4504
|
}
|
|
4099
4505
|
);
|
|
4100
|
-
|
|
4506
|
+
addPlatformOptions2(
|
|
4101
4507
|
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)")
|
|
4102
4508
|
).action(
|
|
4103
4509
|
async (options, command) => {
|
|
@@ -4117,7 +4523,7 @@ function registerEvalCommands(program) {
|
|
|
4117
4523
|
}
|
|
4118
4524
|
);
|
|
4119
4525
|
const cases = evals.command("cases").description("List, author, and edit an eval suite's test cases");
|
|
4120
|
-
|
|
4526
|
+
addPlatformOptions2(
|
|
4121
4527
|
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)
|
|
4122
4528
|
).action(
|
|
4123
4529
|
async (options, command) => {
|
|
@@ -4129,7 +4535,7 @@ function registerEvalCommands(program) {
|
|
|
4129
4535
|
);
|
|
4130
4536
|
}
|
|
4131
4537
|
);
|
|
4132
|
-
|
|
4538
|
+
addPlatformOptions2(
|
|
4133
4539
|
cases.command("get").description("Show one test case").requiredOption("--suite <id-or-name>", "Eval suite name or ID").requiredOption("--case <id-or-title>", "Eval case title or ID").option("--project <id-or-name>", PROJECT_OPT)
|
|
4134
4540
|
).action(
|
|
4135
4541
|
async (options, command) => {
|
|
@@ -4141,7 +4547,7 @@ function registerEvalCommands(program) {
|
|
|
4141
4547
|
);
|
|
4142
4548
|
}
|
|
4143
4549
|
);
|
|
4144
|
-
|
|
4550
|
+
addPlatformOptions2(
|
|
4145
4551
|
cases.command("run").description(
|
|
4146
4552
|
"Run a single case as a persisted, fully-queryable run (inspect it with `eval iterations` / `eval steps` like any run)"
|
|
4147
4553
|
).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(
|
|
@@ -4163,7 +4569,7 @@ function registerEvalCommands(program) {
|
|
|
4163
4569
|
);
|
|
4164
4570
|
}
|
|
4165
4571
|
);
|
|
4166
|
-
|
|
4572
|
+
addPlatformOptions2(
|
|
4167
4573
|
cases.command("create").description("Add a test case to a suite (definition via --file/--json)").requiredOption("--suite <id-or-name>", "Eval suite name or ID").option("--project <id-or-name>", PROJECT_OPT).option("--file <path>", "Case JSON body (or - for stdin)").option("--json <json>", "Inline case JSON (or @file, or -)").option("--title <title>", "Case title (overrides the body)")
|
|
4168
4574
|
).action(async (options, command) => {
|
|
4169
4575
|
const input = validateOpInput(
|
|
@@ -4172,7 +4578,7 @@ function registerEvalCommands(program) {
|
|
|
4172
4578
|
);
|
|
4173
4579
|
await executeOp(createEvalCaseOperation, input, options, command);
|
|
4174
4580
|
});
|
|
4175
|
-
|
|
4581
|
+
addPlatformOptions2(
|
|
4176
4582
|
cases.command("update").description("Edit a test case (definition via --file/--json)").requiredOption("--suite <id-or-name>", "Eval suite name or ID").requiredOption("--case <id-or-title>", "Eval case title or ID").option("--project <id-or-name>", PROJECT_OPT).option("--file <path>", "Case JSON body (or - for stdin)").option("--json <json>", "Inline case JSON (or @file, or -)").option("--title <title>", "Rename the case")
|
|
4177
4583
|
).action(async (options, command) => {
|
|
4178
4584
|
const input = validateOpInput(
|
|
@@ -4181,7 +4587,7 @@ function registerEvalCommands(program) {
|
|
|
4181
4587
|
);
|
|
4182
4588
|
await executeOp(updateEvalCaseOperation, input, options, command);
|
|
4183
4589
|
});
|
|
4184
|
-
|
|
4590
|
+
addPlatformOptions2(
|
|
4185
4591
|
cases.command("delete").description("Permanently delete a test case").requiredOption("--suite <id-or-name>", "Eval suite name or ID").requiredOption("--case <id-or-title>", "Eval case title or ID").option("--project <id-or-name>", PROJECT_OPT)
|
|
4186
4592
|
).action(
|
|
4187
4593
|
async (options, command) => {
|
|
@@ -4193,7 +4599,7 @@ function registerEvalCommands(program) {
|
|
|
4193
4599
|
);
|
|
4194
4600
|
}
|
|
4195
4601
|
);
|
|
4196
|
-
|
|
4602
|
+
addPlatformOptions2(
|
|
4197
4603
|
cases.command("generate").description(
|
|
4198
4604
|
"AI-generate test cases from the suite's tools (spends credits)"
|
|
4199
4605
|
).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(
|
|
@@ -4242,13 +4648,13 @@ function registerEvalCommands(program) {
|
|
|
4242
4648
|
);
|
|
4243
4649
|
}
|
|
4244
4650
|
var HOST_TEMPLATES = HOST_TEMPLATES$1.map(({ id, label }) => ({ id, label }));
|
|
4245
|
-
function
|
|
4651
|
+
function addPlatformOptions3(command) {
|
|
4246
4652
|
return command.option("--api-key <key>", "MCPJam sk_ API key (overrides MCPJAM_API_KEY)").option(
|
|
4247
4653
|
"--api-url <url>",
|
|
4248
4654
|
"MCPJam API base URL (defaults to https://app.mcpjam.com/api/v1)"
|
|
4249
4655
|
);
|
|
4250
4656
|
}
|
|
4251
|
-
async function
|
|
4657
|
+
async function runPlatformCommand3(options, timeoutMs, execute) {
|
|
4252
4658
|
const controller = new AbortController();
|
|
4253
4659
|
const timeoutHandle = setTimeout(() => {
|
|
4254
4660
|
controller.abort(
|
|
@@ -4308,26 +4714,26 @@ function registerHostsCommands(program) {
|
|
|
4308
4714
|
const globalOptions = getGlobalOptions(command);
|
|
4309
4715
|
writeResult({ items: HOST_TEMPLATES }, globalOptions.format);
|
|
4310
4716
|
});
|
|
4311
|
-
|
|
4717
|
+
addPlatformOptions3(
|
|
4312
4718
|
hosts.command("list").description("List the hosts saved in a project").option(
|
|
4313
4719
|
"--project <id-or-name>",
|
|
4314
4720
|
"Project name or ID (defaults to the most recently updated project)"
|
|
4315
4721
|
)
|
|
4316
4722
|
).action(async (options, command) => {
|
|
4317
4723
|
const globalOptions = getGlobalOptions(command);
|
|
4318
|
-
const result = await
|
|
4724
|
+
const result = await runPlatformCommand3(
|
|
4319
4725
|
options,
|
|
4320
4726
|
globalOptions.timeout,
|
|
4321
4727
|
({ client, signal }) => listHostsOperation.execute({ project: options.project }, { client, signal })
|
|
4322
4728
|
);
|
|
4323
4729
|
writeResult(result, globalOptions.format);
|
|
4324
4730
|
});
|
|
4325
|
-
|
|
4731
|
+
addPlatformOptions3(
|
|
4326
4732
|
hosts.command("get").description("Show one host's full settings, including its host config").requiredOption("--host <id-or-name>", "Host name or ID").option("--project <id-or-name>", "Project name or ID")
|
|
4327
4733
|
).action(
|
|
4328
4734
|
async (options, command) => {
|
|
4329
4735
|
const globalOptions = getGlobalOptions(command);
|
|
4330
|
-
const result = await
|
|
4736
|
+
const result = await runPlatformCommand3(
|
|
4331
4737
|
options,
|
|
4332
4738
|
globalOptions.timeout,
|
|
4333
4739
|
({ client, signal }) => getHostOperation.execute(
|
|
@@ -4338,7 +4744,7 @@ function registerHostsCommands(program) {
|
|
|
4338
4744
|
writeResult(result, globalOptions.format);
|
|
4339
4745
|
}
|
|
4340
4746
|
);
|
|
4341
|
-
|
|
4747
|
+
addPlatformOptions3(
|
|
4342
4748
|
hosts.command("create").description(
|
|
4343
4749
|
"Create a host from a built-in template (--template) or a full host config (--file/--json)"
|
|
4344
4750
|
).requiredOption("--name <name>", "Display name for the new host").option("--project <id-or-name>", "Project name or ID").option(
|
|
@@ -4352,14 +4758,14 @@ function registerHostsCommands(program) {
|
|
|
4352
4758
|
async (options, command) => {
|
|
4353
4759
|
const globalOptions = getGlobalOptions(command);
|
|
4354
4760
|
const config = loadConfigObject(options);
|
|
4355
|
-
const input =
|
|
4761
|
+
const input = validateInput2(createHostOperation, {
|
|
4356
4762
|
project: options.project,
|
|
4357
4763
|
name: options.name,
|
|
4358
4764
|
...options.template !== void 0 ? { template: options.template } : {},
|
|
4359
4765
|
...options.theme !== void 0 ? { theme: options.theme } : {},
|
|
4360
4766
|
...config !== void 0 ? { config } : {}
|
|
4361
4767
|
});
|
|
4362
|
-
const result = await
|
|
4768
|
+
const result = await runPlatformCommand3(
|
|
4363
4769
|
options,
|
|
4364
4770
|
globalOptions.timeout,
|
|
4365
4771
|
({ client, signal }) => createHostOperation.execute(input, { client, signal })
|
|
@@ -4367,19 +4773,19 @@ function registerHostsCommands(program) {
|
|
|
4367
4773
|
writeResult(result, globalOptions.format);
|
|
4368
4774
|
}
|
|
4369
4775
|
);
|
|
4370
|
-
|
|
4776
|
+
addPlatformOptions3(
|
|
4371
4777
|
hosts.command("update").description("Edit a host's name and/or its host config").requiredOption("--host <id-or-name>", "Host name or ID").option("--project <id-or-name>", "Project name or ID").option("--name <name>", "New display name").option("--file <path>", "Replacement host config v2 JSON (or - for stdin)").option("--json <json>", "Inline replacement host config v2 JSON (or @file, or -)")
|
|
4372
4778
|
).action(
|
|
4373
4779
|
async (options, command) => {
|
|
4374
4780
|
const globalOptions = getGlobalOptions(command);
|
|
4375
4781
|
const config = loadConfigObject(options);
|
|
4376
|
-
const input =
|
|
4782
|
+
const input = validateInput2(updateHostOperation, {
|
|
4377
4783
|
project: options.project,
|
|
4378
4784
|
host: options.host,
|
|
4379
4785
|
...options.name !== void 0 ? { name: options.name } : {},
|
|
4380
4786
|
...config !== void 0 ? { config } : {}
|
|
4381
4787
|
});
|
|
4382
|
-
const result = await
|
|
4788
|
+
const result = await runPlatformCommand3(
|
|
4383
4789
|
options,
|
|
4384
4790
|
globalOptions.timeout,
|
|
4385
4791
|
({ client, signal }) => updateHostOperation.execute(input, { client, signal })
|
|
@@ -4387,12 +4793,12 @@ function registerHostsCommands(program) {
|
|
|
4387
4793
|
writeResult(result, globalOptions.format);
|
|
4388
4794
|
}
|
|
4389
4795
|
);
|
|
4390
|
-
|
|
4796
|
+
addPlatformOptions3(
|
|
4391
4797
|
hosts.command("delete").description("Permanently delete a host from a project").requiredOption("--host <id-or-name>", "Host name or ID").option("--project <id-or-name>", "Project name or ID")
|
|
4392
4798
|
).action(
|
|
4393
4799
|
async (options, command) => {
|
|
4394
4800
|
const globalOptions = getGlobalOptions(command);
|
|
4395
|
-
const result = await
|
|
4801
|
+
const result = await runPlatformCommand3(
|
|
4396
4802
|
options,
|
|
4397
4803
|
globalOptions.timeout,
|
|
4398
4804
|
({ client, signal }) => deleteHostOperation.execute(
|
|
@@ -4407,7 +4813,7 @@ function registerHostsCommands(program) {
|
|
|
4407
4813
|
}
|
|
4408
4814
|
);
|
|
4409
4815
|
}
|
|
4410
|
-
function
|
|
4816
|
+
function validateInput2(op, raw) {
|
|
4411
4817
|
const parsed = op.inputSchema.safeParse(raw);
|
|
4412
4818
|
if (!parsed.success) {
|
|
4413
4819
|
const detail = parsed.error.issues.map((issue) => `${issue.path.join(".") || "(root)"}: ${issue.message}`).join("; ");
|
|
@@ -5166,13 +5572,13 @@ function statusGlyph(status) {
|
|
|
5166
5572
|
}
|
|
5167
5573
|
|
|
5168
5574
|
// src/commands/projects.ts
|
|
5169
|
-
function
|
|
5575
|
+
function addPlatformOptions4(command) {
|
|
5170
5576
|
return command.option("--api-key <key>", "MCPJam sk_ API key (overrides MCPJAM_API_KEY)").option(
|
|
5171
5577
|
"--api-url <url>",
|
|
5172
5578
|
"MCPJam API base URL (defaults to https://app.mcpjam.com/api/v1)"
|
|
5173
5579
|
);
|
|
5174
5580
|
}
|
|
5175
|
-
async function
|
|
5581
|
+
async function runPlatformCommand4(options, timeoutMs, execute) {
|
|
5176
5582
|
const controller = new AbortController();
|
|
5177
5583
|
const timeoutHandle = setTimeout(() => {
|
|
5178
5584
|
controller.abort(
|
|
@@ -5200,11 +5606,11 @@ async function runPlatformCommand3(options, timeoutMs, execute) {
|
|
|
5200
5606
|
}
|
|
5201
5607
|
function registerProjectsCommands(program) {
|
|
5202
5608
|
const projects = program.command("projects").description("Operate the MCP servers saved in your hosted MCPJam projects");
|
|
5203
|
-
|
|
5609
|
+
addPlatformOptions4(
|
|
5204
5610
|
projects.command("list").description("List the projects you can access")
|
|
5205
5611
|
).action(async (options, command) => {
|
|
5206
5612
|
const globalOptions = getGlobalOptions(command);
|
|
5207
|
-
const result = await
|
|
5613
|
+
const result = await runPlatformCommand4(
|
|
5208
5614
|
options,
|
|
5209
5615
|
globalOptions.timeout,
|
|
5210
5616
|
({ client, signal }) => listProjectsOperation.execute({}, { client, signal })
|
|
@@ -5216,14 +5622,14 @@ function registerProjectsCommands(program) {
|
|
|
5216
5622
|
writeResult(result, globalOptions.format);
|
|
5217
5623
|
}
|
|
5218
5624
|
});
|
|
5219
|
-
|
|
5625
|
+
addPlatformOptions4(
|
|
5220
5626
|
projects.command("servers").description("List the servers saved in a project").option(
|
|
5221
5627
|
"--project <id-or-name>",
|
|
5222
5628
|
"Project name or ID (defaults to the most recently updated project)"
|
|
5223
5629
|
)
|
|
5224
5630
|
).action(async (options, command) => {
|
|
5225
5631
|
const globalOptions = getGlobalOptions(command);
|
|
5226
|
-
const result = await
|
|
5632
|
+
const result = await runPlatformCommand4(
|
|
5227
5633
|
options,
|
|
5228
5634
|
globalOptions.timeout,
|
|
5229
5635
|
({ client, signal }) => listProjectServersOperation.execute(
|
|
@@ -5238,7 +5644,7 @@ function registerProjectsCommands(program) {
|
|
|
5238
5644
|
writeResult(result, globalOptions.format);
|
|
5239
5645
|
}
|
|
5240
5646
|
});
|
|
5241
|
-
|
|
5647
|
+
addPlatformOptions4(
|
|
5242
5648
|
projects.command("status").description(
|
|
5243
5649
|
"Health-check every server in a project (hosted doctor per server)"
|
|
5244
5650
|
).option(
|
|
@@ -5247,7 +5653,7 @@ function registerProjectsCommands(program) {
|
|
|
5247
5653
|
)
|
|
5248
5654
|
).action(async (options, command) => {
|
|
5249
5655
|
const globalOptions = getGlobalOptions(command);
|
|
5250
|
-
const payload = await
|
|
5656
|
+
const payload = await runPlatformCommand4(
|
|
5251
5657
|
options,
|
|
5252
5658
|
globalOptions.timeout,
|
|
5253
5659
|
({ client, signal }) => showServersOperation.execute(
|
|
@@ -6111,26 +6517,18 @@ function statusToErrorCode(status) {
|
|
|
6111
6517
|
if (status === 504) return "TIMEOUT";
|
|
6112
6518
|
return "INTERNAL_ERROR";
|
|
6113
6519
|
}
|
|
6114
|
-
async function withEphemeralManager(config, fn, options) {
|
|
6115
|
-
return withEphemeralClient(config, fn, {
|
|
6116
|
-
serverId: "__cli__",
|
|
6117
|
-
clientName: "mcpjam",
|
|
6118
|
-
timeout: options?.timeout ?? 3e4,
|
|
6119
|
-
rpcLogger: options?.rpcLogger,
|
|
6120
|
-
retryPolicy: options?.retryPolicy
|
|
6121
|
-
});
|
|
6122
|
-
}
|
|
6123
|
-
|
|
6124
|
-
// src/commands/prompts.ts
|
|
6125
6520
|
function registerPromptCommands(program) {
|
|
6126
6521
|
const prompts = program.command("prompts").description("List and fetch MCP prompts");
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6522
|
+
addHostOption(
|
|
6523
|
+
addRetryOptions(
|
|
6524
|
+
addSharedServerOptions(
|
|
6525
|
+
prompts.command("list").description("List prompts exposed by an MCP server").option("--cursor <cursor>", "Pagination cursor")
|
|
6526
|
+
)
|
|
6130
6527
|
)
|
|
6131
6528
|
).action(async (options, command) => {
|
|
6132
6529
|
const globalOptions = getGlobalOptions(command);
|
|
6133
6530
|
const retryPolicy = parseRetryPolicy(options);
|
|
6531
|
+
const host = resolveHostFromOptions(options);
|
|
6134
6532
|
const target = describeTarget(options);
|
|
6135
6533
|
const collector = globalOptions.rpc ? createCliRpcLogCollector({ __cli__: target }) : void 0;
|
|
6136
6534
|
const config = parseServerConfig({
|
|
@@ -6143,7 +6541,8 @@ function registerPromptCommands(program) {
|
|
|
6143
6541
|
{
|
|
6144
6542
|
timeout: globalOptions.timeout,
|
|
6145
6543
|
rpcLogger: collector?.rpcLogger,
|
|
6146
|
-
retryPolicy
|
|
6544
|
+
retryPolicy,
|
|
6545
|
+
host: host?.connection
|
|
6147
6546
|
}
|
|
6148
6547
|
);
|
|
6149
6548
|
writeResult(
|
|
@@ -6151,16 +6550,19 @@ function registerPromptCommands(program) {
|
|
|
6151
6550
|
globalOptions.format
|
|
6152
6551
|
);
|
|
6153
6552
|
});
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
"--prompt-
|
|
6158
|
-
|
|
6553
|
+
addHostOption(
|
|
6554
|
+
addRetryOptions(
|
|
6555
|
+
addSharedServerOptions(
|
|
6556
|
+
prompts.command("get").description("Get a named prompt from an MCP server").option("--prompt-name <prompt>", "Prompt name").option("--name <prompt>", "Alias for --prompt-name").option(
|
|
6557
|
+
"--prompt-args <json>",
|
|
6558
|
+
"Prompt arguments as JSON, @path, or - for stdin"
|
|
6559
|
+
)
|
|
6159
6560
|
)
|
|
6160
6561
|
)
|
|
6161
6562
|
).action(async (options, command) => {
|
|
6162
6563
|
const globalOptions = getGlobalOptions(command);
|
|
6163
6564
|
const retryPolicy = parseRetryPolicy(options);
|
|
6565
|
+
const host = resolveHostFromOptions(options);
|
|
6164
6566
|
const target = describeTarget(options);
|
|
6165
6567
|
const collector = globalOptions.rpc ? createCliRpcLogCollector({ __cli__: target }) : void 0;
|
|
6166
6568
|
const promptName = resolveAliasedStringOption(
|
|
@@ -6187,7 +6589,8 @@ function registerPromptCommands(program) {
|
|
|
6187
6589
|
{
|
|
6188
6590
|
timeout: globalOptions.timeout,
|
|
6189
6591
|
rpcLogger: collector?.rpcLogger,
|
|
6190
|
-
retryPolicy
|
|
6592
|
+
retryPolicy,
|
|
6593
|
+
host: host?.connection
|
|
6191
6594
|
}
|
|
6192
6595
|
);
|
|
6193
6596
|
writeResult(
|
|
@@ -6198,13 +6601,16 @@ function registerPromptCommands(program) {
|
|
|
6198
6601
|
}
|
|
6199
6602
|
function registerResourcesCommands(program) {
|
|
6200
6603
|
const resources = program.command("resources").description("List and read MCP resources");
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6604
|
+
addHostOption(
|
|
6605
|
+
addRetryOptions(
|
|
6606
|
+
addSharedServerOptions(
|
|
6607
|
+
resources.command("list").description("List resources exposed by an MCP server").option("--cursor <cursor>", "Pagination cursor")
|
|
6608
|
+
)
|
|
6204
6609
|
)
|
|
6205
6610
|
).action(async (options, command) => {
|
|
6206
6611
|
const globalOptions = getGlobalOptions(command);
|
|
6207
6612
|
const retryPolicy = parseRetryPolicy(options);
|
|
6613
|
+
const host = resolveHostFromOptions(options);
|
|
6208
6614
|
const target = describeTarget(options);
|
|
6209
6615
|
const collector = globalOptions.rpc ? createCliRpcLogCollector({ __cli__: target }) : void 0;
|
|
6210
6616
|
const config = parseServerConfig({
|
|
@@ -6217,7 +6623,8 @@ function registerResourcesCommands(program) {
|
|
|
6217
6623
|
{
|
|
6218
6624
|
timeout: globalOptions.timeout,
|
|
6219
6625
|
rpcLogger: collector?.rpcLogger,
|
|
6220
|
-
retryPolicy
|
|
6626
|
+
retryPolicy,
|
|
6627
|
+
host: host?.connection
|
|
6221
6628
|
}
|
|
6222
6629
|
);
|
|
6223
6630
|
writeResult(
|
|
@@ -6225,13 +6632,16 @@ function registerResourcesCommands(program) {
|
|
|
6225
6632
|
globalOptions.format
|
|
6226
6633
|
);
|
|
6227
6634
|
});
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
|
|
6635
|
+
addHostOption(
|
|
6636
|
+
addRetryOptions(
|
|
6637
|
+
addSharedServerOptions(
|
|
6638
|
+
resources.command("read").description("Read a resource from an MCP server").option("--resource-uri <uri>", "Resource URI").option("--uri <uri>", "Alias for --resource-uri")
|
|
6639
|
+
)
|
|
6231
6640
|
)
|
|
6232
6641
|
).action(async (options, command) => {
|
|
6233
6642
|
const globalOptions = getGlobalOptions(command);
|
|
6234
6643
|
const retryPolicy = parseRetryPolicy(options);
|
|
6644
|
+
const host = resolveHostFromOptions(options);
|
|
6235
6645
|
const target = describeTarget(options);
|
|
6236
6646
|
const collector = globalOptions.rpc ? createCliRpcLogCollector({ __cli__: target }) : void 0;
|
|
6237
6647
|
const resourceUri = resolveAliasedStringOption(
|
|
@@ -6253,7 +6663,8 @@ function registerResourcesCommands(program) {
|
|
|
6253
6663
|
{
|
|
6254
6664
|
timeout: globalOptions.timeout,
|
|
6255
6665
|
rpcLogger: collector?.rpcLogger,
|
|
6256
|
-
retryPolicy
|
|
6666
|
+
retryPolicy,
|
|
6667
|
+
host: host?.connection
|
|
6257
6668
|
}
|
|
6258
6669
|
);
|
|
6259
6670
|
writeResult(
|
|
@@ -6261,13 +6672,16 @@ function registerResourcesCommands(program) {
|
|
|
6261
6672
|
globalOptions.format
|
|
6262
6673
|
);
|
|
6263
6674
|
});
|
|
6264
|
-
|
|
6265
|
-
|
|
6266
|
-
|
|
6675
|
+
addHostOption(
|
|
6676
|
+
addRetryOptions(
|
|
6677
|
+
addSharedServerOptions(
|
|
6678
|
+
resources.command("templates").description("List resource templates exposed by an MCP server").option("--cursor <cursor>", "Pagination cursor")
|
|
6679
|
+
)
|
|
6267
6680
|
)
|
|
6268
6681
|
).action(async (options, command) => {
|
|
6269
6682
|
const globalOptions = getGlobalOptions(command);
|
|
6270
6683
|
const retryPolicy = parseRetryPolicy(options);
|
|
6684
|
+
const host = resolveHostFromOptions(options);
|
|
6271
6685
|
const target = describeTarget(options);
|
|
6272
6686
|
const collector = globalOptions.rpc ? createCliRpcLogCollector({ __cli__: target }) : void 0;
|
|
6273
6687
|
const config = parseServerConfig({
|
|
@@ -6283,7 +6697,8 @@ function registerResourcesCommands(program) {
|
|
|
6283
6697
|
{
|
|
6284
6698
|
timeout: globalOptions.timeout,
|
|
6285
6699
|
rpcLogger: collector?.rpcLogger,
|
|
6286
|
-
retryPolicy
|
|
6700
|
+
retryPolicy,
|
|
6701
|
+
host: host?.connection
|
|
6287
6702
|
}
|
|
6288
6703
|
);
|
|
6289
6704
|
writeResult(
|
|
@@ -7458,13 +7873,16 @@ function writeTelemetryStatus(status, format) {
|
|
|
7458
7873
|
}
|
|
7459
7874
|
function registerToolsCommands(program) {
|
|
7460
7875
|
const tools = program.command("tools").description("List and invoke MCP server tools");
|
|
7461
|
-
|
|
7462
|
-
|
|
7463
|
-
|
|
7876
|
+
addHostOption(
|
|
7877
|
+
addRetryOptions(
|
|
7878
|
+
addSharedServerOptions(
|
|
7879
|
+
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")
|
|
7880
|
+
)
|
|
7464
7881
|
)
|
|
7465
7882
|
).action(async (options, command) => {
|
|
7466
7883
|
const globalOptions = getGlobalOptions(command);
|
|
7467
7884
|
const retryPolicy = parseRetryPolicy(options);
|
|
7885
|
+
const host = resolveHostFromOptions(options);
|
|
7468
7886
|
const target = describeTarget(options);
|
|
7469
7887
|
const collector = globalOptions.rpc ? createCliRpcLogCollector({ __cli__: target }) : void 0;
|
|
7470
7888
|
const config = parseServerConfig({
|
|
@@ -7473,15 +7891,40 @@ function registerToolsCommands(program) {
|
|
|
7473
7891
|
});
|
|
7474
7892
|
const result = await withEphemeralManager(
|
|
7475
7893
|
config,
|
|
7476
|
-
(manager, serverId) =>
|
|
7477
|
-
|
|
7478
|
-
|
|
7479
|
-
|
|
7480
|
-
|
|
7894
|
+
async (manager, serverId) => {
|
|
7895
|
+
const listed = await listToolsWithMetadata(manager, {
|
|
7896
|
+
serverId,
|
|
7897
|
+
cursor: options.cursor,
|
|
7898
|
+
modelId: options.modelId
|
|
7899
|
+
});
|
|
7900
|
+
if (!host) return listed;
|
|
7901
|
+
const { tools: visibleTools, toolsDroppedVisibility } = applyHostVisibility(
|
|
7902
|
+
listed.tools,
|
|
7903
|
+
manager,
|
|
7904
|
+
serverId,
|
|
7905
|
+
host.policy
|
|
7906
|
+
);
|
|
7907
|
+
const visibleNames = new Set(
|
|
7908
|
+
visibleTools.map((tool) => String(tool.name))
|
|
7909
|
+
);
|
|
7910
|
+
return {
|
|
7911
|
+
...listed,
|
|
7912
|
+
tools: visibleTools,
|
|
7913
|
+
toolsMetadata: Object.fromEntries(
|
|
7914
|
+
Object.entries(listed.toolsMetadata).filter(
|
|
7915
|
+
([name]) => visibleNames.has(name)
|
|
7916
|
+
)
|
|
7917
|
+
),
|
|
7918
|
+
...listed.tokenCount === void 0 ? {} : { tokenCount: estimateTokensFromChars(JSON.stringify(visibleTools)) },
|
|
7919
|
+
host: host.id,
|
|
7920
|
+
toolsDroppedVisibility
|
|
7921
|
+
};
|
|
7922
|
+
},
|
|
7481
7923
|
{
|
|
7482
7924
|
timeout: globalOptions.timeout,
|
|
7483
7925
|
rpcLogger: collector?.rpcLogger,
|
|
7484
|
-
retryPolicy
|
|
7926
|
+
retryPolicy,
|
|
7927
|
+
host: host?.connection
|
|
7485
7928
|
}
|
|
7486
7929
|
);
|
|
7487
7930
|
writeResult(
|
|
@@ -7489,52 +7932,55 @@ function registerToolsCommands(program) {
|
|
|
7489
7932
|
globalOptions.format
|
|
7490
7933
|
);
|
|
7491
7934
|
});
|
|
7492
|
-
|
|
7493
|
-
|
|
7494
|
-
"--tool-
|
|
7495
|
-
|
|
7496
|
-
|
|
7497
|
-
"--
|
|
7498
|
-
|
|
7499
|
-
|
|
7500
|
-
|
|
7501
|
-
|
|
7502
|
-
|
|
7503
|
-
|
|
7504
|
-
|
|
7505
|
-
|
|
7506
|
-
|
|
7507
|
-
|
|
7508
|
-
|
|
7509
|
-
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
|
|
7517
|
-
|
|
7518
|
-
|
|
7519
|
-
|
|
7520
|
-
|
|
7521
|
-
|
|
7522
|
-
|
|
7523
|
-
|
|
7524
|
-
"--
|
|
7525
|
-
|
|
7526
|
-
|
|
7527
|
-
|
|
7528
|
-
|
|
7529
|
-
|
|
7530
|
-
|
|
7531
|
-
|
|
7532
|
-
|
|
7533
|
-
|
|
7534
|
-
|
|
7535
|
-
|
|
7935
|
+
addHostOption(
|
|
7936
|
+
addSharedServerOptions(
|
|
7937
|
+
tools.command("call").description("Call an MCP tool").option("--tool-name <tool>", "Tool name").option("--name <tool>", "Alias for --tool-name").option(
|
|
7938
|
+
"--tool-args <json>",
|
|
7939
|
+
"Tool parameter object as JSON, @path, or - for stdin"
|
|
7940
|
+
).option("--params <json>", "Alias for --tool-args").option("--tool-args-stdin", "Read tool parameter JSON from stdin").option(
|
|
7941
|
+
"--validate-response",
|
|
7942
|
+
"Validate the MCP tool-call envelope returned by the server"
|
|
7943
|
+
).option(
|
|
7944
|
+
"--expect-success",
|
|
7945
|
+
"Evaluate the tool-call outcome policy against isError"
|
|
7946
|
+
).option(
|
|
7947
|
+
"--reporter <reporter>",
|
|
7948
|
+
"Structured reporter output: json-summary or junit-xml"
|
|
7949
|
+
).option(
|
|
7950
|
+
"--debug-out <path>",
|
|
7951
|
+
"Write a structured debug artifact to a file"
|
|
7952
|
+
).option(
|
|
7953
|
+
"--ui",
|
|
7954
|
+
"Render the tool result in Inspector Playground; opens a browser by default in a TTY"
|
|
7955
|
+
).option(
|
|
7956
|
+
"--require-render",
|
|
7957
|
+
"Treat skipped Inspector renders as errors (with --ui)"
|
|
7958
|
+
).option(
|
|
7959
|
+
"--open",
|
|
7960
|
+
"Open Inspector in the system browser before rendering (default with --ui in a TTY)"
|
|
7961
|
+
).option(
|
|
7962
|
+
"--no-open",
|
|
7963
|
+
"Start/use Inspector without opening a system browser"
|
|
7964
|
+
).option(
|
|
7965
|
+
"--attach-only",
|
|
7966
|
+
"Require an already-running Inspector browser client; do not start or open Inspector"
|
|
7967
|
+
).option("--inspector-url <url>", "Local Inspector base URL (with --ui)").option(
|
|
7968
|
+
"--frontend-url <url>",
|
|
7969
|
+
"Inspector frontend URL (with --ui; overrides health-advertised frontend and skips discovery)"
|
|
7970
|
+
).option(
|
|
7971
|
+
"--server-name <name>",
|
|
7972
|
+
"Server name inside Inspector (with --ui)"
|
|
7973
|
+
).option(
|
|
7974
|
+
"--protocol <protocol>",
|
|
7975
|
+
'Render protocol: "mcp-apps" or "openai-sdk" (with --ui)'
|
|
7976
|
+
).option(
|
|
7977
|
+
"--device <device>",
|
|
7978
|
+
'Render device: "mobile", "tablet", "desktop", or "custom" (with --ui)'
|
|
7979
|
+
).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)")
|
|
7980
|
+
)
|
|
7536
7981
|
).action(async (options, command) => {
|
|
7537
7982
|
const globalOptions = getGlobalOptions(command);
|
|
7983
|
+
const host = resolveHostFromOptions(options);
|
|
7538
7984
|
const target = describeTarget(options);
|
|
7539
7985
|
const primaryCollector = globalOptions.rpc || options.debugOut ? createCliRpcLogCollector({ __cli__: target }) : void 0;
|
|
7540
7986
|
const snapshotCollector = options.debugOut ? createCliRpcLogCollector({ __cli__: target }) : void 0;
|
|
@@ -7598,10 +8044,14 @@ function registerToolsCommands(program) {
|
|
|
7598
8044
|
try {
|
|
7599
8045
|
result = await withEphemeralManager(
|
|
7600
8046
|
config,
|
|
7601
|
-
(manager, serverId) =>
|
|
8047
|
+
async (manager, serverId) => {
|
|
8048
|
+
if (host) await assertToolVisibleToHost(manager, serverId, toolName, host);
|
|
8049
|
+
return manager.executeTool(serverId, toolName, params);
|
|
8050
|
+
},
|
|
7602
8051
|
{
|
|
7603
8052
|
timeout: globalOptions.timeout,
|
|
7604
|
-
rpcLogger: primaryCollector?.rpcLogger
|
|
8053
|
+
rpcLogger: primaryCollector?.rpcLogger,
|
|
8054
|
+
host: host?.connection
|
|
7605
8055
|
}
|
|
7606
8056
|
);
|
|
7607
8057
|
} catch (error) {
|
|
@@ -9125,6 +9575,7 @@ async function main(argv = process.argv, dependencies = {}) {
|
|
|
9125
9575
|
registerServerCommands(program);
|
|
9126
9576
|
registerToolsCommands(program);
|
|
9127
9577
|
registerResourcesCommands(program);
|
|
9578
|
+
registerCompatCommands(program);
|
|
9128
9579
|
registerPromptCommands(program);
|
|
9129
9580
|
registerAppsCommands(program);
|
|
9130
9581
|
registerOAuthCommands(program);
|
|
@@ -9133,6 +9584,7 @@ async function main(argv = process.argv, dependencies = {}) {
|
|
|
9133
9584
|
registerProjectsCommands(program);
|
|
9134
9585
|
registerEvalCommands(program);
|
|
9135
9586
|
registerHostsCommands(program);
|
|
9587
|
+
registerEnvironmentsCommands(program);
|
|
9136
9588
|
registerTunnelCommands(program);
|
|
9137
9589
|
registerInspectorCommands(program);
|
|
9138
9590
|
registerMcpCommands(program);
|