@mcpjam/cli 6.4.1 → 6.4.3

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
@@ -43,7 +43,7 @@ Local MCP testing:
43
43
  prompts List and fetch MCP prompts
44
44
  apps Validate MCP Apps metadata and resource wiring
45
45
  tasks Create, inspect and drive MCP Tasks
46
- events List, poll, watch, subscribe to and conformance-check MCP Events (triggers, draft@28ec35e)
46
+ events List, poll, watch, subscribe to and conformance-check MCP Events
47
47
  oauth Run MCP OAuth login, proxy, and conformance flows
48
48
  xaa Run the Cross-App Access (ID-JAG) debugger against an MCP server
49
49
  protocol MCP protocol inspection and conformance checks
@@ -86,6 +86,8 @@ mcpjam tools list --url https://your-server.com/mcp --access-token $TOKEN --form
86
86
  mcpjam events list --url https://your-server.com/mcp
87
87
  mcpjam events watch comment.created --url https://your-server.com/mcp \
88
88
  --event-args '{"document_id":"doc_1"}' --duration 60
89
+ mcpjam events conformance --profile beta --url https://your-server.com/mcp \
90
+ --checks events-capability-declared,events-list-shape
89
91
 
90
92
  # Run MCPJam itself as a stdio MCP server (for Claude Desktop, Claude Code, Cursor, ...)
91
93
  mcpjam mcp
@@ -96,6 +98,8 @@ mcpjam cloud projects list
96
98
  mcpjam cloud eval run --suite smoke
97
99
  ```
98
100
 
101
+ The CLI selects Events Beta when the server declares `io.modelcontextprotocol/events` on MCP `2026-07-28`. Use `--profile draft` or `--profile chatgpt` to exercise the corresponding top-level `capabilities.events` contract. Webhook conformance requires a receiver the MCP server can reach. Run `mcpjam events conformance --help` for receiver options.
102
+
99
103
  ## Why
100
104
 
101
105
  MCP servers don't have built-in health checks, OAuth conformance tests, or deploy-time regression detection. `mcpjam` adds those.
package/dist/index.js CHANGED
@@ -30,12 +30,12 @@ import { applyVisibilityPolicyAndCountSignals, isAppOnlyTool, extractHostExecuti
30
30
  import { StdioServerTransport } from '@modelcontextprotocol/server/stdio';
31
31
  import { McpServer } from '@modelcontextprotocol/server';
32
32
  import { z } from 'zod';
33
- import { generateWebhookSecret, isValidWebhookSecret, DRAFT_PROFILE_ID, CHATGPT_PROFILE_ID, getEventsProfile, CHATGPT_2026_09_30_PROFILE_ID, selectDeliveryMode, MemoryEventInbox, computeBindingKey, EventsCoordinator, EventsPushRuntime, createManagerPushPort, applySubscriptionPatch, IDLE_NEXT_ACTION_AT, MAX_DELIVERY_BODY_BYTES } from '@mcpjam/sdk/events';
33
+ import { BETA_PROFILE_ID, checkCallbackUrl, generateWebhookSecret, isValidWebhookSecret, DRAFT_PROFILE_ID, CHATGPT_PROFILE_ID, getEventsProfile, CHATGPT_2026_09_30_PROFILE_ID, selectDeliveryMode, MemoryEventInbox, DEFAULT_LOCAL_WEBHOOK_TTL_MS, computeBindingKey, EventsCoordinator, EventsPushRuntime, hasEventsProfileCapability, createManagerPushPort, applySubscriptionPatch, IDLE_NEXT_ACTION_AT, MAX_DELIVERY_BODY_BYTES } from '@mcpjam/sdk/events';
34
34
  import { selectPluginMcpServerMap, detectPluginMcpTransport } from '@mcpjam/sdk/plugin-bundle';
35
35
 
36
36
  // package.json
37
37
  var package_default = {
38
- version: "6.4.1"};
38
+ version: "6.4.3"};
39
39
 
40
40
  // src/lib/command-outcome.ts
41
41
  var UNKNOWN_COMMAND = "(unknown)";
@@ -24962,6 +24962,8 @@ function writeTelemetryStatus(status, format) {
24962
24962
  );
24963
24963
  }
24964
24964
  var EVENTS_PROFILE_ALIASES = {
24965
+ beta: BETA_PROFILE_ID,
24966
+ [BETA_PROFILE_ID]: BETA_PROFILE_ID,
24965
24967
  draft: DRAFT_PROFILE_ID,
24966
24968
  chatgpt: CHATGPT_PROFILE_ID,
24967
24969
  [DRAFT_PROFILE_ID]: DRAFT_PROFILE_ID,
@@ -24973,7 +24975,7 @@ function parseEventsProfile(value) {
24973
24975
  const id = EVENTS_PROFILE_ALIASES[key];
24974
24976
  if (!id) {
24975
24977
  throw usageError(
24976
- `Unknown --profile "${key}". Use "draft" (${DRAFT_PROFILE_ID}) or "chatgpt" (${CHATGPT_PROFILE_ID}).`
24978
+ `Unknown --profile "${key}". Use "beta" (${BETA_PROFILE_ID}), "draft" (${DRAFT_PROFILE_ID}) or "chatgpt" (${CHATGPT_PROFILE_ID}).`
24977
24979
  );
24978
24980
  }
24979
24981
  return getEventsProfile(id);
@@ -25006,8 +25008,8 @@ function applyEventsProtocolVersion(config, options) {
25006
25008
  }
25007
25009
  return { ...config, mcpProtocolVersion: version };
25008
25010
  }
25009
- function eventsNotDeclaredError(support, serverLabel) {
25010
- const reason = support.handshakeObserved ? "the server did not declare `capabilities.events` in its handshake" : "the server's handshake was not observed on this connection, so its events capability is unknown";
25011
+ function eventsNotDeclaredError(support, serverLabel, placement = "capabilities.events") {
25012
+ const reason = support.handshakeObserved ? `the server did not declare \`${placement}\` in its handshake` : "the server's handshake was not observed on this connection, so its events capability is unknown";
25011
25013
  return cliError(
25012
25014
  "EVENTS_NOT_DECLARED",
25013
25015
  `Refusing to send events/* to ${serverLabel}: ${reason}. Pass --force to send it anyway (a conformance probe of an undeclared server).`,
@@ -25017,10 +25019,11 @@ function eventsNotDeclaredError(support, serverLabel) {
25017
25019
  }
25018
25020
  function assertEventsDeclaredOrForced(manager, serverId, args) {
25019
25021
  const support = manager.getEventsSupport(serverId);
25020
- if (!support.declared) {
25021
- if (!args.force) throw eventsNotDeclaredError(support, args.serverLabel);
25022
+ if (!hasEventsProfileCapability(support, args.profile.id)) {
25023
+ const placement = args.profile.capabilityPlacement.value;
25024
+ if (!args.force) throw eventsNotDeclaredError(support, args.serverLabel, placement);
25022
25025
  args.warn(
25023
- "Warning: the server did not declare `capabilities.events`; sending events/* anyway because of --force."
25026
+ `Warning: the server did not declare \`${placement}\`; sending events/* anyway because of --force.`
25024
25027
  );
25025
25028
  }
25026
25029
  return support;
@@ -25084,26 +25087,18 @@ async function withEventsErrors(method, fn) {
25084
25087
  throw toEventsCliError(method, error);
25085
25088
  }
25086
25089
  }
25087
- function checkCallbackUrl(value, args) {
25088
- let url;
25089
- try {
25090
- url = new URL(value);
25091
- } catch {
25092
- throw usageError(`${args.flag} is not a valid URL: ${value}`);
25093
- }
25094
- if (url.protocol === "https:") return { url, insecure: false };
25095
- if (url.protocol !== "http:") {
25096
- throw usageError(`${args.flag} must be an https:// URL (got ${url.protocol}).`);
25097
- }
25098
- if (!args.allowInsecure) {
25090
+ function requireCallbackUrl(value, args) {
25091
+ const checked2 = checkCallbackUrl(value);
25092
+ if (!checked2.ok) throw usageError(`${args.flag}: ${checked2.reason}`);
25093
+ if (checked2.insecure && !args.allowInsecure) {
25099
25094
  throw usageError(
25100
- `${args.flag} must be https:// \u2014 the MCP Events draft requires https callback URLs. Pass ${args.insecureFlag} to use plain http for local development (NON-CONFORMANT; never a conformance pass).`
25095
+ `${args.flag} must be https://. Pass ${args.insecureFlag} to use plain http for local development (NON-CONFORMANT).`
25101
25096
  );
25102
25097
  }
25103
- return { url, insecure: true };
25098
+ return checked2;
25104
25099
  }
25105
25100
  function insecureModeWarning(flag, url) {
25106
- return `WARNING: ${flag} is a NON-CONFORMANT development mode. The callback URL ${url} is plain http; the MCP Events draft requires https, so a conformant server must refuse it. Results from this mode never count as a conformance pass.`;
25101
+ return `WARNING: ${flag} is a NON-CONFORMANT development mode. The callback URL ${url} is plain http; MCP Events requires HTTPS, so a conformant server must refuse it. Results from this mode never count as a conformance pass.`;
25107
25102
  }
25108
25103
  function describeDeliveryMismatch(args) {
25109
25104
  return `Event "${args.descriptor.name}" advertises delivery [${args.descriptor.delivery.join(", ")}], and profile ${args.profile.id} uses [${args.profile.deliveryModes.value.join(", ")}]; "${args.mode}" is not usable under both.`;
@@ -25193,12 +25188,12 @@ function planConformanceReceiver(options) {
25193
25188
  let publicOrigin;
25194
25189
  let insecure = !tls && insecureFlag;
25195
25190
  if (options.publicUrl !== void 0) {
25196
- const checked2 = checkCallbackUrl(options.publicUrl, {
25191
+ const checked2 = requireCallbackUrl(options.publicUrl, {
25197
25192
  flag: "--public-url",
25198
25193
  insecureFlag: "--insecure-local-receiver",
25199
25194
  allowInsecure: insecureFlag
25200
25195
  });
25201
- if (checked2.url.pathname !== "/" || checked2.url.search || checked2.url.hash) {
25196
+ if (checked2.url.pathname !== "/") {
25202
25197
  throw usageError(
25203
25198
  "--public-url must be a bare origin (the conformance receiver serves /i/<inbox>/s/<slot> at the root)."
25204
25199
  );
@@ -25271,8 +25266,6 @@ function renderEventsConformanceTable(result) {
25271
25266
  );
25272
25267
  return redactSecrets(lines.join("\n"));
25273
25268
  }
25274
-
25275
- // src/commands/events-context.ts
25276
25269
  function buildContext(options, command) {
25277
25270
  const globalOptions = getGlobalOptions(command);
25278
25271
  const target = describeTarget(options);
@@ -25299,8 +25292,9 @@ async function withEventsConnection(options, ctx, fn) {
25299
25292
  options
25300
25293
  );
25301
25294
  return withEphemeralManager(
25302
- config,
25295
+ options.profile ? { ...config, eventsWireProfile: ctx.profile.id === BETA_PROFILE_ID ? "beta" : "legacy" } : config,
25303
25296
  async (manager, serverId) => {
25297
+ if (!options.profile && manager.getEventsSupport(serverId).beta) ctx.profile = parseEventsProfile("beta");
25304
25298
  notePeerProtocol(manager, serverId, ctx);
25305
25299
  return fn(manager, serverId);
25306
25300
  },
@@ -25313,7 +25307,7 @@ async function withEventsConnection(options, ctx, fn) {
25313
25307
  );
25314
25308
  }
25315
25309
  function notePeerProtocol(manager, serverId, ctx) {
25316
- const negotiated = manager.getCapturedEventsCapability(serverId)?.protocolVersion;
25310
+ const negotiated = manager.getNegotiatedProtocolVersion(serverId);
25317
25311
  const documented = ctx.profile.protocolVersions.value;
25318
25312
  if (negotiated && !documented.includes(negotiated)) {
25319
25313
  ctx.status(
@@ -25334,14 +25328,13 @@ function addEventsTargetOptions(command) {
25334
25328
  addSharedServerOptions(
25335
25329
  command.option(
25336
25330
  "--profile <profile>",
25337
- 'Events profile the run is judged by: "draft" (draft@28ec35e) or "chatgpt" (chatgpt@2026-11-05)',
25338
- "draft"
25331
+ 'Events wire profile: "beta", "draft" or "chatgpt" (default: negotiated Events profile)'
25339
25332
  ).option(
25340
25333
  "--protocol-version <version>",
25341
25334
  "Pin the MCP protocol version (e.g. 2026-07-28). HTTP targets only."
25342
25335
  ).option(
25343
25336
  "--force",
25344
- "Send events/* even when the server did not declare capabilities.events (conformance probing)"
25337
+ "Send events/* without the selected capability declaration to probe conformance"
25345
25338
  )
25346
25339
  )
25347
25340
  )
@@ -25350,7 +25343,7 @@ function addEventsTargetOptions(command) {
25350
25343
  function addEventArgsOption(command) {
25351
25344
  return command.option(
25352
25345
  "--event-args <json>",
25353
- "Event arguments as a JSON object, @path, or - for stdin (default {})"
25346
+ "Subscription arguments as a JSON object, @path, or - for stdin (default {})"
25354
25347
  );
25355
25348
  }
25356
25349
  function positiveInteger(label) {
@@ -25769,6 +25762,9 @@ function planWatchReceiver(options) {
25769
25762
  throw usageError(`--mode must be one of ${WATCH_MODES.join(", ")} (got "${mode}").`);
25770
25763
  }
25771
25764
  const receiverFlags = options.publicUrl !== void 0 || options.insecureLocalReceiver === true || options.listen !== void 0;
25765
+ if (options.ttl !== void 0 && options.expiry === false) {
25766
+ throw usageError("Pass --ttl or --no-expiry, not both.");
25767
+ }
25772
25768
  if (mode !== void 0 && mode !== "webhook" && receiverFlags) {
25773
25769
  throw usageError(
25774
25770
  "--public-url, --listen and --insecure-local-receiver apply only to --mode webhook."
@@ -25776,6 +25772,9 @@ function planWatchReceiver(options) {
25776
25772
  }
25777
25773
  const wantsWebhook = mode === "webhook" || receiverFlags;
25778
25774
  if (!wantsWebhook) {
25775
+ if (options.ttl !== void 0 || options.expiry === false) {
25776
+ throw usageError("--ttl and --no-expiry apply only to --mode webhook.");
25777
+ }
25779
25778
  return mode ? { forcedMode: mode } : {};
25780
25779
  }
25781
25780
  if (options.publicUrl === void 0 && options.insecureLocalReceiver !== true) {
@@ -25786,14 +25785,11 @@ function planWatchReceiver(options) {
25786
25785
  let publicUrl;
25787
25786
  let insecure = options.insecureLocalReceiver === true && options.publicUrl === void 0;
25788
25787
  if (options.publicUrl !== void 0) {
25789
- const checked2 = checkCallbackUrl(options.publicUrl, {
25788
+ const checked2 = requireCallbackUrl(options.publicUrl, {
25790
25789
  flag: "--public-url",
25791
25790
  insecureFlag: "--insecure-local-receiver",
25792
25791
  allowInsecure: options.insecureLocalReceiver === true
25793
25792
  });
25794
- if (checked2.url.search || checked2.url.hash) {
25795
- throw usageError("--public-url must not carry a query string or fragment.");
25796
- }
25797
25793
  publicUrl = checked2.url;
25798
25794
  insecure = checked2.insecure;
25799
25795
  }
@@ -25826,8 +25822,8 @@ function registerWatch(events) {
25826
25822
  addEventsTargetOptions(
25827
25823
  addEventArgsOption(
25828
25824
  events.command("watch").description(
25829
- "Stream an event as NDJSON on stdout until Ctrl-C, --duration or --max-events, then unsubscribe. Modes: push (events/stream), poll (events/poll loop) or webhook (a local receiver behind --public-url). Default: webhook when a receiver flag (--public-url, --listen, --insecure-local-receiver) is given, else push when the event offers it, else poll."
25830
- ).argument("<name>", "Event name, from `events list`").option("--mode <mode>", "Delivery mode: poll, push or webhook").option(
25825
+ "Watch occurrences and control messages for an event type as MCPJam NDJSON until Ctrl-C, --duration or --max-events. On exit, stop polling, close the push stream, or unsubscribe the webhook. Modes: push (events/stream), poll (events/poll loop) or webhook (a local receiver behind --public-url). Default: webhook when a receiver flag (--public-url, --listen, --insecure-local-receiver) is given, else push when the event offers it, else poll."
25826
+ ).argument("<name>", "Event type name, from `events list`").option("--mode <mode>", "Delivery mode: poll, push or webhook").option(
25831
25827
  "--duration <seconds>",
25832
25828
  "Stop after this many seconds",
25833
25829
  parseDurationSeconds
@@ -25835,7 +25831,7 @@ function registerWatch(events) {
25835
25831
  "--max-events <n>",
25836
25832
  "Stop after this many delivered events",
25837
25833
  positiveInteger("Max events")
25838
- ).option("--cursor <cursor>", "Start from this cursor (default: null, start from now)").option(
25834
+ ).option("--ttl <seconds>", "Webhook subscription lifetime (default 600 seconds)", parseDurationSeconds).option("--no-expiry", "Webhook subscription with no expiry").option("--cursor <cursor>", "Start from this cursor (default: null, start from now)").option(
25839
25835
  "--max-age-ms <ms>",
25840
25836
  "maxAgeMs sent with poll/stream/subscribe",
25841
25837
  (value) => parseNonNegativeInteger(value, "Max age")
@@ -25856,6 +25852,7 @@ function registerWatch(events) {
25856
25852
  const plan = planWatchReceiver(options);
25857
25853
  const result = await withEventsConnection(options, ctx, async (manager, serverId) => {
25858
25854
  assertEventsDeclaredOrForced(manager, serverId, {
25855
+ profile: ctx.profile,
25859
25856
  force: options.force,
25860
25857
  serverLabel: ctx.target,
25861
25858
  warn: ctx.warn
@@ -25910,7 +25907,7 @@ function registerWatch(events) {
25910
25907
  ctx.warn(insecureModeWarning("--insecure-local-receiver", publicOrigin));
25911
25908
  }
25912
25909
  }
25913
- const inbox = new MemoryEventInbox({ publicOrigin });
25910
+ const inbox = new MemoryEventInbox({ publicOrigin, independentWebhookIds: ctx.profile.id === BETA_PROFILE_ID });
25914
25911
  receiver?.attach(inbox);
25915
25912
  const record = {
25916
25913
  id: `esub_cli_${randomBytes(8).toString("hex")}`,
@@ -25932,7 +25929,8 @@ function registerWatch(events) {
25932
25929
  nextActionAt: 0,
25933
25930
  lastCursor: options.cursor ?? null,
25934
25931
  consecutiveFailures: 0,
25935
- ...options.maxAgeMs !== void 0 ? { maxAgeMs: options.maxAgeMs } : {}
25932
+ ...options.maxAgeMs !== void 0 ? { maxAgeMs: options.maxAgeMs } : {},
25933
+ ...mode === "webhook" ? { ttlMs: options.expiry === false ? null : options.ttl ?? DEFAULT_LOCAL_WEBHOOK_TTL_MS } : {}
25936
25934
  };
25937
25935
  const coordinator = new EventsCoordinator({
25938
25936
  rpc: async () => buildRpcPort(manager, serverId, options.force),
@@ -26027,12 +26025,13 @@ function reportWatchResult(result, ctx) {
26027
26025
  function registerList(events) {
26028
26026
  addEventsTargetOptions(
26029
26027
  events.command("list").description(
26030
- "Report the server's events capability and every event type it offers (events/list, all pages). Exits 2 when the server did not declare capabilities.events, unless --force."
26028
+ "Report the selected Events capability and all event types. Exits 2 when the capability is absent, unless --force."
26031
26029
  )
26032
26030
  ).action(async (options, command) => {
26033
26031
  const ctx = buildContext(options, command);
26034
26032
  const result = await withEventsConnection(options, ctx, async (manager, serverId) => {
26035
26033
  const support = assertEventsDeclaredOrForced(manager, serverId, {
26034
+ profile: ctx.profile,
26036
26035
  force: options.force,
26037
26036
  serverLabel: ctx.target,
26038
26037
  warn: ctx.warn
@@ -26074,6 +26073,7 @@ function registerPoll(events) {
26074
26073
  }
26075
26074
  const result = await withEventsConnection(options, ctx, async (manager, serverId) => {
26076
26075
  assertEventsDeclaredOrForced(manager, serverId, {
26076
+ profile: ctx.profile,
26077
26077
  force: options.force,
26078
26078
  serverLabel: ctx.target,
26079
26079
  warn: ctx.warn
@@ -26166,7 +26166,7 @@ function registerSubscribe(events) {
26166
26166
  const ctx = buildContext(options, command);
26167
26167
  const eventArguments = parseEventArguments(options.eventArgs);
26168
26168
  if (!options.callbackUrl) throw usageError("--callback-url is required.");
26169
- const callback = checkCallbackUrl(options.callbackUrl, {
26169
+ const callback = requireCallbackUrl(options.callbackUrl, {
26170
26170
  flag: "--callback-url",
26171
26171
  insecureFlag: "--insecure-callback",
26172
26172
  allowInsecure: options.insecureCallback === true
@@ -26181,6 +26181,7 @@ function registerSubscribe(events) {
26181
26181
  const secret = resolveSecret(options.secretFile, ctx);
26182
26182
  const result = await withEventsConnection(options, ctx, async (manager, serverId) => {
26183
26183
  assertEventsDeclaredOrForced(manager, serverId, {
26184
+ profile: ctx.profile,
26184
26185
  force: options.force,
26185
26186
  serverLabel: ctx.target,
26186
26187
  warn: ctx.warn
@@ -26226,6 +26227,7 @@ function registerUnsubscribe(events) {
26226
26227
  }
26227
26228
  const outcome = await withEventsConnection(options, ctx, async (manager, serverId) => {
26228
26229
  assertEventsDeclaredOrForced(manager, serverId, {
26230
+ profile: ctx.profile,
26229
26231
  force: options.force,
26230
26232
  serverLabel: ctx.target,
26231
26233
  warn: ctx.warn
@@ -26253,8 +26255,7 @@ function registerConformance(events) {
26253
26255
  "Run the profile-aware MCP Events conformance checks (MUST fails, SHOULD warns). Result JSON on stdout, a table on stderr. Exit 0 passed, 1 failed, 3 incomplete."
26254
26256
  ).option(
26255
26257
  "--profile <profile>",
26256
- 'Profile to judge by: "draft" (draft@28ec35e) or "chatgpt" (chatgpt@2026-11-05)',
26257
- "draft"
26258
+ 'Profile to judge by: "beta", "draft" or "chatgpt" (default: negotiated Events version)'
26258
26259
  ).option(
26259
26260
  "--protocol-version <version>",
26260
26261
  "Pin the MCP protocol version (e.g. 2026-07-28). HTTP targets only."
@@ -26352,7 +26353,7 @@ function registerConformance(events) {
26352
26353
  }
26353
26354
  function registerEventsCommands(program) {
26354
26355
  const events = program.command("events").description(
26355
- "List, poll, watch, subscribe to and conformance-check MCP Events (triggers, draft@28ec35e)"
26356
+ "List, poll, watch, subscribe to and conformance-check MCP Events (poll, push and webhook)"
26356
26357
  );
26357
26358
  registerList(events);
26358
26359
  registerPoll(events);
@@ -26497,7 +26498,14 @@ async function runTaskAugmentedToolCall(args) {
26497
26498
  request: { signal }
26498
26499
  });
26499
26500
  } catch (error) {
26500
- if (!signal.aborted) throw error;
26501
+ if (!signal.aborted) {
26502
+ if (isMCPTasksWireError(error)) {
26503
+ throw cliError("TASKS_UNSUPPORTED", error.message, 1, {
26504
+ wire: error.wire
26505
+ });
26506
+ }
26507
+ throw error;
26508
+ }
26501
26509
  return {
26502
26510
  aborted: { wire: support.wire, phase: "create" },
26503
26511
  created: null,