apple-notes-mcp 2.14.1 → 2.14.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.
Files changed (3) hide show
  1. package/README.md +2 -2
  2. package/build/index.js +338 -50
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1331,9 +1331,9 @@ fixed HTML subset rather than anything Notes.app can render:
1331
1331
 
1332
1332
  | | Native append |
1333
1333
  |---|---|
1334
- | Elements | `<a>` `<b>` `<br>` `<code>` `<del>` `<div>` `<em>` `<h1>` `<h2>` `<h3>` `<i>` `<li>` `<ol>` `<p>` `<s>` `<span>` `<strong>` `<table>` `<tbody>` `<td>` `<th>` `<thead>` `<tr>` `<tt>` `<u>` `<ul>` |
1334
+ | Elements | `<a>` `<b>` `<br>` `<code>` `<del>` `<div>` `<em>` `<h1>` `<h2>` `<h3>` `<i>` `<li>` `<ol>` `<p>` `<s>` `<span>` `<strong>` `<tt>` `<u>` `<ul>` |
1335
1335
  | Attributes | `href` on `<a>` (`https:`, `http:`, `notes:`, `applenotes:`, `mailto:` only) and a `font-size` style on `<span>`, e.g. `<span style="font-size: 18px">` — the form Notes itself stores a heading as |
1336
- | Refused | every other element and attribute, by name, naming the accepted subset; `<table>` here (use [`create-table`](#create-table)); comments, doctype and processing instructions |
1336
+ | Refused | every other element and attribute, by name, naming the accepted subset; a table, in whole or in part (`<table>` `<thead>` `<tbody>` `<tr>` `<td>` `<th>`) — use [`create-table`](#create-table) instead; comments, doctype and processing instructions |
1337
1337
 
1338
1338
  Ordinary notes take the guarded HTML path and are not restricted to that subset.
1339
1339
 
package/build/index.js CHANGED
@@ -40014,6 +40014,316 @@ function uniqueById(items) {
40014
40014
  return result;
40015
40015
  }
40016
40016
 
40017
+ // src/utils/htmlEntities.ts
40018
+ var NAMED_CHARACTER_REFERENCES = {
40019
+ Aacute: 193,
40020
+ aacute: 225,
40021
+ Acirc: 194,
40022
+ acirc: 226,
40023
+ acute: 180,
40024
+ AElig: 198,
40025
+ aelig: 230,
40026
+ Agrave: 192,
40027
+ agrave: 224,
40028
+ alefsym: 8501,
40029
+ Alpha: 913,
40030
+ alpha: 945,
40031
+ amp: 38,
40032
+ and: 8743,
40033
+ ang: 8736,
40034
+ apos: 39,
40035
+ Aring: 197,
40036
+ aring: 229,
40037
+ asymp: 8776,
40038
+ Atilde: 195,
40039
+ atilde: 227,
40040
+ Auml: 196,
40041
+ auml: 228,
40042
+ bdquo: 8222,
40043
+ Beta: 914,
40044
+ beta: 946,
40045
+ brvbar: 166,
40046
+ bull: 8226,
40047
+ cap: 8745,
40048
+ Ccedil: 199,
40049
+ ccedil: 231,
40050
+ cedil: 184,
40051
+ cent: 162,
40052
+ Chi: 935,
40053
+ chi: 967,
40054
+ circ: 710,
40055
+ clubs: 9827,
40056
+ cong: 8773,
40057
+ copy: 169,
40058
+ crarr: 8629,
40059
+ cup: 8746,
40060
+ curren: 164,
40061
+ Dagger: 8225,
40062
+ dagger: 8224,
40063
+ dArr: 8659,
40064
+ darr: 8595,
40065
+ deg: 176,
40066
+ Delta: 916,
40067
+ delta: 948,
40068
+ diams: 9830,
40069
+ divide: 247,
40070
+ Eacute: 201,
40071
+ eacute: 233,
40072
+ Ecirc: 202,
40073
+ ecirc: 234,
40074
+ Egrave: 200,
40075
+ egrave: 232,
40076
+ empty: 8709,
40077
+ emsp: 8195,
40078
+ ensp: 8194,
40079
+ Epsilon: 917,
40080
+ epsilon: 949,
40081
+ equiv: 8801,
40082
+ Eta: 919,
40083
+ eta: 951,
40084
+ ETH: 208,
40085
+ eth: 240,
40086
+ Euml: 203,
40087
+ euml: 235,
40088
+ euro: 8364,
40089
+ exist: 8707,
40090
+ fnof: 402,
40091
+ forall: 8704,
40092
+ frac12: 189,
40093
+ frac14: 188,
40094
+ frac34: 190,
40095
+ frasl: 8260,
40096
+ Gamma: 915,
40097
+ gamma: 947,
40098
+ ge: 8805,
40099
+ gt: 62,
40100
+ hArr: 8660,
40101
+ harr: 8596,
40102
+ hearts: 9829,
40103
+ hellip: 8230,
40104
+ Iacute: 205,
40105
+ iacute: 237,
40106
+ Icirc: 206,
40107
+ icirc: 238,
40108
+ iexcl: 161,
40109
+ Igrave: 204,
40110
+ igrave: 236,
40111
+ image: 8465,
40112
+ infin: 8734,
40113
+ int: 8747,
40114
+ Iota: 921,
40115
+ iota: 953,
40116
+ iquest: 191,
40117
+ isin: 8712,
40118
+ Iuml: 207,
40119
+ iuml: 239,
40120
+ Kappa: 922,
40121
+ kappa: 954,
40122
+ Lambda: 923,
40123
+ lambda: 955,
40124
+ lang: 10216,
40125
+ laquo: 171,
40126
+ lArr: 8656,
40127
+ larr: 8592,
40128
+ lceil: 8968,
40129
+ ldquo: 8220,
40130
+ le: 8804,
40131
+ lfloor: 8970,
40132
+ lowast: 8727,
40133
+ loz: 9674,
40134
+ lrm: 8206,
40135
+ lsaquo: 8249,
40136
+ lsquo: 8216,
40137
+ lt: 60,
40138
+ macr: 175,
40139
+ mdash: 8212,
40140
+ micro: 181,
40141
+ middot: 183,
40142
+ minus: 8722,
40143
+ Mu: 924,
40144
+ mu: 956,
40145
+ nabla: 8711,
40146
+ nbsp: 160,
40147
+ ndash: 8211,
40148
+ ne: 8800,
40149
+ ni: 8715,
40150
+ not: 172,
40151
+ notin: 8713,
40152
+ nsub: 8836,
40153
+ Ntilde: 209,
40154
+ ntilde: 241,
40155
+ Nu: 925,
40156
+ nu: 957,
40157
+ Oacute: 211,
40158
+ oacute: 243,
40159
+ Ocirc: 212,
40160
+ ocirc: 244,
40161
+ OElig: 338,
40162
+ oelig: 339,
40163
+ Ograve: 210,
40164
+ ograve: 242,
40165
+ oline: 8254,
40166
+ Omega: 937,
40167
+ omega: 969,
40168
+ Omicron: 927,
40169
+ omicron: 959,
40170
+ oplus: 8853,
40171
+ or: 8744,
40172
+ ordf: 170,
40173
+ ordm: 186,
40174
+ Oslash: 216,
40175
+ oslash: 248,
40176
+ Otilde: 213,
40177
+ otilde: 245,
40178
+ otimes: 8855,
40179
+ Ouml: 214,
40180
+ ouml: 246,
40181
+ para: 182,
40182
+ part: 8706,
40183
+ permil: 8240,
40184
+ perp: 8869,
40185
+ Phi: 934,
40186
+ phi: 966,
40187
+ Pi: 928,
40188
+ pi: 960,
40189
+ piv: 982,
40190
+ plusmn: 177,
40191
+ pound: 163,
40192
+ Prime: 8243,
40193
+ prime: 8242,
40194
+ prod: 8719,
40195
+ prop: 8733,
40196
+ Psi: 936,
40197
+ psi: 968,
40198
+ quot: 34,
40199
+ radic: 8730,
40200
+ rang: 10217,
40201
+ raquo: 187,
40202
+ rArr: 8658,
40203
+ rarr: 8594,
40204
+ rceil: 8969,
40205
+ rdquo: 8221,
40206
+ real: 8476,
40207
+ reg: 174,
40208
+ rfloor: 8971,
40209
+ Rho: 929,
40210
+ rho: 961,
40211
+ rlm: 8207,
40212
+ rsaquo: 8250,
40213
+ rsquo: 8217,
40214
+ sbquo: 8218,
40215
+ Scaron: 352,
40216
+ scaron: 353,
40217
+ sdot: 8901,
40218
+ sect: 167,
40219
+ shy: 173,
40220
+ Sigma: 931,
40221
+ sigma: 963,
40222
+ sigmaf: 962,
40223
+ sim: 8764,
40224
+ spades: 9824,
40225
+ sub: 8834,
40226
+ sube: 8838,
40227
+ sum: 8721,
40228
+ sup: 8835,
40229
+ sup1: 185,
40230
+ sup2: 178,
40231
+ sup3: 179,
40232
+ supe: 8839,
40233
+ szlig: 223,
40234
+ Tau: 932,
40235
+ tau: 964,
40236
+ there4: 8756,
40237
+ Theta: 920,
40238
+ theta: 952,
40239
+ thetasym: 977,
40240
+ thinsp: 8201,
40241
+ THORN: 222,
40242
+ thorn: 254,
40243
+ tilde: 732,
40244
+ times: 215,
40245
+ trade: 8482,
40246
+ Uacute: 218,
40247
+ uacute: 250,
40248
+ uArr: 8657,
40249
+ uarr: 8593,
40250
+ Ucirc: 219,
40251
+ ucirc: 251,
40252
+ Ugrave: 217,
40253
+ ugrave: 249,
40254
+ uml: 168,
40255
+ upsih: 978,
40256
+ Upsilon: 933,
40257
+ upsilon: 965,
40258
+ Uuml: 220,
40259
+ uuml: 252,
40260
+ weierp: 8472,
40261
+ Xi: 926,
40262
+ xi: 958,
40263
+ Yacute: 221,
40264
+ yacute: 253,
40265
+ yen: 165,
40266
+ Yuml: 376,
40267
+ yuml: 255,
40268
+ Zeta: 918,
40269
+ zeta: 950,
40270
+ zwj: 8205,
40271
+ zwnj: 8204
40272
+ };
40273
+ var LEGACY = { amp: "&", lt: "<", gt: ">", quot: '"', nbsp: "\xA0" };
40274
+ var C1_REPLACEMENTS = {
40275
+ 128: 8364,
40276
+ 130: 8218,
40277
+ 131: 402,
40278
+ 132: 8222,
40279
+ 133: 8230,
40280
+ 134: 8224,
40281
+ 135: 8225,
40282
+ 136: 710,
40283
+ 137: 8240,
40284
+ 138: 352,
40285
+ 139: 8249,
40286
+ 140: 338,
40287
+ 142: 381,
40288
+ 145: 8216,
40289
+ 146: 8217,
40290
+ 147: 8220,
40291
+ 148: 8221,
40292
+ 149: 8226,
40293
+ 150: 8211,
40294
+ 151: 8212,
40295
+ 152: 732,
40296
+ 153: 8482,
40297
+ 154: 353,
40298
+ 155: 8250,
40299
+ 156: 339,
40300
+ 158: 382,
40301
+ 159: 376
40302
+ };
40303
+ function numericReferenceText(value) {
40304
+ if (!Number.isSafeInteger(value) || value === 0 || value > 1114111) return "\uFFFD";
40305
+ if (value >= 55296 && value <= 57343) return "\uFFFD";
40306
+ return String.fromCodePoint(C1_REPLACEMENTS[value] ?? value);
40307
+ }
40308
+ function namedReferenceText(name) {
40309
+ return Object.hasOwn(NAMED_CHARACTER_REFERENCES, name) ? String.fromCodePoint(NAMED_CHARACTER_REFERENCES[name]) : void 0;
40310
+ }
40311
+ function decodeHtmlEntities(text2) {
40312
+ return text2.replace(
40313
+ /&(?:#(\d+);?|#[xX]([0-9a-fA-F]+);?|([A-Za-z][A-Za-z0-9]*)(;?))/g,
40314
+ (match, dec, hex3, name, semicolon) => {
40315
+ if (dec !== void 0) return numericReferenceText(Number(dec));
40316
+ if (hex3 !== void 0) return numericReferenceText(Number.parseInt(hex3, 16));
40317
+ const named = semicolon ? namedReferenceText(name) : void 0;
40318
+ if (named !== void 0) return named;
40319
+ const legacy = /^(?:amp|lt|gt|quot|nbsp)/i.exec(name);
40320
+ if (!legacy) return match;
40321
+ const rest = name.slice(legacy[0].length);
40322
+ return LEGACY[legacy[0].toLowerCase()] + rest + (rest ? semicolon : "");
40323
+ }
40324
+ );
40325
+ }
40326
+
40017
40327
  // src/utils/noteRichText.ts
40018
40328
  var HTML_LOSSY_ORDER = [
40019
40329
  "superscript",
@@ -40191,15 +40501,14 @@ function readRichNote(id2, options = {}) {
40191
40501
  ];
40192
40502
  return rich;
40193
40503
  }
40504
+ var LEGACY_NAMED = {
40505
+ amp: "&",
40506
+ lt: "<",
40507
+ gt: ">",
40508
+ quot: '"',
40509
+ nbsp: " "
40510
+ };
40194
40511
  function decodeEntity(value) {
40195
- const named = {
40196
- amp: "&",
40197
- lt: "<",
40198
- gt: ">",
40199
- quot: '"',
40200
- apos: "'",
40201
- nbsp: " "
40202
- };
40203
40512
  if (!value.startsWith("&") || value === "&") return value;
40204
40513
  const name = value.slice(1).replace(/;$/, "");
40205
40514
  if (name.startsWith("#")) {
@@ -40207,8 +40516,11 @@ function decodeEntity(value) {
40207
40516
  if (!Number.isInteger(cp) || cp < 0 || cp > 1114111) throw new Error("Invalid HTML entity");
40208
40517
  return String.fromCodePoint(cp);
40209
40518
  }
40210
- if (!(name in named)) throw new Error("Unsupported HTML entity");
40211
- return named[name];
40519
+ const legacy = name.toLowerCase();
40520
+ if (Object.hasOwn(LEGACY_NAMED, legacy)) return LEGACY_NAMED[legacy];
40521
+ const named = value.endsWith(";") ? namedReferenceText(name) : void 0;
40522
+ if (named === void 0) throw new Error("Unsupported HTML entity");
40523
+ return named;
40212
40524
  }
40213
40525
  function visibleCharacters(html) {
40214
40526
  const chars = [];
@@ -40217,18 +40529,16 @@ function visibleCharacters(html) {
40217
40529
  token++;
40218
40530
  if (part[0].startsWith("<")) continue;
40219
40531
  for (const item of part[0].matchAll(
40220
- /&(?:#[0-9]+;?|#x[0-9a-f]+;?|(?:amp|lt|gt|quot|nbsp);?|apos;)|[\s\S]/gi
40532
+ /&(?:#[0-9]+;?|#x[0-9a-f]+;?|(?:amp|lt|gt|quot|nbsp);?)|&(?<name>[a-z][a-z0-9]*);|[\s\S]/gi
40221
40533
  )) {
40222
- const value = decodeEntity(item[0]);
40223
- for (let i = 0; i < value.length; i++) {
40224
- if (/\s/u.test(value[i])) continue;
40225
- chars.push({
40226
- value: value[i],
40227
- start: part.index + item.index,
40228
- end: part.index + item.index + item[0].length,
40229
- token
40230
- });
40231
- }
40534
+ const start = part.index + item.index;
40535
+ const name = item.groups?.name;
40536
+ const pieces = name !== void 0 && namedReferenceText(name) === void 0 ? [...item[0]].map((value, i) => ({ value, start: start + i, end: start + i + 1 })) : [{ value: decodeEntity(item[0]), start, end: start + item[0].length }];
40537
+ for (const piece of pieces)
40538
+ for (let i = 0; i < piece.value.length; i++) {
40539
+ if (/\s/u.test(piece.value[i])) continue;
40540
+ chars.push({ value: piece.value[i], start: piece.start, end: piece.end, token });
40541
+ }
40232
40542
  }
40233
40543
  }
40234
40544
  return chars;
@@ -47091,7 +47401,7 @@ var BLOCK_END_RE = /<\/(?:div|h[1-6]|p|li)>/gi;
47091
47401
  var BREAK_RE = /<br\s*\/?\s*>/gi;
47092
47402
  var TAG_RE = /<[^>]*>/g;
47093
47403
  var NON_RENDERED_BLOCK_RE = /<(script|style)\b[^>]*>[\s\S]*?(?:<\/\1>|$)/gi;
47094
- function decodeHtmlEntities(text2) {
47404
+ function decodeHtmlEntities2(text2) {
47095
47405
  const decodeCodePoint = (match, value, radix) => {
47096
47406
  const codePoint = Number.parseInt(value, radix);
47097
47407
  if (!Number.isInteger(codePoint) || codePoint < 0 || codePoint > 1114111 || codePoint >= 55296 && codePoint <= 57343) {
@@ -47113,7 +47423,7 @@ function firstVisibleHtmlLine(html) {
47113
47423
  previous = text2;
47114
47424
  text2 = text2.replace(TAG_RE, "");
47115
47425
  } while (text2 !== previous);
47116
- return decodeHtmlEntities(text2).split(/[\r\n\u2028\u2029]+/).map((line) => line.replace(/\s+/g, " ").trim()).find(Boolean);
47426
+ return decodeHtmlEntities2(text2).split(/[\r\n\u2028\u2029]+/).map((line) => line.replace(/\s+/g, " ").trim()).find(Boolean);
47117
47427
  }
47118
47428
  function resolveUpdateResponseTitle(currentTitle, newTitle, format, newContent) {
47119
47429
  if (format === "html") return firstVisibleHtmlLine(newContent) ?? currentTitle;
@@ -48479,25 +48789,9 @@ function appendMarkdownHtml(markdown, options = {}) {
48479
48789
 
48480
48790
  // src/utils/noteRevision.ts
48481
48791
  var INLINE_TAG = /^<\/?(?:b|i|u|s|strike|em|strong|span|a|font|sub|sup|code|tt|small|big|mark)\b/i;
48482
- var LEGACY_ENTITIES = {
48483
- nbsp: " ",
48484
- quot: '"',
48485
- lt: "<",
48486
- gt: ">",
48487
- amp: "&"
48488
- };
48489
- function codePointText(value) {
48490
- return Number.isSafeInteger(value) && value <= 1114111 ? String.fromCodePoint(value) : "\uFFFD";
48491
- }
48492
48792
  function comparableVisibleText(html) {
48493
- return html.replace(/<br\s*\/?\s*>/gi, " ").replace(/<[^>]*>/g, (tag) => INLINE_TAG.test(tag) ? "" : " ").replace(
48494
- /&(?:(nbsp|quot|lt|gt|amp);?|apos;|#(\d+);|#x([0-9a-f]+);)/gi,
48495
- (_match, legacy, dec, hex3) => {
48496
- if (legacy) return LEGACY_ENTITIES[legacy.toLowerCase()];
48497
- if (dec) return codePointText(Number(dec));
48498
- if (hex3) return codePointText(Number.parseInt(hex3, 16));
48499
- return "'";
48500
- }
48793
+ return decodeHtmlEntities(
48794
+ html.replace(/<br\s*\/?\s*>/gi, " ").replace(/<[^>]*>/g, (tag) => INLINE_TAG.test(tag) ? "" : " ")
48501
48795
  ).replace(/\s+/g, " ").trim();
48502
48796
  }
48503
48797
 
@@ -48549,18 +48843,12 @@ var NATIVE_APPEND_ELEMENTS = [
48549
48843
  "s",
48550
48844
  "span",
48551
48845
  "strong",
48552
- "table",
48553
- "tbody",
48554
- "td",
48555
- "th",
48556
- "thead",
48557
- "tr",
48558
48846
  "tt",
48559
48847
  "u",
48560
48848
  "ul"
48561
48849
  ];
48562
48850
  var NATIVE_APPEND_SPAN_STYLE = /^font-size\s*:\s*\d{1,3}(?:\.\d+)?(?:px|pt)\s*;?$/i;
48563
- var NATIVE_APPEND_HTML_SUBSET = `Native append accepts ${NATIVE_APPEND_ELEMENTS.map((e) => `<${e}>`).join(" ")}, with href on <a> and a font-size style on <span> as the only attributes; everything else needs update-note.`;
48851
+ var NATIVE_APPEND_HTML_SUBSET = `Native append accepts ${NATIVE_APPEND_ELEMENTS.map((e) => `<${e}>`).join(" ")}, with href on <a> and a font-size style on <span> as the only attributes; a native table is refused here \u2014 use create-table; everything else needs update-note.`;
48564
48852
  var UNDERSCORES_OUTSIDE_A_WORD = "underscores outside a word";
48565
48853
  var UNMODELED_MARKDOWN = [
48566
48854
  [/(?<![\p{L}\p{N}])_|_(?![\p{L}\p{N}])/mu, UNDERSCORES_OUTSIDE_A_WORD],
@@ -48831,9 +49119,9 @@ function assertAppendedVisibleText(beforeHtml, afterHtml, expected) {
48831
49119
  if (!suffix || !suffix.includes(wanted)) throw new Error("Appended text not verified");
48832
49120
  }
48833
49121
  function appendNative(manager, request) {
48834
- validateAppendContent(request.content, request.format);
48835
- if (request.format === "html" && /<table\b/i.test(request.content))
49122
+ if (request.format === "html" && /<\/?\s*(?:table|thead|tbody|tr|td|th)\b/i.test(request.content))
48836
49123
  throw new Error("Use create-table for verified native table insertion");
49124
+ validateAppendContent(request.content, request.format);
48837
49125
  const markdownHtml = request.format === "markdown" ? appendMarkdownHtml(request.content) : null;
48838
49126
  const op = request.format === "plaintext" ? "append-text" : request.format === "markdown" ? "append-markdown" : "append-html";
48839
49127
  const text2 = request.format === "html" ? "<div><br></div>" + request.content : "\n\n" + request.content;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apple-notes-mcp",
3
- "version": "2.14.1",
3
+ "version": "2.14.3",
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",