standardnotes-mcp 3.0.1 → 3.1.0

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/CHANGELOG.md CHANGED
@@ -4,6 +4,43 @@ All notable changes to this project are documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [3.1.0] - 2026-12-06
8
+
9
+ ### Changed
10
+ - Faster syncs on large vaults: after the first sync, each sync decrypts only the notes, tags and Smart Views that changed since the last one (plus any that failed before), instead of the whole vault. A change to an items key still decrypts everything.
11
+ - `standardnotes-mcp-login` now walks a new install through everything: after logging in it asks which AI clients to connect, then writes their config or shows the settings to paste. `--no-setup` (or a non-interactive run) logs in only.
12
+ - Setup prints Lumo's settings field by field in the order of Lumo's Add MCP server form, each value flush left on its own line so it copies cleanly, instead of a JSON snippet.
13
+ - Setup's closing tip points to the `server_status` tool (works in clients without resource support, such as Lumo).
14
+ - Much less of the AI's context window used. The tool list the AI receives with every message is about 37% smaller (about 8,700 → 5,500 tokens): tighter tool and field descriptions that keep example phrases, the order of steps and "use X instead" pointers, a short working guide in the startup instructions, and no repeated uuid regex, `$schema` or default `execution` fields in the schemas (inputs are still validated in full). Tool results are compact JSON, and note flags (trashed, archived, pinned, locked, protected) appear only when true.
15
+ - Smaller default results: `notes_list` and `smartviews_notes` return 25 notes (was 50), `notes_search` returns 3 snippets per note (was 10), and note previews are 120 characters (was 200). The AI can still ask for more (`limit` up to 200, `maxMatchesPerHit` up to 50). On a real vault a default list is about 57% smaller and a default search about 64% smaller.
16
+ - Free accounts are no longer reminded of paid plans. The plain-text fallback is explained once per session instead of on every note, link results drop the paid-feature note, refusals say a feature "isn't available on this account's plan" without naming plans, and the AI is told not to suggest upgrading unless asked.
17
+ - Setup no longer asks for each app's name: it keeps the name already in the app's config or uses the app's default, and explains names once in the summary. Only "Other" asks.
18
+ - Pressing Enter at setup's app list now connects the apps found on this computer instead of skipping; type 0 to skip.
19
+
20
+ ### Fixed
21
+ - The printed Claude Code command put `--env` after the server path, where it could be passed to the server instead of to `claude`, and had no scope, so the server was added only for the current folder. It now uses `claude mcp add --scope user --env ... standardnotes-mcp -- <node> <server>`.
22
+ - `SN_EMAIL` no longer has to match the capitals used at login: the stored session is found whatever the case (`Me@example.com` and `me@example.com` are the same account), and logging in again with different capitals updates the existing session instead of adding a second one. The email sent to Standard Notes is unchanged, so existing logins keep working.
23
+ - Re-running setup no longer drops settings added by hand to a client's config (such as `SN_DENY_TAGS` or `SN_READ_ONLY`); only the email, client name and tag scope are replaced.
24
+ - Frontmatter edits no longer bring back the heading bug. Standard Notes doesn't read frontmatter, so a line directly above the closing `---` displays as a heading; a blank line before the fence prevents that. `notes_frontmatter` now adds new keys above that blank line instead of below it, keeps it when deleting a key, and includes it when creating a new frontmatter block.
25
+ - Appending table rows (`notes_append`, with or without `section`) no longer inserts a blank line that splits the table in two.
26
+ - Templates work with a tag scope. The Templates tag may sit outside `SN_READ_TAGS` (on a free plan it can't be nested under the scope tag); templates tagged with both it and an in-scope tag are offered. Templates outside the scope stay hidden, denied tags never match, and the out-of-scope tag is still not listed or copied onto new notes.
27
+ - Deletes are confirmed by default, in every AI app. `notes_delete`, `notes_delete_many` and trashing through `notes_update` / `notes_update_many` (`trashed=true`) ask the user first: in the app's confirmation prompt when it has one, otherwise the call deletes nothing and returns a question and a one-time `confirmToken`, and the AI repeats the call with the token only after the user says yes. Set with `SN_DELETE_CONFIRM` (`auto` default, `prompt`, `off`); the older `SN_DELETE_ELICITATION=true` means `prompt`, which refuses deletes (`confirmation_unavailable`) when the app can't show a prompt.
28
+ - `notes_update` can no longer wipe a note's tags by accident. New `addTags` / `removeTags` change only those tags (also in `notes_update_many`); `tags` still replaces all of them but now needs `replaceTags=true`.
29
+ - Replacing a note's tags no longer removes tags outside the AI's tag scope, which it can't see.
30
+ - Editing a note no longer switches it to a different editor. Every save used to rewrite the note's editor from its type, so notes in a custom plugin, Markdown Visual or the checklist editor went back to the default editor (or none) after any AI edit. A note now keeps its editor unless its type is changed on purpose.
31
+
32
+ ### Added
33
+ - `SN_NEW_NOTE_EDITOR`: the editor new notes open in when the AI doesn't ask for a type, such as a custom plugin (`com.vtttech.frontmatter-editor`). Paid accounts only, since free accounts can't install custom plugins; free accounts keep plain text.
34
+ - `SN_SHARED_TEMPLATES=true` (opt-in, per client): use every note with the templates tag even when it sits outside the client's `SN_READ_TAGS` scope, so AIs with different scopes can share one set of templates on a free plan without retagging each template into each scope. Shared templates are read-only and reachable only through `templates_list` and `notes_create_from_template`; denied tags and `ai: no-access` still hide them. `server_status` reports the setting.
35
+ - `notes_create_from_template` tags the new note with the client's scope tag when the template brings no usable tag, and asks for one (`tag_required`) when the scope has several.
36
+ - Setup finds Claude Desktop, Claude Code and Cursor on this computer, marks them in the app list, and connects them when you press Enter (type 0 to skip).
37
+ - Setup can add the server to Claude Code itself (`claude mcp add --scope user`, so it works in every project), replacing an existing entry; it falls back to printing the command.
38
+ - Setup asks which tags each AI client may see, checks the names against your vault (listing your tags, matching case-insensitively), and writes them as `SN_READ_TAGS`. Enter means the whole vault; when re-running for a client that already has tags set, Enter keeps them and `all` removes the limit.
39
+ - `server_status` / `sn://status` report which `SN_READ_TAGS` and `SN_DENY_TAGS` entries matched a tag, with warnings for any that didn't, and those warnings are included in the instructions the AI receives at startup (#18).
40
+
41
+ ### Removed
42
+ - `daily_list` and `daily_append`. Use `periodic_list` and `periodic_append`, which default to the daily journal when no period is given.
43
+
7
44
  ## [3.0.1] - 2026-12-05
8
45
 
9
46
  Fixes for installing from npm.
package/README.md CHANGED
@@ -1,8 +1,10 @@
1
1
  # standardnotes-mcp
2
2
 
3
- A private [MCP](https://modelcontextprotocol.io) server that gives AI assistants (Lumo, Claude, Kimi, or any MCP client) end-to-end-encrypted access to your [Standard Notes](https://standardnotes.com) vault — with per-client folder scopes and per-note rules enforced in the server, not by asking the AI nicely.
3
+ [![npm](https://img.shields.io/npm/v/standardnotes-mcp)](https://www.npmjs.com/package/standardnotes-mcp) [![standardnotes-mcp MCP server](https://glama.ai/mcp/servers/vtttech/standardnotes-mcp/badges/score.svg)](https://glama.ai/mcp/servers/vtttech/standardnotes-mcp)
4
4
 
5
- **Built for free Standard Notes accounts.** Standard Notes includes end-to-end encryption on its free plan, so you get a private, AI-connected notes vault — with links, backlinks, ranked search, templates and weekly notes — without paying for a subscription. Paid Standard Notes features work when your account has them; this server never uses the API to unlock a paid feature for a free account.
5
+ A private [MCP](https://modelcontextprotocol.io) server that gives AI assistants (Lumo, Claude, Kimi, or any MCP client) end-to-end-encrypted access to your [Standard Notes](https://standardnotes.com) vault — with per-client tag scopes and per-note rules enforced in the server, not by asking the AI nicely.
6
+
7
+ **Built for free Standard Notes accounts.** Standard Notes includes end-to-end encryption on its free plan, so you get a private, AI-connected notes vault — with links, backlinks, ranked search, templates and weekly notes — without paying for a subscription. Paid Standard Notes features work when your account has them.
6
8
 
7
9
  ## At a glance
8
10
 
@@ -13,24 +15,24 @@ A private [MCP](https://modelcontextprotocol.io) server that gives AI assistants
13
15
  | Relevance-ranked, typo-tolerant search | Yes | Yes |
14
16
  | `[[Wikilinks]]`, backlinks, frontmatter queries | Yes | Yes |
15
17
  | Templates, daily / weekly / monthly notes | Yes | Yes |
16
- | Folder scopes and per-note AI rules | Yes | Yes |
18
+ | Tag scopes and per-note AI rules | Yes | Yes |
17
19
  | Tasks, export | Yes | Yes |
18
20
  | Native Standard Notes note links | Read only | Read and create |
19
21
  | Smart Views | Only views your account already has | Yes |
20
22
  | Note history | Recent revisions only | Longer history, by plan |
21
- | Nested folders, Super notes | No — paid SN features ([details](#free-vs-paid-in-detail)) | Yes |
23
+ | Nested tags, Super notes | No — paid SN features ([details](#free-vs-paid-in-detail)) | Yes |
22
24
  | Attachments | Not supported yet ([Roadmap](#roadmap)) | Not supported yet |
23
25
 
24
26
  ## Why
25
27
 
26
28
  - **No credentials in your AI client's settings.** A one-time login stores the session in the OS keychain (Windows Credential Manager, macOS Keychain, Linux Secret Service). Client configs hold only your email and a name — nothing secret.
27
29
  - **E2EE intact.** Your password is used once at login and discarded; the derived encryption key is stored only in your OS keychain. Standard Notes' servers see ciphertext only, same as the official apps.
28
- - **Per-AI control.** Confine each AI client to specific folders, mark notes read-only or invisible per client, and know that every rule is enforced server-side — a misbehaving or prompt-injected model cannot reach what the server refuses to serve.
30
+ - **Per-AI control.** Confine each AI client to specific tags, mark notes read-only or invisible per client, and know that every rule is enforced server-side — a misbehaving or prompt-injected model cannot reach what the server refuses to serve.
29
31
  - **Local only.** stdio transport, no network port opened, no model or index on disk. Search, links and templates all run in memory on this machine.
30
32
 
31
33
  ## Requirements
32
34
 
33
- - Node.js >= 20
35
+ - [Node.js](https://nodejs.org/en/download) 20 or newer (the LTS download is fine). Check with `node --version` in a terminal.
34
36
  - Windows / macOS / Linux with a working OS keychain (Linux: see [Platform notes](#platform-notes-linux))
35
37
  - A Standard Notes account on protocol 004 (any account created or upgraded since 2020) — free or paid
36
38
 
@@ -38,15 +40,15 @@ A private [MCP](https://modelcontextprotocol.io) server that gives AI assistants
38
40
 
39
41
  ```bash
40
42
  npm install -g standardnotes-mcp
41
- standardnotes-mcp-setup
43
+ standardnotes-mcp-login
42
44
  ```
43
45
 
44
- `standardnotes-mcp-setup` is the whole onboarding: if no session exists it runs the login flow first (email, password, 2FA — the password is used once for key derivation and discarded), then walks you through connecting your AI clients. Re-run it any time to add or reconfigure a client.
46
+ `standardnotes-mcp-login` walks you through everything: it logs you in (email, password, 2FA — the password is used once for key derivation and discarded), shows which AI apps it found on this computer (press Enter to connect those, or pick others), asks which tags each may see (Enter for the whole vault), then sets each one up: it writes the config for Claude Desktop and Cursor, adds the server to Claude Code with the `claude` CLI, and shows the exact settings to paste for the rest (field by field for Lumo). Type 0 at the app list to skip that part.
45
47
 
46
48
  | Command | What it does |
47
49
  |---|---|
48
- | `standardnotes-mcp-setup` | Connect AI clients (runs login first if needed) |
49
- | `standardnotes-mcp-login` | Authenticate and store the session in the OS keychain (re-login, or add another account) |
50
+ | `standardnotes-mcp-login` | Log in, then connect AI clients. `--no-setup` logs in only (re-login, or add another account) |
51
+ | `standardnotes-mcp-setup` | Connect or reconfigure AI clients later (logs in first if no session exists) |
50
52
  | `standardnotes-mcp-logout <email>` | Wipe the keychain session — revokes MCP access without touching your SN password |
51
53
  | `standardnotes-mcp-install [desktop] [code]` | Non-interactive: add the server to Claude Desktop and/or print the Claude Code command |
52
54
  | `standardnotes-mcp` | The MCP server itself; AI clients start it, you don't need to |
@@ -69,7 +71,11 @@ In a source checkout the commands are `npm run setup`, `npm run login` and `npm
69
71
 
70
72
  ## Connecting AI clients
71
73
 
72
- `standardnotes-mcp-setup` offers Claude Desktop, Claude Code, ChatGPT, Kimi Code, Lumo, Cursor, or any custom client. For file-based clients (Claude Desktop, Cursor) it writes the config directly, with a timestamped backup; for the rest it prints a ready-to-paste snippet with the exact paths for your machine.
74
+ The app step (in `standardnotes-mcp-login`, or later `standardnotes-mcp-setup`) offers Claude Desktop, Claude Code, ChatGPT, Kimi Code, Lumo, Cursor, or any custom client. Claude Desktop, Claude Code and Cursor are marked when they're found on this computer, and pressing Enter connects those. For Claude Desktop and Cursor it writes the config directly, with a timestamped backup. For Claude Code it offers to run `claude mcp add --scope user ...` for you (the server is then available in every project), and prints the command instead if you decline or it fails. For the rest it prints ready-to-paste settings with the exact paths for your machine.
75
+
76
+ Each app gets a name (`SN_CLIENT_NAME`) that per-note rules such as `ai-lumo: no-access` match. Setup doesn't ask: it keeps the name already in the app's config, or uses the app's default (`claude`, `lumo`, `cursor`, ...); only "Other" asks for one. To change it, edit `SN_CLIENT_NAME` in the app's MCP settings.
77
+
78
+ For each client it asks which tags it may see, checks the names against your vault, and writes them as `SN_READ_TAGS` (see [scopes](#limiting-an-ai-to-tags-scopes)). Press Enter for the whole vault. When re-running setup for a client that already has tags set, Enter keeps them and `all` removes the limit. Settings you added by hand, such as `SN_DENY_TAGS` or `SN_READ_ONLY`, are kept.
73
79
 
74
80
  To configure a client by hand, with the package installed globally:
75
81
 
@@ -81,16 +87,16 @@ To configure a client by hand, with the package installed globally:
81
87
  "env": {
82
88
  "SN_EMAIL": "you@example.com",
83
89
  "SN_CLIENT_NAME": "claude",
84
- "SN_READ_TAGS": "some-folder"
90
+ "SN_READ_TAGS": "some-tag"
85
91
  }
86
92
  }
87
93
  }
88
94
  }
89
95
  ```
90
96
 
91
- - `SN_EMAIL` — which account (must match login exactly).
97
+ - `SN_EMAIL` — which account (the email you logged in with; capitals don't matter).
92
98
  - `SN_CLIENT_NAME` — the client's **governance identity**; per-note rules like `ai-claude: ...` match against it. Set it explicitly so it comes from a config *you* wrote.
93
- - `SN_READ_TAGS` — optional **folder scope** (see [scopes](#limiting-an-ai-to-folders-scopes)). Omit for full-vault access.
99
+ - `SN_READ_TAGS` — optional **tag scope** (see [scopes](#limiting-an-ai-to-tags-scopes)). Omit for full-vault access.
94
100
 
95
101
  **Windows:** many clients can't start npm's `.cmd` command wrappers. If `"command": "standardnotes-mcp"` doesn't start, use `"command": "node"` with `"args": ["<path>\\standardnotes-mcp\\dist\\index.js"]`, where `<path>` is the output of `npm root -g` (for a source checkout, the path to its `dist\index.js`). `standardnotes-mcp-setup` writes this form for you.
96
102
 
@@ -98,7 +104,7 @@ Restart the client fully after changing its config.
98
104
 
99
105
  ### Connecting Lumo (Custom MCP settings)
100
106
 
101
- Install the package and run `standardnotes-mcp-login` (or `standardnotes-mcp-setup`) first. Then in Lumo's MCP settings choose **Add MCP server**:
107
+ Run `standardnotes-mcp-login` and pick Lumo: it prints these fields with the exact values for your machine. To fill them in by hand, choose **Add MCP server** in Lumo's MCP settings:
102
108
 
103
109
  | Lumo field | Value |
104
110
  |---|---|
@@ -115,7 +121,7 @@ Click **Add server**, then ask Lumo "how many notes are in my vault?" — the an
115
121
 
116
122
  ## Free vs paid in detail
117
123
 
118
- Standard Notes reserves some features for its paid plans. Most of those are enforced only inside the official apps, not by Standard Notes' sync server — so a third-party tool *could* create them for a free account. This server deliberately doesn't. It reads your plan from the account roles Standard Notes reports (there is no setting to override it), and when a request needs a paid feature it either falls back cleanly or refuses with reason `paid_feature` and a free alternative. Reading anything already in your account always works.
124
+ Standard Notes reserves some features for its paid plans. This server reads your plan from the account roles Standard Notes reports (there is no setting to override it), and when a request needs a paid feature it either falls back cleanly or refuses with reason `paid_feature` and a free alternative. Reading anything already in your account always works.
119
125
 
120
126
  | Standard Notes feature | Free | Paid | What this server does on a free account |
121
127
  |---|---|---|---|
@@ -123,7 +129,7 @@ Standard Notes reserves some features for its paid plans. Most of those are enfo
123
129
  | Markdown and other editors | No | Yes | Saved as plain text, with a notice. The text is unchanged, so markdown syntax still reads fine. Existing notes keep their type. |
124
130
  | Super notes (rich text) | No (read-only in the app) | Yes | Readable. Creating them or editing their content is refused. |
125
131
  | Tags | Yes | Yes | Full support |
126
- | Nested folders | No | Yes | Existing ones work. Creating or moving a folder under another is refused; top-level folders are fine. |
132
+ | Nested tags | No | Yes | Existing ones work. Creating or moving a tag under another is refused; top-level tags are fine. |
127
133
  | Note-to-note links | No | Yes | `[[Wikilinks]]` in note text work on every plan. Native links made in the app are read; new ones are created only on paid plans. |
128
134
  | Smart Views | No | Yes | Views from a past subscription can be read and run. `notes_query` offers the same kind of filtering on demand. |
129
135
  | Note history | Recent revisions only | Longer, by plan | Only revisions your plan may view are listed or opened — the same window the app shows. |
@@ -150,19 +156,38 @@ Ranking uses only the notes the AI may see, so scores never reveal anything abou
150
156
 
151
157
  ## Templates
152
158
 
153
- *Every plan.* Put template notes in a top-level **Templates** folder (or name another with `SN_TEMPLATES_TAG`). `notes_create_from_template` copies one into a new note and fills placeholders:
159
+ *Every plan.* Tag template notes with **Templates** (or choose another tag with `SN_TEMPLATES_TAG`). `notes_create_from_template` copies one into a new note and fills placeholders:
154
160
 
155
161
  `{{date}}` `{{time}}` `{{datetime}}` `{{title}}` `{{week}}` `{{month}}` `{{year}}`, plus any `{{name}}` you pass in `vars`.
156
162
 
157
- The new note is filed in the template's own folders (except Templates). Placeholders without a value are left in place and listed back. Substitution is plain text — templates never run code.
163
+ The new note is tagged with the template's own tags that the client can see (never Templates). If there are none and the client is limited to one tag, it gets that tag; if it's limited to several, the AI is asked to pick one. Placeholders without a value are left in place and listed back. Substitution is plain text — templates never run code.
164
+
165
+ ### Templates with tag scopes
166
+
167
+ On a free plan, tags can't be nested, so a Templates tag usually sits outside an AI's tag scope. There are two ways to make templates available:
168
+
169
+ | | How | Best for |
170
+ |---|---|---|
171
+ | **Also give each template the AI's tag** (default) | Tag the template with Templates *and* the AI's tag, e.g. Templates + WSD. | One scoped AI, or templates only one AI should use. |
172
+ | **Shared templates** | Add `SN_SHARED_TEMPLATES=true` to that AI's config. It can use every template in Templates, whatever its tag scope. | Several AIs with different scopes sharing one set of templates. |
173
+
174
+ Shared templates are deliberately narrow:
175
+
176
+ - Reachable **only** through `templates_list` and `notes_create_from_template`. They don't appear in search, lists, reads, links or stats.
177
+ - **Read-only.** No tool can edit, retag or delete them for that AI.
178
+ - Still hidden when the template has an `SN_DENY_TAGS` tag or carries `ai: no-access` (or `ai-<name>: no-access` for that AI).
179
+ - The template's other tags are never shown or copied onto the new note, which is tagged inside the AI's own scope.
180
+ - Off by default and set per AI, in that AI's config.
181
+
182
+ **Keep Templates to boilerplate.** With shared templates on, any note tagged Templates can be read by that AI, so don't put private notes there.
158
183
 
159
184
  ## Daily, weekly and monthly notes
160
185
 
161
- *Every plan.* `periodic_append` adds to the current period's note, creating it if needed: `Journal 2026-12-05`, `Week 2026-W49` (ISO weeks, Monday–Sunday) or `Month 2026-12`. `periodic_list` shows everything created in a day, week or month. `daily_append` / `daily_list` remain as shortcuts for the daily journal. Set `SN_PERIODIC_TAG` to file new periodic notes under a folder.
186
+ *Every plan.* `periodic_append` adds to the current period's note, creating it if needed: `Journal 2026-12-05`, `Week 2026-W49` (ISO weeks, Monday–Sunday) or `Month 2026-12`. `periodic_list` shows everything created in a day, week or month. Without a period, both use the daily journal. Set `SN_PERIODIC_TAG` to file new periodic notes under a tag.
162
187
 
163
- ## Limiting an AI to folders (scopes)
188
+ ## Limiting an AI to tags (scopes)
164
189
 
165
- *Every plan.* Standard Notes folders are tags, so scopes are tag-based. Set in the client's config, enforced in the server process:
190
+ *Every plan.* Scopes are tag-based. Set in the client's config, enforced in the server process:
166
191
 
167
192
  | Variable | Effect |
168
193
  |---|---|
@@ -170,8 +195,10 @@ The new note is filed in the template's own folders (except Templates). Placehol
170
195
  | `SN_DENY_TAGS=journal,private` | **Blocklist.** Everything is visible *except* these tag subtrees. Deny wins over allow. |
171
196
  | `SN_READ_ONLY=true` | Write tools are not registered at all — the AI only sees read tools. |
172
197
 
173
- - "Out of scope" looks exactly like "doesn't exist" — in lists, search, stats, links, templates and every other tool.
198
+ - "Out of scope" looks exactly like "doesn't exist" — in lists, search, stats, links, templates and every other tool. The one opt-in exception is [shared templates](#templates-with-tag-scopes).
174
199
  - Combine freely: `SN_READ_TAGS` for the working set, `SN_DENY_TAGS` for carve-outs, `SN_READ_ONLY` for read-only clients.
200
+ - Entries match tag names (case-insensitive) or uuids. **An entry that matches no tag is skipped**: a misspelled `SN_READ_TAGS` leaves the AI seeing nothing, and a misspelled `SN_DENY_TAGS` hides nothing. `server_status` lists which entries matched, with a warning for any that didn't, and the AI is told about it at startup.
201
+ - Nested tags are a paid Standard Notes feature (the app calls them folders). On a free plan, use top-level tags; a note can carry several tags, so tagging it with one in-scope tag is enough to make it visible.
175
202
 
176
203
  ## Per-note rules (frontmatter)
177
204
 
@@ -196,10 +223,22 @@ ai-kimi: ok # Kimi specifically: full access (per-client beats global)
196
223
 
197
224
  - **Write order matters**: to protect a note with `ai: no-access` + `ai-<name>: ok`, write the allow key FIRST, then the deny.
198
225
  - **Fail-safe pattern for sensitive notes**: `ai: no-access` + `ai-<name>: ok`. A name mismatch then keeps the note hidden instead of exposing it.
199
- - **Super notes can't carry frontmatter** — protect them with folder scopes.
226
+ - **Super notes can't carry frontmatter** — protect them with tag scopes.
200
227
  - Manage keys with the `notes_frontmatter` tool or by hand in the app. An AI can't remove governance keys from a note it isn't allowed to edit.
201
228
  - `SN_GOVERNANCE=off` disables enforcement entirely (not recommended).
202
229
 
230
+ ### Frontmatter MD Editor plugin
231
+
232
+ Standard Notes' own editors show frontmatter as raw text at the top of the note. [Frontmatter MD Editor](https://github.com/vtttech/standardnotes-frontmatter-editor) is a companion editor plugin. It shows markdown notes rendered, and folds the frontmatter into a one-line bar with the note's AI permissions as coloured badges. It reads frontmatter by the same rules as this server. Custom plugins need a paid Standard Notes plan; on a free account, frontmatter works the same, it just shows as text at the top of the note.
233
+
234
+ Install it in Standard Notes under **Preferences > Plugins > Install Custom Plugin** with:
235
+
236
+ ```
237
+ https://vtttech.github.io/standardnotes-frontmatter-editor/ext.json
238
+ ```
239
+
240
+ This server keeps a note in that editor when the AI edits it. To have new notes open in it too, set `SN_NEW_NOTE_EDITOR=com.vtttech.frontmatter-editor`.
241
+
203
242
  ## The security model — what each layer stops
204
243
 
205
244
  1. **The AI model** — fully bound. Refused content never enters its context; no prompt, injection, or persuasion changes what the server serves.
@@ -209,11 +248,11 @@ ai-kimi: ok # Kimi specifically: full access (per-client beats global)
209
248
  **Things to know:**
210
249
 
211
250
  - **Client identity is not verified.** Per-client rules (`ai-claude: ...`) trust `SN_CLIENT_NAME` from the client's config. Anything that can edit that config file can claim another client's name. If `SN_CLIENT_NAME` is unset, the client names itself in the MCP handshake, which any app can fake. Always set it, and treat AI client config files as sensitive.
212
- - **Deletes can be permanent.** An AI with write tools can permanently delete notes, and Standard Notes cannot recover them. For clients that don't need to delete, use `SN_READ_ONLY=true` or a narrow scope. `SN_DELETE_ELICITATION=true` asks you before each delete, but only if the AI app supports MCP confirmation prompts; apps that don't support them delete without asking.
251
+ - **Deletes can be permanent.** An AI with write tools can permanently delete notes, and Standard Notes cannot recover them. For clients that don't need to delete, use `SN_READ_ONLY=true` or a narrow scope. Every delete, including moving a note to the trash, asks you first: in the AI app's confirmation prompt if it has one, otherwise the AI has to ask you in chat and can only delete after you say yes (`SN_DELETE_CONFIRM`).
213
252
  - **Decrypted notes live in memory.** While running, the server holds decrypted notes in RAM, which the OS can write to swap or hibernation files. Full-disk encryption (BitLocker, FileVault, LUKS) covers this.
214
253
  - **Self-hosted servers need HTTPS.** The server does not refuse `http://` URLs. Use `https://` for anything other than `localhost`; see [docs/self-hosted.md](./docs/self-hosted.md).
215
254
 
216
- **What the AI provider sees.** End-to-end encryption ends at this server, by design: it decrypts notes locally so the AI can read them. Whatever the AI reads is sent to that AI's provider — Lumo keeps chats under Proton's zero-access encryption; other providers keep them under their own policies. Folder scopes and `ai: no-access` decide what the AI ever sees.
255
+ **What the AI provider sees.** End-to-end encryption ends at this server, by design: it decrypts notes locally so the AI can read them. Whatever the AI reads is sent to that AI's provider — Lumo keeps chats under Proton's zero-access encryption; other providers keep them under their own policies. Tag scopes and `ai: no-access` decide what the AI ever sees.
217
256
 
218
257
  Enforcement bounds what a tool call can **do** — it can't stop an agent from following bad instructions hidden in text it **reads** (prompt injection). Keep untrusted reading and sensitive sending (web, email, file tools) out of the same session.
219
258
 
@@ -225,8 +264,8 @@ All tools validate input. Mutating note tools return size deltas so an accidenta
225
264
 
226
265
  | Tool | What it does | Plan |
227
266
  |---|---|---|
228
- | `notes_list` | Browse notes, newest-updated first; filter by folder (`includeDescendants` for subfolders) | Free |
229
- | `notes_search` | Relevance-ranked, typo-tolerant full-text search, or regex; filters for folder, note type, date range, trashed; snippets and paging | Free |
267
+ | `notes_list` | Browse notes, newest-updated first; filter by tag (`includeDescendants` for child tags) | Free |
268
+ | `notes_search` | Relevance-ranked, typo-tolerant full-text search, or regex; filters for tag, note type, date range, trashed; snippets and paging | Free |
230
269
  | `notes_get` | Read one note: full content, an outline of its headings, or one heading's section | Free |
231
270
  | `notes_query` | Structured filters (and/or/not over title, text, flags, note type, tag count, and `frontmatter.<key>`), in Standard Notes' Smart View format | Free |
232
271
  | `notes_links` | Outgoing links, backlinks, unresolved and ambiguous `[[wikilinks]]` of a note | Free |
@@ -234,7 +273,7 @@ All tools validate input. Mutating note tools return size deltas so an accidenta
234
273
  | `notes_stats` | Vault statistics: counts, sizes, note types, cache age | Free |
235
274
  | `notes_tasks` | Find markdown checkbox tasks across the vault | Free |
236
275
  | `server_status` | Detected plan, limited features, active policy, sync health (same as `sn://status`, for clients without resource support) | Free |
237
- | `templates_list` | List the notes in the Templates folder | Free |
276
+ | `templates_list` | List the notes tagged Templates | Free |
238
277
 
239
278
  **Writing & editing**
240
279
 
@@ -242,7 +281,7 @@ All tools validate input. Mutating note tools return size deltas so an accidenta
242
281
  |---|---|---|
243
282
  | `notes_create` / `notes_create_many` | Create one note, or up to 50 at once | Limited — plain text on free; Super refused |
244
283
  | `notes_create_from_template` | Create a note from a template, filling placeholders | Limited — Super templates refused on free |
245
- | `notes_update` / `notes_update_many` | Change text, title, type, folders; archive, pin, trash or restore | Limited — Super content read-only on free |
284
+ | `notes_update` / `notes_update_many` | Change text, title, type; add or remove tags (`addTags` / `removeTags`, or replace them all with `tags` plus `replaceTags=true`); archive, pin, trash or restore | Limited — Super content read-only on free |
246
285
  | `notes_append` | Add text to a note or to one heading's section, at the end or start | Free |
247
286
  | `notes_replace_in` | Find and replace inside one note (literal or regex) | Free |
248
287
  | `notes_link` | Link a note to another: a `[[wikilink]]`, plus a native link on paid plans | Free (native link: Paid) |
@@ -250,16 +289,15 @@ All tools validate input. Mutating note tools return size deltas so an accidenta
250
289
  | `notes_frontmatter` | Get, set or remove frontmatter keys, leaving the rest untouched | Free (plain-text and markdown notes) |
251
290
  | `notes_task_toggle` | Check or uncheck a task | Free |
252
291
  | `periodic_append` | Append to the current day's, week's or month's note, creating it if needed | Free |
253
- | `daily_append` | Append to today's journal note (`Journal YYYY-MM-DD`) | Free |
254
292
 
255
- **Folders, history & periods**
293
+ **Tags, history & periods**
256
294
 
257
295
  | Tool | What it does | Plan |
258
296
  |---|---|---|
259
- | `tags_list` / `tags_get` | Folder structure with note counts | Free |
260
- | `tags_create` / `tags_update` / `tags_delete` | Create, rename, move or delete folders | Limited — top-level folders on free; nesting is paid |
297
+ | `tags_list` / `tags_get` | Tag structure with note counts | Free |
298
+ | `tags_create` / `tags_update` / `tags_delete` | Create, rename, move or delete tags | Limited — top-level tags on free; nesting is paid |
261
299
  | `tags_attach` / `tags_detach` | File or unfile a note | Free |
262
- | `periodic_list` / `daily_list` | Notes created in a given day, week or month | Free |
300
+ | `periodic_list` | Notes created in a given day, week or month | Free |
263
301
  | `notes_history` / `notes_revision_get` / `notes_revision_restore` | List, read or restore past versions kept by Standard Notes | Limited — recent revisions on free; longer history on paid |
264
302
  | `vault_export` | Export decrypted notes as markdown files (only when `SN_ALLOW_EXPORT=true`) | Free |
265
303
  | `sync` | Force a full re-sync | Free |
@@ -270,15 +308,17 @@ All tools validate input. Mutating note tools return size deltas so an accidenta
270
308
 
271
309
  | Variable | Default | Description |
272
310
  |---|---|---|
273
- | `SN_EMAIL` | required | Account email; must match login exactly |
311
+ | `SN_EMAIL` | required | Account email, as used at login (not case-sensitive) |
274
312
  | `SN_CLIENT_NAME` | handshake name | Identity for `ai-<name>` rules — set per client |
275
- | `SN_READ_TAGS` | unset | Allowlist of visible folder subtrees |
276
- | `SN_DENY_TAGS` | unset | Hidden folder subtrees; deny wins |
313
+ | `SN_READ_TAGS` | unset | Allowlist of visible tag subtrees |
314
+ | `SN_DENY_TAGS` | unset | Hidden tag subtrees; deny wins |
277
315
  | `SN_READ_ONLY` | `false` | `true` = write tools not registered |
278
316
  | `SN_GOVERNANCE` | `on` | Frontmatter `ai:` enforcement; `off` disables |
279
- | `SN_TEMPLATES_TAG` | `Templates` | Folder whose notes are templates |
280
- | `SN_PERIODIC_TAG` | unset | Folder new daily/weekly/monthly notes are filed under |
281
- | `SN_DELETE_ELICITATION` | `false` | `true` = deletions require interactive confirmation (apps without MCP confirmation prompts delete without asking) |
317
+ | `SN_TEMPLATES_TAG` | `Templates` | Tag whose notes are templates |
318
+ | `SN_SHARED_TEMPLATES` | `false` | `true` = this AI can use every note with that tag as a template, even outside `SN_READ_TAGS` (read-only, template tools only; see [Templates with tag scopes](#templates-with-tag-scopes)) |
319
+ | `SN_PERIODIC_TAG` | unset | Tag added to new daily/weekly/monthly notes |
320
+ | `SN_NEW_NOTE_EDITOR` | unset | Editor new notes open in when the AI doesn't ask for a type, e.g. `com.vtttech.frontmatter-editor` for a custom plugin. Paid accounts only, since Standard Notes doesn't let free accounts install custom plugins; free accounts keep plain text. The text stays plain markdown, so the note is still readable in other editors. Unset: Markdown on paid, plain text on free. |
321
+ | `SN_DELETE_CONFIRM` | `auto` | How deletes and trashing are confirmed. `auto`: the app's confirmation prompt, or the AI asks you in chat in apps without one (such as Lumo). `prompt`: only the app's prompt; apps without one can't delete. `off`: no confirmation. The older `SN_DELETE_ELICITATION=true` means `prompt`. |
282
322
  | `SN_ALLOW_EXPORT` | `false` | `true` registers `vault_export` (writes decrypted plaintext to disk) |
283
323
  | `SN_EXPORT_DIR` | unset | Confine exports to this directory |
284
324
  | `SN_SERVER_URL` | `https://api.standardnotes.com` | Sync server (self-hosted: see [docs/self-hosted.md](./docs/self-hosted.md)) |
@@ -295,12 +335,11 @@ Planned for the next release:
295
335
  |---|---|
296
336
  | Attachments: list names and types for everyone; open and read files on paid plans | List: Free / Open: Paid |
297
337
  | Optional semantic search with a local model or Ollama (`SN_SEMANTIC`) — never a cloud service | Free |
298
- | Faster syncs on large vaults (decrypt only what changed) | Free and paid |
299
338
  | Early warning when Standard Notes changes its API requirements | Free and paid |
300
339
 
301
340
  ## Auth lifecycle
302
341
 
303
- - **Login** (`standardnotes-mcp-setup` or `standardnotes-mcp-login`): email, password and 2FA, once per machine. Master key derived in RAM; session stored in the OS keychain.
342
+ - **Login** (`standardnotes-mcp-login`): email, password and 2FA, once per machine. Master key derived in RAM; session stored in the OS keychain.
304
343
  - **Every server start**: reads the keychain session — no password, no login round-trip.
305
344
  - **Token expiry**: refreshed automatically.
306
345
  - **`standardnotes-mcp-logout <email>`**: wipes the keychain session.
@@ -320,10 +359,18 @@ The keyring must be unlocked — a normal desktop login does this; headless/SSH
320
359
  From a [source checkout](#from-source):
321
360
 
322
361
  ```bash
323
- npm run typecheck && npm run lint && npm run build # full gate
362
+ npm run typecheck && npm run lint && npm test && npm run build # full gate
324
363
  npm run dev # tsx watch
325
364
  ```
326
365
 
366
+ **Windows:** run the tests from a path with an uppercase drive letter (`C:\...`). Started from a lowercase one (`c:\...`, which some terminals and editors use), Vitest loads its own modules twice and every test file fails before running with `Cannot read properties of undefined (reading 'config')`. In PowerShell, `Set-Location C:\path\to\standardnotes-mcp` before `npm test`.
367
+
368
+ ## Listings
369
+
370
+ - **npm:** [standardnotes-mcp](https://www.npmjs.com/package/standardnotes-mcp)
371
+ - **Glama:** [vtttech/standardnotes-mcp](https://glama.ai/mcp/servers/vtttech/standardnotes-mcp): browse the server's tools and check its quality score before installing.
372
+ - **MCP Registry:** `io.github.vtttech/standardnotes-mcp`
373
+
327
374
  ## Troubleshooting & security
328
375
 
329
376
  - [docs/troubleshooting.md](./docs/troubleshooting.md) — common errors and fixes
package/SECURITY.md CHANGED
@@ -27,7 +27,8 @@ What this server does to protect the vault, by design:
27
27
  **Blast-radius controls (all opt-in via env)**
28
28
  - `SN_READ_ONLY=true` — write tools are not registered at all; the MCP client never sees them.
29
29
  - `SN_READ_TAGS` / `SN_DENY_TAGS` — tag-subtree read scope; out-of-scope notes are indistinguishable from nonexistent ones (no existence probing).
30
- - `SN_DELETE_ELICITATION=true` — deletions require interactive user confirmation. MCP clients that don't support elicitation fall back to deleting without asking; use `SN_READ_ONLY` where deletion must be impossible.
30
+ - `SN_SHARED_TEMPLATES=true` — the one opt-in widening of `SN_READ_TAGS`: notes with the templates tag (`SN_TEMPLATES_TAG`) become readable to that client even outside its scope, but only through `templates_list` and `notes_create_from_template`. Every other read and every write still treats them as out of scope; `SN_DENY_TAGS`, `ai: no-access` and per-client `ai-<name>: no-access` still hide them; their out-of-scope tags are never revealed. Off by default. Anything filed in the templates tag is readable by clients that enable it.
31
+ - Delete confirmation (on by default, `SN_DELETE_CONFIRM`) — every delete and trash needs the user's OK. Apps with MCP confirmation prompts show one. In apps without them, the first call deletes nothing and returns a one-time token; the AI must ask the user in chat and repeat the call with the token. A token covers exactly those notes and that trash/permanent choice, works once and expires after 10 minutes. This relies on the AI asking honestly: it stops accidental deletes, not an AI determined to delete. `SN_DELETE_CONFIRM=prompt` (or `SN_DELETE_ELICITATION=true`) accepts only the app's prompt and refuses deletes without one. Use `SN_READ_ONLY` where deletion must be impossible.
31
32
  - `SN_ALLOW_EXPORT` — `vault_export` writes **decrypted plaintext to disk** and is therefore unregistered unless explicitly enabled; `SN_EXPORT_DIR` confines destinations.
32
33
  - Frontmatter AI governance (`ai: read-only` / `ai: no-access`, plus per-client keys like `ai-claude: no-access`) is enforced in the client, not in prompts — refused content never enters the model's context. Client identity comes from operator-set `SN_CLIENT_NAME` (trusted) or the MCP handshake name (self-reported); a malicious client app is out of scope — that boundary requires separate SN credentials.
33
34
 
@@ -0,0 +1,124 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import { existsSync } from "node:fs";
3
+ import { dirname, join } from "node:path";
4
+ import { homedir } from "node:os";
5
+ /**
6
+ * Apps that look installed. Claude Desktop and Cursor create their config
7
+ * folder on first run; Claude Code is detected by its `claude` command.
8
+ * Lumo, ChatGPT and others store their MCP settings somewhere this tool
9
+ * doesn't write to, so they're never detected (the user picks them).
10
+ */
11
+ export function detectInstalled(p) {
12
+ const found = new Set();
13
+ const desktop = p.desktopConfigPath();
14
+ if (desktop !== null && p.exists(dirname(desktop)))
15
+ found.add("claude-desktop");
16
+ if (p.hasCommand("claude"))
17
+ found.add("claude-code");
18
+ if (p.exists(join(homedir(), ".cursor")))
19
+ found.add("cursor");
20
+ return found;
21
+ }
22
+ export function commandOnPath(name) {
23
+ const finder = process.platform === "win32" ? "where" : "which";
24
+ try {
25
+ return spawnSync(finder, [name], { stdio: "ignore" }).status === 0;
26
+ }
27
+ catch {
28
+ return false;
29
+ }
30
+ }
31
+ export const realProbes = (desktopConfigPath) => ({
32
+ exists: existsSync,
33
+ hasCommand: commandOnPath,
34
+ desktopConfigPath: () => {
35
+ try {
36
+ return desktopConfigPath();
37
+ }
38
+ catch {
39
+ return null;
40
+ }
41
+ },
42
+ });
43
+ /**
44
+ * Lumo's Add MCP server form, field by field: each label on its own line and
45
+ * each value flush left beneath it, so copying a value never picks up an
46
+ * indent. Fields appear in the form's order.
47
+ */
48
+ export function lumoFormText(entry) {
49
+ const field = (label, value) => `${label}\n${value}\n\n`;
50
+ return ("In Lumo, open MCP settings and choose Add MCP server. Fill in each field\n" +
51
+ "with the value under its name (copy the whole line):\n\n" +
52
+ field("ID", "standardnotes-mcp") +
53
+ field("Display name", "Standard Notes") +
54
+ field("Description (optional)", "Search, read and edit notes in my Standard Notes vault.") +
55
+ field("Transport", "Local (command)") +
56
+ field("Command", entry.command) +
57
+ field("Args (one per line)", entry.args.join("\n")) +
58
+ field("Environment (one per line)", Object.entries(entry.env)
59
+ .map(([k, v]) => `${k}=${v}`)
60
+ .join("\n")) +
61
+ "Secret environment\n(leave empty: your session is in the OS keychain)\n\n" +
62
+ 'Click Add server, then ask Lumo "how many notes are in my vault?" to check it works.\n');
63
+ }
64
+ /**
65
+ * What the user typed at the app list → 0-based indexes. Enter accepts the
66
+ * apps found on this computer (none found: skip); "0" or "none" skips.
67
+ */
68
+ export function parseSelection(raw, count, detected) {
69
+ const t = raw.trim().toLowerCase();
70
+ if (t === "")
71
+ return { kind: "picked", indexes: [...detected] };
72
+ if (t === "0" || t === "none")
73
+ return { kind: "picked", indexes: [] };
74
+ const parts = t.split(",").map((s) => s.trim()).filter((s) => s !== "");
75
+ const indexes = [];
76
+ for (const part of parts) {
77
+ const n = Number(part);
78
+ if (!Number.isInteger(n) || n < 1 || n > count) {
79
+ return { kind: "error", message: `Pick numbers from 1 to ${count}.` };
80
+ }
81
+ if (!indexes.includes(n - 1))
82
+ indexes.push(n - 1);
83
+ }
84
+ return { kind: "picked", indexes };
85
+ }
86
+ /**
87
+ * Arguments for `claude mcp add`, in the documented order: options, then the
88
+ * server name, then `--` and the command to run. `--scope user` makes the
89
+ * server available in every project, not just the current folder.
90
+ */
91
+ export function claudeCodeAddArgs(paths, env) {
92
+ const envArgs = Object.entries(env).flatMap(([k, v]) => ["--env", `${k}=${v}`]);
93
+ return [
94
+ "mcp",
95
+ "add",
96
+ "--scope",
97
+ "user",
98
+ ...envArgs,
99
+ "standardnotes-mcp",
100
+ "--",
101
+ paths.node,
102
+ paths.server,
103
+ ];
104
+ }
105
+ /** Quote one argument for display, or for cmd.exe on Windows. */
106
+ export function shellQuote(arg) {
107
+ return /^[A-Za-z0-9_\-.,/:=@]+$/.test(arg) ? arg : `"${arg.replace(/"/g, '\\"')}"`;
108
+ }
109
+ /**
110
+ * Runs `claude` with these arguments. On Windows the CLI is usually a .cmd
111
+ * shim, which only starts through the shell, so arguments are quoted.
112
+ */
113
+ export function runClaude(args) {
114
+ const win = process.platform === "win32";
115
+ const res = win
116
+ ? spawnSync(["claude", ...args.map(shellQuote)].join(" "), {
117
+ shell: true,
118
+ encoding: "utf8",
119
+ })
120
+ : spawnSync("claude", args, { encoding: "utf8" });
121
+ const output = `${res.stdout ?? ""}${res.stderr ?? ""}`.trim();
122
+ return { ok: res.status === 0, output };
123
+ }
124
+ //# sourceMappingURL=clients.js.map
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Folder-scope answers in setup: turning what the user typed into the
3
+ * SN_READ_TAGS value written to an AI client's config. Kept free of I/O so
4
+ * it can be tested on its own.
5
+ */
6
+ /**
7
+ * @param input what the user typed
8
+ * @param known folder titles in the vault, or null when they couldn't
9
+ * be read (then names are accepted as typed)
10
+ * @param hasCurrent whether the client already has a folder scope, which
11
+ * makes Enter mean "keep it" instead of "whole vault"
12
+ */
13
+ export function parseFolderAnswer(input, known, hasCurrent) {
14
+ const trimmed = input.trim();
15
+ if (trimmed === "")
16
+ return hasCurrent ? { kind: "keep" } : { kind: "all" };
17
+ if (trimmed.toLowerCase() === "all")
18
+ return { kind: "all" };
19
+ const names = trimmed
20
+ .split(",")
21
+ .map((s) => s.trim())
22
+ .filter((s) => s !== "");
23
+ if (names.length === 0)
24
+ return hasCurrent ? { kind: "keep" } : { kind: "all" };
25
+ if (known === null)
26
+ return { kind: "folders", folders: dedupe(names) };
27
+ const unknown = [];
28
+ const folders = [];
29
+ for (const name of names) {
30
+ // Same rule the server uses: case-insensitive title match.
31
+ const match = known.find((k) => k.toLowerCase() === name.toLowerCase());
32
+ if (match === undefined)
33
+ unknown.push(name);
34
+ else
35
+ folders.push(match);
36
+ }
37
+ if (unknown.length > 0)
38
+ return { kind: "unknown", names: unknown };
39
+ return { kind: "folders", folders: dedupe(folders) };
40
+ }
41
+ function dedupe(names) {
42
+ const seen = new Set();
43
+ return names.filter((n) => {
44
+ const k = n.toLowerCase();
45
+ if (seen.has(k))
46
+ return false;
47
+ seen.add(k);
48
+ return true;
49
+ });
50
+ }
51
+ /**
52
+ * Folder titles to show as a hint, sorted and de-duplicated; titles with a
53
+ * comma are left out because SN_READ_TAGS is comma-separated and can't
54
+ * hold them. Long lists are cut to `max` with a count of the rest.
55
+ */
56
+ export function folderHint(known, max = 40) {
57
+ const titles = [...new Set(known.filter((t) => t.trim() !== "" && !t.includes(",")))].sort((a, b) => a.localeCompare(b, undefined, { sensitivity: "base" }));
58
+ if (titles.length === 0)
59
+ return "(no tags yet)";
60
+ const shown = titles.slice(0, max).join(", ");
61
+ return titles.length > max ? `${shown} (+${titles.length - max} more)` : shown;
62
+ }
63
+ //# sourceMappingURL=folders.js.map