@umbraco-cms/mcp-dev 17.2.0 → 17.2.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
@@ -7,7 +7,7 @@ import {
7
7
  allModes,
8
8
  allSliceNames,
9
9
  availableCollections
10
- } from "./chunk-O5JJAK7Z.js";
10
+ } from "./chunk-7U4TTAJQ.js";
11
11
 
12
12
  // node_modules/ajv/dist/compile/codegen/code.js
13
13
  var require_code = __commonJS({
@@ -6935,10 +6935,9 @@ var ProgressTokenSchema = z.union([z.string(), z.number().int()]);
6935
6935
  var CursorSchema = z.string();
6936
6936
  var TaskCreationParamsSchema = z.looseObject({
6937
6937
  /**
6938
- * Time in milliseconds to keep task results available after completion.
6939
- * If null, the task has unlimited lifetime until manually cleaned up.
6938
+ * Requested duration in milliseconds to retain task from creation.
6940
6939
  */
6941
- ttl: z.union([z.number(), z.null()]).optional(),
6940
+ ttl: z.number().optional(),
6942
6941
  /**
6943
6942
  * Time in milliseconds to wait between task status requests.
6944
6943
  */
@@ -7238,7 +7237,11 @@ var ClientCapabilitiesSchema = z.object({
7238
7237
  /**
7239
7238
  * Present if the client supports task creation.
7240
7239
  */
7241
- tasks: ClientTasksCapabilitySchema.optional()
7240
+ tasks: ClientTasksCapabilitySchema.optional(),
7241
+ /**
7242
+ * Extensions that the client supports. Keys are extension identifiers (vendor-prefix/extension-name).
7243
+ */
7244
+ extensions: z.record(z.string(), AssertObjectSchema).optional()
7242
7245
  });
7243
7246
  var InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
7244
7247
  /**
@@ -7299,7 +7302,11 @@ var ServerCapabilitiesSchema = z.object({
7299
7302
  /**
7300
7303
  * Present if the server supports task creation.
7301
7304
  */
7302
- tasks: ServerTasksCapabilitySchema.optional()
7305
+ tasks: ServerTasksCapabilitySchema.optional(),
7306
+ /**
7307
+ * Extensions that the server supports. Keys are extension identifiers (vendor-prefix/extension-name).
7308
+ */
7309
+ extensions: z.record(z.string(), AssertObjectSchema).optional()
7303
7310
  });
7304
7311
  var InitializeResultSchema = ResultSchema.extend({
7305
7312
  /**
@@ -7491,6 +7498,12 @@ var ResourceSchema = z.object({
7491
7498
  * The MIME type of this resource, if known.
7492
7499
  */
7493
7500
  mimeType: z.optional(z.string()),
7501
+ /**
7502
+ * The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.
7503
+ *
7504
+ * This can be used by Hosts to display file sizes and estimate context window usage.
7505
+ */
7506
+ size: z.optional(z.number()),
7494
7507
  /**
7495
7508
  * Optional annotations for the client.
7496
7509
  */
@@ -9996,6 +10009,10 @@ var Protocol = class {
9996
10009
  this._progressHandlers.clear();
9997
10010
  this._taskProgressTokens.clear();
9998
10011
  this._pendingDebouncedNotifications.clear();
10012
+ for (const info of this._timeoutInfo.values()) {
10013
+ clearTimeout(info.timeoutId);
10014
+ }
10015
+ this._timeoutInfo.clear();
9999
10016
  for (const controller of this._requestHandlerAbortControllers.values()) {
10000
10017
  controller.abort();
10001
10018
  }
@@ -10126,7 +10143,9 @@ var Protocol = class {
10126
10143
  await capturedTransport?.send(errorResponse);
10127
10144
  }
10128
10145
  }).catch((error) => this._onerror(new Error(`Failed to send response: ${error}`))).finally(() => {
10129
- this._requestHandlerAbortControllers.delete(request.id);
10146
+ if (this._requestHandlerAbortControllers.get(request.id) === abortController) {
10147
+ this._requestHandlerAbortControllers.delete(request.id);
10148
+ }
10130
10149
  });
10131
10150
  }
10132
10151
  _onprogress(notification) {
@@ -10822,6 +10841,147 @@ var ExperimentalServerTasks = class {
10822
10841
  requestStream(request, resultSchema, options) {
10823
10842
  return this._server.requestStream(request, resultSchema, options);
10824
10843
  }
10844
+ /**
10845
+ * Sends a sampling request and returns an AsyncGenerator that yields response messages.
10846
+ * The generator is guaranteed to end with either a 'result' or 'error' message.
10847
+ *
10848
+ * For task-augmented requests, yields 'taskCreated' and 'taskStatus' messages
10849
+ * before the final result.
10850
+ *
10851
+ * @example
10852
+ * ```typescript
10853
+ * const stream = server.experimental.tasks.createMessageStream({
10854
+ * messages: [{ role: 'user', content: { type: 'text', text: 'Hello' } }],
10855
+ * maxTokens: 100
10856
+ * }, {
10857
+ * onprogress: (progress) => {
10858
+ * // Handle streaming tokens via progress notifications
10859
+ * console.log('Progress:', progress.message);
10860
+ * }
10861
+ * });
10862
+ *
10863
+ * for await (const message of stream) {
10864
+ * switch (message.type) {
10865
+ * case 'taskCreated':
10866
+ * console.log('Task created:', message.task.taskId);
10867
+ * break;
10868
+ * case 'taskStatus':
10869
+ * console.log('Task status:', message.task.status);
10870
+ * break;
10871
+ * case 'result':
10872
+ * console.log('Final result:', message.result);
10873
+ * break;
10874
+ * case 'error':
10875
+ * console.error('Error:', message.error);
10876
+ * break;
10877
+ * }
10878
+ * }
10879
+ * ```
10880
+ *
10881
+ * @param params - The sampling request parameters
10882
+ * @param options - Optional request options (timeout, signal, task creation params, onprogress, etc.)
10883
+ * @returns AsyncGenerator that yields ResponseMessage objects
10884
+ *
10885
+ * @experimental
10886
+ */
10887
+ createMessageStream(params, options) {
10888
+ const clientCapabilities = this._server.getClientCapabilities();
10889
+ if ((params.tools || params.toolChoice) && !clientCapabilities?.sampling?.tools) {
10890
+ throw new Error("Client does not support sampling tools capability.");
10891
+ }
10892
+ if (params.messages.length > 0) {
10893
+ const lastMessage = params.messages[params.messages.length - 1];
10894
+ const lastContent = Array.isArray(lastMessage.content) ? lastMessage.content : [lastMessage.content];
10895
+ const hasToolResults = lastContent.some((c) => c.type === "tool_result");
10896
+ const previousMessage = params.messages.length > 1 ? params.messages[params.messages.length - 2] : void 0;
10897
+ const previousContent = previousMessage ? Array.isArray(previousMessage.content) ? previousMessage.content : [previousMessage.content] : [];
10898
+ const hasPreviousToolUse = previousContent.some((c) => c.type === "tool_use");
10899
+ if (hasToolResults) {
10900
+ if (lastContent.some((c) => c.type !== "tool_result")) {
10901
+ throw new Error("The last message must contain only tool_result content if any is present");
10902
+ }
10903
+ if (!hasPreviousToolUse) {
10904
+ throw new Error("tool_result blocks are not matching any tool_use from the previous message");
10905
+ }
10906
+ }
10907
+ if (hasPreviousToolUse) {
10908
+ const toolUseIds = new Set(previousContent.filter((c) => c.type === "tool_use").map((c) => c.id));
10909
+ const toolResultIds = new Set(lastContent.filter((c) => c.type === "tool_result").map((c) => c.toolUseId));
10910
+ if (toolUseIds.size !== toolResultIds.size || ![...toolUseIds].every((id) => toolResultIds.has(id))) {
10911
+ throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match");
10912
+ }
10913
+ }
10914
+ }
10915
+ return this.requestStream({
10916
+ method: "sampling/createMessage",
10917
+ params
10918
+ }, CreateMessageResultSchema, options);
10919
+ }
10920
+ /**
10921
+ * Sends an elicitation request and returns an AsyncGenerator that yields response messages.
10922
+ * The generator is guaranteed to end with either a 'result' or 'error' message.
10923
+ *
10924
+ * For task-augmented requests (especially URL-based elicitation), yields 'taskCreated'
10925
+ * and 'taskStatus' messages before the final result.
10926
+ *
10927
+ * @example
10928
+ * ```typescript
10929
+ * const stream = server.experimental.tasks.elicitInputStream({
10930
+ * mode: 'url',
10931
+ * message: 'Please authenticate',
10932
+ * elicitationId: 'auth-123',
10933
+ * url: 'https://example.com/auth'
10934
+ * }, {
10935
+ * task: { ttl: 300000 } // Task-augmented for long-running auth flow
10936
+ * });
10937
+ *
10938
+ * for await (const message of stream) {
10939
+ * switch (message.type) {
10940
+ * case 'taskCreated':
10941
+ * console.log('Task created:', message.task.taskId);
10942
+ * break;
10943
+ * case 'taskStatus':
10944
+ * console.log('Task status:', message.task.status);
10945
+ * break;
10946
+ * case 'result':
10947
+ * console.log('User action:', message.result.action);
10948
+ * break;
10949
+ * case 'error':
10950
+ * console.error('Error:', message.error);
10951
+ * break;
10952
+ * }
10953
+ * }
10954
+ * ```
10955
+ *
10956
+ * @param params - The elicitation request parameters
10957
+ * @param options - Optional request options (timeout, signal, task creation params, etc.)
10958
+ * @returns AsyncGenerator that yields ResponseMessage objects
10959
+ *
10960
+ * @experimental
10961
+ */
10962
+ elicitInputStream(params, options) {
10963
+ const clientCapabilities = this._server.getClientCapabilities();
10964
+ const mode = params.mode ?? "form";
10965
+ switch (mode) {
10966
+ case "url": {
10967
+ if (!clientCapabilities?.elicitation?.url) {
10968
+ throw new Error("Client does not support url elicitation.");
10969
+ }
10970
+ break;
10971
+ }
10972
+ case "form": {
10973
+ if (!clientCapabilities?.elicitation?.form) {
10974
+ throw new Error("Client does not support form elicitation.");
10975
+ }
10976
+ break;
10977
+ }
10978
+ }
10979
+ const normalizedParams = mode === "form" && params.mode === void 0 ? { ...params, mode: "form" } : params;
10980
+ return this.requestStream({
10981
+ method: "elicitation/create",
10982
+ params: normalizedParams
10983
+ }, ElicitResultSchema, options);
10984
+ }
10825
10985
  /**
10826
10986
  * Gets the current status of a task.
10827
10987
  *
@@ -11999,6 +12159,9 @@ var McpServer = class {
11999
12159
  annotations = rest.shift();
12000
12160
  }
12001
12161
  } else if (typeof firstArg === "object" && firstArg !== null) {
12162
+ if (Object.values(firstArg).some((v) => typeof v === "object" && v !== null)) {
12163
+ throw new Error(`Tool ${name} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);
12164
+ }
12002
12165
  annotations = rest.shift();
12003
12166
  }
12004
12167
  }
@@ -12117,6 +12280,9 @@ function getZodSchemaObject(schema) {
12117
12280
  if (isZodRawShapeCompat(schema)) {
12118
12281
  return objectFromShape(schema);
12119
12282
  }
12283
+ if (!isZodSchemaInstance(schema)) {
12284
+ throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");
12285
+ }
12120
12286
  return schema;
12121
12287
  }
12122
12288
  function promptArgumentsFromSchema(schema) {
@@ -12256,7 +12422,7 @@ var StdioServerTransport = class {
12256
12422
  // package.json
12257
12423
  var package_default = {
12258
12424
  name: "@umbraco-cms/mcp-dev",
12259
- version: "17.2.0",
12425
+ version: "17.2.1",
12260
12426
  type: "module",
12261
12427
  description: "A model context protocol (MCP) server for Umbraco CMS",
12262
12428
  main: "dist/index.js",
@@ -12279,6 +12445,8 @@ var package_default = {
12279
12445
  generate: "orval --config orval.config.ts",
12280
12446
  inspect: "npx @modelcontextprotocol/inspector node dist/index.js",
12281
12447
  test: "node --experimental-vm-modules node_modules/jest/bin/jest.js",
12448
+ "test:rerun-failures": "grep '^FAIL ' test-failures.log 2>/dev/null | sed 's/^FAIL //' | tr '\\n' ' ' | xargs -r node --experimental-vm-modules node_modules/jest/bin/jest.js --no-coverage || echo 'No failures to rerun (test-failures.log not found or empty)'",
12449
+ "test:evals": "node --experimental-vm-modules node_modules/jest/bin/jest.js --no-coverage --config tests/evals/jest.config.ts",
12282
12450
  "patch-publish-alpha": "npm version prerelease --preid=alpha && npm publish --tag alpha --access public",
12283
12451
  "test:e2e-sdk": "node --experimental-vm-modules node_modules/jest/bin/jest.js --config tests/e2e-sdk/jest.config.ts --runInBand --silent --forceExit 2>/dev/null",
12284
12452
  "test:e2e-sdk:verbose": "E2E_VERBOSITY=verbose node --experimental-vm-modules node_modules/jest/bin/jest.js tests/e2e-sdk --runInBand --testTimeout=120000 --forceExit",
@@ -12314,10 +12482,11 @@ var package_default = {
12314
12482
  },
12315
12483
  homepage: "https://github.com/umbraco/Umbraco-CMS-MCP-Dev#readme",
12316
12484
  dependencies: {
12317
- "@modelcontextprotocol/sdk": "^1.25.1",
12485
+ "@modelcontextprotocol/sdk": "^1.28.0",
12318
12486
  "@types/uuid": "^10.0.0",
12319
12487
  "@types/yargs": "^17.0.33",
12320
- "@umbraco-cms/mcp-server-sdk": "^17.0.0-beta.5",
12488
+ "@umbraco-cms/mcp-hosted": "^17.0.0-beta.8",
12489
+ "@umbraco-cms/mcp-server-sdk": "^17.0.0-beta.8",
12321
12490
  axios: "^1.8.4",
12322
12491
  dotenv: "^16.5.0",
12323
12492
  "form-data": "^4.0.4",
@@ -12337,7 +12506,6 @@ var package_default = {
12337
12506
  "@types/mime-types": "^3.0.1",
12338
12507
  "@types/node": "^22.14.1",
12339
12508
  "@types/qs": "^6.9.18",
12340
- "@umbraco-cms/mcp-hosted": "^17.0.0-beta.5",
12341
12509
  agents: "^0.6.0",
12342
12510
  copyfiles: "^2.4.1",
12343
12511
  glob: "^11.0.2",
@@ -12518,7 +12686,7 @@ Readonly mode: Disabled ${filteredTools.length} write tools:`);
12518
12686
  }
12519
12687
 
12520
12688
  // src/index.ts
12521
- import { checkUmbracoVersion, configureApiClient, initializeUmbracoFetch } from "@umbraco-cms/mcp-server-sdk";
12689
+ import { checkUmbracoVersion, configureApiClient, initializeUmbracoFetch, getServerConfig as getServerConfig2, handleCliCommands, createCollectionConfigLoader as createCollectionConfigLoader2 } from "@umbraco-cms/mcp-server-sdk";
12522
12690
  var main = async () => {
12523
12691
  clearConfigCache();
12524
12692
  const serverConfig = await loadServerConfig(true);
@@ -12531,6 +12699,21 @@ var main = async () => {
12531
12699
  });
12532
12700
  const client = UmbracoManagementClient.getClient();
12533
12701
  const user = await client.getUserCurrent();
12702
+ const rawConfig = await getServerConfig2(true);
12703
+ const configLoader2 = createCollectionConfigLoader2({
12704
+ modeRegistry: allModes,
12705
+ allModeNames,
12706
+ allSliceNames
12707
+ });
12708
+ const filterConfig = configLoader2.loadFromConfig(config);
12709
+ handleCliCommands(availableCollections, {
12710
+ cliFlags: rawConfig.cliFlags,
12711
+ serverName: "Umbraco CMS Developer MCP Server",
12712
+ serverVersion: package_default.version,
12713
+ user,
12714
+ filterConfig,
12715
+ serverConfig: config
12716
+ });
12534
12717
  await checkUmbracoVersion({
12535
12718
  mcpVersion: package_default.version,
12536
12719
  client: { getServerInformation: () => client.getServerInformation() }