@mcpjam/cli 2.0.1 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # @mcpjam/cli
2
2
 
3
- Test, debug, and validate MCP servers — health checks, OAuth conformance, tool-surface diffing, and structured triage from the terminal or CI.
3
+ Test, debug, and validate MCP servers. Health checks, OAuth conformance, tool-surface diffing, and structured triage from the terminal or CI.
4
4
 
5
5
  ## Install
6
6
 
@@ -21,8 +21,7 @@ $ mcpjam --help
21
21
 
22
22
  Usage: mcpjam [options] [command]
23
23
 
24
- Test, debug, and validate MCP servers — health checks, OAuth conformance,
25
- tool-surface diffing, and structured triage from the terminal or CI
24
+ Test, debug, and validate MCP servers. Health checks, OAuth conformance, tool-surface diffing, and structured triage from the terminal or CI.
26
25
 
27
26
  Options:
28
27
  -v, --version output the CLI version
@@ -36,7 +35,7 @@ Commands:
36
35
  tools List and invoke MCP server tools
37
36
  resources List and read MCP resources
38
37
  prompts List and fetch MCP prompts
39
- apps Fetch MCP App and ChatGPT App widget content
38
+ apps MCP Apps utilities, widget extraction, and conformance checks
40
39
  oauth Run MCP OAuth login, proxy, and conformance flows
41
40
  protocol MCP protocol inspection and conformance checks
42
41
  ```
@@ -53,13 +52,16 @@ mcpjam server doctor --url https://your-server.com/mcp --access-token $TOKEN
53
52
  # OAuth login
54
53
  mcpjam oauth login --url https://your-server.com/mcp --protocol-version 2025-11-25
55
54
 
55
+ # MCP Apps conformance
56
+ mcpjam apps conformance --url https://your-server.com/mcp --access-token $TOKEN
57
+
56
58
  # List tools with full schemas
57
59
  mcpjam tools list --url https://your-server.com/mcp --access-token $TOKEN --format json
58
60
  ```
59
61
 
60
62
  ## Why
61
63
 
62
- MCP servers ship without the testing infrastructure REST APIs take for granted. No health checks, no OAuth conformance tests, no deploy-time regression detection. `mcpjam` fills that gap.
64
+ MCP servers don't have built-in health checks, OAuth conformance tests, or deploy-time regression detection. `mcpjam` adds those.
63
65
 
64
66
  ## What it does
65
67
 
@@ -73,7 +75,7 @@ mcpjam server doctor --url $MCP_SERVER_URL --access-token $TOKEN --format json
73
75
 
74
76
  ### Catch breaking changes before they ship
75
77
 
76
- `server export` snapshots your entire tool surface — names, schemas, descriptions, capabilities — as diffable JSON. A renamed parameter or changed description shows up in the diff.
78
+ `server export` snapshots your entire tool surface as diffable JSON. A renamed parameter or changed description shows up in the diff.
77
79
 
78
80
  ```bash
79
81
  mcpjam server export --url $URL --access-token $TOKEN > before.json
@@ -92,7 +94,7 @@ mcpjam oauth conformance-suite --config ./oauth-matrix.json --format junit-xml >
92
94
 
93
95
  ### Verify tokens work end-to-end
94
96
 
95
- 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.
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.
96
98
 
97
99
  ```bash
98
100
  mcpjam oauth conformance --url $URL --protocol-version 2025-11-25 \
@@ -115,7 +117,7 @@ MCP has shipped three protocol versions (2025-03-26, 2025-06-18, 2025-11-25). Cl
115
117
 
116
118
  ### Structured debug artifacts
117
119
 
118
- `--debug-out` captures a JSON artifact with every request and response in the OAuth and MCP flow. Attach it to a ticket — no reproduction steps required.
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.
119
121
 
120
122
  ```bash
121
123
  mcpjam oauth login --url $URL --protocol-version 2025-11-25 \
@@ -124,7 +126,7 @@ mcpjam oauth login --url $URL --protocol-version 2025-11-25 \
124
126
 
125
127
  ### Incident triage
126
128
 
127
- 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.
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.
128
130
 
129
131
  ```bash
130
132
  mcpjam server doctor --url $URL --access-token $TOKEN --rpc --out incident-triage.json
@@ -139,6 +141,54 @@ mcpjam tools list --url $URL --access-token $TOKEN --format json \
139
141
  | jq '.tools[] | {name, description, inputSchema}'
140
142
  ```
141
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
+
142
192
  ## Documentation
143
193
 
144
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.1";
15
+ var version = "2.0.2";
16
16
 
17
17
  // src/lib/output.ts
18
18
  var DEFAULT_OUTPUT_FORMAT = "json";
@@ -587,8 +587,53 @@ function resolveHttpAccessToken(options) {
587
587
  }
588
588
 
589
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
+ };
590
603
  function registerAppsCommands(program) {
591
- 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
+ });
592
637
  addSharedServerOptions(
593
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(
594
639
  "--csp-mode <mode>",
@@ -725,6 +770,40 @@ function parseDeviceType(value) {
725
770
  `Invalid device type "${value}". Use "mobile", "tablet", or "desktop".`
726
771
  );
727
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
+ }
728
807
  function registerProtocolCommands(program) {
729
808
  const protocol = program.command("protocol").description("MCP protocol inspection and conformance checks");
730
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(
@@ -761,7 +840,7 @@ function getFormat(command) {
761
840
  const opts = command.optsWithGlobals();
762
841
  return resolveOutputFormat(opts.format, process.stdout.isTTY);
763
842
  }
764
- function collectInvalidEntries(values, allowedValues) {
843
+ function collectInvalidEntries2(values, allowedValues) {
765
844
  return (values ?? []).filter((value) => !allowedValues.includes(value));
766
845
  }
767
846
  function buildConfig(options) {
@@ -777,7 +856,7 @@ function buildConfig(options) {
777
856
  }
778
857
  const customHeaders = parseHeadersOption(options.header);
779
858
  const categories = options.category?.filter(Boolean);
780
- const invalidCategories = collectInvalidEntries(
859
+ const invalidCategories = collectInvalidEntries2(
781
860
  categories,
782
861
  sdk.MCP_CHECK_CATEGORIES
783
862
  );
@@ -787,7 +866,7 @@ function buildConfig(options) {
787
866
  );
788
867
  }
789
868
  const checkIds = options.checkId?.filter(Boolean);
790
- const invalidCheckIds = collectInvalidEntries(checkIds, sdk.MCP_CHECK_IDS);
869
+ const invalidCheckIds = collectInvalidEntries2(checkIds, sdk.MCP_CHECK_IDS);
791
870
  if (invalidCheckIds.length > 0) {
792
871
  throw usageError(
793
872
  `Unknown check id${invalidCheckIds.length === 1 ? "" : "s"}: ${invalidCheckIds.join(", ")}`
@@ -1254,12 +1333,22 @@ function registerOAuthCommands(program) {
1254
1333
  }
1255
1334
  );
1256
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
+ }
1257
1342
  let result;
1258
1343
  let commandError;
1259
1344
  try {
1260
1345
  result = await sdk.runOAuthLogin(config);
1261
1346
  } catch (error) {
1262
1347
  commandError = error;
1348
+ } finally {
1349
+ if (isTTY) {
1350
+ process.stderr.write("\r\x1B[K");
1351
+ }
1263
1352
  }
1264
1353
  const snapshotConfig = buildOAuthLoginSnapshotConfig(config, result);
1265
1354
  const target = summarizeServerDoctorTarget(
@@ -2253,7 +2342,7 @@ function registerToolsCommands(program) {
2253
2342
  async function main(argv = process.argv) {
2254
2343
  const program = addGlobalOptions(
2255
2344
  new commander.Command().name("mcpjam").version(version, "-v, --version", "output the CLI version").description(
2256
- "Test, debug, and validate MCP servers \u2014 health checks, OAuth conformance, tool-surface diffing, and structured triage from the terminal or CI"
2345
+ "Test, debug, and validate MCP servers. Health checks, OAuth conformance, tool-surface diffing, and structured triage from the terminal or CI."
2257
2346
  ).allowExcessArguments(false).exitOverride().configureOutput({
2258
2347
  writeOut: (value) => process.stdout.write(value),
2259
2348
  writeErr: () => {