apple-numbers-mcp 1.2.6 → 1.2.8

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.
Files changed (2) hide show
  1. package/build/index.js +91 -28
  2. package/package.json +1 -1
package/build/index.js CHANGED
@@ -15090,7 +15090,7 @@ function object(shape, params) {
15090
15090
  return new ZodMiniObject(def);
15091
15091
  }
15092
15092
 
15093
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
15093
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
15094
15094
  function isZ4Schema(s) {
15095
15095
  const schema = s;
15096
15096
  return !!schema._zod;
@@ -15945,7 +15945,7 @@ function preprocess(fn, schema) {
15945
15945
  // node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/external.js
15946
15946
  config(en_default2());
15947
15947
 
15948
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
15948
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
15949
15949
  var LATEST_PROTOCOL_VERSION = "2025-11-25";
15950
15950
  var SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-06-18", "2025-03-26", "2024-11-05", "2024-10-07"];
15951
15951
  var RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task";
@@ -17476,7 +17476,7 @@ var UrlElicitationRequiredError = class extends McpError {
17476
17476
  }
17477
17477
  };
17478
17478
 
17479
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
17479
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
17480
17480
  function isTerminal(status) {
17481
17481
  return status === "completed" || status === "failed" || status === "cancelled";
17482
17482
  }
@@ -18765,7 +18765,7 @@ var zodToJsonSchema = (schema, options) => {
18765
18765
  return combined;
18766
18766
  };
18767
18767
 
18768
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
18768
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
18769
18769
  function mapMiniTarget(t) {
18770
18770
  if (!t)
18771
18771
  return "draft-7";
@@ -18807,7 +18807,7 @@ function parseWithCompat(schema, data) {
18807
18807
  return result.data;
18808
18808
  }
18809
18809
 
18810
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
18810
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
18811
18811
  var DEFAULT_REQUEST_TIMEOUT_MSEC = 6e4;
18812
18812
  var Protocol = class {
18813
18813
  constructor(_options) {
@@ -18848,6 +18848,9 @@ var Protocol = class {
18848
18848
  this.setRequestHandler(GetTaskPayloadRequestSchema, async (request, extra) => {
18849
18849
  const handleTaskResult = async () => {
18850
18850
  const taskId = request.params.taskId;
18851
+ if (!await this._taskStore.getTask(taskId, extra.sessionId)) {
18852
+ throw new McpError(ErrorCode.InvalidParams, `Task not found: ${taskId}`);
18853
+ }
18851
18854
  if (this._taskMessageQueue) {
18852
18855
  let queuedMessage;
18853
18856
  while (queuedMessage = await this._taskMessageQueue.dequeue(taskId, extra.sessionId)) {
@@ -18878,12 +18881,12 @@ var Protocol = class {
18878
18881
  throw new McpError(ErrorCode.InvalidParams, `Task not found: ${taskId}`);
18879
18882
  }
18880
18883
  if (!isTerminal(task.status)) {
18881
- await this._waitForTaskUpdate(taskId, extra.signal);
18884
+ await this._waitForTaskUpdate(taskId, extra.signal, extra.sessionId);
18882
18885
  return await handleTaskResult();
18883
18886
  }
18884
18887
  if (isTerminal(task.status)) {
18885
18888
  const result = await this._taskStore.getTaskResult(taskId, extra.sessionId);
18886
- this._clearTaskQueue(taskId);
18889
+ this._clearTaskQueue(taskId, extra.sessionId);
18887
18890
  return {
18888
18891
  ...result,
18889
18892
  _meta: {
@@ -18920,7 +18923,7 @@ var Protocol = class {
18920
18923
  throw new McpError(ErrorCode.InvalidParams, `Cannot cancel task in terminal status: ${task.status}`);
18921
18924
  }
18922
18925
  await this._taskStore.updateTaskStatus(request.params.taskId, "cancelled", "Client cancelled task execution.", extra.sessionId);
18923
- this._clearTaskQueue(request.params.taskId);
18926
+ this._clearTaskQueue(request.params.taskId, extra.sessionId);
18924
18927
  const cancelledTask = await this._taskStore.getTask(request.params.taskId, extra.sessionId);
18925
18928
  if (!cancelledTask) {
18926
18929
  throw new McpError(ErrorCode.InvalidParams, `Task not found after cancellation: ${request.params.taskId}`);
@@ -19048,6 +19051,19 @@ var Protocol = class {
19048
19051
  const handler = this._requestHandlers.get(request.method) ?? this.fallbackRequestHandler;
19049
19052
  const capturedTransport = this._transport;
19050
19053
  const relatedTaskId = request.params?._meta?.[RELATED_TASK_META_KEY]?.taskId;
19054
+ const sessionId = capturedTransport?.sessionId;
19055
+ const store = this._taskStore;
19056
+ let relatedTaskFound = true;
19057
+ let relatedTaskLookup;
19058
+ if (relatedTaskId && store && this._taskMessageQueue && sessionId !== void 0) {
19059
+ relatedTaskFound = false;
19060
+ relatedTaskLookup = (async () => {
19061
+ if (!await store.getTask(relatedTaskId, sessionId)) {
19062
+ throw new McpError(ErrorCode.InvalidParams, `Task not found: ${relatedTaskId}`);
19063
+ }
19064
+ relatedTaskFound = true;
19065
+ })();
19066
+ }
19051
19067
  if (handler === void 0) {
19052
19068
  const errorResponse2 = {
19053
19069
  jsonrpc: "2.0",
@@ -19057,7 +19073,10 @@ var Protocol = class {
19057
19073
  message: "Method not found"
19058
19074
  }
19059
19075
  };
19060
- if (relatedTaskId && this._taskMessageQueue) {
19076
+ if (relatedTaskId && relatedTaskLookup) {
19077
+ const queuedError = { type: "error", message: errorResponse2, timestamp: Date.now() };
19078
+ relatedTaskLookup.then(() => this._enqueueTaskMessage(relatedTaskId, queuedError, sessionId), () => capturedTransport?.send(errorResponse2)).catch((error2) => this._onerror(new Error(`Failed to send an error response: ${error2}`)));
19079
+ } else if (relatedTaskId && this._taskMessageQueue) {
19061
19080
  this._enqueueTaskMessage(relatedTaskId, {
19062
19081
  type: "error",
19063
19082
  message: errorResponse2,
@@ -19108,7 +19127,10 @@ var Protocol = class {
19108
19127
  closeSSEStream: extra?.closeSSEStream,
19109
19128
  closeStandaloneSSEStream: extra?.closeStandaloneSSEStream
19110
19129
  };
19111
- Promise.resolve().then(() => {
19130
+ (relatedTaskLookup ?? Promise.resolve()).then(() => {
19131
+ if (relatedTaskLookup && abortController.signal.aborted) {
19132
+ throw new McpError(ErrorCode.ConnectionClosed, "Request was cancelled");
19133
+ }
19112
19134
  if (taskCreationParams) {
19113
19135
  this.assertTaskHandlerCapability(request.method);
19114
19136
  }
@@ -19143,7 +19165,7 @@ var Protocol = class {
19143
19165
  ...error2["data"] !== void 0 && { data: error2["data"] }
19144
19166
  }
19145
19167
  };
19146
- if (relatedTaskId && this._taskMessageQueue) {
19168
+ if (relatedTaskId && this._taskMessageQueue && relatedTaskFound) {
19147
19169
  await this._enqueueTaskMessage(relatedTaskId, {
19148
19170
  type: "error",
19149
19171
  message: errorResponse2,
@@ -19623,7 +19645,7 @@ var Protocol = class {
19623
19645
  throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");
19624
19646
  }
19625
19647
  const maxQueueSize = this._options?.maxTaskQueueSize;
19626
- await this._taskMessageQueue.enqueue(taskId, message, sessionId, maxQueueSize);
19648
+ await this._taskMessageQueue.enqueue(taskId, message, sessionId ?? this._transport?.sessionId, maxQueueSize);
19627
19649
  }
19628
19650
  /**
19629
19651
  * Clears the message queue for a task and rejects any pending request resolvers.
@@ -19652,12 +19674,13 @@ var Protocol = class {
19652
19674
  * Uses polling to check for updates at the task's configured poll interval.
19653
19675
  * @param taskId The task ID to wait for
19654
19676
  * @param signal Abort signal to cancel the wait
19677
+ * @param sessionId Session of the request that waits, passed to the task store
19655
19678
  * @returns Promise that resolves when an update occurs or rejects if aborted
19656
19679
  */
19657
- async _waitForTaskUpdate(taskId, signal) {
19680
+ async _waitForTaskUpdate(taskId, signal, sessionId) {
19658
19681
  let interval = this._options?.defaultTaskPollInterval ?? 1e3;
19659
19682
  try {
19660
- const task = await this._taskStore?.getTask(taskId);
19683
+ const task = await this._taskStore?.getTask(taskId, sessionId);
19661
19684
  if (task?.pollInterval) {
19662
19685
  interval = task.pollInterval;
19663
19686
  }
@@ -19761,7 +19784,7 @@ function mergeCapabilities(base, additional) {
19761
19784
  return result;
19762
19785
  }
19763
19786
 
19764
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
19787
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
19765
19788
  var import_ajv = __toESM(require_ajv(), 1);
19766
19789
  var import_ajv_formats = __toESM(require_dist(), 1);
19767
19790
  function createDefaultAjvInstance() {
@@ -19829,7 +19852,7 @@ var AjvJsonSchemaValidator = class {
19829
19852
  }
19830
19853
  };
19831
19854
 
19832
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
19855
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
19833
19856
  var ExperimentalServerTasks = class {
19834
19857
  constructor(_server) {
19835
19858
  this._server = _server;
@@ -20042,7 +20065,7 @@ var ExperimentalServerTasks = class {
20042
20065
  }
20043
20066
  };
20044
20067
 
20045
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
20068
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
20046
20069
  function assertToolsCallTaskCapability(requests, method, entityName) {
20047
20070
  if (!requests) {
20048
20071
  throw new Error(`${entityName} does not support task creation (required for ${method})`);
@@ -20077,7 +20100,7 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
20077
20100
  }
20078
20101
  }
20079
20102
 
20080
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
20103
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
20081
20104
  var Server = class extends Protocol {
20082
20105
  /**
20083
20106
  * Initializes this server with the given name and version information.
@@ -20448,7 +20471,7 @@ var Server = class extends Protocol {
20448
20471
  }
20449
20472
  };
20450
20473
 
20451
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
20474
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
20452
20475
  var COMPLETABLE_SYMBOL = /* @__PURE__ */ Symbol.for("mcp.completable");
20453
20476
  function isCompletable(schema) {
20454
20477
  return !!schema && typeof schema === "object" && COMPLETABLE_SYMBOL in schema;
@@ -20462,7 +20485,7 @@ var McpZodTypeKind;
20462
20485
  McpZodTypeKind2["Completable"] = "McpCompletable";
20463
20486
  })(McpZodTypeKind || (McpZodTypeKind = {}));
20464
20487
 
20465
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/uriTemplate.js
20488
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/uriTemplate.js
20466
20489
  var MAX_TEMPLATE_LENGTH = 1e6;
20467
20490
  var MAX_VARIABLE_LENGTH = 1e6;
20468
20491
  var MAX_TEMPLATE_EXPRESSIONS = 1e4;
@@ -20684,7 +20707,7 @@ var UriTemplate = class _UriTemplate {
20684
20707
  }
20685
20708
  };
20686
20709
 
20687
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
20710
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
20688
20711
  var TOOL_NAME_REGEX = /^[A-Za-z0-9._-]{1,128}$/;
20689
20712
  function validateToolName(name) {
20690
20713
  const warnings = [];
@@ -20742,7 +20765,7 @@ function validateAndWarnToolName(name) {
20742
20765
  return result.isValid;
20743
20766
  }
20744
20767
 
20745
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
20768
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
20746
20769
  var ExperimentalMcpServerTasks = class {
20747
20770
  constructor(_mcpServer) {
20748
20771
  this._mcpServer = _mcpServer;
@@ -20757,7 +20780,43 @@ var ExperimentalMcpServerTasks = class {
20757
20780
  }
20758
20781
  };
20759
20782
 
20760
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
20783
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
20784
+ function toolInputElementCount(value, max) {
20785
+ let count = 0;
20786
+ const stack = [value];
20787
+ while (stack.length > 0) {
20788
+ const node = stack.pop();
20789
+ if (node === null || typeof node !== "object")
20790
+ continue;
20791
+ if (Array.isArray(node)) {
20792
+ for (const child of node) {
20793
+ if (++count > max)
20794
+ return count;
20795
+ if (child !== null && typeof child === "object")
20796
+ stack.push(child);
20797
+ }
20798
+ } else {
20799
+ for (const key in node) {
20800
+ if (!Object.prototype.hasOwnProperty.call(node, key))
20801
+ continue;
20802
+ if (++count > max)
20803
+ return count;
20804
+ const child = node[key];
20805
+ if (child !== null && typeof child === "object")
20806
+ stack.push(child);
20807
+ }
20808
+ }
20809
+ }
20810
+ return count;
20811
+ }
20812
+ function resolveMaxToolInputElements(value) {
20813
+ if (value === void 0 || value === Infinity)
20814
+ return void 0;
20815
+ if (typeof value !== "number" || Number.isNaN(value) || value < 1) {
20816
+ throw new RangeError(`maxToolInputElements must be a number of at least 1, or Infinity, got ${String(value)}`);
20817
+ }
20818
+ return value;
20819
+ }
20761
20820
  var McpServer = class {
20762
20821
  constructor(serverInfo, options) {
20763
20822
  this._registeredResources = {};
@@ -20769,6 +20828,7 @@ var McpServer = class {
20769
20828
  this._resourceHandlersInitialized = false;
20770
20829
  this._promptHandlersInitialized = false;
20771
20830
  this.server = new Server(serverInfo, options);
20831
+ this._maxToolInputElements = resolveMaxToolInputElements(options?.maxToolInputElements);
20772
20832
  }
20773
20833
  /**
20774
20834
  * Access experimental features.
@@ -20899,12 +20959,15 @@ var McpServer = class {
20899
20959
  * Validates tool input arguments against the tool's input schema.
20900
20960
  */
20901
20961
  async validateToolInput(tool, args, toolName) {
20962
+ if (this._maxToolInputElements !== void 0 && toolInputElementCount(args, this._maxToolInputElements) > this._maxToolInputElements) {
20963
+ throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for tool ${toolName}: arguments contain more than the maximum of ${this._maxToolInputElements} elements`);
20964
+ }
20902
20965
  if (!tool.inputSchema) {
20903
20966
  return void 0;
20904
20967
  }
20905
20968
  const inputObj = normalizeObjectSchema(tool.inputSchema);
20906
20969
  const schemaToParse = inputObj ?? tool.inputSchema;
20907
- const parseResult = await safeParseAsync2(schemaToParse, args);
20970
+ const parseResult = await safeParseAsync2(schemaToParse, args ?? {});
20908
20971
  if (!parseResult.success) {
20909
20972
  const error2 = "error" in parseResult ? parseResult.error : "Unknown error";
20910
20973
  const errorMessage = getParseErrorMessage(error2);
@@ -21142,7 +21205,7 @@ var McpServer = class {
21142
21205
  }
21143
21206
  if (prompt.argsSchema) {
21144
21207
  const argsObj = normalizeObjectSchema(prompt.argsSchema);
21145
- const parseResult = await safeParseAsync2(argsObj, request.params.arguments);
21208
+ const parseResult = await safeParseAsync2(argsObj, request.params.arguments ?? {});
21146
21209
  if (!parseResult.success) {
21147
21210
  const error2 = "error" in parseResult ? parseResult.error : "Unknown error";
21148
21211
  const errorMessage = getParseErrorMessage(error2);
@@ -21573,10 +21636,10 @@ var EMPTY_COMPLETION_RESULT = {
21573
21636
  }
21574
21637
  };
21575
21638
 
21576
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
21639
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
21577
21640
  import process2 from "node:process";
21578
21641
 
21579
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
21642
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
21580
21643
  var STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024;
21581
21644
  var ReadBuffer = class {
21582
21645
  constructor(options) {
@@ -21613,7 +21676,7 @@ function serializeMessage(message) {
21613
21676
  return JSON.stringify(message) + "\n";
21614
21677
  }
21615
21678
 
21616
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
21679
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
21617
21680
  var StdioServerTransport = class {
21618
21681
  constructor(_stdin = process2.stdin, _stdout = process2.stdout, options) {
21619
21682
  this._stdin = _stdin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apple-numbers-mcp",
3
- "version": "1.2.6",
3
+ "version": "1.2.8",
4
4
  "description": "MCP server for Apple Numbers - read, write, search, and format .numbers spreadsheets via Claude and other AI assistants",
5
5
  "type": "module",
6
6
  "main": "build/index.js",