standardnotes-mcp 3.0.0 → 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 +55 -0
- package/README.md +118 -55
- package/SECURITY.md +2 -1
- package/dist/cli/clients.js +124 -0
- package/dist/cli/folders.js +63 -0
- package/dist/cli/install.js +60 -18
- package/dist/cli/isMain.js +21 -0
- package/dist/cli/login.js +15 -12
- package/dist/cli/logout.js +1 -1
- package/dist/cli/setup.js +168 -72
- package/dist/config.js +30 -2
- package/dist/confirmDelete.js +88 -0
- package/dist/server.js +79 -86
- package/dist/slimTools.js +78 -0
- package/dist/sn/client.js +189 -44
- package/dist/sn/entitlement.js +25 -6
- package/dist/sn/frontmatter.js +15 -4
- package/dist/sn/markdownSections.js +16 -1
- package/dist/sn/protocol004.js +11 -8
- package/dist/sn/scope.js +34 -0
- package/dist/sn/session.js +22 -4
- package/dist/tools/daily.js +7 -19
- package/dist/tools/history.js +1 -1
- package/dist/tools/links.js +2 -9
- package/dist/tools/notes.js +142 -42
- package/dist/tools/smartviews.js +5 -5
- package/dist/tools/tags.js +1 -1
- package/dist/tools/templates.js +42 -32
- package/dist/version.js +12 -0
- package/docs/self-hosted.md +7 -10
- package/docs/troubleshooting.md +97 -89
- package/package.json +6 -5
- package/dist/cli/install.js.map +0 -1
- package/dist/cli/login.js.map +0 -1
- package/dist/cli/logout.js.map +0 -1
- package/dist/cli/setup.js.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/security/errors.js.map +0 -1
- package/dist/security/logger.js.map +0 -1
- package/dist/security/redact.js.map +0 -1
- package/dist/security/regex.js.map +0 -1
- package/dist/server.js.map +0 -1
- package/dist/sn/cache.js.map +0 -1
- package/dist/sn/client.js.map +0 -1
- package/dist/sn/crypto.js.map +0 -1
- package/dist/sn/dates.js.map +0 -1
- package/dist/sn/entitlement.js.map +0 -1
- package/dist/sn/frontmatter.js.map +0 -1
- package/dist/sn/governance.js.map +0 -1
- package/dist/sn/http.js.map +0 -1
- package/dist/sn/links.js.map +0 -1
- package/dist/sn/markdownSections.js.map +0 -1
- package/dist/sn/predicates.js.map +0 -1
- package/dist/sn/protocol004.js.map +0 -1
- package/dist/sn/scope.js.map +0 -1
- package/dist/sn/search.js.map +0 -1
- package/dist/sn/session.js.map +0 -1
- package/dist/sn/tagHierarchy.js.map +0 -1
- package/dist/sn/tasks.js.map +0 -1
- package/dist/sn/templates.js.map +0 -1
- package/dist/sn/types.js.map +0 -1
- package/dist/tools/daily.js.map +0 -1
- package/dist/tools/export.js.map +0 -1
- package/dist/tools/history.js.map +0 -1
- package/dist/tools/links.js.map +0 -1
- package/dist/tools/notes.js.map +0 -1
- package/dist/tools/smartviews.js.map +0 -1
- package/dist/tools/tags.js.map +0 -1
- package/dist/tools/tasks.js.map +0 -1
- package/dist/tools/templates.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,61 @@ 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
|
+
|
|
44
|
+
## [3.0.1] - 2026-12-05
|
|
45
|
+
|
|
46
|
+
Fixes for installing from npm.
|
|
47
|
+
|
|
48
|
+
### Added
|
|
49
|
+
- `standardnotes-mcp-setup` command: the guided setup (login, then connect AI clients) is now available after `npm install -g`.
|
|
50
|
+
- `server_status` reports the server version.
|
|
51
|
+
|
|
52
|
+
### Fixed
|
|
53
|
+
- `standardnotes-mcp-login`, `-setup` and `-install` did nothing when installed globally on macOS and Linux (npm starts them through a symlink, which the start check didn't follow).
|
|
54
|
+
- Error messages pointed npm users at `npm run login` / `npm run build`, which only exist in a source checkout; they now name the installed commands.
|
|
55
|
+
- The version reported to MCP clients is read from package.json instead of being hard-coded.
|
|
56
|
+
- Minimum `@modelcontextprotocol/sdk` raised to the version the server actually needs.
|
|
57
|
+
|
|
58
|
+
### Changed
|
|
59
|
+
- README, self-hosted and troubleshooting docs lead with the npm install; building from source is a separate section.
|
|
60
|
+
- The npm package no longer ships source maps (they pointed at source files that aren't included) or a missing banner image.
|
|
61
|
+
|
|
7
62
|
## [3.0.0] - 2026-12-05
|
|
8
63
|
|
|
9
64
|
Built for free Standard Notes accounts: Obsidian-style links, search, templates and periodic notes that work on every plan, plus plan awareness so this server never creates a paid-only Standard Notes feature for a free account.
|
package/README.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# standardnotes-mcp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/standardnotes-mcp) [](https://glama.ai/mcp/servers/vtttech/standardnotes-mcp)
|
|
4
4
|
|
|
5
|
-
|
|
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,29 +15,50 @@ 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
|
-
|
|
|
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
|
|
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
|
|
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
|
|
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
|
|
|
37
39
|
## Quick start
|
|
38
40
|
|
|
41
|
+
```bash
|
|
42
|
+
npm install -g standardnotes-mcp
|
|
43
|
+
standardnotes-mcp-login
|
|
44
|
+
```
|
|
45
|
+
|
|
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.
|
|
47
|
+
|
|
48
|
+
| Command | What it does |
|
|
49
|
+
|---|---|
|
|
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) |
|
|
52
|
+
| `standardnotes-mcp-logout <email>` | Wipe the keychain session — revokes MCP access without touching your SN password |
|
|
53
|
+
| `standardnotes-mcp-install [desktop] [code]` | Non-interactive: add the server to Claude Desktop and/or print the Claude Code command |
|
|
54
|
+
| `standardnotes-mcp` | The MCP server itself; AI clients start it, you don't need to |
|
|
55
|
+
|
|
56
|
+
**Updating:** `npm install -g standardnotes-mcp@latest`, then fully restart your AI clients.
|
|
57
|
+
|
|
58
|
+
**Upgrading from 2.x:** install as above and fully restart your AI clients. Your login carries over automatically (sessions saved under the old keychain name `mcp-standardnotes` are moved on first start). Re-running `standardnotes-mcp-setup` replaces the old `mcp-standardnotes` config entry with `standardnotes-mcp`.
|
|
59
|
+
|
|
60
|
+
### From source
|
|
61
|
+
|
|
39
62
|
```bash
|
|
40
63
|
git clone https://github.com/vtttech/standardnotes-mcp.git
|
|
41
64
|
cd standardnotes-mcp
|
|
@@ -44,47 +67,44 @@ npm run build
|
|
|
44
67
|
npm run setup
|
|
45
68
|
```
|
|
46
69
|
|
|
47
|
-
|
|
70
|
+
In a source checkout the commands are `npm run setup`, `npm run login` and `npm run logout -- <email>`, and the server is `dist/index.js`. After pulling changes, run `npm run build` and restart your AI clients.
|
|
48
71
|
|
|
49
|
-
|
|
50
|
-
|---|---|
|
|
51
|
-
| `npm run login` | Authenticate and store the session in the OS keychain (re-login, or add another account) |
|
|
52
|
-
| `npm run setup` | Connect AI clients (runs login first if needed) |
|
|
53
|
-
| `npm run logout` | Wipe the keychain session — revokes MCP access without touching your SN password |
|
|
72
|
+
## Connecting AI clients
|
|
54
73
|
|
|
55
|
-
|
|
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.
|
|
56
75
|
|
|
57
|
-
|
|
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.
|
|
58
77
|
|
|
59
|
-
|
|
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.
|
|
60
79
|
|
|
61
|
-
|
|
80
|
+
To configure a client by hand, with the package installed globally:
|
|
62
81
|
|
|
63
82
|
```json
|
|
64
83
|
{
|
|
65
84
|
"mcpServers": {
|
|
66
85
|
"standardnotes-mcp": {
|
|
67
|
-
"command": "
|
|
68
|
-
"args": ["/absolute/path/to/standardnotes-mcp/dist/index.js"],
|
|
86
|
+
"command": "standardnotes-mcp",
|
|
69
87
|
"env": {
|
|
70
88
|
"SN_EMAIL": "you@example.com",
|
|
71
89
|
"SN_CLIENT_NAME": "claude",
|
|
72
|
-
"SN_READ_TAGS": "some-
|
|
90
|
+
"SN_READ_TAGS": "some-tag"
|
|
73
91
|
}
|
|
74
92
|
}
|
|
75
93
|
}
|
|
76
94
|
}
|
|
77
95
|
```
|
|
78
96
|
|
|
79
|
-
- `SN_EMAIL` — which account (
|
|
97
|
+
- `SN_EMAIL` — which account (the email you logged in with; capitals don't matter).
|
|
80
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.
|
|
81
|
-
- `SN_READ_TAGS` — optional **
|
|
99
|
+
- `SN_READ_TAGS` — optional **tag scope** (see [scopes](#limiting-an-ai-to-tags-scopes)). Omit for full-vault access.
|
|
100
|
+
|
|
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.
|
|
82
102
|
|
|
83
103
|
Restart the client fully after changing its config.
|
|
84
104
|
|
|
85
105
|
### Connecting Lumo (Custom MCP settings)
|
|
86
106
|
|
|
87
|
-
Run `
|
|
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:
|
|
88
108
|
|
|
89
109
|
| Lumo field | Value |
|
|
90
110
|
|---|---|
|
|
@@ -93,15 +113,15 @@ Run `npm run build` and `npm run login` (or `npm run setup`) first. Then in Lumo
|
|
|
93
113
|
| **Description (optional)** | `Search, read and edit notes in my Standard Notes vault.` — Lumo is sent this text; never put credentials in it. |
|
|
94
114
|
| **Transport** | `Local (command)` |
|
|
95
115
|
| **Command** | `node` (if Lumo can't find it, use the full path from `where node` / `which node`) |
|
|
96
|
-
| **Args (one per line)** | The absolute path to `dist
|
|
116
|
+
| **Args (one per line)** | The absolute path to the server: the output of `npm root -g` followed by `\standardnotes-mcp\dist\index.js` (e.g. `C:\Users\you\AppData\Roaming\npm\node_modules\standardnotes-mcp\dist\index.js`), or `dist\index.js` in a source checkout — one line, no quotes |
|
|
97
117
|
| **Environment** | `SN_EMAIL=you@example.com` and `SN_CLIENT_NAME=lumo`, one per line; optionally `SN_READ_TAGS=...`, `SN_DENY_TAGS=...`, `SN_READ_ONLY=true` |
|
|
98
118
|
| **Secret environment** | Leave empty. Your session is in the OS keychain. Never put your Standard Notes password anywhere. |
|
|
99
119
|
|
|
100
|
-
Click **Add server**, then ask Lumo "how many notes are in my vault?" — the answer comes from `notes_stats` and reflects your scope. If it fails: wrong `node` path → full path in **Command**; "Cannot find module" → check **Args**
|
|
120
|
+
Click **Add server**, then ask Lumo "how many notes are in my vault?" — the answer comes from `notes_stats` and reflects your scope. If it fails: wrong `node` path → full path in **Command**; "Cannot find module" → check **Args** (re-run `npm root -g`; in a source checkout, run `npm run build`); auth error → `standardnotes-mcp-login` and check `SN_EMAIL`.
|
|
101
121
|
|
|
102
122
|
## Free vs paid in detail
|
|
103
123
|
|
|
104
|
-
Standard Notes reserves some features for its paid plans.
|
|
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.
|
|
105
125
|
|
|
106
126
|
| Standard Notes feature | Free | Paid | What this server does on a free account |
|
|
107
127
|
|---|---|---|---|
|
|
@@ -109,7 +129,7 @@ Standard Notes reserves some features for its paid plans. Most of those are enfo
|
|
|
109
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. |
|
|
110
130
|
| Super notes (rich text) | No (read-only in the app) | Yes | Readable. Creating them or editing their content is refused. |
|
|
111
131
|
| Tags | Yes | Yes | Full support |
|
|
112
|
-
| Nested
|
|
132
|
+
| Nested tags | No | Yes | Existing ones work. Creating or moving a tag under another is refused; top-level tags are fine. |
|
|
113
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. |
|
|
114
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. |
|
|
115
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. |
|
|
@@ -136,19 +156,38 @@ Ranking uses only the notes the AI may see, so scores never reveal anything abou
|
|
|
136
156
|
|
|
137
157
|
## Templates
|
|
138
158
|
|
|
139
|
-
*Every plan.*
|
|
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:
|
|
140
160
|
|
|
141
161
|
`{{date}}` `{{time}}` `{{datetime}}` `{{title}}` `{{week}}` `{{month}}` `{{year}}`, plus any `{{name}}` you pass in `vars`.
|
|
142
162
|
|
|
143
|
-
The new note is
|
|
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.
|
|
144
183
|
|
|
145
184
|
## Daily, weekly and monthly notes
|
|
146
185
|
|
|
147
|
-
*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.
|
|
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.
|
|
148
187
|
|
|
149
|
-
## Limiting an AI to
|
|
188
|
+
## Limiting an AI to tags (scopes)
|
|
150
189
|
|
|
151
|
-
*Every plan.*
|
|
190
|
+
*Every plan.* Scopes are tag-based. Set in the client's config, enforced in the server process:
|
|
152
191
|
|
|
153
192
|
| Variable | Effect |
|
|
154
193
|
|---|---|
|
|
@@ -156,8 +195,10 @@ The new note is filed in the template's own folders (except Templates). Placehol
|
|
|
156
195
|
| `SN_DENY_TAGS=journal,private` | **Blocklist.** Everything is visible *except* these tag subtrees. Deny wins over allow. |
|
|
157
196
|
| `SN_READ_ONLY=true` | Write tools are not registered at all — the AI only sees read tools. |
|
|
158
197
|
|
|
159
|
-
- "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).
|
|
160
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.
|
|
161
202
|
|
|
162
203
|
## Per-note rules (frontmatter)
|
|
163
204
|
|
|
@@ -182,10 +223,22 @@ ai-kimi: ok # Kimi specifically: full access (per-client beats global)
|
|
|
182
223
|
|
|
183
224
|
- **Write order matters**: to protect a note with `ai: no-access` + `ai-<name>: ok`, write the allow key FIRST, then the deny.
|
|
184
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.
|
|
185
|
-
- **Super notes can't carry frontmatter** — protect them with
|
|
226
|
+
- **Super notes can't carry frontmatter** — protect them with tag scopes.
|
|
186
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.
|
|
187
228
|
- `SN_GOVERNANCE=off` disables enforcement entirely (not recommended).
|
|
188
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
|
+
|
|
189
242
|
## The security model — what each layer stops
|
|
190
243
|
|
|
191
244
|
1. **The AI model** — fully bound. Refused content never enters its context; no prompt, injection, or persuasion changes what the server serves.
|
|
@@ -195,11 +248,11 @@ ai-kimi: ok # Kimi specifically: full access (per-client beats global)
|
|
|
195
248
|
**Things to know:**
|
|
196
249
|
|
|
197
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.
|
|
198
|
-
- **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.
|
|
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`).
|
|
199
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.
|
|
200
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).
|
|
201
254
|
|
|
202
|
-
**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.
|
|
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.
|
|
203
256
|
|
|
204
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.
|
|
205
258
|
|
|
@@ -211,8 +264,8 @@ All tools validate input. Mutating note tools return size deltas so an accidenta
|
|
|
211
264
|
|
|
212
265
|
| Tool | What it does | Plan |
|
|
213
266
|
|---|---|---|
|
|
214
|
-
| `notes_list` | Browse notes, newest-updated first; filter by
|
|
215
|
-
| `notes_search` | Relevance-ranked, typo-tolerant full-text search, or regex; filters for
|
|
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 |
|
|
216
269
|
| `notes_get` | Read one note: full content, an outline of its headings, or one heading's section | Free |
|
|
217
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 |
|
|
218
271
|
| `notes_links` | Outgoing links, backlinks, unresolved and ambiguous `[[wikilinks]]` of a note | Free |
|
|
@@ -220,7 +273,7 @@ All tools validate input. Mutating note tools return size deltas so an accidenta
|
|
|
220
273
|
| `notes_stats` | Vault statistics: counts, sizes, note types, cache age | Free |
|
|
221
274
|
| `notes_tasks` | Find markdown checkbox tasks across the vault | Free |
|
|
222
275
|
| `server_status` | Detected plan, limited features, active policy, sync health (same as `sn://status`, for clients without resource support) | Free |
|
|
223
|
-
| `templates_list` | List the notes
|
|
276
|
+
| `templates_list` | List the notes tagged Templates | Free |
|
|
224
277
|
|
|
225
278
|
**Writing & editing**
|
|
226
279
|
|
|
@@ -228,7 +281,7 @@ All tools validate input. Mutating note tools return size deltas so an accidenta
|
|
|
228
281
|
|---|---|---|
|
|
229
282
|
| `notes_create` / `notes_create_many` | Create one note, or up to 50 at once | Limited — plain text on free; Super refused |
|
|
230
283
|
| `notes_create_from_template` | Create a note from a template, filling placeholders | Limited — Super templates refused on free |
|
|
231
|
-
| `notes_update` / `notes_update_many` | Change text, title, type
|
|
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 |
|
|
232
285
|
| `notes_append` | Add text to a note or to one heading's section, at the end or start | Free |
|
|
233
286
|
| `notes_replace_in` | Find and replace inside one note (literal or regex) | Free |
|
|
234
287
|
| `notes_link` | Link a note to another: a `[[wikilink]]`, plus a native link on paid plans | Free (native link: Paid) |
|
|
@@ -236,16 +289,15 @@ All tools validate input. Mutating note tools return size deltas so an accidenta
|
|
|
236
289
|
| `notes_frontmatter` | Get, set or remove frontmatter keys, leaving the rest untouched | Free (plain-text and markdown notes) |
|
|
237
290
|
| `notes_task_toggle` | Check or uncheck a task | Free |
|
|
238
291
|
| `periodic_append` | Append to the current day's, week's or month's note, creating it if needed | Free |
|
|
239
|
-
| `daily_append` | Append to today's journal note (`Journal YYYY-MM-DD`) | Free |
|
|
240
292
|
|
|
241
|
-
**
|
|
293
|
+
**Tags, history & periods**
|
|
242
294
|
|
|
243
295
|
| Tool | What it does | Plan |
|
|
244
296
|
|---|---|---|
|
|
245
|
-
| `tags_list` / `tags_get` |
|
|
246
|
-
| `tags_create` / `tags_update` / `tags_delete` | Create, rename, move or delete
|
|
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 |
|
|
247
299
|
| `tags_attach` / `tags_detach` | File or unfile a note | Free |
|
|
248
|
-
| `periodic_list`
|
|
300
|
+
| `periodic_list` | Notes created in a given day, week or month | Free |
|
|
249
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 |
|
|
250
302
|
| `vault_export` | Export decrypted notes as markdown files (only when `SN_ALLOW_EXPORT=true`) | Free |
|
|
251
303
|
| `sync` | Force a full re-sync | Free |
|
|
@@ -256,15 +308,17 @@ All tools validate input. Mutating note tools return size deltas so an accidenta
|
|
|
256
308
|
|
|
257
309
|
| Variable | Default | Description |
|
|
258
310
|
|---|---|---|
|
|
259
|
-
| `SN_EMAIL` | required | Account email
|
|
311
|
+
| `SN_EMAIL` | required | Account email, as used at login (not case-sensitive) |
|
|
260
312
|
| `SN_CLIENT_NAME` | handshake name | Identity for `ai-<name>` rules — set per client |
|
|
261
|
-
| `SN_READ_TAGS` | unset | Allowlist of visible
|
|
262
|
-
| `SN_DENY_TAGS` | unset | Hidden
|
|
313
|
+
| `SN_READ_TAGS` | unset | Allowlist of visible tag subtrees |
|
|
314
|
+
| `SN_DENY_TAGS` | unset | Hidden tag subtrees; deny wins |
|
|
263
315
|
| `SN_READ_ONLY` | `false` | `true` = write tools not registered |
|
|
264
316
|
| `SN_GOVERNANCE` | `on` | Frontmatter `ai:` enforcement; `off` disables |
|
|
265
|
-
| `SN_TEMPLATES_TAG` | `Templates` |
|
|
266
|
-
| `
|
|
267
|
-
| `
|
|
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`. |
|
|
268
322
|
| `SN_ALLOW_EXPORT` | `false` | `true` registers `vault_export` (writes decrypted plaintext to disk) |
|
|
269
323
|
| `SN_EXPORT_DIR` | unset | Confine exports to this directory |
|
|
270
324
|
| `SN_SERVER_URL` | `https://api.standardnotes.com` | Sync server (self-hosted: see [docs/self-hosted.md](./docs/self-hosted.md)) |
|
|
@@ -281,15 +335,14 @@ Planned for the next release:
|
|
|
281
335
|
|---|---|
|
|
282
336
|
| Attachments: list names and types for everyone; open and read files on paid plans | List: Free / Open: Paid |
|
|
283
337
|
| Optional semantic search with a local model or Ollama (`SN_SEMANTIC`) — never a cloud service | Free |
|
|
284
|
-
| Faster syncs on large vaults (decrypt only what changed) | Free and paid |
|
|
285
338
|
| Early warning when Standard Notes changes its API requirements | Free and paid |
|
|
286
339
|
|
|
287
340
|
## Auth lifecycle
|
|
288
341
|
|
|
289
|
-
- **Login** (`
|
|
342
|
+
- **Login** (`standardnotes-mcp-login`): email, password and 2FA, once per machine. Master key derived in RAM; session stored in the OS keychain.
|
|
290
343
|
- **Every server start**: reads the keychain session — no password, no login round-trip.
|
|
291
344
|
- **Token expiry**: refreshed automatically.
|
|
292
|
-
- **`
|
|
345
|
+
- **`standardnotes-mcp-logout <email>`**: wipes the keychain session.
|
|
293
346
|
|
|
294
347
|
## Platform notes (Linux)
|
|
295
348
|
|
|
@@ -299,15 +352,25 @@ On Linux the session is stored in the **Secret Service** (usually gnome-keyring)
|
|
|
299
352
|
sudo apt install gnome-keyring libsecret-1-0 # Debian/Ubuntu/Mint
|
|
300
353
|
```
|
|
301
354
|
|
|
302
|
-
The keyring must be unlocked — a normal desktop login does this; headless/SSH sessions need `DBUS_SESSION_BUS_ADDRESS` and `gnome-keyring-daemon --unlock` (see [docs/troubleshooting.md](./docs/troubleshooting.md)). Coming from an old `keytar`-based install? Run `
|
|
355
|
+
The keyring must be unlocked — a normal desktop login does this; headless/SSH sessions need `DBUS_SESSION_BUS_ADDRESS` and `gnome-keyring-daemon --unlock` (see [docs/troubleshooting.md](./docs/troubleshooting.md)). Coming from an old `keytar`-based install? Run `standardnotes-mcp-login` again or see the migration steps in [docs/troubleshooting.md](./docs/troubleshooting.md).
|
|
303
356
|
|
|
304
357
|
## Development
|
|
305
358
|
|
|
359
|
+
From a [source checkout](#from-source):
|
|
360
|
+
|
|
306
361
|
```bash
|
|
307
|
-
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
|
|
308
363
|
npm run dev # tsx watch
|
|
309
364
|
```
|
|
310
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
|
+
|
|
311
374
|
## Troubleshooting & security
|
|
312
375
|
|
|
313
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
|
-
- `
|
|
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
|