standardnotes-mcp 3.0.0 → 3.0.1
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 +18 -0
- package/README.md +36 -20
- package/dist/cli/install.js +2 -9
- package/dist/cli/isMain.js +21 -0
- package/dist/cli/login.js +2 -11
- package/dist/cli/logout.js +1 -1
- package/dist/cli/setup.js +5 -13
- package/dist/server.js +3 -1
- package/dist/sn/client.js +4 -4
- package/dist/sn/session.js +1 -1
- package/dist/version.js +12 -0
- package/docs/self-hosted.md +6 -9
- package/docs/troubleshooting.md +89 -89
- package/package.json +5 -4
- 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,24 @@ 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.0.1] - 2026-12-05
|
|
8
|
+
|
|
9
|
+
Fixes for installing from npm.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- `standardnotes-mcp-setup` command: the guided setup (login, then connect AI clients) is now available after `npm install -g`.
|
|
13
|
+
- `server_status` reports the server version.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
- `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).
|
|
17
|
+
- 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.
|
|
18
|
+
- The version reported to MCP clients is read from package.json instead of being hard-coded.
|
|
19
|
+
- Minimum `@modelcontextprotocol/sdk` raised to the version the server actually needs.
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
- README, self-hosted and troubleshooting docs lead with the npm install; building from source is a separate section.
|
|
23
|
+
- The npm package no longer ships source maps (they pointed at source files that aren't included) or a missing banner image.
|
|
24
|
+
|
|
7
25
|
## [3.0.0] - 2026-12-05
|
|
8
26
|
|
|
9
27
|
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
|
@@ -37,35 +37,47 @@ A private [MCP](https://modelcontextprotocol.io) server that gives AI assistants
|
|
|
37
37
|
## Quick start
|
|
38
38
|
|
|
39
39
|
```bash
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
npm install
|
|
43
|
-
npm run build
|
|
44
|
-
npm run setup
|
|
40
|
+
npm install -g standardnotes-mcp
|
|
41
|
+
standardnotes-mcp-setup
|
|
45
42
|
```
|
|
46
43
|
|
|
47
|
-
`
|
|
44
|
+
`standardnotes-mcp-setup` is the whole onboarding: if no session exists it runs the login flow first (email, password, 2FA — the password is used once for key derivation and discarded), then walks you through connecting your AI clients. Re-run it any time to add or reconfigure a client.
|
|
48
45
|
|
|
49
46
|
| Command | What it does |
|
|
50
47
|
|---|---|
|
|
51
|
-
| `
|
|
52
|
-
| `
|
|
53
|
-
| `
|
|
48
|
+
| `standardnotes-mcp-setup` | Connect AI clients (runs login first if needed) |
|
|
49
|
+
| `standardnotes-mcp-login` | Authenticate and store the session in the OS keychain (re-login, or add another account) |
|
|
50
|
+
| `standardnotes-mcp-logout <email>` | Wipe the keychain session — revokes MCP access without touching your SN password |
|
|
51
|
+
| `standardnotes-mcp-install [desktop] [code]` | Non-interactive: add the server to Claude Desktop and/or print the Claude Code command |
|
|
52
|
+
| `standardnotes-mcp` | The MCP server itself; AI clients start it, you don't need to |
|
|
54
53
|
|
|
55
|
-
|
|
54
|
+
**Updating:** `npm install -g standardnotes-mcp@latest`, then fully restart your AI clients.
|
|
55
|
+
|
|
56
|
+
**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`.
|
|
57
|
+
|
|
58
|
+
### From source
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
git clone https://github.com/vtttech/standardnotes-mcp.git
|
|
62
|
+
cd standardnotes-mcp
|
|
63
|
+
npm install
|
|
64
|
+
npm run build
|
|
65
|
+
npm run setup
|
|
66
|
+
```
|
|
56
67
|
|
|
57
|
-
|
|
68
|
+
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.
|
|
58
69
|
|
|
59
70
|
## Connecting AI clients
|
|
60
71
|
|
|
61
|
-
`
|
|
72
|
+
`standardnotes-mcp-setup` offers Claude Desktop, Claude Code, ChatGPT, Kimi Code, Lumo, Cursor, or any custom client. For file-based clients (Claude Desktop, Cursor) it writes the config directly, with a timestamped backup; for the rest it prints a ready-to-paste snippet with the exact paths for your machine.
|
|
73
|
+
|
|
74
|
+
To configure a client by hand, with the package installed globally:
|
|
62
75
|
|
|
63
76
|
```json
|
|
64
77
|
{
|
|
65
78
|
"mcpServers": {
|
|
66
79
|
"standardnotes-mcp": {
|
|
67
|
-
"command": "
|
|
68
|
-
"args": ["/absolute/path/to/standardnotes-mcp/dist/index.js"],
|
|
80
|
+
"command": "standardnotes-mcp",
|
|
69
81
|
"env": {
|
|
70
82
|
"SN_EMAIL": "you@example.com",
|
|
71
83
|
"SN_CLIENT_NAME": "claude",
|
|
@@ -80,11 +92,13 @@ Installed globally, the same commands are `standardnotes-mcp-login`, `standardno
|
|
|
80
92
|
- `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
93
|
- `SN_READ_TAGS` — optional **folder scope** (see [scopes](#limiting-an-ai-to-folders-scopes)). Omit for full-vault access.
|
|
82
94
|
|
|
95
|
+
**Windows:** many clients can't start npm's `.cmd` command wrappers. If `"command": "standardnotes-mcp"` doesn't start, use `"command": "node"` with `"args": ["<path>\\standardnotes-mcp\\dist\\index.js"]`, where `<path>` is the output of `npm root -g` (for a source checkout, the path to its `dist\index.js`). `standardnotes-mcp-setup` writes this form for you.
|
|
96
|
+
|
|
83
97
|
Restart the client fully after changing its config.
|
|
84
98
|
|
|
85
99
|
### Connecting Lumo (Custom MCP settings)
|
|
86
100
|
|
|
87
|
-
|
|
101
|
+
Install the package and run `standardnotes-mcp-login` (or `standardnotes-mcp-setup`) first. Then in Lumo's MCP settings choose **Add MCP server**:
|
|
88
102
|
|
|
89
103
|
| Lumo field | Value |
|
|
90
104
|
|---|---|
|
|
@@ -93,11 +107,11 @@ Run `npm run build` and `npm run login` (or `npm run setup`) first. Then in Lumo
|
|
|
93
107
|
| **Description (optional)** | `Search, read and edit notes in my Standard Notes vault.` — Lumo is sent this text; never put credentials in it. |
|
|
94
108
|
| **Transport** | `Local (command)` |
|
|
95
109
|
| **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
|
|
110
|
+
| **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
111
|
| **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
112
|
| **Secret environment** | Leave empty. Your session is in the OS keychain. Never put your Standard Notes password anywhere. |
|
|
99
113
|
|
|
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**
|
|
114
|
+
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
115
|
|
|
102
116
|
## Free vs paid in detail
|
|
103
117
|
|
|
@@ -286,10 +300,10 @@ Planned for the next release:
|
|
|
286
300
|
|
|
287
301
|
## Auth lifecycle
|
|
288
302
|
|
|
289
|
-
- **Login** (`
|
|
303
|
+
- **Login** (`standardnotes-mcp-setup` or `standardnotes-mcp-login`): email, password and 2FA, once per machine. Master key derived in RAM; session stored in the OS keychain.
|
|
290
304
|
- **Every server start**: reads the keychain session — no password, no login round-trip.
|
|
291
305
|
- **Token expiry**: refreshed automatically.
|
|
292
|
-
- **`
|
|
306
|
+
- **`standardnotes-mcp-logout <email>`**: wipes the keychain session.
|
|
293
307
|
|
|
294
308
|
## Platform notes (Linux)
|
|
295
309
|
|
|
@@ -299,10 +313,12 @@ On Linux the session is stored in the **Secret Service** (usually gnome-keyring)
|
|
|
299
313
|
sudo apt install gnome-keyring libsecret-1-0 # Debian/Ubuntu/Mint
|
|
300
314
|
```
|
|
301
315
|
|
|
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 `
|
|
316
|
+
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
317
|
|
|
304
318
|
## Development
|
|
305
319
|
|
|
320
|
+
From a [source checkout](#from-source):
|
|
321
|
+
|
|
306
322
|
```bash
|
|
307
323
|
npm run typecheck && npm run lint && npm run build # full gate
|
|
308
324
|
npm run dev # tsx watch
|
package/dist/cli/install.js
CHANGED
|
@@ -6,6 +6,7 @@ import { dirname, join, resolve } from "node:path";
|
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
import readline from "node:readline";
|
|
8
8
|
import { storedAccounts } from "../sn/session.js";
|
|
9
|
+
import { isMainModule } from "./isMain.js";
|
|
9
10
|
/** Config key for this server in MCP client configs (renamed in 3.0.0). */
|
|
10
11
|
export const SERVER_KEY = "standardnotes-mcp";
|
|
11
12
|
const LEGACY_SERVER_KEY = "mcp-standardnotes";
|
|
@@ -170,15 +171,7 @@ async function main() {
|
|
|
170
171
|
}
|
|
171
172
|
}
|
|
172
173
|
// Don't auto-run when imported (e.g. from login.ts or tests).
|
|
173
|
-
|
|
174
|
-
try {
|
|
175
|
-
return fileURLToPath(import.meta.url) === resolve(process.argv[1] ?? "");
|
|
176
|
-
}
|
|
177
|
-
catch {
|
|
178
|
-
return false;
|
|
179
|
-
}
|
|
180
|
-
})();
|
|
181
|
-
if (isMain) {
|
|
174
|
+
if (isMainModule(import.meta.url)) {
|
|
182
175
|
main().catch((err) => {
|
|
183
176
|
process.stderr.write(`${err instanceof Error ? err.message : String(err)}\n`);
|
|
184
177
|
process.exit(1);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { realpathSync } from "node:fs";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
/**
|
|
4
|
+
* True when the module at `metaUrl` is the script node was started with.
|
|
5
|
+
*
|
|
6
|
+
* Compares real paths, because npm installs global commands on macOS and
|
|
7
|
+
* Linux as symlinks named after the command (e.g. `standardnotes-mcp-login`
|
|
8
|
+
* -> dist/cli/login.js), so `process.argv[1]` is the link, not the file.
|
|
9
|
+
*/
|
|
10
|
+
export function isMainModule(metaUrl) {
|
|
11
|
+
const entry = process.argv[1];
|
|
12
|
+
if (!entry)
|
|
13
|
+
return false;
|
|
14
|
+
try {
|
|
15
|
+
return realpathSync(entry) === realpathSync(fileURLToPath(metaUrl));
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=isMain.js.map
|
package/dist/cli/login.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import readline from "node:readline";
|
|
3
3
|
import { logger } from "../security/logger.js";
|
|
4
4
|
import { createClientFromLogin } from "../sn/client.js";
|
|
5
|
+
import { isMainModule } from "./isMain.js";
|
|
5
6
|
const CTRL_C = "\u0003";
|
|
6
7
|
const DEL = "";
|
|
7
8
|
function promptVisible(question) {
|
|
@@ -104,17 +105,7 @@ export async function runLogin() {
|
|
|
104
105
|
}
|
|
105
106
|
}
|
|
106
107
|
// Don't auto-run when imported (e.g. from setup.ts).
|
|
107
|
-
|
|
108
|
-
try {
|
|
109
|
-
return (import.meta.url === new URL(`file://${process.argv[1]}`).href ||
|
|
110
|
-
process.argv[1]?.endsWith("login.ts") === true ||
|
|
111
|
-
process.argv[1]?.endsWith("login.js") === true);
|
|
112
|
-
}
|
|
113
|
-
catch {
|
|
114
|
-
return true;
|
|
115
|
-
}
|
|
116
|
-
})();
|
|
117
|
-
if (isMain) {
|
|
108
|
+
if (isMainModule(import.meta.url)) {
|
|
118
109
|
runLogin().catch((err) => {
|
|
119
110
|
// "Login failed" was already logged with its cause chain above.
|
|
120
111
|
if (err instanceof Error && err.message !== "Login failed") {
|
package/dist/cli/logout.js
CHANGED
|
@@ -3,7 +3,7 @@ import { deleteSession } from "../sn/session.js";
|
|
|
3
3
|
async function main() {
|
|
4
4
|
const email = process.env.SN_EMAIL ?? process.argv[2];
|
|
5
5
|
if (!email) {
|
|
6
|
-
console.error("Usage:
|
|
6
|
+
console.error("Usage: standardnotes-mcp-logout <email> (or set SN_EMAIL; from a source checkout: npm run logout -- <email>)");
|
|
7
7
|
process.exit(2);
|
|
8
8
|
}
|
|
9
9
|
const removed = await deleteSession(email);
|
package/dist/cli/setup.js
CHANGED
|
@@ -3,6 +3,7 @@ import readline from "node:readline";
|
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
4
|
import { buildEntry, cursorConfigPath, installDesktop, installJsonConfig, pickEmail, printCodeInstructions, resolvePaths, storedSessionEmails, } from "./install.js";
|
|
5
5
|
import { runLogin } from "./login.js";
|
|
6
|
+
import { isMainModule } from "./isMain.js";
|
|
6
7
|
const CHOICES = [
|
|
7
8
|
{ label: "Claude (Desktop app)", defaultName: "claude", wiring: "claude-desktop" },
|
|
8
9
|
{ label: "Claude Code (CLI)", defaultName: "claude", wiring: "claude-code" },
|
|
@@ -47,11 +48,12 @@ async function wire(choice, clientName, email, paths) {
|
|
|
47
48
|
async function main() {
|
|
48
49
|
const paths = resolvePaths();
|
|
49
50
|
if (!existsSync(paths.server)) {
|
|
50
|
-
throw new Error(`Server entrypoint not found at ${paths.server}.
|
|
51
|
+
throw new Error(`Server entrypoint not found at ${paths.server}. ` +
|
|
52
|
+
"In a source checkout run `npm run build` first; otherwise reinstall: `npm install -g standardnotes-mcp`.");
|
|
51
53
|
}
|
|
52
54
|
if (process.stdin.isTTY !== true) {
|
|
53
55
|
process.stdout.write("Note: stdin is not a terminal, so line editing (backspace) may not work.\n" +
|
|
54
|
-
"For a fully interactive run
|
|
56
|
+
"For a fully interactive run, start `standardnotes-mcp-setup` directly in a terminal.\n\n");
|
|
55
57
|
}
|
|
56
58
|
// Resolve the account before opening the readline UI below: the login
|
|
57
59
|
// flow uses its own stdin handling, so it must run before this
|
|
@@ -181,17 +183,7 @@ async function main() {
|
|
|
181
183
|
rl.close();
|
|
182
184
|
}
|
|
183
185
|
}
|
|
184
|
-
|
|
185
|
-
try {
|
|
186
|
-
return (import.meta.url === new URL(`file://${process.argv[1]}`).href ||
|
|
187
|
-
process.argv[1]?.endsWith("setup.ts") === true ||
|
|
188
|
-
process.argv[1]?.endsWith("setup.js") === true);
|
|
189
|
-
}
|
|
190
|
-
catch {
|
|
191
|
-
return true;
|
|
192
|
-
}
|
|
193
|
-
})();
|
|
194
|
-
if (isMain) {
|
|
186
|
+
if (isMainModule(import.meta.url)) {
|
|
195
187
|
main().catch((err) => {
|
|
196
188
|
process.stderr.write(`${err instanceof Error ? err.message : String(err)}\n`);
|
|
197
189
|
process.exit(1);
|
package/dist/server.js
CHANGED
|
@@ -4,6 +4,7 @@ import { z } from "zod";
|
|
|
4
4
|
import { logger } from "./security/logger.js";
|
|
5
5
|
import { isToolError } from "./security/errors.js";
|
|
6
6
|
import { loadConfig } from "./config.js";
|
|
7
|
+
import { VERSION } from "./version.js";
|
|
7
8
|
import { createClientFromSession } from "./sn/client.js";
|
|
8
9
|
import { degradedFeatures } from "./sn/entitlement.js";
|
|
9
10
|
import { appendInput, createInput, createManyInput, deleteInput, deleteManyInput, frontmatterInput, getInput, listInput, registerNoteHandlers, replaceInInput, searchInput, statsInput, updateInput, updateManyInput, } from "./tools/notes.js";
|
|
@@ -60,7 +61,7 @@ export async function startServer() {
|
|
|
60
61
|
.join(" ");
|
|
61
62
|
const server = new McpServer({
|
|
62
63
|
name: "StandardNotes-MCP",
|
|
63
|
-
version:
|
|
64
|
+
version: VERSION,
|
|
64
65
|
}, { instructions });
|
|
65
66
|
const confirmDelete = config.deleteElicitation
|
|
66
67
|
? async (note) => {
|
|
@@ -209,6 +210,7 @@ export async function startServer() {
|
|
|
209
210
|
};
|
|
210
211
|
const ent = client.entitlement();
|
|
211
212
|
return {
|
|
213
|
+
serverVersion: VERSION,
|
|
212
214
|
...stats,
|
|
213
215
|
policy,
|
|
214
216
|
plan: {
|
package/dist/sn/client.js
CHANGED
|
@@ -38,7 +38,7 @@ export async function createClientFromLogin(config, password, mfaPrompt) {
|
|
|
38
38
|
}
|
|
39
39
|
if (!mfaPrompt) {
|
|
40
40
|
throw new Error("Two-factor authentication is enabled on this account. " +
|
|
41
|
-
"Run `
|
|
41
|
+
"Run `standardnotes-mcp-login` interactively (it wires the MFA prompt).");
|
|
42
42
|
}
|
|
43
43
|
const mfaKey = err.payload?.mfa_key ?? "";
|
|
44
44
|
if (!mfaKey) {
|
|
@@ -98,10 +98,10 @@ export async function createClientFromLogin(config, password, mfaPrompt) {
|
|
|
98
98
|
export async function createClientFromSession(config) {
|
|
99
99
|
const stored = await loadSession(config.email);
|
|
100
100
|
if (!stored) {
|
|
101
|
-
throw new Error("No session found. Run `
|
|
101
|
+
throw new Error("No session found. Run `standardnotes-mcp-login` to authenticate first.");
|
|
102
102
|
}
|
|
103
103
|
if (!stored.masterKeyHex || !/^[0-9a-f]{64}$/i.test(stored.masterKeyHex)) {
|
|
104
|
-
throw new Error("Stored session is missing a valid masterKey; run `
|
|
104
|
+
throw new Error("Stored session is missing a valid masterKey; run `standardnotes-mcp-login` again.");
|
|
105
105
|
}
|
|
106
106
|
const keyParams = stored.keyParams;
|
|
107
107
|
const rootKey = {
|
|
@@ -159,7 +159,7 @@ async function refreshTokens(state) {
|
|
|
159
159
|
fresh = await http.refreshSession({ serverUrl: state.serverUrl }, state.authToken, state.refreshToken);
|
|
160
160
|
}
|
|
161
161
|
catch (refreshErr) {
|
|
162
|
-
throw new Error("Session refresh failed; run `
|
|
162
|
+
throw new Error("Session refresh failed; run `standardnotes-mcp-login` to re-authenticate. " +
|
|
163
163
|
(refreshErr instanceof Error ? refreshErr.message : String(refreshErr)));
|
|
164
164
|
}
|
|
165
165
|
state.authToken = fresh.access_token;
|
package/dist/sn/session.js
CHANGED
|
@@ -36,7 +36,7 @@ export async function loadSession(email) {
|
|
|
36
36
|
return JSON.parse(raw);
|
|
37
37
|
}
|
|
38
38
|
catch {
|
|
39
|
-
throw new Error("Stored session is corrupt; run `
|
|
39
|
+
throw new Error("Stored session is corrupt; run `standardnotes-mcp-login` again.");
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
export async function deleteSession(email) {
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
/** Package version, read from package.json (one level above src/ and dist/). */
|
|
3
|
+
export const VERSION = (() => {
|
|
4
|
+
try {
|
|
5
|
+
const pkg = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
|
|
6
|
+
return typeof pkg.version === "string" ? pkg.version : "unknown";
|
|
7
|
+
}
|
|
8
|
+
catch {
|
|
9
|
+
return "unknown";
|
|
10
|
+
}
|
|
11
|
+
})();
|
|
12
|
+
//# sourceMappingURL=version.js.map
|
package/docs/self-hosted.md
CHANGED
|
@@ -31,7 +31,7 @@ Use the official Standard Notes app (web or desktop) and register against your s
|
|
|
31
31
|
Pass `SN_SERVER_URL` when running the login and the server:
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
|
-
SN_SERVER_URL=https://sn.example.com SN_EMAIL=you@example.com
|
|
34
|
+
SN_SERVER_URL=https://sn.example.com SN_EMAIL=you@example.com standardnotes-mcp-login
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
Then in your MCP client config:
|
|
@@ -41,8 +41,7 @@ Then in your MCP client config:
|
|
|
41
41
|
"mcpServers": {
|
|
42
42
|
"standardnotes-mcp": {
|
|
43
43
|
"type": "stdio",
|
|
44
|
-
"command": "
|
|
45
|
-
"args": ["/absolute/path/to/standardnotes-mcp/dist/index.js"],
|
|
44
|
+
"command": "standardnotes-mcp",
|
|
46
45
|
"env": {
|
|
47
46
|
"SN_EMAIL": "you@example.com",
|
|
48
47
|
"SN_SERVER_URL": "https://sn.example.com"
|
|
@@ -67,7 +66,7 @@ echo | openssl s_client -connect sn.example.com:443 -servername sn.example.com 2
|
|
|
67
66
|
Output looks like `7a3c9b...` (64 hex chars). Set it in your env:
|
|
68
67
|
|
|
69
68
|
```bash
|
|
70
|
-
SN_CERT_FINGERPRINT=7a3c9b... SN_SERVER_URL=https://sn.example.com
|
|
69
|
+
SN_CERT_FINGERPRINT=7a3c9b... SN_SERVER_URL=https://sn.example.com standardnotes-mcp-login
|
|
71
70
|
```
|
|
72
71
|
|
|
73
72
|
And mirror it into your MCP client config's `env` block. Re-run the fingerprint extraction after every cert renewal.
|
|
@@ -80,8 +79,7 @@ Each MCP instance is single-account. If you host multiple users on the same SN s
|
|
|
80
79
|
{
|
|
81
80
|
"mcpServers": {
|
|
82
81
|
"alice-notes": {
|
|
83
|
-
"command": "
|
|
84
|
-
"args": ["/path/to/standardnotes-mcp/dist/index.js"],
|
|
82
|
+
"command": "standardnotes-mcp",
|
|
85
83
|
"env": {
|
|
86
84
|
"SN_EMAIL": "alice@example.com",
|
|
87
85
|
"SN_SERVER_URL": "https://sn.example.com",
|
|
@@ -89,8 +87,7 @@ Each MCP instance is single-account. If you host multiple users on the same SN s
|
|
|
89
87
|
}
|
|
90
88
|
},
|
|
91
89
|
"bob-notes": {
|
|
92
|
-
"command": "
|
|
93
|
-
"args": ["/path/to/standardnotes-mcp/dist/index.js"],
|
|
90
|
+
"command": "standardnotes-mcp",
|
|
94
91
|
"env": {
|
|
95
92
|
"SN_EMAIL": "bob@example.com",
|
|
96
93
|
"SN_SERVER_URL": "https://sn.example.com",
|
|
@@ -116,7 +113,7 @@ If you've given your account a subscription on your own server, following Standa
|
|
|
116
113
|
|
|
117
114
|
## Troubleshooting
|
|
118
115
|
|
|
119
|
-
If you can log in via the official SN app but `
|
|
116
|
+
If you can log in via the official SN app but `standardnotes-mcp-login` fails, the most common causes are:
|
|
120
117
|
|
|
121
118
|
- `SN_SERVER_URL` includes a trailing slash or wrong scheme — drop the slash, use `https://`.
|
|
122
119
|
- TLS cert is invalid (expired, wrong hostname, untrusted CA): fix it at the server, or pin with `SN_CERT_FINGERPRINT` if it's intentional self-signed.
|
package/docs/troubleshooting.md
CHANGED
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
# Troubleshooting
|
|
2
|
-
|
|
3
|
-
### "No session found. Run `
|
|
4
|
-
|
|
5
|
-
The keychain lookup (`service: standardnotes-mcp`, `username: SN_EMAIL`) found nothing. (Sessions saved by versions before 3.0.0 under the old name `mcp-standardnotes` are moved over automatically on first start.) Make sure `SN_EMAIL` matches the email you used at login **exactly** (case-sensitive on some OSes).
|
|
6
|
-
|
|
7
|
-
### "Account is not on protocol 004..."
|
|
8
|
-
|
|
9
|
-
Legacy 003 accounts are rejected. Upgrade via the official Standard Notes app (Preferences → Security → Upgrade Encryption).
|
|
10
|
-
|
|
11
|
-
### Notes created via MCP don't appear in the official SN app
|
|
12
|
-
|
|
13
|
-
This was a known bug fixed in early 2026: the AAD `kp` field must be omitted for items-key-encrypted notes/tags (it's only included for items_keys encrypted under the root key). If you're on an old revision of this project and see this symptom, update.
|
|
14
|
-
|
|
15
|
-
### Server disconnects immediately in the MCP client
|
|
16
|
-
|
|
17
|
-
Logs show `SyntaxError: Unexpected token '??='`?
|
|
18
|
-
|
|
19
|
-
The MCP client does not inherit your shell's `nvm` setup — it's resolving `node` to an old version from its own PATH. Use an **absolute path** to a Node ≥ 20 binary in the `command` field:
|
|
20
|
-
|
|
21
|
-
```json
|
|
22
|
-
{
|
|
23
|
-
"mcpServers": {
|
|
24
|
-
"standardnotes-mcp": {
|
|
25
|
-
"command": "/Users/you/.nvm/versions/node/v22.13.1/bin/node",
|
|
26
|
-
"args": ["/
|
|
27
|
-
"env": { "SN_EMAIL": "you@example.com" }
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
Then quit the MCP client completely and relaunch.
|
|
34
|
-
|
|
35
|
-
Logs go to stderr
|
|
36
|
-
|
|
37
|
-
### Rate limited (429) after repeated logins
|
|
38
|
-
|
|
39
|
-
Standard Notes caps auth at ~5/min. Wait a minute before retrying. Do **not** retry in a loop.
|
|
40
|
-
|
|
41
|
-
### Sync returns conflicts
|
|
42
|
-
|
|
43
|
-
On create/update, if the server returns conflicts, the MCP throws with the conflict payload instead of silently swallowing. For `notes_update`, the common cause is a stale `updated_at_timestamp` — fetch the note fresh (`notes_get`) and retry.
|
|
44
|
-
|
|
45
|
-
### Linux: keychain library won't load
|
|
46
|
-
|
|
47
|
-
As of v0.7.0 the keychain layer is `@napi-rs/keyring`, which ships prebuilt native binaries - there is no compile step and no libsecret headers needed. If loading fails, check your platform is supported (x64/arm64 glibc and musl Linux are covered) and that `node_modules/@napi-rs/keyring-*/keyring.*.node` exists after
|
|
48
|
-
|
|
49
|
-
### Linux: secret store fails or hangs, or MCP cannot read the session
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
pgrep -a gnome-keyring-daemon || sudo apt install gnome-keyring libpam-gnome-keyring
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
Then log out of the desktop and back in so PAM unlocks the `login` keyring. Over SSH (no PAM unlock) either run `
|
|
58
|
-
|
|
59
|
-
### I want to switch accounts
|
|
60
|
-
|
|
61
|
-
Wipe the current session from the keychain, then re-login:
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
|
|
65
|
-
SN_EMAIL=new@example.com
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### Migrating a keytar-era session (Linux)
|
|
69
|
-
|
|
70
|
-
Sessions written by old keytar builds use a different Secret Service attribute layout (`account` vs `username`). Either run `
|
|
71
|
-
|
|
72
|
-
```bash
|
|
73
|
-
pip install secretstorage
|
|
74
|
-
python3 - << 'PYEOF'
|
|
75
|
-
import secretstorage
|
|
76
|
-
conn = secretstorage.dbus_init()
|
|
77
|
-
coll = secretstorage.get_default_collection(conn)
|
|
78
|
-
for item in coll.get_all_items():
|
|
79
|
-
attrs = item.get_attributes()
|
|
80
|
-
if attrs.get('service') == 'mcp-standardnotes' and 'account' in attrs:
|
|
81
|
-
account = attrs['account']
|
|
82
|
-
secret = item.get_secret()
|
|
83
|
-
item.delete()
|
|
84
|
-
coll.create_item(f'keyring:{account}@standardnotes-mcp',
|
|
85
|
-
{'service': 'standardnotes-mcp', 'username': account,
|
|
86
|
-
'xdg:schema': 'org.freedesktop.Secret.Generic'}, secret)
|
|
87
|
-
print(f'MIGRATED: {account}')
|
|
88
|
-
PYEOF
|
|
89
|
-
```
|
|
1
|
+
# Troubleshooting
|
|
2
|
+
|
|
3
|
+
### "No session found. Run `standardnotes-mcp-login` to authenticate first."
|
|
4
|
+
|
|
5
|
+
The keychain lookup (`service: standardnotes-mcp`, `username: SN_EMAIL`) found nothing. (Sessions saved by versions before 3.0.0 under the old name `mcp-standardnotes` are moved over automatically on first start.) Make sure `SN_EMAIL` matches the email you used at login **exactly** (case-sensitive on some OSes).
|
|
6
|
+
|
|
7
|
+
### "Account is not on protocol 004..."
|
|
8
|
+
|
|
9
|
+
Legacy 003 accounts are rejected. Upgrade via the official Standard Notes app (Preferences → Security → Upgrade Encryption).
|
|
10
|
+
|
|
11
|
+
### Notes created via MCP don't appear in the official SN app
|
|
12
|
+
|
|
13
|
+
This was a known bug fixed in early 2026: the AAD `kp` field must be omitted for items-key-encrypted notes/tags (it's only included for items_keys encrypted under the root key). If you're on an old revision of this project and see this symptom, update.
|
|
14
|
+
|
|
15
|
+
### Server disconnects immediately in the MCP client
|
|
16
|
+
|
|
17
|
+
Logs show `SyntaxError: Unexpected token '??='`?
|
|
18
|
+
|
|
19
|
+
The MCP client does not inherit your shell's `nvm` setup — it's resolving `node` to an old version from its own PATH. Use an **absolute path** to a Node ≥ 20 binary in the `command` field:
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"mcpServers": {
|
|
24
|
+
"standardnotes-mcp": {
|
|
25
|
+
"command": "/Users/you/.nvm/versions/node/v22.13.1/bin/node",
|
|
26
|
+
"args": ["/Users/you/.nvm/versions/node/v22.13.1/lib/node_modules/standardnotes-mcp/dist/index.js"],
|
|
27
|
+
"env": { "SN_EMAIL": "you@example.com" }
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The `args` path is the server inside your global npm folder (`npm root -g` prints it); for a source checkout, use its `dist/index.js`. Then quit the MCP client completely and relaunch.
|
|
34
|
+
|
|
35
|
+
Logs go to stderr; MCP clients capture and display them.
|
|
36
|
+
|
|
37
|
+
### Rate limited (429) after repeated logins
|
|
38
|
+
|
|
39
|
+
Standard Notes caps auth at ~5/min. Wait a minute before retrying. Do **not** retry in a loop.
|
|
40
|
+
|
|
41
|
+
### Sync returns conflicts
|
|
42
|
+
|
|
43
|
+
On create/update, if the server returns conflicts, the MCP throws with the conflict payload instead of silently swallowing. For `notes_update`, the common cause is a stale `updated_at_timestamp` — fetch the note fresh (`notes_get`) and retry.
|
|
44
|
+
|
|
45
|
+
### Linux: keychain library won't load
|
|
46
|
+
|
|
47
|
+
As of v0.7.0 the keychain layer is `@napi-rs/keyring`, which ships prebuilt native binaries - there is no compile step and no libsecret headers needed. If loading fails, check your platform is supported (x64/arm64 glibc and musl Linux are covered) and that `node_modules/@napi-rs/keyring-*/keyring.*.node` exists after installing; a corrupted install is fixed by reinstalling (`npm install -g standardnotes-mcp`, or `rm -rf node_modules && npm install` in a source checkout).
|
|
48
|
+
|
|
49
|
+
### Linux: secret store fails or hangs, or MCP cannot read the session
|
|
50
|
+
|
|
51
|
+
The keychain library reaches the Secret Service over the D-Bus session bus, normally served by `gnome-keyring-daemon`. Check it is alive:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pgrep -a gnome-keyring-daemon || sudo apt install gnome-keyring libpam-gnome-keyring
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Then log out of the desktop and back in so PAM unlocks the `login` keyring. Over SSH (no PAM unlock) either run `standardnotes-mcp-login` from a desktop session instead, or export `DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$UID/bus` and unlock the keyring with `gnome-keyring-daemon --unlock`.
|
|
58
|
+
|
|
59
|
+
### I want to switch accounts
|
|
60
|
+
|
|
61
|
+
Wipe the current session from the keychain, then re-login:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
standardnotes-mcp-logout old@example.com
|
|
65
|
+
SN_EMAIL=new@example.com standardnotes-mcp-login
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Migrating a keytar-era session (Linux)
|
|
69
|
+
|
|
70
|
+
Sessions written by old keytar builds use a different Secret Service attribute layout (`account` vs `username`). Either run `standardnotes-mcp-login` again, or migrate in place:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
pip install secretstorage
|
|
74
|
+
python3 - << 'PYEOF'
|
|
75
|
+
import secretstorage
|
|
76
|
+
conn = secretstorage.dbus_init()
|
|
77
|
+
coll = secretstorage.get_default_collection(conn)
|
|
78
|
+
for item in coll.get_all_items():
|
|
79
|
+
attrs = item.get_attributes()
|
|
80
|
+
if attrs.get('service') == 'mcp-standardnotes' and 'account' in attrs:
|
|
81
|
+
account = attrs['account']
|
|
82
|
+
secret = item.get_secret()
|
|
83
|
+
item.delete()
|
|
84
|
+
coll.create_item(f'keyring:{account}@standardnotes-mcp',
|
|
85
|
+
{'service': 'standardnotes-mcp', 'username': account,
|
|
86
|
+
'xdg:schema': 'org.freedesktop.Secret.Generic'}, secret)
|
|
87
|
+
print(f'MIGRATED: {account}')
|
|
88
|
+
PYEOF
|
|
89
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "standardnotes-mcp",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Local MCP server for Standard Notes: gives AI assistants scoped, rule-governed access to your end-to-end encrypted notes, with free-plan support and OS-keychain login. Based on lozit/mcp-standardnotes (MIT).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "VTT",
|
|
@@ -26,13 +26,14 @@
|
|
|
26
26
|
"standardnotes-mcp": "dist/index.js",
|
|
27
27
|
"standardnotes-mcp-login": "dist/cli/login.js",
|
|
28
28
|
"standardnotes-mcp-logout": "dist/cli/logout.js",
|
|
29
|
-
"standardnotes-mcp-install": "dist/cli/install.js"
|
|
29
|
+
"standardnotes-mcp-install": "dist/cli/install.js",
|
|
30
|
+
"standardnotes-mcp-setup": "dist/cli/setup.js"
|
|
30
31
|
},
|
|
31
32
|
"files": [
|
|
32
33
|
"dist/",
|
|
33
34
|
"!dist/cli/dump-note.*",
|
|
35
|
+
"!dist/**/*.map",
|
|
34
36
|
"docs/",
|
|
35
|
-
"banner@2x.png",
|
|
36
37
|
"README.md",
|
|
37
38
|
"LICENSE",
|
|
38
39
|
"CHANGELOG.md",
|
|
@@ -54,7 +55,7 @@
|
|
|
54
55
|
"setup": "tsx src/cli/setup.ts"
|
|
55
56
|
},
|
|
56
57
|
"dependencies": {
|
|
57
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
58
|
+
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
58
59
|
"@napi-rs/keyring": "^2.1.2",
|
|
59
60
|
"libsodium-wrappers-sumo": "^0.8.4",
|
|
60
61
|
"undici": "^7.29.0",
|