@mcpjam/cli 6.0.0 → 6.0.1

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 CHANGED
@@ -30,7 +30,7 @@ import { selectPluginMcpServerMap, detectPluginMcpTransport } from '@mcpjam/sdk/
30
30
 
31
31
  // package.json
32
32
  var package_default = {
33
- version: "6.0.0"};
33
+ version: "6.0.1"};
34
34
  function conformanceExitCode(result) {
35
35
  if (result.outcome === "incomplete") return 3;
36
36
  if (result.outcome === "failed") return 1;
@@ -156,6 +156,32 @@ function writeError(error, format = DEFAULT_OUTPUT_FORMAT) {
156
156
  `);
157
157
  return payload;
158
158
  }
159
+ var activeConsoleRoutes = 0;
160
+ var savedConsoleMethods;
161
+ function routeConsoleToStderr() {
162
+ if (activeConsoleRoutes === 0) {
163
+ savedConsoleMethods = {
164
+ log: console.log,
165
+ info: console.info,
166
+ debug: console.debug
167
+ };
168
+ const toStderr = (...args) => console.error(...args);
169
+ console.log = toStderr;
170
+ console.info = toStderr;
171
+ console.debug = toStderr;
172
+ }
173
+ activeConsoleRoutes += 1;
174
+ let released = false;
175
+ return () => {
176
+ if (released) return;
177
+ released = true;
178
+ activeConsoleRoutes -= 1;
179
+ if (activeConsoleRoutes === 0 && savedConsoleMethods) {
180
+ Object.assign(console, savedConsoleMethods);
181
+ savedConsoleMethods = void 0;
182
+ }
183
+ };
184
+ }
159
185
  function parseOutputFormat(value) {
160
186
  if (value === "json" || value === "human") {
161
187
  return value;
@@ -14245,7 +14271,7 @@ function registerSessionsCommands(program) {
14245
14271
  "Continue this session instead of starting one. Configuration is fixed at the first turn, so the config flags below are refused with a session. The per-turn flags are not: --client, --max-steps and --max-tool-calls apply to whichever turn sends them, and --client in particular must be RE-SENT on every turn of a host-bound conversation \u2014 a session started with --client alone refuses a continuation that omits it."
14246
14272
  ).option(
14247
14273
  "--model <modelId>",
14248
- 'Provider-prefixed model id, e.g. "anthropic/claude-sonnet-5". Required to start a session; a bare id is rejected rather than guessed.'
14274
+ 'Provider-prefixed model id, e.g. "anthropic/claude-sonnet-5". Omit it on the first turn to use the environment or client model; the resolved model stays pinned. A bare id is rejected rather than guessed.'
14249
14275
  ).option(
14250
14276
  "--client <hostId>",
14251
14277
  "Client ID (from `mcpjam cloud clients list`) to run the turn AS. A client that declares an agent harness (Claude Code, Codex, Cursor CLI) runs the REAL runtime; without one the turn runs MCPJam's emulated engine. Per-turn, NOT pinned to the session \u2014 pass it on every turn, and check the printed `engine` to see what ran. Continuing a session you started with --client alone REQUIRES it: without it the turn is refused rather than answered by the emulated engine. Alongside --environment it only asserts which host you expect (a mismatch is refused). It cannot be combined with --server: --client cannot be pinned beside a pinned server set, so a later turn that omitted it would run the emulated engine on a session established on the harness. Use --environment, or --client alone (which connects the client's own servers). A harness turn needs --tool-mode auto with no --max-tool-calls."
@@ -14255,7 +14281,7 @@ function registerSessionsCommands(program) {
14255
14281
  ).option(
14256
14282
  "--server <serverId...>",
14257
14283
  "Run against these project servers (mutually exclusive with --environment)"
14258
- ).option("--system-prompt <text>", "System prompt for the session").option(
14284
+ ).option("--no-servers", "Start with no MCP servers; the empty selection stays pinned.").option("--system-prompt <text>", "System prompt for the session").option(
14259
14285
  "--tool-mode <mode>",
14260
14286
  "read_only (default) advertises only tools annotated readOnlyHint:true. auto advertises everything and MAY CAUSE REAL SIDE EFFECTS."
14261
14287
  ).option("--max-steps <n>", "Maximum engine steps this turn (1-16)").option(
@@ -14283,7 +14309,7 @@ function registerSessionsCommands(program) {
14283
14309
  modelId: options.model,
14284
14310
  hostId: options.client,
14285
14311
  environmentId: options.environment,
14286
- serverIds: options.server,
14312
+ serverIds: sendServerIds(options),
14287
14313
  systemPrompt: options.systemPrompt,
14288
14314
  toolMode: options.toolMode,
14289
14315
  maxSteps: parseIntegerOption(options.maxSteps, "--max-steps", {
@@ -14349,6 +14375,11 @@ function registerSessionsCommands(program) {
14349
14375
  })
14350
14376
  );
14351
14377
  }
14378
+ function sendServerIds(options) {
14379
+ if (options.servers !== false) return options.server;
14380
+ if (options.server !== void 0) throw usageError("Use either --server or --no-servers.");
14381
+ return [];
14382
+ }
14352
14383
  function parseFloatOption(value) {
14353
14384
  if (value === void 0) return void 0;
14354
14385
  if (value.trim() === "") {
@@ -17252,6 +17283,7 @@ var SKILLS_EXTENSION_ID = "io.modelcontextprotocol/skills";
17252
17283
  var SKILLS_EXTENSION_CAPABILITY = {
17253
17284
  [SKILLS_EXTENSION_ID]: {}
17254
17285
  };
17286
+ var SKILLS_LIST_TTL_MS = 0;
17255
17287
  var SKILLS_LIST_CACHE_SCOPE = "public";
17256
17288
  var INVALID_PARAMS = -32602;
17257
17289
  var InvalidSkillParamsError = class extends Error {
@@ -17276,6 +17308,26 @@ function entryFor(uri) {
17276
17308
  }
17277
17309
  return entry;
17278
17310
  }
17311
+ function resourceMetadataFor(uri) {
17312
+ const entry = SKILLS_BUNDLE_ENTRIES.find(
17313
+ (skill) => skill.resources.some((resource) => resource.uri === uri)
17314
+ );
17315
+ if (!entry) {
17316
+ return { name: uri, description: "Agent Skill file served over MCP." };
17317
+ }
17318
+ const skillName = String(entry.frontmatter.name);
17319
+ if (uri === entry.uri) {
17320
+ return {
17321
+ name: skillName,
17322
+ description: String(entry.frontmatter.description)
17323
+ };
17324
+ }
17325
+ const root = entry.uri.slice(0, -"/SKILL.md".length);
17326
+ return {
17327
+ name: uri.slice(root.length + 1),
17328
+ description: `Supporting file of the "${skillName}" skill, served over MCP.`
17329
+ };
17330
+ }
17279
17331
  function registerSkillsSurface(server) {
17280
17332
  server.server.setRequestHandler(
17281
17333
  "skills/list",
@@ -17288,6 +17340,7 @@ function registerSkillsSurface(server) {
17288
17340
  }
17289
17341
  return {
17290
17342
  skills: SKILLS_BUNDLE_ENTRIES,
17343
+ ttlMs: SKILLS_LIST_TTL_MS,
17291
17344
  cacheScope: SKILLS_LIST_CACHE_SCOPE
17292
17345
  };
17293
17346
  }
@@ -17295,17 +17348,21 @@ function registerSkillsSurface(server) {
17295
17348
  server.server.setRequestHandler(
17296
17349
  "skills/get",
17297
17350
  { params: getParamsSchema, result: looseResult },
17298
- async (params) => ({ skill: entryFor(params.uri) })
17351
+ // The SDK fills `ttlMs` / `cacheScope` only on the base protocol's
17352
+ // cacheable methods, so an extension method has to carry its own.
17353
+ async (params) => ({
17354
+ skill: entryFor(params.uri),
17355
+ ttlMs: SKILLS_LIST_TTL_MS,
17356
+ cacheScope: SKILLS_LIST_CACHE_SCOPE
17357
+ })
17299
17358
  );
17300
17359
  for (const [uri, text] of Object.entries(SKILLS_BUNDLE_CONTENTS)) {
17301
17360
  const mimeType = mimeTypeFor(uri);
17361
+ const { name, description } = resourceMetadataFor(uri);
17302
17362
  server.registerResource(
17363
+ name,
17303
17364
  uri,
17304
- uri,
17305
- {
17306
- mimeType,
17307
- description: "Agent Skill file served over MCP (SEP-2640)."
17308
- },
17365
+ { mimeType, description },
17309
17366
  // The SAME `mimeType` on the content, not only the registration — a
17310
17367
  // reader takes the type from `contents[0]`, and MCPJam's own loader
17311
17368
  // names it in the refusal for a non-text read.
@@ -25463,7 +25520,12 @@ async function main(argv = process.argv, dependencies = {}) {
25463
25520
  };
25464
25521
  }
25465
25522
  try {
25466
- await program.parseAsync(argv);
25523
+ const restoreConsole = routeConsoleToStderr();
25524
+ try {
25525
+ await program.parseAsync(argv);
25526
+ } finally {
25527
+ restoreConsole();
25528
+ }
25467
25529
  const normalizedExitCode = typeof process.exitCode === "number" ? process.exitCode : 0;
25468
25530
  captureCommandEvent(
25469
25531
  normalizedExitCode,