apple-notes-mcp 2.15.7 → 2.15.9

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 (3) hide show
  1. package/README.md +24 -0
  2. package/build/index.js +137 -30
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -153,6 +153,30 @@ In the IDE, open **MCP Servers → Manage MCP Servers → View raw config**. Mer
153
153
 
154
154
  The repository's `.antigravity-plugin/mcp_config.json` supplies an unpinned stdio server entry; the JSON above pins the audited release. Use `command` and `args`; this package does not provide a remote `serverUrl`.
155
155
 
156
+ #### Gemini Spark (macOS Local MCP)
157
+
158
+ In Gemini macOS builds that offer **Local MCP**, open **Connected Apps**, click **+ Custom**, and select **Local MCP** in "Set up a custom connected app". Fill in the form with:
159
+
160
+ | Field | Value |
161
+ |-------|-------|
162
+ | Server Name | Apple Notes |
163
+ | Description | Read, search, create, edit, organize, and export Apple Notes on this Mac. |
164
+ | Command | `npx -y apple-notes-mcp@2.15.1` |
165
+
166
+ You can print these instructions from the installed server:
167
+
168
+ ```bash
169
+ npx -y apple-notes-mcp setup --gemini-spark
170
+ ```
171
+
172
+ The command only prints the guide. It exits before loading server configuration, checking Notes, or running the other setup commands, and it doesn't register the app or change permissions. Exit 0 means the guide was printed, not that Gemini connected. Run it by itself; combining it with other setup options exits 2.
173
+
174
+ Keep **Sandbox settings** at **Default** initially, then click **Next** and review the discovered tools and permission requests before connecting. If Gemini can't launch the server, inspect **Show Logs** and check whether `npx` is available to the app. For a stable local installation, `npm install -g apple-notes-mcp` provides the `apple-notes-mcp` command; you can also use absolute paths to your Node executable and the installed `build/index.js` if the app can't find them. Keep that installation available, and update the command if you move it or replace Node.
175
+
176
+ Gemini's sandbox and macOS permissions are separate. Review any additional filesystem access the launcher needs; **Full Access** isn't a required setup step. Automation of Notes.app enables the AppleScript tools, while database tools need the runtime's [Full Disk Access](#full-disk-access). Shortcut operations need the packaged bridge setup above. After connecting, ask Gemini to run `get-capabilities` for tool availability, then `doctor` for Notes access diagnostics before attempting a write. A successful terminal check doesn't verify the permissions of Gemini's process.
177
+
178
+ This integration uses the Mac app's Local MCP command interface and the server's existing stdio transport. Availability depends on your Gemini build. Google's [custom apps documentation](https://support.google.com/gemini/answer/17209137) currently describes URL-based setup in the web app; it doesn't document this local form. **Cloud MCP**, Gemini web/mobile, and a hosted HTTP endpoint aren't supported by this server. These instructions apply to Gemini Spark, separately from Gemini CLI and Antigravity.
179
+
156
180
  #### Other MCP clients and remote execution
157
181
 
158
182
  A local MCP client can use the command `npx` with arguments `-y` and `apple-notes-mcp@2.15.1`. Follow that client's stdio configuration format: JSON `mcpServers`, TOML, and YAML are not interchangeable.
package/build/index.js CHANGED
@@ -24535,8 +24535,9 @@ Targets (choose at most one; default: packaged Shortcuts):
24535
24535
  --permissions-window Build and install the optional permission checklist window
24536
24536
  --permissions Check permissions; does not grant them
24537
24537
  --broker Build and install the opt-in permission broker
24538
+ --gemini-spark Print the macOS Local MCP guide; no setup effects
24538
24539
 
24539
- Options for every target:
24540
+ Options for installation and permission targets:
24540
24541
  --check Inspect only; do not install or import anything
24541
24542
  --help, -h Show this help without performing any checks
24542
24543
 
@@ -24547,6 +24548,9 @@ Options only with --permissions:
24547
24548
  --window Show the checklist in the installed optional window
24548
24549
  --probe-automation Send a read-only Apple event (may show a consent prompt)
24549
24550
 
24551
+ Options only with --gemini-spark:
24552
+ --help, -h Print the guide without connecting a client
24553
+
24550
24554
  Options only with --broker:
24551
24555
  --uninstall Remove the installed broker and LaunchAgent
24552
24556
  --sign-identity <id> Select an existing signing identity
@@ -24560,7 +24564,8 @@ var SETUP_TARGETS = /* @__PURE__ */ new Map([
24560
24564
  ["--native-helper", "native-helper"],
24561
24565
  ["--permissions-window", "permissions-window"],
24562
24566
  ["--permissions", "permissions"],
24563
- ["--broker", "broker"]
24567
+ ["--broker", "broker"],
24568
+ ["--gemini-spark", "gemini-spark"]
24564
24569
  ]);
24565
24570
  var PERMISSION_OPTIONS = /* @__PURE__ */ new Set([
24566
24571
  "--once",
@@ -24590,6 +24595,13 @@ function parseSetupArgs(args) {
24590
24595
  throw new Error(`Unknown setup option "${arg}".`);
24591
24596
  }
24592
24597
  }
24598
+ if (target === "gemini-spark") {
24599
+ if (args.filter((arg) => arg === "--gemini-spark").length !== 1 || args.some((arg) => !["--gemini-spark", "--help", "-h"].includes(arg)) || args.filter((arg) => arg === "--help" || arg === "-h").length > 1)
24600
+ throw new Error(
24601
+ "The Gemini Spark print-only guide cannot be combined with other setup options."
24602
+ );
24603
+ return { kind: "setup", target, args: [...args], checkOnly: false };
24604
+ }
24593
24605
  if (args.some((arg) => arg === "--uninstall" || arg === "--sign-identity") && target !== "broker")
24594
24606
  throw new Error("--uninstall and --sign-identity require setup --broker.");
24595
24607
  for (const arg of args) {
@@ -24611,6 +24623,33 @@ function parseCliArgs(args) {
24611
24623
  throw new Error(`Unknown command or option "${command2}".`);
24612
24624
  }
24613
24625
 
24626
+ // src/setupGeminiSpark.ts
24627
+ var GEMINI_SPARK_LOCAL_MCP = {
24628
+ serverName: "Apple Notes",
24629
+ description: "Read, search, create, edit, organize, and export Apple Notes on this Mac.",
24630
+ command: "npx -y apple-notes-mcp"
24631
+ };
24632
+ function formatGeminiSparkSetup() {
24633
+ return [
24634
+ "Gemini Spark on macOS: Local MCP",
24635
+ "Requires a Gemini macOS build with Local MCP in Connected Apps > + Custom.",
24636
+ "Select Local MCP and enter:",
24637
+ "",
24638
+ `Server Name: ${GEMINI_SPARK_LOCAL_MCP.serverName}`,
24639
+ `Description: ${GEMINI_SPARK_LOCAL_MCP.description}`,
24640
+ `Command: ${GEMINI_SPARK_LOCAL_MCP.command}`,
24641
+ "",
24642
+ "Keep Sandbox settings at Default initially. If startup fails, inspect Show Logs",
24643
+ "and review the specific launcher or filesystem access it needs.",
24644
+ "Sandbox access and macOS Automation / Full Disk Access are separate permissions.",
24645
+ "Click Next, review the tools and permissions, and complete the connection yourself.",
24646
+ "Verify tool discovery with get-capabilities in Gemini; use doctor for Notes diagnostics.",
24647
+ "",
24648
+ "This command only prints instructions; a successful exit does not verify a connection.",
24649
+ "Cloud MCP needs a hosted MCP URL. This server provides local stdio only."
24650
+ ].join("\n");
24651
+ }
24652
+
24614
24653
  // src/cliEntry.ts
24615
24654
  var parsed;
24616
24655
  try {
@@ -24623,6 +24662,11 @@ ${usage}`);
24623
24662
  process.exit(2);
24624
24663
  }
24625
24664
  var command = parsed;
24665
+ if (command.kind === "setup" && command.target === "gemini-spark") {
24666
+ process.stdout.write(`${formatGeminiSparkSetup()}
24667
+ `);
24668
+ process.exit(0);
24669
+ }
24626
24670
  if (command.kind === "help") {
24627
24671
  process.stdout.write(command.topic === "setup" ? SETUP_USAGE : CLI_USAGE);
24628
24672
  process.exit(0);
@@ -32525,7 +32569,7 @@ function object(shape, params) {
32525
32569
  return new ZodMiniObject(def);
32526
32570
  }
32527
32571
 
32528
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
32572
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
32529
32573
  function isZ4Schema(s) {
32530
32574
  const schema = s;
32531
32575
  return !!schema._zod;
@@ -33380,7 +33424,7 @@ function preprocess(fn, schema) {
33380
33424
  // node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/external.js
33381
33425
  config(en_default2());
33382
33426
 
33383
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
33427
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
33384
33428
  var LATEST_PROTOCOL_VERSION = "2025-11-25";
33385
33429
  var SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-06-18", "2025-03-26", "2024-11-05", "2024-10-07"];
33386
33430
  var RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task";
@@ -34911,7 +34955,7 @@ var UrlElicitationRequiredError = class extends McpError {
34911
34955
  }
34912
34956
  };
34913
34957
 
34914
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
34958
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
34915
34959
  function isTerminal(status) {
34916
34960
  return status === "completed" || status === "failed" || status === "cancelled";
34917
34961
  }
@@ -36200,7 +36244,7 @@ var zodToJsonSchema = (schema, options) => {
36200
36244
  return combined;
36201
36245
  };
36202
36246
 
36203
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
36247
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
36204
36248
  function mapMiniTarget(t) {
36205
36249
  if (!t)
36206
36250
  return "draft-7";
@@ -36242,7 +36286,7 @@ function parseWithCompat(schema, data) {
36242
36286
  return result.data;
36243
36287
  }
36244
36288
 
36245
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
36289
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
36246
36290
  var DEFAULT_REQUEST_TIMEOUT_MSEC = 6e4;
36247
36291
  var Protocol = class {
36248
36292
  constructor(_options) {
@@ -36283,6 +36327,9 @@ var Protocol = class {
36283
36327
  this.setRequestHandler(GetTaskPayloadRequestSchema, async (request, extra) => {
36284
36328
  const handleTaskResult = async () => {
36285
36329
  const taskId = request.params.taskId;
36330
+ if (!await this._taskStore.getTask(taskId, extra.sessionId)) {
36331
+ throw new McpError(ErrorCode.InvalidParams, `Task not found: ${taskId}`);
36332
+ }
36286
36333
  if (this._taskMessageQueue) {
36287
36334
  let queuedMessage;
36288
36335
  while (queuedMessage = await this._taskMessageQueue.dequeue(taskId, extra.sessionId)) {
@@ -36313,12 +36360,12 @@ var Protocol = class {
36313
36360
  throw new McpError(ErrorCode.InvalidParams, `Task not found: ${taskId}`);
36314
36361
  }
36315
36362
  if (!isTerminal(task.status)) {
36316
- await this._waitForTaskUpdate(taskId, extra.signal);
36363
+ await this._waitForTaskUpdate(taskId, extra.signal, extra.sessionId);
36317
36364
  return await handleTaskResult();
36318
36365
  }
36319
36366
  if (isTerminal(task.status)) {
36320
36367
  const result = await this._taskStore.getTaskResult(taskId, extra.sessionId);
36321
- this._clearTaskQueue(taskId);
36368
+ this._clearTaskQueue(taskId, extra.sessionId);
36322
36369
  return {
36323
36370
  ...result,
36324
36371
  _meta: {
@@ -36355,7 +36402,7 @@ var Protocol = class {
36355
36402
  throw new McpError(ErrorCode.InvalidParams, `Cannot cancel task in terminal status: ${task.status}`);
36356
36403
  }
36357
36404
  await this._taskStore.updateTaskStatus(request.params.taskId, "cancelled", "Client cancelled task execution.", extra.sessionId);
36358
- this._clearTaskQueue(request.params.taskId);
36405
+ this._clearTaskQueue(request.params.taskId, extra.sessionId);
36359
36406
  const cancelledTask = await this._taskStore.getTask(request.params.taskId, extra.sessionId);
36360
36407
  if (!cancelledTask) {
36361
36408
  throw new McpError(ErrorCode.InvalidParams, `Task not found after cancellation: ${request.params.taskId}`);
@@ -36483,6 +36530,19 @@ var Protocol = class {
36483
36530
  const handler = this._requestHandlers.get(request.method) ?? this.fallbackRequestHandler;
36484
36531
  const capturedTransport = this._transport;
36485
36532
  const relatedTaskId = request.params?._meta?.[RELATED_TASK_META_KEY]?.taskId;
36533
+ const sessionId = capturedTransport?.sessionId;
36534
+ const store = this._taskStore;
36535
+ let relatedTaskFound = true;
36536
+ let relatedTaskLookup;
36537
+ if (relatedTaskId && store && this._taskMessageQueue && sessionId !== void 0) {
36538
+ relatedTaskFound = false;
36539
+ relatedTaskLookup = (async () => {
36540
+ if (!await store.getTask(relatedTaskId, sessionId)) {
36541
+ throw new McpError(ErrorCode.InvalidParams, `Task not found: ${relatedTaskId}`);
36542
+ }
36543
+ relatedTaskFound = true;
36544
+ })();
36545
+ }
36486
36546
  if (handler === void 0) {
36487
36547
  const errorResponse2 = {
36488
36548
  jsonrpc: "2.0",
@@ -36492,7 +36552,10 @@ var Protocol = class {
36492
36552
  message: "Method not found"
36493
36553
  }
36494
36554
  };
36495
- if (relatedTaskId && this._taskMessageQueue) {
36555
+ if (relatedTaskId && relatedTaskLookup) {
36556
+ const queuedError = { type: "error", message: errorResponse2, timestamp: Date.now() };
36557
+ relatedTaskLookup.then(() => this._enqueueTaskMessage(relatedTaskId, queuedError, sessionId), () => capturedTransport?.send(errorResponse2)).catch((error2) => this._onerror(new Error(`Failed to send an error response: ${error2}`)));
36558
+ } else if (relatedTaskId && this._taskMessageQueue) {
36496
36559
  this._enqueueTaskMessage(relatedTaskId, {
36497
36560
  type: "error",
36498
36561
  message: errorResponse2,
@@ -36543,7 +36606,10 @@ var Protocol = class {
36543
36606
  closeSSEStream: extra?.closeSSEStream,
36544
36607
  closeStandaloneSSEStream: extra?.closeStandaloneSSEStream
36545
36608
  };
36546
- Promise.resolve().then(() => {
36609
+ (relatedTaskLookup ?? Promise.resolve()).then(() => {
36610
+ if (relatedTaskLookup && abortController.signal.aborted) {
36611
+ throw new McpError(ErrorCode.ConnectionClosed, "Request was cancelled");
36612
+ }
36547
36613
  if (taskCreationParams) {
36548
36614
  this.assertTaskHandlerCapability(request.method);
36549
36615
  }
@@ -36578,7 +36644,7 @@ var Protocol = class {
36578
36644
  ...error2["data"] !== void 0 && { data: error2["data"] }
36579
36645
  }
36580
36646
  };
36581
- if (relatedTaskId && this._taskMessageQueue) {
36647
+ if (relatedTaskId && this._taskMessageQueue && relatedTaskFound) {
36582
36648
  await this._enqueueTaskMessage(relatedTaskId, {
36583
36649
  type: "error",
36584
36650
  message: errorResponse2,
@@ -37058,7 +37124,7 @@ var Protocol = class {
37058
37124
  throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");
37059
37125
  }
37060
37126
  const maxQueueSize = this._options?.maxTaskQueueSize;
37061
- await this._taskMessageQueue.enqueue(taskId, message, sessionId, maxQueueSize);
37127
+ await this._taskMessageQueue.enqueue(taskId, message, sessionId ?? this._transport?.sessionId, maxQueueSize);
37062
37128
  }
37063
37129
  /**
37064
37130
  * Clears the message queue for a task and rejects any pending request resolvers.
@@ -37087,12 +37153,13 @@ var Protocol = class {
37087
37153
  * Uses polling to check for updates at the task's configured poll interval.
37088
37154
  * @param taskId The task ID to wait for
37089
37155
  * @param signal Abort signal to cancel the wait
37156
+ * @param sessionId Session of the request that waits, passed to the task store
37090
37157
  * @returns Promise that resolves when an update occurs or rejects if aborted
37091
37158
  */
37092
- async _waitForTaskUpdate(taskId, signal) {
37159
+ async _waitForTaskUpdate(taskId, signal, sessionId) {
37093
37160
  let interval = this._options?.defaultTaskPollInterval ?? 1e3;
37094
37161
  try {
37095
- const task = await this._taskStore?.getTask(taskId);
37162
+ const task = await this._taskStore?.getTask(taskId, sessionId);
37096
37163
  if (task?.pollInterval) {
37097
37164
  interval = task.pollInterval;
37098
37165
  }
@@ -37196,7 +37263,7 @@ function mergeCapabilities(base, additional) {
37196
37263
  return result;
37197
37264
  }
37198
37265
 
37199
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
37266
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
37200
37267
  var import_ajv = __toESM(require_ajv(), 1);
37201
37268
  var import_ajv_formats = __toESM(require_dist(), 1);
37202
37269
  function createDefaultAjvInstance() {
@@ -37264,7 +37331,7 @@ var AjvJsonSchemaValidator = class {
37264
37331
  }
37265
37332
  };
37266
37333
 
37267
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
37334
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
37268
37335
  var ExperimentalServerTasks = class {
37269
37336
  constructor(_server) {
37270
37337
  this._server = _server;
@@ -37477,7 +37544,7 @@ var ExperimentalServerTasks = class {
37477
37544
  }
37478
37545
  };
37479
37546
 
37480
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
37547
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
37481
37548
  function assertToolsCallTaskCapability(requests, method, entityName) {
37482
37549
  if (!requests) {
37483
37550
  throw new Error(`${entityName} does not support task creation (required for ${method})`);
@@ -37512,7 +37579,7 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
37512
37579
  }
37513
37580
  }
37514
37581
 
37515
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
37582
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
37516
37583
  var Server = class extends Protocol {
37517
37584
  /**
37518
37585
  * Initializes this server with the given name and version information.
@@ -37883,7 +37950,7 @@ var Server = class extends Protocol {
37883
37950
  }
37884
37951
  };
37885
37952
 
37886
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
37953
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
37887
37954
  var COMPLETABLE_SYMBOL = /* @__PURE__ */ Symbol.for("mcp.completable");
37888
37955
  function isCompletable(schema) {
37889
37956
  return !!schema && typeof schema === "object" && COMPLETABLE_SYMBOL in schema;
@@ -37897,7 +37964,7 @@ var McpZodTypeKind;
37897
37964
  McpZodTypeKind2["Completable"] = "McpCompletable";
37898
37965
  })(McpZodTypeKind || (McpZodTypeKind = {}));
37899
37966
 
37900
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/uriTemplate.js
37967
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/uriTemplate.js
37901
37968
  var MAX_TEMPLATE_LENGTH = 1e6;
37902
37969
  var MAX_VARIABLE_LENGTH = 1e6;
37903
37970
  var MAX_TEMPLATE_EXPRESSIONS = 1e4;
@@ -38119,7 +38186,7 @@ var UriTemplate = class _UriTemplate {
38119
38186
  }
38120
38187
  };
38121
38188
 
38122
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
38189
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
38123
38190
  var TOOL_NAME_REGEX = /^[A-Za-z0-9._-]{1,128}$/;
38124
38191
  function validateToolName(name) {
38125
38192
  const warnings = [];
@@ -38177,7 +38244,7 @@ function validateAndWarnToolName(name) {
38177
38244
  return result.isValid;
38178
38245
  }
38179
38246
 
38180
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
38247
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
38181
38248
  var ExperimentalMcpServerTasks = class {
38182
38249
  constructor(_mcpServer) {
38183
38250
  this._mcpServer = _mcpServer;
@@ -38192,7 +38259,43 @@ var ExperimentalMcpServerTasks = class {
38192
38259
  }
38193
38260
  };
38194
38261
 
38195
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
38262
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
38263
+ function toolInputElementCount(value, max) {
38264
+ let count = 0;
38265
+ const stack = [value];
38266
+ while (stack.length > 0) {
38267
+ const node = stack.pop();
38268
+ if (node === null || typeof node !== "object")
38269
+ continue;
38270
+ if (Array.isArray(node)) {
38271
+ for (const child2 of node) {
38272
+ if (++count > max)
38273
+ return count;
38274
+ if (child2 !== null && typeof child2 === "object")
38275
+ stack.push(child2);
38276
+ }
38277
+ } else {
38278
+ for (const key in node) {
38279
+ if (!Object.prototype.hasOwnProperty.call(node, key))
38280
+ continue;
38281
+ if (++count > max)
38282
+ return count;
38283
+ const child2 = node[key];
38284
+ if (child2 !== null && typeof child2 === "object")
38285
+ stack.push(child2);
38286
+ }
38287
+ }
38288
+ }
38289
+ return count;
38290
+ }
38291
+ function resolveMaxToolInputElements(value) {
38292
+ if (value === void 0 || value === Infinity)
38293
+ return void 0;
38294
+ if (typeof value !== "number" || Number.isNaN(value) || value < 1) {
38295
+ throw new RangeError(`maxToolInputElements must be a number of at least 1, or Infinity, got ${String(value)}`);
38296
+ }
38297
+ return value;
38298
+ }
38196
38299
  var McpServer = class {
38197
38300
  constructor(serverInfo, options) {
38198
38301
  this._registeredResources = {};
@@ -38204,6 +38307,7 @@ var McpServer = class {
38204
38307
  this._resourceHandlersInitialized = false;
38205
38308
  this._promptHandlersInitialized = false;
38206
38309
  this.server = new Server(serverInfo, options);
38310
+ this._maxToolInputElements = resolveMaxToolInputElements(options?.maxToolInputElements);
38207
38311
  }
38208
38312
  /**
38209
38313
  * Access experimental features.
@@ -38334,12 +38438,15 @@ var McpServer = class {
38334
38438
  * Validates tool input arguments against the tool's input schema.
38335
38439
  */
38336
38440
  async validateToolInput(tool, args, toolName) {
38441
+ if (this._maxToolInputElements !== void 0 && toolInputElementCount(args, this._maxToolInputElements) > this._maxToolInputElements) {
38442
+ throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for tool ${toolName}: arguments contain more than the maximum of ${this._maxToolInputElements} elements`);
38443
+ }
38337
38444
  if (!tool.inputSchema) {
38338
38445
  return void 0;
38339
38446
  }
38340
38447
  const inputObj = normalizeObjectSchema(tool.inputSchema);
38341
38448
  const schemaToParse = inputObj ?? tool.inputSchema;
38342
- const parseResult = await safeParseAsync2(schemaToParse, args);
38449
+ const parseResult = await safeParseAsync2(schemaToParse, args ?? {});
38343
38450
  if (!parseResult.success) {
38344
38451
  const error2 = "error" in parseResult ? parseResult.error : "Unknown error";
38345
38452
  const errorMessage = getParseErrorMessage(error2);
@@ -38577,7 +38684,7 @@ var McpServer = class {
38577
38684
  }
38578
38685
  if (prompt.argsSchema) {
38579
38686
  const argsObj = normalizeObjectSchema(prompt.argsSchema);
38580
- const parseResult = await safeParseAsync2(argsObj, request.params.arguments);
38687
+ const parseResult = await safeParseAsync2(argsObj, request.params.arguments ?? {});
38581
38688
  if (!parseResult.success) {
38582
38689
  const error2 = "error" in parseResult ? parseResult.error : "Unknown error";
38583
38690
  const errorMessage = getParseErrorMessage(error2);
@@ -39008,10 +39115,10 @@ var EMPTY_COMPLETION_RESULT = {
39008
39115
  }
39009
39116
  };
39010
39117
 
39011
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
39118
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
39012
39119
  import process2 from "node:process";
39013
39120
 
39014
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
39121
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
39015
39122
  var STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024;
39016
39123
  var ReadBuffer = class {
39017
39124
  constructor(options) {
@@ -39048,7 +39155,7 @@ function serializeMessage(message) {
39048
39155
  return JSON.stringify(message) + "\n";
39049
39156
  }
39050
39157
 
39051
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
39158
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
39052
39159
  var StdioServerTransport = class {
39053
39160
  constructor(_stdin = process2.stdin, _stdout = process2.stdout, options) {
39054
39161
  this._stdin = _stdin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apple-notes-mcp",
3
- "version": "2.15.7",
3
+ "version": "2.15.9",
4
4
  "description": "MCP server for Apple Notes - read, search, create, edit, organize, and export notes on macOS via Claude and other AI assistants",
5
5
  "type": "module",
6
6
  "main": "build/index.js",