apple-notes-mcp 2.9.14 → 2.9.16

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/README.md CHANGED
@@ -1710,6 +1710,8 @@ single note.
1710
1710
  | `outputPath` | string | No | Absolute file to create. Create-only: an existing file (or symlink) is refused with `[output_exists]` |
1711
1711
  | `assetsDir` | string | No | Absolute directory for attachment copies. Existing files are never replaced; a taken name gets `-2`, `-3`, ... |
1712
1712
  | `wrap` | number | No | Hard-wrap prose at this many columns. Code, tables and headings are never wrapped |
1713
+ | `template` | string | No | Render through a template: `standard-markdown`, `obsidian`, or a saved template's name. Exclusive with `templateFile` |
1714
+ | `templateFile` | string | No | Render through the JSON template in this `.json` file (same path rules; at most 256 KiB) |
1713
1715
 
1714
1716
  Both paths follow the `save-attachment` rules (absolute, under the home
1715
1717
  directory, a temp directory, or `/Volumes`, no symlink escapes) and may not
@@ -1724,6 +1726,19 @@ Both carry `stats` (attachments, placed, placeholders, unavailable, tables,
1724
1726
  unreadableTables, unreferenced) and `skipped`. Nothing already written is
1725
1727
  deleted if a later step fails.
1726
1728
 
1729
+ **Templates:** `template` or `templateFile` renders through a portable JSON
1730
+ template that sets how every block style, inline format, attachment,
1731
+ per-note header and footer (for YAML front matter with title, dates,
1732
+ folder, tags and id), and the note separator are written. The built-in
1733
+ `standard-markdown` reproduces the default output; `obsidian` adds front
1734
+ matter and copies attachments into `<file>.assets` beside `outputPath`.
1735
+ Templated asset copies get stable content-hashed names and are reused on a
1736
+ repeat export. An invalid template is refused with `[invalid-template]` and
1737
+ one JSON path per problem, before any note is read. A templated receipt adds
1738
+ `template`, `warnings` (such as `missing_asset`) and `assetFiles`. See
1739
+ [docs/markdown-templates.md](docs/markdown-templates.md) for the schema,
1740
+ every rule and placeholder, and examples.
1741
+
1727
1742
  ---
1728
1743
 
1729
1744
  #### `export-notes-html`
@@ -1770,6 +1785,88 @@ already written is deleted if a later step fails.
1770
1785
 
1771
1786
  ---
1772
1787
 
1788
+ #### `list-markdown-templates`
1789
+
1790
+ Lists the Markdown export templates: the built-ins (`standard-markdown`,
1791
+ `obsidian`) and every saved template in the library, with its display name,
1792
+ description, size and modification date. Unreadable, invalid or unsafe files
1793
+ in the library are skipped and counted in `skipped`. Takes no parameters.
1794
+
1795
+ **Returns:** `builtins`, `templates`, `skipped`, and `dir` (the library
1796
+ directory).
1797
+
1798
+ ---
1799
+
1800
+ #### `show-markdown-template`
1801
+
1802
+ Returns one template in its portable form: a built-in, or a saved template
1803
+ exactly as stored (overrides only). Use it as the starting point for a new
1804
+ template.
1805
+
1806
+ | Parameter | Type | Required | Description |
1807
+ |-----------|------|----------|-------------|
1808
+ | `name` | string | Yes | A built-in or saved template name |
1809
+ | `expanded` | boolean | No | Also return `expanded`, with every rule filled in from its base |
1810
+
1811
+ **Returns:** `name`, `source` (`builtin` or `saved`), `template`, and
1812
+ optionally `expanded`.
1813
+
1814
+ ---
1815
+
1816
+ #### `validate-markdown-template`
1817
+
1818
+ Checks a template without saving it. Pass exactly one of `name`, `template`
1819
+ or `templateFile`.
1820
+
1821
+ | Parameter | Type | Required | Description |
1822
+ |-----------|------|----------|-------------|
1823
+ | `name` | string | One of three | A saved or built-in template |
1824
+ | `template` | object or string | One of three | The template as a JSON object or JSON text |
1825
+ | `templateFile` | string | One of three | Absolute path of a JSON template file (home, a temp directory, or `/Volumes`; at most 256 KiB) |
1826
+
1827
+ **Returns:** `valid`, and `errors` as `{path, message}` pairs such as
1828
+ `$.rules["inline.bold"].after: is required when mode is "wrap"`. An invalid
1829
+ template is a normal result, not a tool error.
1830
+
1831
+ ---
1832
+
1833
+ #### `save-markdown-template`
1834
+
1835
+ Validates a template and stores it in the library so `export-notes-markdown`
1836
+ can use it by `template` name.
1837
+
1838
+ | Parameter | Type | Required | Description |
1839
+ |-----------|------|----------|-------------|
1840
+ | `name` | string | Yes | Lowercase `a-z`, `0-9`, `-` and `_`, 1-64 characters, starting with a letter or digit. Built-in names are reserved |
1841
+ | `template` | object or string | One of `template`/`templateFile` | The template |
1842
+ | `templateFile` | string | One of `template`/`templateFile` | A JSON template file |
1843
+ | `force` | boolean | No | Replace an existing template of this name (default `false`) |
1844
+
1845
+ Saving is create-only: an existing name is refused with `[template-exists]`
1846
+ unless `force` is true. An invalid template is refused with
1847
+ `[invalid-template]` and one JSON path per problem. The file is written to a
1848
+ temporary name and then moved into place, with mode `0600` in a `0700`
1849
+ directory. The library is `~/Library/Application Support/apple-notes-mcp/templates`,
1850
+ or `APPLE_NOTES_MCP_TEMPLATE_DIR`. A symlinked library or template file is
1851
+ refused.
1852
+
1853
+ **Returns:** `name`, `path`, `bytes`, and `replaced`.
1854
+
1855
+ ---
1856
+
1857
+ #### `delete-markdown-template`
1858
+
1859
+ Removes one saved template file from the library. Built-in templates cannot
1860
+ be deleted.
1861
+
1862
+ | Parameter | Type | Required | Description |
1863
+ |-----------|------|----------|-------------|
1864
+ | `name` | string | Yes | The saved template to delete |
1865
+
1866
+ **Returns:** `name`, `path`, and `deleted: true`.
1867
+
1868
+ ---
1869
+
1773
1870
  #### `get-checklist-state`
1774
1871
 
1775
1872
  Reads checklist done/undone state for a note. This bypasses the AppleScript limitation where `body of note` strips checklist state, by reading directly from the NoteStore SQLite database.
@@ -2493,6 +2590,7 @@ All configuration is optional — the server works out of the box. Override beha
2493
2590
  | `APPLE_NOTES_MCP_MAX_INLINE_IMAGE_BYTES` | `262144` (256 KB) | Per-image cap on the base64 payload kept inline in a [`get-note-content`](#get-note-content) response. Inline images over the cap are replaced with placeholders (with a warning appended) so an image-heavy note cannot exceed the MCP client's message limit and drop the connection; export the real files with [`save-attachment`](#save-attachment) or [`fetch-attachment`](#fetch-attachment). Raise it to keep bigger images inline. |
2494
2591
  | `APPLE_NOTES_MCP_CONFIG_FILE` | `~/Library/Application Support/apple-notes-mcp/config.json` | Path to the JSON config file (see below). |
2495
2592
  | `APPLE_NOTES_MCP_TIMEOUT_MS` | `30000` (30 s) | Total AppleScript operation timeout, including retry attempts and delays. Raise it if full-library operations (large searches, exports) time out on a big Notes library. Per-call `timeoutMs` options still win, and a write tool's `timeoutSeconds` argument overrides it for that call. |
2593
+ | `APPLE_NOTES_MCP_TEMPLATE_DIR` | `~/Library/Application Support/apple-notes-mcp/templates` | Absolute directory of the saved Markdown template library (`save-markdown-template` and friends). |
2496
2594
  | `APPLE_NOTES_MCP_EXPORT_MAX_BYTES` | `8388608` (8 MB) | Largest response `export-notes-json` sends; a page closes early to stay under it. `export-notes-markdown` returns inline Markdown up to half of it. The default sits below the 10 MB per-message limit of MCP SDK stdio clients, which drop the connection on anything larger. Raise it only if your MCP client accepts bigger messages. |
2497
2595
  | `APPLE_NOTES_MCP_BLOCKS_MAX_BYTES` | `4194304` (4 MB) | Largest block payload one [`get-note-blocks`](#get-note-blocks) page returns; the page closes early to stay under it, and a single oversized paragraph comes back with `textOmitted: true`. [`get-note-structure`](#get-note-structure) also omits note text larger than this. A [`list-note-paragraphs`](#list-note-paragraphs) or [`list-note-links`](#list-note-links) page also stops early to stay under it. |
2498
2596
  | `APPLE_NOTES_MCP_MAX_RETRIES` | `2` | Maximum attempts for a read-only AppleScript call that fails with a **transient** error (Notes.app busy / not responding / lost connection). `2` means one retry; set `1` to fail fast with no retries. Retries share the single `APPLE_NOTES_MCP_TIMEOUT_MS` budget rather than each getting a fresh one, and a retry is skipped when under a second of that budget remains — so this is a ceiling, not a guarantee. In particular a call that exhausts the budget with a **timeout** has no time left to retry by construction. Mutating operations run once because a timeout can occur after Notes.app applied the change. Non-transient errors (e.g. "note not found") never retry. |