@mcpjam/cli 2.0.0 → 2.0.2

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/README.md ADDED
@@ -0,0 +1,194 @@
1
+ # @mcpjam/cli
2
+
3
+ Test, debug, and validate MCP servers. Health checks, OAuth conformance, tool-surface diffing, and structured triage from the terminal or CI.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm i -g @mcpjam/cli
9
+ ```
10
+
11
+ Or run without installing:
12
+
13
+ ```bash
14
+ npx -y @mcpjam/cli@latest --help
15
+ ```
16
+
17
+ ## Commands
18
+
19
+ ```
20
+ $ mcpjam --help
21
+
22
+ Usage: mcpjam [options] [command]
23
+
24
+ Test, debug, and validate MCP servers. Health checks, OAuth conformance, tool-surface diffing, and structured triage from the terminal or CI.
25
+
26
+ Options:
27
+ -v, --version output the CLI version
28
+ --timeout <ms> Request timeout in milliseconds (default: 30000)
29
+ --rpc Include RPC logs in JSON output
30
+ --format <format> Output format
31
+ -h, --help display help for command
32
+
33
+ Commands:
34
+ server Inspect MCP server connectivity and capabilities
35
+ tools List and invoke MCP server tools
36
+ resources List and read MCP resources
37
+ prompts List and fetch MCP prompts
38
+ apps MCP Apps utilities, widget extraction, and conformance checks
39
+ oauth Run MCP OAuth login, proxy, and conformance flows
40
+ protocol MCP protocol inspection and conformance checks
41
+ ```
42
+
43
+ ## Quick start
44
+
45
+ ```bash
46
+ # Probe: is the server reachable? What transport? Is OAuth configured?
47
+ mcpjam server probe --url https://your-server.com/mcp
48
+
49
+ # Health check: MCP handshake, tool/resource/prompt sweep, exit code 0 or fail
50
+ mcpjam server doctor --url https://your-server.com/mcp --access-token $TOKEN
51
+
52
+ # OAuth login
53
+ mcpjam oauth login --url https://your-server.com/mcp --protocol-version 2025-11-25
54
+
55
+ # MCP Apps conformance
56
+ mcpjam apps conformance --url https://your-server.com/mcp --access-token $TOKEN
57
+
58
+ # List tools with full schemas
59
+ mcpjam tools list --url https://your-server.com/mcp --access-token $TOKEN --format json
60
+ ```
61
+
62
+ ## Why
63
+
64
+ MCP servers don't have built-in health checks, OAuth conformance tests, or deploy-time regression detection. `mcpjam` adds those.
65
+
66
+ ## What it does
67
+
68
+ ### CI gate on every deploy
69
+
70
+ Run `server doctor` in your pipeline. It probes connectivity, runs the MCP handshake, and sweeps every tool, resource, and prompt. Exit code 0 or the build fails.
71
+
72
+ ```bash
73
+ mcpjam server doctor --url $MCP_SERVER_URL --access-token $TOKEN --format json
74
+ ```
75
+
76
+ ### Catch breaking changes before they ship
77
+
78
+ `server export` snapshots your entire tool surface as diffable JSON. A renamed parameter or changed description shows up in the diff.
79
+
80
+ ```bash
81
+ mcpjam server export --url $URL --access-token $TOKEN > before.json
82
+ # deploy...
83
+ mcpjam server export --url $URL --access-token $TOKEN > after.json
84
+ diff <(jq -S . before.json) <(jq -S . after.json)
85
+ ```
86
+
87
+ ### OAuth conformance across the full matrix
88
+
89
+ Cover the full registration × protocol version × auth mode matrix from a single config file. Outputs JUnit XML.
90
+
91
+ ```bash
92
+ mcpjam oauth conformance-suite --config ./oauth-matrix.json --format junit-xml > report.xml
93
+ ```
94
+
95
+ ### Verify tokens work end-to-end
96
+
97
+ OAuth can succeed while `tools/list` returns 401 because the audience, scope, or session init is wrong. `--verify-call-tool` completes the full chain (OAuth, MCP connect, tool call) and reports which step fails.
98
+
99
+ ```bash
100
+ mcpjam oauth conformance --url $URL --protocol-version 2025-11-25 \
101
+ --registration dcr --verify-call-tool your_critical_tool
102
+ ```
103
+
104
+ ### Protocol version compatibility
105
+
106
+ MCP has shipped three protocol versions (2025-03-26, 2025-06-18, 2025-11-25). Clients upgrade on their own schedule. Declare the version matrix once and test on every push.
107
+
108
+ ```json
109
+ {
110
+ "flows": [
111
+ { "label": "2025-03-26/dcr", "protocolVersion": "2025-03-26", "registrationStrategy": "dcr" },
112
+ { "label": "2025-06-18/dcr", "protocolVersion": "2025-06-18", "registrationStrategy": "dcr" },
113
+ { "label": "2025-11-25/cimd", "protocolVersion": "2025-11-25", "registrationStrategy": "cimd" }
114
+ ]
115
+ }
116
+ ```
117
+
118
+ ### Structured debug artifacts
119
+
120
+ `--debug-out` captures a JSON artifact with every request and response in the OAuth and MCP flow. Attach it to a ticket instead of writing reproduction steps.
121
+
122
+ ```bash
123
+ mcpjam oauth login --url $URL --protocol-version 2025-11-25 \
124
+ --registration dcr --debug-out oauth-debug.json
125
+ ```
126
+
127
+ ### Incident triage
128
+
129
+ Separate your failures from host-side failures. `--rpc` records what your server returned (transport type, status codes, raw JSON-RPC pairs) as a structured artifact for postmortems.
130
+
131
+ ```bash
132
+ mcpjam server doctor --url $URL --access-token $TOKEN --rpc --out incident-triage.json
133
+ ```
134
+
135
+ ### Tool surface audit
136
+
137
+ Pipe the full schema inventory into your own linter, review it in a PR, or check whether descriptions are clear enough for tool selection.
138
+
139
+ ```bash
140
+ mcpjam tools list --url $URL --access-token $TOKEN --format json \
141
+ | jq '.tools[] | {name, description, inputSchema}'
142
+ ```
143
+
144
+ ## GitHub Actions
145
+
146
+ ```yaml
147
+ name: MCP Health Check
148
+
149
+ on:
150
+ push:
151
+ branches: [main]
152
+ pull_request:
153
+
154
+ jobs:
155
+ mcp-doctor:
156
+ runs-on: ubuntu-latest
157
+ steps:
158
+ - uses: actions/setup-node@v4
159
+ with:
160
+ node-version: 20
161
+
162
+ - name: OAuth login (headless)
163
+ run: |
164
+ set -euo pipefail
165
+ npx -y @mcpjam/cli@latest oauth login \
166
+ --url ${{ secrets.MCP_SERVER_URL }} \
167
+ --protocol-version 2025-11-25 \
168
+ --registration dcr \
169
+ --auth-mode headless \
170
+ --format json > /tmp/oauth-result.json
171
+ TOKEN=$(jq -r '.credentials.accessToken // empty' /tmp/oauth-result.json)
172
+ rm -f /tmp/oauth-result.json
173
+ if [ -z "$TOKEN" ]; then
174
+ echo "::error::OAuth login did not return an access token"
175
+ exit 1
176
+ fi
177
+ echo "::add-mask::$TOKEN"
178
+ echo "MCP_TOKEN=$TOKEN" >> "$GITHUB_ENV"
179
+
180
+ - name: Run doctor
181
+ run: npx -y @mcpjam/cli@latest server doctor --url ${{ secrets.MCP_SERVER_URL }} --access-token $MCP_TOKEN --format json
182
+ ```
183
+
184
+ If you already have a refresh token, you can skip the login step and pass it directly:
185
+
186
+ ```bash
187
+ mcpjam server doctor --url $URL --refresh-token $REFRESH_TOKEN --client-id $CLIENT_ID --client-secret $CLIENT_SECRET --format json
188
+ ```
189
+
190
+ See the full [CI documentation](https://docs.mcpjam.com/cli/ci-github-actions) for all authentication options.
191
+
192
+ ## Documentation
193
+
194
+ Full docs at [docs.mcpjam.com/cli](https://docs.mcpjam.com/cli).
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
12
12
  var path__default = /*#__PURE__*/_interopDefault(path);
13
13
 
14
14
  // package.json
15
- var version = "2.0.0";
15
+ var version = "2.0.2";
16
16
 
17
17
  // src/lib/output.ts
18
18
  var DEFAULT_OUTPUT_FORMAT = "json";
@@ -95,7 +95,10 @@ function parseOutputFormat(value) {
95
95
  }
96
96
  throw usageError(`Invalid output format "${value}". Use "json" or "human".`);
97
97
  }
98
- function detectOutputFormatFromArgv(argv) {
98
+ function resolveOutputFormat(value, isTTY) {
99
+ return parseOutputFormat(value ?? (isTTY ? "human" : "json"));
100
+ }
101
+ function detectOutputFormatFromArgv(argv, isTTY = process.stdout.isTTY) {
99
102
  for (let index = 0; index < argv.length; index += 1) {
100
103
  const token = argv[index];
101
104
  if (token === "--format") {
@@ -105,7 +108,7 @@ function detectOutputFormatFromArgv(argv) {
105
108
  return parseLooseOutputFormat(token.slice("--format=".length));
106
109
  }
107
110
  }
108
- return DEFAULT_OUTPUT_FORMAT;
111
+ return isTTY ? "human" : DEFAULT_OUTPUT_FORMAT;
109
112
  }
110
113
  function parseLooseOutputFormat(value) {
111
114
  return value === "human" ? "human" : DEFAULT_OUTPUT_FORMAT;
@@ -360,7 +363,7 @@ function addSharedServerOptions(command) {
360
363
  function getGlobalOptions(command) {
361
364
  const options = command.optsWithGlobals();
362
365
  return {
363
- format: parseOutputFormat(options.format ?? "json"),
366
+ format: resolveOutputFormat(options.format, process.stdout.isTTY),
364
367
  timeout: options.timeout ?? 3e4,
365
368
  rpc: options.rpc ?? false
366
369
  };
@@ -413,6 +416,34 @@ function parsePromptArguments(value) {
413
416
  Object.entries(raw).map(([key, entryValue]) => [key, String(entryValue)])
414
417
  );
415
418
  }
419
+ function resolveAliasedStringOption(options, aliases, label, config) {
420
+ const provided = aliases.map((alias) => {
421
+ const value = options[alias.key];
422
+ if (typeof value !== "string") {
423
+ return void 0;
424
+ }
425
+ const normalized = value.trim();
426
+ if (!normalized) {
427
+ return void 0;
428
+ }
429
+ return {
430
+ flag: alias.flag,
431
+ value: normalized
432
+ };
433
+ }).filter((entry) => entry !== void 0);
434
+ const flagsText = aliases.map((alias) => alias.flag).join(" or ");
435
+ if (provided.length === 0) {
436
+ if (config?.required) {
437
+ throw usageError(`${label} is required. Use ${flagsText}.`);
438
+ }
439
+ return void 0;
440
+ }
441
+ const values = new Set(provided.map((entry) => entry.value));
442
+ if (values.size > 1) {
443
+ throw usageError(`Specify only one of ${flagsText}.`);
444
+ }
445
+ return provided[0]?.value;
446
+ }
416
447
  function parseServerConfig(options) {
417
448
  const url = options.url?.trim();
418
449
  const command = options.command?.trim();
@@ -556,10 +587,55 @@ function resolveHttpAccessToken(options) {
556
587
  }
557
588
 
558
589
  // src/commands/apps.ts
590
+ var APPS_CHECK_IDS_BY_CATEGORY = {
591
+ tools: [
592
+ "ui-tools-present",
593
+ "ui-tool-metadata-valid",
594
+ "ui-tool-input-schema-valid"
595
+ ],
596
+ resources: [
597
+ "ui-listed-resources-valid",
598
+ "ui-resources-readable",
599
+ "ui-resource-contents-valid",
600
+ "ui-resource-meta-valid"
601
+ ]
602
+ };
559
603
  function registerAppsCommands(program) {
560
- const apps = program.command("apps").description("Fetch MCP App and ChatGPT App widget content");
604
+ const apps = program.command("apps").description("MCP Apps utilities, widget extraction, and conformance checks");
605
+ addSharedServerOptions(
606
+ apps.command("conformance").description("Run MCP Apps server conformance checks").option(
607
+ "--category <category>",
608
+ "Check category to run. Repeat for multiple. Default: all.",
609
+ (value, previous = []) => [...previous, value],
610
+ []
611
+ ).option(
612
+ "--check-id <id>",
613
+ "Specific check ID to run. Repeat for multiple. Default: all.",
614
+ (value, previous = []) => [...previous, value],
615
+ []
616
+ )
617
+ ).action(async (options, command) => {
618
+ const globalOptions = getGlobalOptions(command);
619
+ const target = describeTarget(options);
620
+ const collector = globalOptions.rpc ? createCliRpcLogCollector({ __cli__: target }) : void 0;
621
+ const config = {
622
+ ...buildAppsConformanceConfig({
623
+ ...options,
624
+ timeout: globalOptions.timeout
625
+ }),
626
+ ...collector ? { rpcLogger: collector.rpcLogger } : {}
627
+ };
628
+ const result = await new sdk.MCPAppsConformanceTest(config).run();
629
+ writeResult(
630
+ withRpcLogsIfRequested(result, collector, globalOptions),
631
+ globalOptions.format
632
+ );
633
+ if (!result.passed) {
634
+ setProcessExitCode(1);
635
+ }
636
+ });
561
637
  addSharedServerOptions(
562
- apps.command("mcp-widget").description("Fetch hosted-style MCP App widget content").requiredOption("--resource-uri <uri>", "Widget resource URI").requiredOption("--tool-id <id>", "Tool call id used for runtime injection").requiredOption("--tool-name <name>", "Tool name used for runtime injection").option("--tool-input <json>", "Tool input payload as JSON").option("--tool-output <json>", "Tool output payload as JSON").option("--theme <theme>", "Widget theme: light or dark").option(
638
+ apps.command("mcp-widget").description("Fetch hosted-style MCP App widget content").option("--resource-uri <uri>", "Widget resource URI").option("--uri <uri>", "Alias for --resource-uri").requiredOption("--tool-id <id>", "Tool call id used for runtime injection").requiredOption("--tool-name <name>", "Tool name used for runtime injection").option("--tool-input <json>", "Tool input payload as JSON").option("--tool-output <json>", "Tool output payload as JSON").option("--theme <theme>", "Widget theme: light or dark").option(
563
639
  "--csp-mode <mode>",
564
640
  "CSP mode: permissive or widget-declared"
565
641
  ).option("--template <uri>", "Optional ui:// template override").option("--view-mode <mode>", "Widget view mode").option("--view-params <json>", "Widget view params as JSON")
@@ -567,6 +643,15 @@ function registerAppsCommands(program) {
567
643
  const globalOptions = getGlobalOptions(command);
568
644
  const target = describeTarget(options);
569
645
  const collector = globalOptions.rpc ? createCliRpcLogCollector({ __cli__: target }) : void 0;
646
+ const resourceUri = resolveAliasedStringOption(
647
+ options,
648
+ [
649
+ { key: "resourceUri", flag: "--resource-uri" },
650
+ { key: "uri", flag: "--uri" }
651
+ ],
652
+ "Widget resource URI",
653
+ { required: true }
654
+ );
570
655
  const config = parseServerConfig({
571
656
  ...options,
572
657
  timeout: globalOptions.timeout
@@ -574,7 +659,7 @@ function registerAppsCommands(program) {
574
659
  const result = await withEphemeralManager(
575
660
  config,
576
661
  (manager, serverId) => buildMcpWidgetContent(manager, serverId, {
577
- resourceUri: options.resourceUri,
662
+ resourceUri,
578
663
  toolId: options.toolId,
579
664
  toolName: options.toolName,
580
665
  toolInput: parseJsonRecord(options.toolInput, "Tool input") ?? {},
@@ -593,7 +678,7 @@ function registerAppsCommands(program) {
593
678
  writeResult(withRpcLogsIfRequested(result, collector, globalOptions), globalOptions.format);
594
679
  });
595
680
  addSharedServerOptions(
596
- apps.command("chatgpt-widget").description("Fetch hosted-style ChatGPT App widget content").requiredOption("--uri <uri>", "Widget resource URI").requiredOption("--tool-id <id>", "Tool call id used for runtime injection").requiredOption("--tool-name <name>", "Tool name used for runtime injection").option("--tool-input <json>", "Tool input payload as JSON").option("--tool-output <json>", "Tool output payload as JSON").option(
681
+ apps.command("chatgpt-widget").description("Fetch hosted-style ChatGPT App widget content").option("--resource-uri <uri>", "Widget resource URI").option("--uri <uri>", "Alias for --resource-uri").requiredOption("--tool-id <id>", "Tool call id used for runtime injection").requiredOption("--tool-name <name>", "Tool name used for runtime injection").option("--tool-input <json>", "Tool input payload as JSON").option("--tool-output <json>", "Tool output payload as JSON").option(
597
682
  "--tool-response-metadata <json>",
598
683
  "Tool response metadata as a JSON object"
599
684
  ).option("--theme <theme>", "Widget theme: light or dark").option(
@@ -604,6 +689,15 @@ function registerAppsCommands(program) {
604
689
  const globalOptions = getGlobalOptions(command);
605
690
  const target = describeTarget(options);
606
691
  const collector = globalOptions.rpc ? createCliRpcLogCollector({ __cli__: target }) : void 0;
692
+ const resourceUri = resolveAliasedStringOption(
693
+ options,
694
+ [
695
+ { key: "resourceUri", flag: "--resource-uri" },
696
+ { key: "uri", flag: "--uri" }
697
+ ],
698
+ "Widget resource URI",
699
+ { required: true }
700
+ );
607
701
  const config = parseServerConfig({
608
702
  ...options,
609
703
  timeout: globalOptions.timeout
@@ -611,7 +705,7 @@ function registerAppsCommands(program) {
611
705
  const result = await withEphemeralManager(
612
706
  config,
613
707
  (manager, serverId) => buildChatGptWidgetContent(manager, serverId, {
614
- uri: options.uri,
708
+ uri: resourceUri,
615
709
  toolId: options.toolId,
616
710
  toolName: options.toolName,
617
711
  toolInput: parseJsonRecord(options.toolInput, "Tool input") ?? {},
@@ -676,6 +770,40 @@ function parseDeviceType(value) {
676
770
  `Invalid device type "${value}". Use "mobile", "tablet", or "desktop".`
677
771
  );
678
772
  }
773
+ function collectInvalidEntries(values, allowedValues) {
774
+ return (values ?? []).filter((value) => !allowedValues.includes(value));
775
+ }
776
+ function buildAppsConformanceConfig(options) {
777
+ const serverConfig = parseServerConfig(options);
778
+ const categories = options.category?.filter(Boolean);
779
+ const invalidCategories = collectInvalidEntries(
780
+ categories,
781
+ sdk.MCP_APPS_CHECK_CATEGORIES
782
+ );
783
+ if (invalidCategories.length > 0) {
784
+ throw usageError(
785
+ invalidCategories.length === 1 ? `Unknown category: ${invalidCategories[0]}` : `Unknown categories: ${invalidCategories.join(", ")}`
786
+ );
787
+ }
788
+ const checkIds = options.checkId?.filter(Boolean);
789
+ const invalidCheckIds = collectInvalidEntries(checkIds, sdk.MCP_APPS_CHECK_IDS);
790
+ if (invalidCheckIds.length > 0) {
791
+ throw usageError(
792
+ `Unknown check id${invalidCheckIds.length === 1 ? "" : "s"}: ${invalidCheckIds.join(", ")}`
793
+ );
794
+ }
795
+ const resolvedCheckIds = checkIds && checkIds.length > 0 ? checkIds : categories && categories.length > 0 ? Array.from(
796
+ new Set(
797
+ categories.flatMap(
798
+ (category) => APPS_CHECK_IDS_BY_CATEGORY[category]
799
+ )
800
+ )
801
+ ) : void 0;
802
+ return {
803
+ ...serverConfig,
804
+ ...resolvedCheckIds && resolvedCheckIds.length > 0 ? { checkIds: resolvedCheckIds } : {}
805
+ };
806
+ }
679
807
  function registerProtocolCommands(program) {
680
808
  const protocol = program.command("protocol").description("MCP protocol inspection and conformance checks");
681
809
  protocol.command("conformance").description("Run MCP protocol conformance checks against an HTTP server").requiredOption("--url <url>", "MCP server URL").option("--access-token <token>", "Bearer access token for HTTP servers").option(
@@ -710,13 +838,9 @@ function registerProtocolCommands(program) {
710
838
  }
711
839
  function getFormat(command) {
712
840
  const opts = command.optsWithGlobals();
713
- const value = opts.format ?? "json";
714
- if (value === "json" || value === "human") {
715
- return value;
716
- }
717
- throw usageError(`Invalid output format "${value}". Use "json" or "human".`);
841
+ return resolveOutputFormat(opts.format, process.stdout.isTTY);
718
842
  }
719
- function collectInvalidEntries(values, allowedValues) {
843
+ function collectInvalidEntries2(values, allowedValues) {
720
844
  return (values ?? []).filter((value) => !allowedValues.includes(value));
721
845
  }
722
846
  function buildConfig(options) {
@@ -732,7 +856,7 @@ function buildConfig(options) {
732
856
  }
733
857
  const customHeaders = parseHeadersOption(options.header);
734
858
  const categories = options.category?.filter(Boolean);
735
- const invalidCategories = collectInvalidEntries(
859
+ const invalidCategories = collectInvalidEntries2(
736
860
  categories,
737
861
  sdk.MCP_CHECK_CATEGORIES
738
862
  );
@@ -742,7 +866,7 @@ function buildConfig(options) {
742
866
  );
743
867
  }
744
868
  const checkIds = options.checkId?.filter(Boolean);
745
- const invalidCheckIds = collectInvalidEntries(checkIds, sdk.MCP_CHECK_IDS);
869
+ const invalidCheckIds = collectInvalidEntries2(checkIds, sdk.MCP_CHECK_IDS);
746
870
  if (invalidCheckIds.length > 0) {
747
871
  throw usageError(
748
872
  `Unknown check id${invalidCheckIds.length === 1 ? "" : "s"}: ${invalidCheckIds.join(", ")}`
@@ -1209,12 +1333,22 @@ function registerOAuthCommands(program) {
1209
1333
  }
1210
1334
  );
1211
1335
  const snapshotCollector = options.debugOut ? createCliRpcLogCollector({ __cli__: config.serverUrl }) : void 0;
1336
+ const isTTY = process.stderr.isTTY;
1337
+ if (isTTY) {
1338
+ config.onProgress = (message) => {
1339
+ process.stderr.write(`\r\x1B[K${message}`);
1340
+ };
1341
+ }
1212
1342
  let result;
1213
1343
  let commandError;
1214
1344
  try {
1215
1345
  result = await sdk.runOAuthLogin(config);
1216
1346
  } catch (error) {
1217
1347
  commandError = error;
1348
+ } finally {
1349
+ if (isTTY) {
1350
+ process.stderr.write("\r\x1B[K");
1351
+ }
1218
1352
  }
1219
1353
  const snapshotConfig = buildOAuthLoginSnapshotConfig(config, result);
1220
1354
  const target = summarizeServerDoctorTarget(
@@ -1622,11 +1756,20 @@ function registerPromptCommands(program) {
1622
1756
  writeResult(withRpcLogsIfRequested(result, collector, globalOptions), globalOptions.format);
1623
1757
  });
1624
1758
  addSharedServerOptions(
1625
- prompts.command("get").description("Get a named prompt from an MCP server").requiredOption("--name <prompt>", "Prompt name").option("--prompt-args <json>", "Prompt arguments as a JSON object")
1759
+ 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("--prompt-args <json>", "Prompt arguments as a JSON object")
1626
1760
  ).action(async (options, command) => {
1627
1761
  const globalOptions = getGlobalOptions(command);
1628
1762
  const target = describeTarget(options);
1629
1763
  const collector = globalOptions.rpc ? createCliRpcLogCollector({ __cli__: target }) : void 0;
1764
+ const promptName = resolveAliasedStringOption(
1765
+ options,
1766
+ [
1767
+ { key: "promptName", flag: "--prompt-name" },
1768
+ { key: "name", flag: "--name" }
1769
+ ],
1770
+ "Prompt name",
1771
+ { required: true }
1772
+ );
1630
1773
  const config = parseServerConfig({
1631
1774
  ...options,
1632
1775
  timeout: globalOptions.timeout
@@ -1636,7 +1779,7 @@ function registerPromptCommands(program) {
1636
1779
  config,
1637
1780
  (manager, serverId) => sdk.getPrompt(manager, {
1638
1781
  serverId,
1639
- name: options.name,
1782
+ name: promptName,
1640
1783
  arguments: promptArguments
1641
1784
  }),
1642
1785
  {
@@ -1670,18 +1813,27 @@ function registerResourcesCommands(program) {
1670
1813
  writeResult(withRpcLogsIfRequested(result, collector, globalOptions), globalOptions.format);
1671
1814
  });
1672
1815
  addSharedServerOptions(
1673
- resources.command("read").description("Read a resource from an MCP server").requiredOption("--uri <uri>", "Resource URI")
1816
+ resources.command("read").description("Read a resource from an MCP server").option("--resource-uri <uri>", "Resource URI").option("--uri <uri>", "Alias for --resource-uri")
1674
1817
  ).action(async (options, command) => {
1675
1818
  const globalOptions = getGlobalOptions(command);
1676
1819
  const target = describeTarget(options);
1677
1820
  const collector = globalOptions.rpc ? createCliRpcLogCollector({ __cli__: target }) : void 0;
1821
+ const resourceUri = resolveAliasedStringOption(
1822
+ options,
1823
+ [
1824
+ { key: "resourceUri", flag: "--resource-uri" },
1825
+ { key: "uri", flag: "--uri" }
1826
+ ],
1827
+ "Resource URI",
1828
+ { required: true }
1829
+ );
1678
1830
  const config = parseServerConfig({
1679
1831
  ...options,
1680
1832
  timeout: globalOptions.timeout
1681
1833
  });
1682
1834
  const result = await withEphemeralManager(
1683
1835
  config,
1684
- (manager, serverId) => sdk.readResource(manager, { serverId, uri: options.uri }),
1836
+ (manager, serverId) => sdk.readResource(manager, { serverId, uri: resourceUri }),
1685
1837
  {
1686
1838
  timeout: globalOptions.timeout,
1687
1839
  rpcLogger: collector?.rpcLogger
@@ -2074,8 +2226,6 @@ function registerServerCommands(program) {
2074
2226
  writeResult(withRpcLogsIfRequested(result, collector, globalOptions), globalOptions.format);
2075
2227
  });
2076
2228
  }
2077
-
2078
- // src/commands/tools.ts
2079
2229
  function registerToolsCommands(program) {
2080
2230
  const tools = program.command("tools").description("List and invoke MCP server tools");
2081
2231
  addSharedServerOptions(
@@ -2103,7 +2253,7 @@ function registerToolsCommands(program) {
2103
2253
  writeResult(withRpcLogsIfRequested(result, collector, globalOptions), globalOptions.format);
2104
2254
  });
2105
2255
  addSharedServerOptions(
2106
- tools.command("call").description("Call an MCP tool").requiredOption("--name <tool>", "Tool name").option("--params <json>", "Tool parameter object as JSON").option(
2256
+ tools.command("call").description("Call an MCP tool").option("--tool-name <tool>", "Tool name").option("--name <tool>", "Alias for --tool-name").option("--tool-args <json>", "Tool parameter object as JSON").option("--params <json>", "Alias for --tool-args").option(
2107
2257
  "--debug-out <path>",
2108
2258
  "Write a structured debug artifact to a file"
2109
2259
  )
@@ -2116,14 +2266,31 @@ function registerToolsCommands(program) {
2116
2266
  ...options,
2117
2267
  timeout: globalOptions.timeout
2118
2268
  });
2119
- const params = parseJsonRecord(options.params, "Tool parameters") ?? {};
2269
+ const toolName = resolveAliasedStringOption(
2270
+ options,
2271
+ [
2272
+ { key: "toolName", flag: "--tool-name" },
2273
+ { key: "name", flag: "--name" }
2274
+ ],
2275
+ "Tool name",
2276
+ { required: true }
2277
+ );
2278
+ const paramsInput = resolveAliasedStringOption(
2279
+ options,
2280
+ [
2281
+ { key: "toolArgs", flag: "--tool-args" },
2282
+ { key: "params", flag: "--params" }
2283
+ ],
2284
+ "Tool parameters"
2285
+ );
2286
+ const params = parseJsonRecord(paramsInput, "Tool parameters") ?? {};
2120
2287
  const targetSummary = summarizeServerDoctorTarget(target, config);
2121
2288
  let result;
2122
2289
  let commandError;
2123
2290
  try {
2124
2291
  result = await withEphemeralManager(
2125
2292
  config,
2126
- (manager, serverId) => manager.executeTool(serverId, options.name, params),
2293
+ (manager, serverId) => manager.executeTool(serverId, toolName, params),
2127
2294
  {
2128
2295
  timeout: globalOptions.timeout,
2129
2296
  rpcLogger: primaryCollector?.rpcLogger
@@ -2137,7 +2304,7 @@ function registerToolsCommands(program) {
2137
2304
  format: globalOptions.format,
2138
2305
  commandName: "tools call",
2139
2306
  commandInput: {
2140
- toolName: options.name,
2307
+ toolName,
2141
2308
  params
2142
2309
  },
2143
2310
  target: targetSummary,
@@ -2165,6 +2332,9 @@ function registerToolsCommands(program) {
2165
2332
  withRpcLogsIfRequested(result, primaryCollector, globalOptions),
2166
2333
  globalOptions.format
2167
2334
  );
2335
+ if (sdk.isCallToolResultError(result)) {
2336
+ setProcessExitCode(1);
2337
+ }
2168
2338
  });
2169
2339
  }
2170
2340
 
@@ -2172,7 +2342,7 @@ function registerToolsCommands(program) {
2172
2342
  async function main(argv = process.argv) {
2173
2343
  const program = addGlobalOptions(
2174
2344
  new commander.Command().name("mcpjam").version(version, "-v, --version", "output the CLI version").description(
2175
- "Stateless MCP server probing, debugging, OAuth login, and conformance commands backed by @mcpjam/sdk"
2345
+ "Test, debug, and validate MCP servers. Health checks, OAuth conformance, tool-surface diffing, and structured triage from the terminal or CI."
2176
2346
  ).allowExcessArguments(false).exitOverride().configureOutput({
2177
2347
  writeOut: (value) => process.stdout.write(value),
2178
2348
  writeErr: () => {