standardnotes-mcp 0.0.0-stage → 3.0.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 +165 -0
- package/LICENSE +22 -0
- package/README.md +320 -3
- package/SECURITY.md +56 -0
- package/dist/cli/install.js +187 -0
- package/dist/cli/install.js.map +1 -0
- package/dist/cli/login.js +126 -0
- package/dist/cli/login.js.map +1 -0
- package/dist/cli/logout.js +22 -0
- package/dist/cli/logout.js.map +1 -0
- package/dist/cli/setup.js +200 -0
- package/dist/cli/setup.js.map +1 -0
- package/dist/config.js +60 -0
- package/dist/config.js.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/security/errors.js +20 -0
- package/dist/security/errors.js.map +1 -0
- package/dist/security/logger.js +17 -0
- package/dist/security/logger.js.map +1 -0
- package/dist/security/redact.js +31 -0
- package/dist/security/redact.js.map +1 -0
- package/dist/security/regex.js +27 -0
- package/dist/security/regex.js.map +1 -0
- package/dist/server.js +327 -0
- package/dist/server.js.map +1 -0
- package/dist/sn/cache.js +53 -0
- package/dist/sn/cache.js.map +1 -0
- package/dist/sn/client.js +1999 -0
- package/dist/sn/client.js.map +1 -0
- package/dist/sn/crypto.js +63 -0
- package/dist/sn/crypto.js.map +1 -0
- package/dist/sn/dates.js +157 -0
- package/dist/sn/dates.js.map +1 -0
- package/dist/sn/entitlement.js +75 -0
- package/dist/sn/entitlement.js.map +1 -0
- package/dist/sn/frontmatter.js +171 -0
- package/dist/sn/frontmatter.js.map +1 -0
- package/dist/sn/governance.js +40 -0
- package/dist/sn/governance.js.map +1 -0
- package/dist/sn/http.js +289 -0
- package/dist/sn/http.js.map +1 -0
- package/dist/sn/links.js +78 -0
- package/dist/sn/links.js.map +1 -0
- package/dist/sn/markdownSections.js +141 -0
- package/dist/sn/markdownSections.js.map +1 -0
- package/dist/sn/predicates.js +135 -0
- package/dist/sn/predicates.js.map +1 -0
- package/dist/sn/protocol004.js +401 -0
- package/dist/sn/protocol004.js.map +1 -0
- package/dist/sn/scope.js +68 -0
- package/dist/sn/scope.js.map +1 -0
- package/dist/sn/search.js +260 -0
- package/dist/sn/search.js.map +1 -0
- package/dist/sn/session.js +55 -0
- package/dist/sn/session.js.map +1 -0
- package/dist/sn/tagHierarchy.js +105 -0
- package/dist/sn/tagHierarchy.js.map +1 -0
- package/dist/sn/tasks.js +32 -0
- package/dist/sn/tasks.js.map +1 -0
- package/dist/sn/templates.js +23 -0
- package/dist/sn/templates.js.map +1 -0
- package/dist/sn/types.js +12 -0
- package/dist/sn/types.js.map +1 -0
- package/dist/tools/daily.js +126 -0
- package/dist/tools/daily.js.map +1 -0
- package/dist/tools/export.js +96 -0
- package/dist/tools/export.js.map +1 -0
- package/dist/tools/history.js +41 -0
- package/dist/tools/history.js.map +1 -0
- package/dist/tools/links.js +51 -0
- package/dist/tools/links.js.map +1 -0
- package/dist/tools/notes.js +404 -0
- package/dist/tools/notes.js.map +1 -0
- package/dist/tools/smartviews.js +52 -0
- package/dist/tools/smartviews.js.map +1 -0
- package/dist/tools/tags.js +82 -0
- package/dist/tools/tags.js.map +1 -0
- package/dist/tools/tasks.js +43 -0
- package/dist/tools/tasks.js.map +1 -0
- package/dist/tools/templates.js +145 -0
- package/dist/tools/templates.js.map +1 -0
- package/docs/protocol-004.md +72 -0
- package/docs/self-hosted.md +123 -0
- package/docs/troubleshooting.md +89 -0
- package/package.json +85 -6
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented in this file.
|
|
4
|
+
|
|
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
|
+
|
|
7
|
+
## [3.0.0] - 2026-12-05
|
|
8
|
+
|
|
9
|
+
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.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- **Plan awareness.** The account's plan is read from the roles Standard Notes reports on every response (`CORE_USER` = free, `PLUS_USER`/`PRO_USER` = paid); there is deliberately no override. On free accounts: new notes default to plain text, other paid editor types are saved as plain text with a notice, Super notes and nested folders are refused with reason `paid_feature`, Super note content is read-only, and note history only shows revisions the plan may view (matching the official app). `sn://status` reports the plan and which features are degraded.
|
|
13
|
+
- **Links and backlinks:** `notes_links` (outgoing, backlinks, unresolved and ambiguous `[[wikilinks]]`, plus native Standard Notes links and Super bubbles) and `notes_link` (adds a `[[wikilink]]` on every plan, and a native link on paid plans).
|
|
14
|
+
- **Relevance-ranked, typo-tolerant search.** `notes_search` text mode now ranks by relevance (BM25 over title and body with a fuzzy title boost) and tolerates small typos; new `sort` (`relevance`/`updated`) and `fuzzy` options, and hits flag `fuzzy` when they matched only approximately. Ranking statistics come only from notes the client may see.
|
|
15
|
+
- **Frontmatter queries:** `notes_query` accepts `frontmatter.<key>` keypaths (e.g. `frontmatter.status = "active"`, `frontmatter.tags includes "client"`).
|
|
16
|
+
- **Templates:** `templates_list` and `notes_create_from_template`, using notes in a `Templates` folder (`SN_TEMPLATES_TAG`) with `{{date}}`, `{{time}}`, `{{datetime}}`, `{{title}}`, `{{week}}`, `{{month}}`, `{{year}}` and custom `{{vars}}`. Plain substitution only, never code.
|
|
17
|
+
- **`server_status` tool:** the same data as the `sn://status` resource (detected plan, limited features, active policy, sync health), for clients like Lumo that can call tools but not read resources.
|
|
18
|
+
- **Weekly and monthly notes:** `periodic_list` and `periodic_append` (`Week 2026-W49`, `Month 2026-12`, and the daily `Journal YYYY-MM-DD`); optional `SN_PERIODIC_TAG` folder for new periodic notes.
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
- **Timezone defaults to your computer's.** When `SN_TIMEZONE` isn't set, dates (search filters, journals, periodic notes, template `{{date}}`/`{{time}}`) now use the timezone of the machine running the server instead of a hard-coded `America/Los_Angeles`, falling back to UTC if the system reports none. `notes_create_from_template` now returns the `timezone` it used.
|
|
22
|
+
- **Renamed to `standardnotes-mcp` everywhere.** The MCP server name is now `StandardNotes-MCP`; CLI commands are `standardnotes-mcp`, `standardnotes-mcp-login`, `standardnotes-mcp-logout`, `standardnotes-mcp-install`; the config key written by setup is `standardnotes-mcp` (the old `mcp-standardnotes` entry is replaced, not duplicated); the keychain service is `standardnotes-mcp`, and sessions stored under the old name are moved over automatically on first start, so no re-login is needed; the User-Agent is `standardnotes-mcp/<version>`.
|
|
23
|
+
- `smartviews_list` now returns `{ smartViews, notice? }` instead of a bare array.
|
|
24
|
+
- `daily_append` creates the journal note with the plan's default type instead of always markdown, and its description no longer promises the SN Daily view (a paid feature).
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
- **Protected notes are now fully invisible.** A note protected in the Standard Notes app used to show up as a `[Protected]` placeholder, and its title still leaked through `notes_stats` (largest/oldest/newest). Its body was also still searchable and queryable, tasks were listed, and tag counts included it. It is now treated exactly like a note that doesn't exist, on every read and write path: no title, body, dates, tags, counts, search ranking, links, or "this note is protected" error. Tag note counts and note lists likewise count only notes the AI may see (also excluding `ai: no-access` and out-of-scope notes). `vault_export` no longer reports a skipped-protected count.
|
|
28
|
+
- **Edits no longer strip links.** Every MCP edit used to drop the note's references (links to other notes and attached files made in the SN app) and any app data this server doesn't model (editor settings, extension data). They're now preserved byte-for-byte.
|
|
29
|
+
- **Changes from other clients carried by a write's response are no longer dropped.** A write's sync response can include edits and deletions made in the SN app since the last sync; they were discarded while the sync position moved past them, so those notes and folders stayed visible until the server restarted. They're now applied.
|
|
30
|
+
- **Creation-date matching.** Standard Notes timestamps are microseconds; `daily_list` compared them with milliseconds and never matched, and `updatedBefore` in search excluded everything. Both now convert correctly.
|
|
31
|
+
|
|
32
|
+
### Security
|
|
33
|
+
- `notes_stats` no longer reveals `ai: no-access` notes (their titles could surface as the largest/oldest/newest note, and they were counted), and scoped clients now see only their own tag count and no vault-wide decrypt diagnostics. The `sync` tool's counts are likewise limited to what the client can see.
|
|
34
|
+
- Links, backlinks, frontmatter queries, ranked search and templates all apply the same scope and governance rules: a hidden note is indistinguishable from a missing one. New privacy tests cover each.
|
|
35
|
+
- Documented known limitations in README and SECURITY.md: other programs running as your OS user can read the keychain, `SN_CLIENT_NAME` is trust-on-config, `SN_DELETE_ELICITATION` falls back to deleting without asking in clients without elicitation, decrypted notes can reach swap, and `http://` server URLs expose session tokens. The npm package no longer includes the `dump-note` debug script.
|
|
36
|
+
|
|
37
|
+
## [2.1.5] - 2026-12-04
|
|
38
|
+
|
|
39
|
+
### Changed
|
|
40
|
+
- README rewritten top to bottom: quick start via `npm run setup`, connecting AI clients, a dedicated "Limiting an AI to folders" section (scopes), frontmatter governance with the write-order and fail-safe patterns, an honest three-layer security model (model / client app / OS user), grouped tool tables, and consolidated configuration. Linux keychain details moved to platform notes; the keytar migration script moved to docs/troubleshooting.md.
|
|
41
|
+
|
|
42
|
+
## [2.1.4] - 2026-12-04
|
|
43
|
+
|
|
44
|
+
### Security
|
|
45
|
+
- Closed the last two orphan vectors (found in live testing): `tags_detach` now refuses to remove a note's LAST in-scope tag (`scope_orphan`), and `tags_delete` on an in-scope tag refuses while the tag still holds notes with no other in-scope tag OR child tags (deleting a mid-level tag would drop its children — and their notes — out of scope). Both errors carry remediation hints (re-file first, then detach/delete).
|
|
46
|
+
|
|
47
|
+
## [2.1.3] - 2026-12-04
|
|
48
|
+
|
|
49
|
+
### Security
|
|
50
|
+
- Closed a read-escalation via tag writes (found in live testing): `tags_update` let a scoped client re-parent ANY tag under an allowed one, exposing every note in it — converting write access into full read access. Tag mutations (`tags_create`/`tags_update`/`tags_delete`) now only operate on tags inside the allowlist scope; re-parenting to a parent outside the scope or to top level is refused; new tags must nest under an in-scope tag.
|
|
51
|
+
- Scope roots (the tags named in `SN_READ_TAGS`) are now immutable to the scoped client — they cannot be renamed, moved, or deleted (`scope_tag_root`).
|
|
52
|
+
- `tags_list` / `tags_get` / tag filters no longer reveal tags outside the allowlist scope (previously all tag titles were visible, leaking vault structure).
|
|
53
|
+
|
|
54
|
+
## [2.1.2] - 2026-12-04
|
|
55
|
+
|
|
56
|
+
### Security
|
|
57
|
+
- Closed a scope-write gap found in live testing: `notes_create` / `notes_create_many` performed no scope checks, so a tag-scoped client (e.g. `SN_READ_TAGS=WSD`) could create notes outside its scope — notes it could then neither see nor clean up. Under an allowlist scope, creates must now file the note under at least one in-scope tag (`scope_create_denied` otherwise), and denied tags are rejected.
|
|
58
|
+
- Same protection for retags: `notes_update` / `notes_update_many` with a `tags` patch must keep at least one in-scope tag, so a scoped client cannot untag an existing note out of its own scope (same orphaning vector).
|
|
59
|
+
|
|
60
|
+
## [2.1.1] - 2026-12-04
|
|
61
|
+
|
|
62
|
+
### Security
|
|
63
|
+
- Closed a tag-scope escape: `tags_attach` / `tags_detach` performed no scope or governance checks, so a tag-scoped client (e.g. `SN_READ_TAGS=WSD`) could attach an out-of-scope note to an allowed tag and then read it. Both tools now reject out-of-scope and `ai: no-access` notes as not-found, refuse `ai: read-only` notes, and reject denied (hidden) tags.
|
|
64
|
+
|
|
65
|
+
## [2.1.0] - 2026-12-04
|
|
66
|
+
|
|
67
|
+
### Added
|
|
68
|
+
- `npm run setup` now runs the login flow inline when no usable keychain session exists (none stored, or none matching `SN_EMAIL`), then continues into client wiring — a fresh machine needs only this one command. With a session already stored, setup goes straight to wiring, making it the tool for changing client configs later. `npm run login` remains for re-login or adding another account.
|
|
69
|
+
|
|
70
|
+
### Fixed
|
|
71
|
+
- The password prompt no longer crashes on piped/non-TTY stdin (`stdin.setRawMode is not a function`); it falls back to a normal line prompt, which is safe because a pipe has no terminal echo to suppress.
|
|
72
|
+
|
|
73
|
+
## [2.0.3] - 2026-12-04
|
|
74
|
+
|
|
75
|
+
### Fixed
|
|
76
|
+
- `npm run setup` on Windows consoles where the npm wrapper detaches the TTY: line editing (backspace) was silently unavailable. Setup now detects a non-terminal stdin and prints the direct invocation (`node dist/cli/setup.js`) that restores editing.
|
|
77
|
+
|
|
78
|
+
## [2.0.2] - 2026-12-04
|
|
79
|
+
|
|
80
|
+
### Changed
|
|
81
|
+
- `npm run setup` identity step rewritten for clarity: each client now explains what the governance name does with a concrete frontmatter example, and asks a plain "Use the name X? [Y/n]" (typing a different name directly also works) instead of the bare "Identity name [x]:" prompt.
|
|
82
|
+
|
|
83
|
+
## [2.0.1] - 2026-12-04
|
|
84
|
+
|
|
85
|
+
### Fixed
|
|
86
|
+
- `npm run setup` (and the installer run via tsx from `src/`) failed with "Server entrypoint not found": `resolvePaths()` assumed the built `dist/cli` layout. It now always resolves the server entrypoint to `dist/index.js` regardless of where the CLI runs from.
|
|
87
|
+
|
|
88
|
+
## [2.0.0] - 2026-12-03
|
|
89
|
+
|
|
90
|
+
Obsidian-parity round two: Smart Views, batch operations, frontmatter with per-AI governance, journal tools, vault-wide tasks, export, note history, and guided multi-client setup.
|
|
91
|
+
|
|
92
|
+
Major bump because response shapes changed relative to 1.1.0 (the 1.2.0/1.3.0 headings below were internal milestones, never tagged or published; their changes are all part of this release).
|
|
93
|
+
|
|
94
|
+
### Breaking (relative to 1.1.0)
|
|
95
|
+
- `notes_search` returns `{ hits, totalCount, nextCursor }` instead of a bare array of summaries.
|
|
96
|
+
- `notes_get` default (`format=content`) returns `{ uuid, title, text, noteType }`; the previous full shape is available via `format=full`.
|
|
97
|
+
- `zod` is now v4 (dependency-level; tool behavior unchanged).
|
|
98
|
+
|
|
99
|
+
### Added
|
|
100
|
+
- **Smart Views**: your SN saved searches are decrypted and runnable — `smartviews_list` (with readable filter summaries) and `smartviews_notes` (evaluate a view locally). `notes_query` runs ad-hoc SN predicate JSON (and/or/not trees; =, !=, comparisons, startsWith, includes, ReDoS-guarded matches, in).
|
|
101
|
+
- **Batch tools**: `notes_update_many` / `notes_delete_many` — up to 50 notes in one sync push, per-note failure reporting, single batch delete confirmation under `SN_DELETE_ELICITATION`.
|
|
102
|
+
- **Frontmatter**: `notes_frontmatter` get/set/delete on markdown YAML blocks via line surgery (only the target key's lines change).
|
|
103
|
+
- **AI governance**: `ai: read-only` / `ai: no-access` frontmatter is enforced in the client — read-only notes reject all writes; no-access notes are hidden everywhere. `SN_GOVERNANCE=off` disables.
|
|
104
|
+
- **Per-AI governance**: `ai-<name>: <policy>` frontmatter keys apply per AI client (e.g. `ai-claude: no-access`, `ai-kimi: ok`). Client identity from operator-set `SN_CLIENT_NAME` or the MCP handshake name; matching per-client keys override the global `ai` key.
|
|
105
|
+
- **Guided setup**: `npm run setup` — interactive, client-agnostic MCP wiring (Claude Desktop/Code, ChatGPT, Kimi Code, Lumo, Cursor, or custom) that pins each client's governance identity in its config. `sn://status` now reports the active client identity.
|
|
106
|
+
- **Daily journal**: `daily_list` / `daily_append`, interoperating with the SN Daily view (notes grouped by creation date; appends create today's `Journal YYYY-MM-DD` note, which appears in the app's Daily view).
|
|
107
|
+
- **Tasks**: `notes_tasks` finds markdown checkboxes across the vault (filter by tag/note, open-only by default); `notes_task_toggle` checks them off.
|
|
108
|
+
- **Export**: `vault_export` writes decrypted notes as markdown + `index.json`. Opt-in via `SN_ALLOW_EXPORT`, confinable with `SN_EXPORT_DIR`; protected notes are never exported.
|
|
109
|
+
- **Note history**: `notes_history`, `notes_revision_get`, `notes_revision_restore` — list, read, and restore server-kept revisions (subscription-gated upstream).
|
|
110
|
+
- Notes now expose and preserve `archived` and `pinned` (settable via `notes_update`).
|
|
111
|
+
|
|
112
|
+
### Fixed
|
|
113
|
+
- `archived`/`pinned` flags were silently stripped when a note was edited via MCP (content is rebuilt on encrypt; the flags are now carried through).
|
|
114
|
+
|
|
115
|
+
### Changed
|
|
116
|
+
- SECURITY.md rewritten: supported versions updated, accidentally pasted `npm audit` dump removed, and the full security posture documented (blast-radius controls, governance enforcement, ReDoS guard, write-integrity invariants). README security section expanded to match.
|
|
117
|
+
- `.env.example` documents all current env vars (cache TTL, timezone, safety rails, governance, export).
|
|
118
|
+
|
|
119
|
+
### Removed
|
|
120
|
+
- Dead "reserved for future" code in the client (unused `generateItemsKeyRaw` import kept alive with `void`, unused `StoredSession` re-export).
|
|
121
|
+
|
|
122
|
+
## [1.2.0] - 2026-12-03
|
|
123
|
+
|
|
124
|
+
Robustness pass modeled on the leading Obsidian MCP servers: surgical edits, real search, safety rails, and MCP resources/prompts. All new behavior is opt-in; defaults are unchanged.
|
|
125
|
+
|
|
126
|
+
### Added
|
|
127
|
+
- `notes_append`: insert text into a note without resending its body. Optional `section` targets a markdown heading (`"Heading"` or `"Parent::Child"`, ambiguity reported with candidates); `position` append/prepend.
|
|
128
|
+
- `notes_replace_in`: literal or regex find-and-replace inside one note, rules applied in order, per-rule replacement counts. Regex input is length-capped and rejected on nested quantifiers (ReDoS guard).
|
|
129
|
+
- `notes_update` accepts `trashed` — notes can now be restored from trash (`trashed: false`).
|
|
130
|
+
- `notes_search` overhaul: `text` mode (every token must match) or `regex` mode; filters for tag (+`includeDescendants`), noteType, `updatedAfter`/`updatedBefore`, `includeTrashed`; snippet windows around each match; cursor pagination with `totalCount`.
|
|
131
|
+
- `notes_get` formats: `content` (default), `full`, `outline` (heading map), `section` (one heading's body).
|
|
132
|
+
- Size deltas (`previousSizeInBytes`/`currentSizeInBytes`) on every mutating note tool.
|
|
133
|
+
- Safety rails via env: `SN_READ_ONLY` (write tools not registered), `SN_READ_TAGS`/`SN_DENY_TAGS` (tag-subtree read scope; out-of-scope notes appear as not found), `SN_DELETE_ELICITATION` (confirm deletes via MCP elicitation).
|
|
134
|
+
- Structured tool errors: `{ reason, message, recoveryHint }` so agents can self-correct.
|
|
135
|
+
- MCP resources `sn://notes/{uuid}`, `sn://tags`, `sn://status`; prompts `summarize-note`, `weekly-review`, `inbox-triage`.
|
|
136
|
+
- `SN_TIMEZONE` (default `America/Los_Angeles`): date-only search filters are interpreted in this timezone instead of UTC.
|
|
137
|
+
|
|
138
|
+
### Changed
|
|
139
|
+
- Tool descriptions rewritten in intent-routing style ("Use this when… / Do NOT use for…").
|
|
140
|
+
- Protected-note masking now also blanks search snippets.
|
|
141
|
+
|
|
142
|
+
## [1.1.0] - 2026-12-03
|
|
143
|
+
|
|
144
|
+
Repo renamed to `standardnotes-mcp`; internal tooling cleaned up accordingly.
|
|
145
|
+
|
|
146
|
+
### Security
|
|
147
|
+
- Resolved all 24 `npm audit` vulnerabilities (14 moderate, 8 high, 2 critical → 0): `@modelcontextprotocol/sdk` → 1.32.2, `undici` → 7.30.3, `vitest`/`vite` → latest, `@typescript-eslint` → v8, and **zod 3 → 4.6.7** (memory-exhaustion DoS advisory). The zod 4 migration changed one internal API usage (`.refine()` schemas now expose `.shape` directly); tool behavior is unchanged.
|
|
148
|
+
|
|
149
|
+
### Removed
|
|
150
|
+
- Claude Desktop setup prompt at the end of `npm run login`. Login now exits after storing the keychain session. This is a Lumo-facing MCP; Claude onboarding does not belong in the login flow. (The `mcp-standardnotes-install` command remains available for anyone who still wants it.)
|
|
151
|
+
|
|
152
|
+
### Changed
|
|
153
|
+
- Package name and all repo URLs (`homepage`, `bugs`, `repository`, `mcpName`) updated from `vtt-standardnotes-mcp` / `vtttech-standardnotes-mcp` to `standardnotes-mcp`, matching the GitHub repo rename.
|
|
154
|
+
- README clone URL and all example paths updated to the new folder name.
|
|
155
|
+
|
|
156
|
+
## [1.0.0] - 2026-11-28
|
|
157
|
+
|
|
158
|
+
First stable release.
|
|
159
|
+
|
|
160
|
+
### Changed
|
|
161
|
+
- Replaced `keytar` with `@napi-rs/keyring` for OS-keychain session storage; `keytar` is unmaintained (deprecated upstream repository).
|
|
162
|
+
- Added Linux support.
|
|
163
|
+
|
|
164
|
+
### Fixed
|
|
165
|
+
- Batch note creation (`notes_create_many`) now reliably saves all notes in a single sync push, with explicit error reporting when the server fails to save one or more notes in the batch.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 VTT Tech
|
|
4
|
+
Copyright (c) 2023 Guillaume Ferrari
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,320 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# standardnotes-mcp
|
|
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.
|
|
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.
|
|
6
|
+
|
|
7
|
+
## At a glance
|
|
8
|
+
|
|
9
|
+
| | Free SN account | Paid SN account (Productivity / Professional) |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| E2EE, OS-keychain login, no secrets in AI configs | Yes | Yes |
|
|
12
|
+
| Read, search, query, create and edit notes | Yes (plain-text notes) | Yes (all note types) |
|
|
13
|
+
| Relevance-ranked, typo-tolerant search | Yes | Yes |
|
|
14
|
+
| `[[Wikilinks]]`, backlinks, frontmatter queries | Yes | Yes |
|
|
15
|
+
| Templates, daily / weekly / monthly notes | Yes | Yes |
|
|
16
|
+
| Folder scopes and per-note AI rules | Yes | Yes |
|
|
17
|
+
| Tasks, export | Yes | Yes |
|
|
18
|
+
| Native Standard Notes note links | Read only | Read and create |
|
|
19
|
+
| Smart Views | Only views your account already has | Yes |
|
|
20
|
+
| 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 |
|
|
22
|
+
| Attachments | Not supported yet ([Roadmap](#roadmap)) | Not supported yet |
|
|
23
|
+
|
|
24
|
+
## Why
|
|
25
|
+
|
|
26
|
+
- **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
|
+
- **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.
|
|
29
|
+
- **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
|
+
|
|
31
|
+
## Requirements
|
|
32
|
+
|
|
33
|
+
- Node.js >= 20
|
|
34
|
+
- Windows / macOS / Linux with a working OS keychain (Linux: see [Platform notes](#platform-notes-linux))
|
|
35
|
+
- A Standard Notes account on protocol 004 (any account created or upgraded since 2020) — free or paid
|
|
36
|
+
|
|
37
|
+
## Quick start
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
git clone https://github.com/vtttech/standardnotes-mcp.git
|
|
41
|
+
cd standardnotes-mcp
|
|
42
|
+
npm install
|
|
43
|
+
npm run build
|
|
44
|
+
npm run setup
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
`npm run 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.
|
|
48
|
+
|
|
49
|
+
| Command | What it does |
|
|
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 |
|
|
54
|
+
|
|
55
|
+
Installed globally, the same commands are `standardnotes-mcp-login`, `standardnotes-mcp-install` and `standardnotes-mcp-logout`, and the server itself is `standardnotes-mcp`.
|
|
56
|
+
|
|
57
|
+
**Upgrading from 2.x:** run `npm run build` 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 `npm run setup` renames the old `mcp-standardnotes` config entry to `standardnotes-mcp`.
|
|
58
|
+
|
|
59
|
+
## Connecting AI clients
|
|
60
|
+
|
|
61
|
+
`npm run 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.
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"mcpServers": {
|
|
66
|
+
"standardnotes-mcp": {
|
|
67
|
+
"command": "node",
|
|
68
|
+
"args": ["/absolute/path/to/standardnotes-mcp/dist/index.js"],
|
|
69
|
+
"env": {
|
|
70
|
+
"SN_EMAIL": "you@example.com",
|
|
71
|
+
"SN_CLIENT_NAME": "claude",
|
|
72
|
+
"SN_READ_TAGS": "some-folder"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
- `SN_EMAIL` — which account (must match login exactly).
|
|
80
|
+
- `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 **folder scope** (see [scopes](#limiting-an-ai-to-folders-scopes)). Omit for full-vault access.
|
|
82
|
+
|
|
83
|
+
Restart the client fully after changing its config.
|
|
84
|
+
|
|
85
|
+
### Connecting Lumo (Custom MCP settings)
|
|
86
|
+
|
|
87
|
+
Run `npm run build` and `npm run login` (or `npm run setup`) first. Then in Lumo's MCP settings choose **Add MCP server**:
|
|
88
|
+
|
|
89
|
+
| Lumo field | Value |
|
|
90
|
+
|---|---|
|
|
91
|
+
| **ID** | `standardnotes-mcp` |
|
|
92
|
+
| **Display name** | `Standard Notes` |
|
|
93
|
+
| **Description (optional)** | `Search, read and edit notes in my Standard Notes vault.` — Lumo is sent this text; never put credentials in it. |
|
|
94
|
+
| **Transport** | `Local (command)` |
|
|
95
|
+
| **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/index.js`, e.g. `C:\path\to\standardnotes-mcp\dist\index.js` — one line, no quotes |
|
|
97
|
+
| **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
|
+
| **Secret environment** | Leave empty. Your session is in the OS keychain. Never put your Standard Notes password anywhere. |
|
|
99
|
+
|
|
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** and run `npm run build`; auth error → `npm run login` and check `SN_EMAIL`.
|
|
101
|
+
|
|
102
|
+
## Free vs paid in detail
|
|
103
|
+
|
|
104
|
+
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.
|
|
105
|
+
|
|
106
|
+
| Standard Notes feature | Free | Paid | What this server does on a free account |
|
|
107
|
+
|---|---|---|---|
|
|
108
|
+
| Plain-text notes | Yes | Yes | Full support, including frontmatter rules. New notes default to plain text. |
|
|
109
|
+
| 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
|
+
| Super notes (rich text) | No (read-only in the app) | Yes | Readable. Creating them or editing their content is refused. |
|
|
111
|
+
| Tags | Yes | Yes | Full support |
|
|
112
|
+
| Nested folders | No | Yes | Existing ones work. Creating or moving a folder under another is refused; top-level folders are fine. |
|
|
113
|
+
| 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
|
+
| 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
|
+
| Note history | Recent revisions only | Longer, by plan | Only revisions your plan may view are listed or opened — the same window the app shows. |
|
|
116
|
+
| Daily Notebook view | No | Yes | Daily, weekly and monthly notes are ordinary notes and work on every plan; the app's Daily Notebook view itself stays a paid feature. |
|
|
117
|
+
| Files / attachments | No (SN's server refuses them) | Yes | Not supported yet on any plan |
|
|
118
|
+
|
|
119
|
+
Check what was detected with the `server_status` tool or the `sn://status` resource (`plan.standardNotes` and `plan.degradedFeatures`). Self-hosted servers: see [docs/self-hosted.md](./docs/self-hosted.md#paid-features-on-a-self-hosted-server).
|
|
120
|
+
|
|
121
|
+
## Links and backlinks
|
|
122
|
+
|
|
123
|
+
*Every plan.* Write `[[Note Title]]` in any plain-text or markdown note (also `[[Note Title|alias]]` and `[[Note Title#Heading]]`). `notes_links` shows a note's outgoing links, its backlinks, links that point nowhere, and titles shared by several notes; `notes_link` adds a link for you. Matching is by title, case-insensitive, and ignores links inside code.
|
|
124
|
+
|
|
125
|
+
Native Standard Notes links (made in the app, or Super note `@` mentions) are included too. On paid plans `notes_link` also creates a native link so it shows in the app's linked items.
|
|
126
|
+
|
|
127
|
+
A note the AI isn't allowed to see never appears as a backlink, and a link to it looks exactly like a link to a note that doesn't exist.
|
|
128
|
+
|
|
129
|
+
## Search
|
|
130
|
+
|
|
131
|
+
*Every plan.* `notes_search` ranks results by relevance — notes where your words appear in the title or more often come first — and tolerates small typos ("resturant" finds "restaurant", "meeting notse" finds "Meeting Notes"). Hits found only approximately are marked `fuzzy`. Use `sort: "updated"` for newest first or `fuzzy: false` for exact words only; `mode: "regex"` is still available.
|
|
132
|
+
|
|
133
|
+
Ranking uses only the notes the AI may see, so scores never reveal anything about hidden notes. Nothing is indexed to disk.
|
|
134
|
+
|
|
135
|
+
`notes_query` filters structurally, including on frontmatter properties: `{"keypath": "frontmatter.status", "operator": "=", "value": "active"}`, or `includes` for list fields like `frontmatter.tags`.
|
|
136
|
+
|
|
137
|
+
## Templates
|
|
138
|
+
|
|
139
|
+
*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:
|
|
140
|
+
|
|
141
|
+
`{{date}}` `{{time}}` `{{datetime}}` `{{title}}` `{{week}}` `{{month}}` `{{year}}`, plus any `{{name}}` you pass in `vars`.
|
|
142
|
+
|
|
143
|
+
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.
|
|
144
|
+
|
|
145
|
+
## Daily, weekly and monthly notes
|
|
146
|
+
|
|
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. `daily_append` / `daily_list` remain as shortcuts for the daily journal. Set `SN_PERIODIC_TAG` to file new periodic notes under a folder.
|
|
148
|
+
|
|
149
|
+
## Limiting an AI to folders (scopes)
|
|
150
|
+
|
|
151
|
+
*Every plan.* Standard Notes folders are tags, so scopes are tag-based. Set in the client's config, enforced in the server process:
|
|
152
|
+
|
|
153
|
+
| Variable | Effect |
|
|
154
|
+
|---|---|
|
|
155
|
+
| `SN_READ_TAGS=wsd` | **Allowlist.** The client sees only notes under the `wsd` tag *and its child tags*. Everything else behaves as if it doesn't exist. Creates must file under an in-scope tag; retags must keep one; tag changes only work inside the subtree; the scope root itself can't be changed by the client. |
|
|
156
|
+
| `SN_DENY_TAGS=journal,private` | **Blocklist.** Everything is visible *except* these tag subtrees. Deny wins over allow. |
|
|
157
|
+
| `SN_READ_ONLY=true` | Write tools are not registered at all — the AI only sees read tools. |
|
|
158
|
+
|
|
159
|
+
- "Out of scope" looks exactly like "doesn't exist" — in lists, search, stats, links, templates and every other tool.
|
|
160
|
+
- Combine freely: `SN_READ_TAGS` for the working set, `SN_DENY_TAGS` for carve-outs, `SN_READ_ONLY` for read-only clients.
|
|
161
|
+
|
|
162
|
+
## Per-note rules (frontmatter)
|
|
163
|
+
|
|
164
|
+
*Every plan; plain-text and markdown notes.* A note can declare how AIs may treat it with a YAML block at the top of its text:
|
|
165
|
+
|
|
166
|
+
```yaml
|
|
167
|
+
---
|
|
168
|
+
ai: read-only # every AI: readable, never editable
|
|
169
|
+
ai-claude: no-access # Claude specifically: invisible
|
|
170
|
+
ai-kimi: ok # Kimi specifically: full access (per-client beats global)
|
|
171
|
+
---
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
| Key | Meaning |
|
|
175
|
+
|---|---|
|
|
176
|
+
| `ai: ok` (or absent) | Full access |
|
|
177
|
+
| `ai: read-only` | Readable; every AI write is refused (`governance_read_only`) |
|
|
178
|
+
| `ai: no-access` | Hidden everywhere; reads and writes fail as "not found" |
|
|
179
|
+
| `ai-<name>: <policy>` | Per-client override, matched case-insensitively against `SN_CLIENT_NAME` |
|
|
180
|
+
|
|
181
|
+
**Protected notes** (protected in the Standard Notes app, needing a password or biometrics to open) are always invisible to the AI, like `ai: no-access`, even with `SN_GOVERNANCE=off`. Nothing about them is exposed: no title, body, dates, tags, counts, search results or links. Every read and write answers "not found", exactly as for a note that doesn't exist. This also covers Super notes, which can't carry frontmatter.
|
|
182
|
+
|
|
183
|
+
- **Write order matters**: to protect a note with `ai: no-access` + `ai-<name>: ok`, write the allow key FIRST, then the deny.
|
|
184
|
+
- **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 folder scopes.
|
|
186
|
+
- 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
|
+
- `SN_GOVERNANCE=off` disables enforcement entirely (not recommended).
|
|
188
|
+
|
|
189
|
+
## The security model — what each layer stops
|
|
190
|
+
|
|
191
|
+
1. **The AI model** — fully bound. Refused content never enters its context; no prompt, injection, or persuasion changes what the server serves.
|
|
192
|
+
2. **The client app** — mostly bound. Scopes and identity come from config *you* wrote. Check the `server_status` tool (or `sn://status` resource) for the active identity and policy.
|
|
193
|
+
3. **Code running as your OS user**: not bound. Any program running as you, including an AI agent with shell access, can still read your keychain or this server's memory and decrypt the vault without going through the MCP. This is a known limitation of keychain-based local tools. For a hard boundary, run AI agents that execute commands under a separate OS user, or point them at a test Standard Notes account.
|
|
194
|
+
|
|
195
|
+
**Things to know:**
|
|
196
|
+
|
|
197
|
+
- **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. `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.
|
|
199
|
+
- **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
|
+
- **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
|
+
|
|
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. Folder scopes and `ai: no-access` decide what the AI ever sees.
|
|
203
|
+
|
|
204
|
+
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
|
+
|
|
206
|
+
## Tools
|
|
207
|
+
|
|
208
|
+
All tools validate input. Mutating note tools return size deltas so an accidental overwrite is visible without a re-read. **Plan** column: **Free** = works on free accounts; **Limited** = works on free with the restriction noted; **Paid** = needs a paid SN plan.
|
|
209
|
+
|
|
210
|
+
**Reading & finding**
|
|
211
|
+
|
|
212
|
+
| Tool | What it does | Plan |
|
|
213
|
+
|---|---|---|
|
|
214
|
+
| `notes_list` | Browse notes, newest-updated first; filter by folder (`includeDescendants` for subfolders) | Free |
|
|
215
|
+
| `notes_search` | Relevance-ranked, typo-tolerant full-text search, or regex; filters for folder, note type, date range, trashed; snippets and paging | Free |
|
|
216
|
+
| `notes_get` | Read one note: full content, an outline of its headings, or one heading's section | Free |
|
|
217
|
+
| `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
|
+
| `notes_links` | Outgoing links, backlinks, unresolved and ambiguous `[[wikilinks]]` of a note | Free |
|
|
219
|
+
| `smartviews_list` / `smartviews_notes` | List your Smart Views and run one, evaluated locally | Limited — free accounts only have views from a past subscription |
|
|
220
|
+
| `notes_stats` | Vault statistics: counts, sizes, note types, cache age | Free |
|
|
221
|
+
| `notes_tasks` | Find markdown checkbox tasks across the vault | Free |
|
|
222
|
+
| `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 in the Templates folder | Free |
|
|
224
|
+
|
|
225
|
+
**Writing & editing**
|
|
226
|
+
|
|
227
|
+
| Tool | What it does | Plan |
|
|
228
|
+
|---|---|---|
|
|
229
|
+
| `notes_create` / `notes_create_many` | Create one note, or up to 50 at once | Limited — plain text on free; Super refused |
|
|
230
|
+
| `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, folders; archive, pin, trash or restore | Limited — Super content read-only on free |
|
|
232
|
+
| `notes_append` | Add text to a note or to one heading's section, at the end or start | Free |
|
|
233
|
+
| `notes_replace_in` | Find and replace inside one note (literal or regex) | Free |
|
|
234
|
+
| `notes_link` | Link a note to another: a `[[wikilink]]`, plus a native link on paid plans | Free (native link: Paid) |
|
|
235
|
+
| `notes_delete` / `notes_delete_many` | Move to trash, or delete permanently | Free |
|
|
236
|
+
| `notes_frontmatter` | Get, set or remove frontmatter keys, leaving the rest untouched | Free (plain-text and markdown notes) |
|
|
237
|
+
| `notes_task_toggle` | Check or uncheck a task | Free |
|
|
238
|
+
| `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
|
+
|
|
241
|
+
**Folders, history & periods**
|
|
242
|
+
|
|
243
|
+
| Tool | What it does | Plan |
|
|
244
|
+
|---|---|---|
|
|
245
|
+
| `tags_list` / `tags_get` | Folder structure with note counts | Free |
|
|
246
|
+
| `tags_create` / `tags_update` / `tags_delete` | Create, rename, move or delete folders | Limited — top-level folders on free; nesting is paid |
|
|
247
|
+
| `tags_attach` / `tags_detach` | File or unfile a note | Free |
|
|
248
|
+
| `periodic_list` / `daily_list` | Notes created in a given day, week or month | Free |
|
|
249
|
+
| `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
|
+
| `vault_export` | Export decrypted notes as markdown files (only when `SN_ALLOW_EXPORT=true`) | Free |
|
|
251
|
+
| `sync` | Force a full re-sync | Free |
|
|
252
|
+
|
|
253
|
+
**Resources & prompts:** `sn://notes/{uuid}`, `sn://tags`, `sn://status` (sync state, active identity and policy, detected plan); prompts `summarize-note`, `weekly-review`, `inbox-triage`.
|
|
254
|
+
|
|
255
|
+
## Configuration
|
|
256
|
+
|
|
257
|
+
| Variable | Default | Description |
|
|
258
|
+
|---|---|---|
|
|
259
|
+
| `SN_EMAIL` | required | Account email; must match login exactly |
|
|
260
|
+
| `SN_CLIENT_NAME` | handshake name | Identity for `ai-<name>` rules — set per client |
|
|
261
|
+
| `SN_READ_TAGS` | unset | Allowlist of visible folder subtrees |
|
|
262
|
+
| `SN_DENY_TAGS` | unset | Hidden folder subtrees; deny wins |
|
|
263
|
+
| `SN_READ_ONLY` | `false` | `true` = write tools not registered |
|
|
264
|
+
| `SN_GOVERNANCE` | `on` | Frontmatter `ai:` enforcement; `off` disables |
|
|
265
|
+
| `SN_TEMPLATES_TAG` | `Templates` | Folder whose notes are templates |
|
|
266
|
+
| `SN_PERIODIC_TAG` | unset | Folder new daily/weekly/monthly notes are filed under |
|
|
267
|
+
| `SN_DELETE_ELICITATION` | `false` | `true` = deletions require interactive confirmation (apps without MCP confirmation prompts delete without asking) |
|
|
268
|
+
| `SN_ALLOW_EXPORT` | `false` | `true` registers `vault_export` (writes decrypted plaintext to disk) |
|
|
269
|
+
| `SN_EXPORT_DIR` | unset | Confine exports to this directory |
|
|
270
|
+
| `SN_SERVER_URL` | `https://api.standardnotes.com` | Sync server (self-hosted: see [docs/self-hosted.md](./docs/self-hosted.md)) |
|
|
271
|
+
| `SN_CERT_FINGERPRINT` | unset | SHA-256 TLS certificate pin for self-hosted servers |
|
|
272
|
+
| `SN_CACHE_TTL_MS` | `30000` | Read-cache freshness window (`0` = sync before every read) |
|
|
273
|
+
| `SN_TIMEZONE` | your computer's timezone | Timezone for date filters, journal and periodic tools, and template dates (an IANA name such as `Europe/London`) |
|
|
274
|
+
| `KEYCHAIN_SERVICE` | `standardnotes-mcp` | Keychain service name (multiple accounts) |
|
|
275
|
+
|
|
276
|
+
## Roadmap
|
|
277
|
+
|
|
278
|
+
Planned for the next release:
|
|
279
|
+
|
|
280
|
+
| Feature | Plan |
|
|
281
|
+
|---|---|
|
|
282
|
+
| Attachments: list names and types for everyone; open and read files on paid plans | List: Free / Open: Paid |
|
|
283
|
+
| 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
|
+
| Early warning when Standard Notes changes its API requirements | Free and paid |
|
|
286
|
+
|
|
287
|
+
## Auth lifecycle
|
|
288
|
+
|
|
289
|
+
- **Login** (`npm run setup` or `npm run login`): email, password and 2FA, once per machine. Master key derived in RAM; session stored in the OS keychain.
|
|
290
|
+
- **Every server start**: reads the keychain session — no password, no login round-trip.
|
|
291
|
+
- **Token expiry**: refreshed automatically.
|
|
292
|
+
- **`npm run logout`**: wipes the keychain session.
|
|
293
|
+
|
|
294
|
+
## Platform notes (Linux)
|
|
295
|
+
|
|
296
|
+
On Linux the session is stored in the **Secret Service** (usually gnome-keyring):
|
|
297
|
+
|
|
298
|
+
```bash
|
|
299
|
+
sudo apt install gnome-keyring libsecret-1-0 # Debian/Ubuntu/Mint
|
|
300
|
+
```
|
|
301
|
+
|
|
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 `npm run login` again or see the migration steps in [docs/troubleshooting.md](./docs/troubleshooting.md).
|
|
303
|
+
|
|
304
|
+
## Development
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
npm run typecheck && npm run lint && npm run build # full gate
|
|
308
|
+
npm run dev # tsx watch
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
## Troubleshooting & security
|
|
312
|
+
|
|
313
|
+
- [docs/troubleshooting.md](./docs/troubleshooting.md) — common errors and fixes
|
|
314
|
+
- [SECURITY.md](./SECURITY.md) — security posture and how to report vulnerabilities
|
|
315
|
+
- [docs/protocol-004.md](./docs/protocol-004.md) — encryption protocol notes
|
|
316
|
+
- [docs/self-hosted.md](./docs/self-hosted.md) — self-hosted server setup
|
|
317
|
+
|
|
318
|
+
## Credits & license
|
|
319
|
+
|
|
320
|
+
MIT. Based on [lozit/mcp-standardnotes](https://github.com/lozit/mcp-standardnotes) by Guillaume Ferrari. Cryptographic primitives by [libsodium](https://doc.libsodium.org). Developed in collaboration with [Lumo](https://lumo.proton.me), Proton's private AI assistant. Not affiliated with Standard Notes or Proton.
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported versions
|
|
4
|
+
|
|
5
|
+
| Version | Supported |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| 3.0.x | Yes |
|
|
8
|
+
| < 3.0 | No, please upgrade |
|
|
9
|
+
|
|
10
|
+
## Reporting a vulnerability
|
|
11
|
+
|
|
12
|
+
This is a personal, E2EE vault client. If you believe you have found a security issue — for example a way to leak note contents, bypass zero-knowledge encryption, escape a configured read scope, or escalate from an MCP client to the local session keys — please open a **private security advisory via GitHub Security Advisories** rather than a public issue.
|
|
13
|
+
|
|
14
|
+
Session tokens are stored in the OS keychain; never include them (or any note content) in a report. Dependency vulnerability reports are welcome too — run `npm audit` locally and reference the advisory ID (GHSA-…) in your report.
|
|
15
|
+
|
|
16
|
+
## Security posture
|
|
17
|
+
|
|
18
|
+
What this server does to protect the vault, by design:
|
|
19
|
+
|
|
20
|
+
**Encryption & credentials**
|
|
21
|
+
- Zero-knowledge intact: the password exists in RAM only during login key derivation (Argon2id); the Standard Notes server only ever sees ciphertext.
|
|
22
|
+
- Session tokens and the master key live in the OS keychain only — never in env vars, config files, or logs.
|
|
23
|
+
- stdio transport only. No HTTP listener, ever.
|
|
24
|
+
- Logs go to stderr through a redactor that masks passwords, keys, JWTs, and token-like strings.
|
|
25
|
+
- Crypto primitives from `libsodium-wrappers-sumo` (Argon2id + XChaCha20-Poly1305).
|
|
26
|
+
|
|
27
|
+
**Blast-radius controls (all opt-in via env)**
|
|
28
|
+
- `SN_READ_ONLY=true` — write tools are not registered at all; the MCP client never sees them.
|
|
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.
|
|
31
|
+
- `SN_ALLOW_EXPORT` — `vault_export` writes **decrypted plaintext to disk** and is therefore unregistered unless explicitly enabled; `SN_EXPORT_DIR` confines destinations.
|
|
32
|
+
- 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
|
+
**Input hardening**
|
|
35
|
+
- All tool inputs validated with zod.
|
|
36
|
+
- User-supplied regexes (search, find-and-replace, Smart View predicates) are length-capped and rejected on nested quantifiers (ReDoS guard).
|
|
37
|
+
- SN "protected" notes are fully invisible to the AI: no titles, bodies, counts, tags, links or search results, and direct reads or writes answer "not found", exactly as for a note that doesn't exist.
|
|
38
|
+
|
|
39
|
+
**Write integrity**
|
|
40
|
+
- Every mutation force-syncs the vault first, so an edit can never silently overwrite a newer revision made in another app; sync conflicts are retried once against the server's copy.
|
|
41
|
+
- Mutating tools return size deltas so an accidental clobber is visible without a re-read.
|
|
42
|
+
|
|
43
|
+
## Known limitations
|
|
44
|
+
|
|
45
|
+
These are outside what the server can enforce:
|
|
46
|
+
|
|
47
|
+
- **Code running as your OS user.** Any program running as you, including an AI agent with shell or file access, can still read the keychain entry or this server's memory and decrypt the vault without going through the MCP. This is a known limitation of keychain-based local tools. For a hard boundary, run such agents under a separate OS user, or point them at a test Standard Notes account.
|
|
48
|
+
- **Client identity is trust-on-config.** `SN_CLIENT_NAME` is trusted because it comes from a config file you wrote; anything that can edit that file can claim another client's identity. Without it, the self-reported handshake name is used, which any app can fake.
|
|
49
|
+
- **What the AI provider sees.** End-to-end encryption ends at this server by design. Anything the AI reads is sent to that AI's provider and kept under the provider's policy. Scopes and `ai: no-access` control what the AI can read.
|
|
50
|
+
- **Prompt injection.** Enforcement limits what a tool call can do, not what an agent does with text it reads. Notes written by others (shared or imported content) can carry instructions aimed at the AI.
|
|
51
|
+
- **Plaintext on disk.** Decrypted notes held in RAM can reach swap or hibernation files; use full-disk encryption. `vault_export`, when enabled, writes plaintext files by design.
|
|
52
|
+
- **Plain HTTP.** `SN_SERVER_URL` is not forced to `https://`. Over `http://` the note contents stay encrypted, but login exchanges and session tokens do not. Use HTTPS for anything other than `localhost`.
|
|
53
|
+
|
|
54
|
+
## Dependency policy
|
|
55
|
+
|
|
56
|
+
`npm audit` is part of release gating; advisories are fixed promptly (see the Security sections in CHANGELOG.md). Run `npm run audit` (audit level: high) before submitting changes.
|