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
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { isPaid } from "../sn/entitlement.js";
|
|
3
|
+
export const smartviewsListInput = z.object({});
|
|
4
|
+
export const smartviewsNotesInput = z.object({
|
|
5
|
+
view: z
|
|
6
|
+
.string()
|
|
7
|
+
.min(1)
|
|
8
|
+
.max(256)
|
|
9
|
+
.describe("Smart view UUID or title (case-insensitive), e.g. \"Action items\""),
|
|
10
|
+
limit: z.number().int().min(1).max(200).default(50),
|
|
11
|
+
offset: z.number().int().min(0).default(0),
|
|
12
|
+
});
|
|
13
|
+
// Predicate trees are validated structurally in the client (isPredicateJson);
|
|
14
|
+
// zod just guarantees "some JSON object".
|
|
15
|
+
export const notesQueryInput = z.object({
|
|
16
|
+
predicate: z
|
|
17
|
+
.record(z.string(), z.unknown())
|
|
18
|
+
.describe('SN predicate JSON. Leaf: {"keypath":"title","operator":"startsWith","value":"Weekly"}. Compound: {"operator":"and","value":[<leaf>, ...]}. Operators: =, !=, <, >, <=, >=, startsWith, includes, matches (regex), in, not, and, or. Keypaths: title, text, trashed, archived, pinned, noteType, tagsCount, created_at_timestamp, updated_at_timestamp, and frontmatter.<key> for YAML frontmatter fields (e.g. {"keypath":"frontmatter.status","operator":"=","value":"active"}; use includes for list fields like frontmatter.tags).'),
|
|
19
|
+
limit: z.number().int().min(1).max(200).default(50),
|
|
20
|
+
offset: z.number().int().min(0).default(0),
|
|
21
|
+
});
|
|
22
|
+
// Second line of defence: the client never returns protected notes.
|
|
23
|
+
const notProtected = (n) => !n.protected;
|
|
24
|
+
export function registerSmartViewHandlers(client) {
|
|
25
|
+
return {
|
|
26
|
+
smartviews_list: async (raw) => {
|
|
27
|
+
smartviewsListInput.parse(raw ?? {});
|
|
28
|
+
const smartViews = await client.listSmartViews();
|
|
29
|
+
if (smartViews.length === 0 && !isPaid(client.entitlement())) {
|
|
30
|
+
return {
|
|
31
|
+
smartViews,
|
|
32
|
+
notice: "Smart Views are a paid Standard Notes feature, so this account has none. notes_query can run the same kind of filter on demand.",
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return { smartViews };
|
|
36
|
+
},
|
|
37
|
+
smartviews_notes: async (raw) => {
|
|
38
|
+
const { view, limit, offset } = smartviewsNotesInput.parse(raw);
|
|
39
|
+
const result = await client.runSmartView(view, { limit, offset });
|
|
40
|
+
return { ...result, notes: result.notes.filter(notProtected) };
|
|
41
|
+
},
|
|
42
|
+
notes_query: async (raw) => {
|
|
43
|
+
const { predicate, limit, offset } = notesQueryInput.parse(raw);
|
|
44
|
+
const result = await client.runPredicateQuery(predicate, {
|
|
45
|
+
limit,
|
|
46
|
+
offset,
|
|
47
|
+
});
|
|
48
|
+
return { ...result, notes: result.notes.filter(notProtected) };
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=smartviews.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smartviews.js","sourceRoot":"","sources":["../../src/tools/smartviews.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAEhD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,GAAG,CAAC;SACR,QAAQ,CAAC,oEAAoE,CAAC;IACjF,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IACnD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;CAC3C,CAAC,CAAC;AAEH,8EAA8E;AAC9E,0CAA0C;AAC1C,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,SAAS,EAAE,CAAC;SACT,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;SAC/B,QAAQ,CACP,ugBAAugB,CACxgB;IACH,KAA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E,KAAK,EAAE,GAAY,EAAE,EAAE;YAClC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAChE,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC,SAAS,EAAE;gBACvD,KAAK;gBACL,MAAM;aACP,CAAC,CAAC;YACH,OAAO,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC;QACjE,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const uuidSchema = z.string().uuid();
|
|
3
|
+
const titleSchema = z.string().min(1).max(256);
|
|
4
|
+
export const tagsListInput = z.object({});
|
|
5
|
+
export const tagsGetInput = z.object({ uuid: uuidSchema });
|
|
6
|
+
export const tagsCreateInput = z.object({
|
|
7
|
+
title: titleSchema,
|
|
8
|
+
parent: uuidSchema
|
|
9
|
+
.optional()
|
|
10
|
+
.describe("Optional parent tag UUID (nests the new tag under it)"),
|
|
11
|
+
});
|
|
12
|
+
export const tagsUpdateInput = z
|
|
13
|
+
.object({
|
|
14
|
+
uuid: uuidSchema,
|
|
15
|
+
title: titleSchema.optional(),
|
|
16
|
+
// `null` moves the tag back to the top level; omit to leave the parent
|
|
17
|
+
// link untouched.
|
|
18
|
+
parent: uuidSchema
|
|
19
|
+
.nullable()
|
|
20
|
+
.optional()
|
|
21
|
+
.describe("Set to a tag UUID to re-parent, or null to detach from the current parent"),
|
|
22
|
+
})
|
|
23
|
+
.refine((v) => v.title !== undefined || v.parent !== undefined, {
|
|
24
|
+
message: "provide at least one of title or parent",
|
|
25
|
+
});
|
|
26
|
+
export const tagsDeleteInput = z.object({ uuid: uuidSchema });
|
|
27
|
+
export const tagsAttachInput = z.object({
|
|
28
|
+
noteUuid: uuidSchema,
|
|
29
|
+
tagUuid: uuidSchema,
|
|
30
|
+
});
|
|
31
|
+
export const tagsDetachInput = tagsAttachInput;
|
|
32
|
+
export const syncInput = z.object({});
|
|
33
|
+
export function registerTagHandlers(client) {
|
|
34
|
+
return {
|
|
35
|
+
tags_list: async (raw) => {
|
|
36
|
+
tagsListInput.parse(raw ?? {});
|
|
37
|
+
return client.listTags();
|
|
38
|
+
},
|
|
39
|
+
tags_get: async (raw) => {
|
|
40
|
+
const { uuid } = tagsGetInput.parse(raw);
|
|
41
|
+
const tag = await client.getTag(uuid);
|
|
42
|
+
if (!tag)
|
|
43
|
+
throw new Error(`Tag ${uuid} not found`);
|
|
44
|
+
return tag;
|
|
45
|
+
},
|
|
46
|
+
tags_create: async (raw) => {
|
|
47
|
+
const args = tagsCreateInput.parse(raw);
|
|
48
|
+
const uuid = await client.createTag(args);
|
|
49
|
+
await client.sync();
|
|
50
|
+
return { uuid };
|
|
51
|
+
},
|
|
52
|
+
tags_update: async (raw) => {
|
|
53
|
+
const args = tagsUpdateInput.parse(raw);
|
|
54
|
+
await client.updateTag(args);
|
|
55
|
+
await client.sync();
|
|
56
|
+
return { ok: true };
|
|
57
|
+
},
|
|
58
|
+
tags_delete: async (raw) => {
|
|
59
|
+
const { uuid } = tagsDeleteInput.parse(raw);
|
|
60
|
+
await client.deleteTag(uuid);
|
|
61
|
+
await client.sync();
|
|
62
|
+
return { ok: true };
|
|
63
|
+
},
|
|
64
|
+
tags_attach: async (raw) => {
|
|
65
|
+
const { noteUuid, tagUuid } = tagsAttachInput.parse(raw);
|
|
66
|
+
await client.attachTag(noteUuid, tagUuid);
|
|
67
|
+
await client.sync();
|
|
68
|
+
return { ok: true };
|
|
69
|
+
},
|
|
70
|
+
tags_detach: async (raw) => {
|
|
71
|
+
const { noteUuid, tagUuid } = tagsDetachInput.parse(raw);
|
|
72
|
+
await client.detachTag(noteUuid, tagUuid);
|
|
73
|
+
await client.sync();
|
|
74
|
+
return { ok: true };
|
|
75
|
+
},
|
|
76
|
+
sync: async (raw) => {
|
|
77
|
+
syncInput.parse(raw ?? {});
|
|
78
|
+
return client.sync();
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=tags.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tags.js","sourceRoot":"","sources":["../../src/tools/tags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC;AAE5C,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAE/C,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAE1C,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;AAE3D,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,KAAK,EAAE,WAAW;IAClB,MAAM,EAAE,UAAU;SACf,QAAQ,EAAE;SACV,QAAQ,CAAC,uDAAuD,CAAC;CACrE,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC;KAC7B,MAAM,CAAC;IACN,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,WAAW,CAAC,QAAQ,EAAE;IAC7B,uEAAuE;IACvE,kBAAkB;IAClB,MAAM,EAAE,UAAU;SACf,QAAQ,EAAE;SACV,QAAQ,EAAE;SACV,QAAQ,CACP,2EAA2E,CAC5E;CACJ,CAAC;KACD,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,CAAC,CAAC,MAAM,KAAK,SAAS,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KAAK,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC;YAC3B,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { uuidSchema } from "./notes.js";
|
|
3
|
+
export const tasksInput = z.object({
|
|
4
|
+
includeDone: z
|
|
5
|
+
.boolean()
|
|
6
|
+
.default(false)
|
|
7
|
+
.describe("Include completed tasks (default: open tasks only)"),
|
|
8
|
+
tag: z
|
|
9
|
+
.string()
|
|
10
|
+
.min(1)
|
|
11
|
+
.max(256)
|
|
12
|
+
.optional()
|
|
13
|
+
.describe("Restrict to notes under this tag/folder (subtree included)"),
|
|
14
|
+
noteUuid: uuidSchema
|
|
15
|
+
.optional()
|
|
16
|
+
.describe("Restrict to one note"),
|
|
17
|
+
limit: z.number().int().min(1).max(500).default(100),
|
|
18
|
+
});
|
|
19
|
+
export const taskToggleInput = z.object({
|
|
20
|
+
uuid: uuidSchema.describe("The note containing the task"),
|
|
21
|
+
line: z
|
|
22
|
+
.number()
|
|
23
|
+
.int()
|
|
24
|
+
.min(0)
|
|
25
|
+
.describe("Line number from notes_tasks (0-based, within the note body)"),
|
|
26
|
+
done: z.boolean().describe("true = check the box, false = uncheck"),
|
|
27
|
+
});
|
|
28
|
+
export function registerTaskHandlers(client) {
|
|
29
|
+
return {
|
|
30
|
+
notes_tasks: async (raw) => {
|
|
31
|
+
const args = tasksInput.parse(raw ?? {});
|
|
32
|
+
const tasks = await client.listTasks(args);
|
|
33
|
+
return { count: tasks.length, tasks };
|
|
34
|
+
},
|
|
35
|
+
notes_task_toggle: async (raw) => {
|
|
36
|
+
const { uuid, line, done } = taskToggleInput.parse(raw);
|
|
37
|
+
const delta = await client.toggleTask(uuid, line, done);
|
|
38
|
+
await client.sync();
|
|
39
|
+
return { ok: true, uuid, line, done, ...delta };
|
|
40
|
+
},
|
|
41
|
+
};
|
|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;YAClC,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC;YACzC,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAC3C,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC;QACxC,CAAC;QACD,iBAAiB,EAAE,KAAK,EAAE,GAAY,EAAE,EAAE;YACxC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACxD,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;YACxD,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;YACpB,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,CAAC;QAClD,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ToolError, isToolError } from "../security/errors.js";
|
|
3
|
+
import { isoWeek, resolveTimeZone, timeInZone, todayInZone } from "../sn/dates.js";
|
|
4
|
+
import { renderTemplate } from "../sn/templates.js";
|
|
5
|
+
import { decideNoteType } from "../sn/entitlement.js";
|
|
6
|
+
import { uuidSchema } from "./notes.js";
|
|
7
|
+
export const templatesListInput = z.object({});
|
|
8
|
+
export const createFromTemplateInput = z.object({
|
|
9
|
+
template: z
|
|
10
|
+
.string()
|
|
11
|
+
.min(1)
|
|
12
|
+
.max(256)
|
|
13
|
+
.describe("Template note uuid or title (from templates_list)"),
|
|
14
|
+
title: z
|
|
15
|
+
.string()
|
|
16
|
+
.max(500)
|
|
17
|
+
.optional()
|
|
18
|
+
.describe("Title for the new note; may use placeholders like {{date}}. Defaults to the template's title, rendered."),
|
|
19
|
+
vars: z
|
|
20
|
+
.record(z.string().regex(/^[A-Za-z0-9_-]+$/), z.string().max(10_000))
|
|
21
|
+
.optional()
|
|
22
|
+
.describe('Values for custom placeholders, e.g. {"client": "Acme"} fills {{client}}'),
|
|
23
|
+
tags: z
|
|
24
|
+
.array(uuidSchema)
|
|
25
|
+
.max(20)
|
|
26
|
+
.optional()
|
|
27
|
+
.describe("Extra tag uuids to file the new note under (in addition to the template's own folders)"),
|
|
28
|
+
});
|
|
29
|
+
const BUILTINS = "{{date}}, {{time}}, {{datetime}}, {{title}}, {{week}}, {{month}}, {{year}}";
|
|
30
|
+
export function registerTemplateHandlers(client, templatesTag) {
|
|
31
|
+
/** Notes under the templates folder (and its subfolders) this client can see. */
|
|
32
|
+
const listTemplates = async () => {
|
|
33
|
+
try {
|
|
34
|
+
return await client.listNotes({
|
|
35
|
+
tag: templatesTag,
|
|
36
|
+
includeDescendants: true,
|
|
37
|
+
includeTrashed: false,
|
|
38
|
+
limit: 200,
|
|
39
|
+
offset: 0,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
// No such folder, or it's outside this client's scope: no templates.
|
|
44
|
+
if (isToolError(err) && err.reason === "tag_not_found")
|
|
45
|
+
return null;
|
|
46
|
+
throw err;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const noTemplatesNotice = `No "${templatesTag}" folder is visible. Create a top-level "${templatesTag}" folder in Standard Notes and put template notes in it (placeholders: ${BUILTINS}, or any {{name}} you pass in vars).`;
|
|
50
|
+
return {
|
|
51
|
+
templates_list: async (raw) => {
|
|
52
|
+
templatesListInput.parse(raw ?? {});
|
|
53
|
+
const templates = await listTemplates();
|
|
54
|
+
if (templates === null)
|
|
55
|
+
return { folder: templatesTag, templates: [], notice: noTemplatesNotice };
|
|
56
|
+
return {
|
|
57
|
+
folder: templatesTag,
|
|
58
|
+
templates: templates.map((t) => ({
|
|
59
|
+
uuid: t.uuid,
|
|
60
|
+
title: t.title,
|
|
61
|
+
noteType: t.noteType,
|
|
62
|
+
})),
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
notes_create_from_template: async (raw) => {
|
|
66
|
+
const args = createFromTemplateInput.parse(raw);
|
|
67
|
+
const templates = await listTemplates();
|
|
68
|
+
if (templates === null) {
|
|
69
|
+
throw new ToolError("template_not_found", noTemplatesNotice);
|
|
70
|
+
}
|
|
71
|
+
const wanted = args.template.toLowerCase();
|
|
72
|
+
const summary = templates.find((t) => t.uuid === args.template) ??
|
|
73
|
+
templates.find((t) => t.title.toLowerCase() === wanted);
|
|
74
|
+
if (!summary) {
|
|
75
|
+
throw new ToolError("template_not_found", `No template "${args.template}" in the "${templatesTag}" folder.`, "Run templates_list to see the available templates.");
|
|
76
|
+
}
|
|
77
|
+
const template = await client.getNote(summary.uuid);
|
|
78
|
+
if (!template) {
|
|
79
|
+
throw new ToolError("template_not_found", `Template ${summary.uuid} not found.`);
|
|
80
|
+
}
|
|
81
|
+
const tz = resolveTimeZone();
|
|
82
|
+
const date = todayInZone(tz);
|
|
83
|
+
const time = timeInZone(tz);
|
|
84
|
+
const base = {
|
|
85
|
+
date,
|
|
86
|
+
time,
|
|
87
|
+
datetime: `${date} ${time}`,
|
|
88
|
+
week: isoWeek(date).label,
|
|
89
|
+
month: date.slice(0, 7),
|
|
90
|
+
year: date.slice(0, 4),
|
|
91
|
+
...(args.vars ?? {}),
|
|
92
|
+
};
|
|
93
|
+
const renderedTitle = renderTemplate(args.title ?? template.title, base);
|
|
94
|
+
const values = { ...base, title: renderedTitle.text };
|
|
95
|
+
const isSuper = template.noteType === "super";
|
|
96
|
+
const body = renderTemplate(template.text, values, isSuper);
|
|
97
|
+
// Folders: the template's own, minus the templates folder subtree,
|
|
98
|
+
// plus any requested. createNote enforces scope on all of them.
|
|
99
|
+
const templateFolders = new Set((await listTemplateFolderUuids(client, templatesTag)) ?? []);
|
|
100
|
+
const ownTags = (await client.getNoteTagUuids(template.uuid)).filter((t) => !templateFolders.has(t));
|
|
101
|
+
const tags = [...new Set([...ownTags, ...(args.tags ?? [])])];
|
|
102
|
+
// Same plan rules as notes_create: a super template is refused on a
|
|
103
|
+
// free account, other paid editor types become plain text.
|
|
104
|
+
const decision = decideNoteType(template.noteType, client.entitlement());
|
|
105
|
+
const uuid = await client.createNote({
|
|
106
|
+
title: renderedTitle.text,
|
|
107
|
+
text: body.text,
|
|
108
|
+
noteType: template.noteType,
|
|
109
|
+
tags,
|
|
110
|
+
});
|
|
111
|
+
await client.sync();
|
|
112
|
+
const unfilled = [...new Set([...renderedTitle.unfilled, ...body.unfilled])];
|
|
113
|
+
return {
|
|
114
|
+
uuid,
|
|
115
|
+
title: renderedTitle.text,
|
|
116
|
+
template: { uuid: template.uuid, title: template.title },
|
|
117
|
+
// {{date}}/{{time}} were filled in this zone (SN_TIMEZONE, else the computer's).
|
|
118
|
+
timezone: tz,
|
|
119
|
+
...(unfilled.length > 0 ? { unfilled } : {}),
|
|
120
|
+
...(decision.notice ? { notices: [decision.notice] } : {}),
|
|
121
|
+
};
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
/** uuids of the templates folder and its subfolders, or null if not visible. */
|
|
126
|
+
async function listTemplateFolderUuids(client, templatesTag) {
|
|
127
|
+
const tags = await client.listTags();
|
|
128
|
+
const root = tags.find((t) => t.uuid === templatesTag) ??
|
|
129
|
+
tags.find((t) => t.title.toLowerCase() === templatesTag.toLowerCase());
|
|
130
|
+
if (!root)
|
|
131
|
+
return null;
|
|
132
|
+
const out = new Set([root.uuid]);
|
|
133
|
+
let grew = true;
|
|
134
|
+
while (grew) {
|
|
135
|
+
grew = false;
|
|
136
|
+
for (const t of tags) {
|
|
137
|
+
if (t.parentUuid !== null && out.has(t.parentUuid) && !out.has(t.uuid)) {
|
|
138
|
+
out.add(t.uuid);
|
|
139
|
+
grew = true;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return [...out];
|
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C,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,YAAY,CAAC,WAAW,EAAE,CAAC,CAAC;IACzE,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACvB,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACjC,IAAI,IAAI,GAAG,IAAI,CAAC;IAChB,OAAO,IAAI,EAAE,CAAC;QACZ,IAAI,GAAG,KAAK,CAAC;QACb,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;YACrB,IAAI,CAAC,CAAC,UAAU,KAAK,IAAI,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;gBACvE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;gBAChB,IAAI,GAAG,IAAI,CAAC;YACd,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Standard Notes protocol 004 — how it works here
|
|
2
|
+
|
|
3
|
+
This document explains what parts of the protocol this server implements locally, and what it deliberately does *not* reimplement.
|
|
4
|
+
|
|
5
|
+
## Threat model & security guarantees
|
|
6
|
+
|
|
7
|
+
- **Your password** is only used in RAM to derive the root key (Argon2id). It is never logged, never written to disk, never sent to the server (only the derived `serverPassword` hex is, over TLS).
|
|
8
|
+
- **Your master key** is derived locally and stays on your machine. It's stored (hex-encoded) in the OS keychain alongside the session token — never in a plaintext file.
|
|
9
|
+
- **All note content** is decrypted *locally*. The server only ever sees ciphertext.
|
|
10
|
+
- **Transport is stdio only.** This process opens no network port. If a future maintainer proposes adding an HTTP transport, the answer is no: a local secrets-reading process must never open a network port.
|
|
11
|
+
- **Destructive ops require explicit flags.** `notes_delete { permanent: true }` is not a default.
|
|
12
|
+
- **All tool inputs are validated by `zod`** (UUID format, 10 MB max content length, etc.).
|
|
13
|
+
- **All logs are routed through `src/security/redact.ts`** which masks passwords, master keys, items_keys, JWTs, and any string that looks like a long token. Stdout is reserved for the MCP protocol; logs go to stderr.
|
|
14
|
+
- **Dependencies** are monitored: `npm audit` HIGH/CRITICAL is a merge blocker in CI.
|
|
15
|
+
|
|
16
|
+
## What's reimplemented locally (framing only)
|
|
17
|
+
|
|
18
|
+
Only the **parsing and serialization** of Standard Notes' public, documented protocol 004 format:
|
|
19
|
+
|
|
20
|
+
- Payload string format: `004:<nonce_hex>:<ciphertext_b64>:<aad_b64>:<additional_data_b64>`
|
|
21
|
+
- Root key derivation (Argon2id with fixed SN parameters: ops=5, mem=64MB, 64-byte output split into masterKey + serverPassword)
|
|
22
|
+
- `SN|ItemsKey` unwrap: each items_key is itself encrypted under the root key; decrypting it yields the symmetric key used to decrypt notes and tags
|
|
23
|
+
- Per-item key wrapping: each note/tag uses a fresh random `perItemKey`; the content is AEAD-encrypted under `perItemKey`, and `perItemKey` itself is AEAD-encrypted under the items_key
|
|
24
|
+
- AAD construction: JSON `{u: item_uuid, v: "004"}` for notes/tags; `{u, v, kp: keyParams}` only for items_keys under the root key (the extra `kp` on regular items causes the official SN app to silently drop them)
|
|
25
|
+
|
|
26
|
+
## What comes from `libsodium-wrappers-sumo`
|
|
27
|
+
|
|
28
|
+
Every single cryptographic primitive:
|
|
29
|
+
|
|
30
|
+
- **Argon2id** for key derivation
|
|
31
|
+
- **XChaCha20-Poly1305 IETF** (AEAD) for all encryption/decryption
|
|
32
|
+
- SHA-256 for salt construction
|
|
33
|
+
- Secure random bytes for nonces and per-item keys
|
|
34
|
+
- Hex/base64 encoding helpers
|
|
35
|
+
|
|
36
|
+
No AES, no ChaCha, no KDF, no HMAC, no signing is written by hand in this repo.
|
|
37
|
+
|
|
38
|
+
## One-paragraph walkthrough
|
|
39
|
+
|
|
40
|
+
At login: `Argon2id(password, salt = sha256(email:pw_nonce)[:16], ops=5, mem=64MB)` → 64 bytes split into `masterKey` (first 32) and `serverPassword` (last 32, hex). `serverPassword` is sent to `/v2/login` with a PKCE code verifier; `masterKey` stays local. The server returns an access_token plus a list of `SN|ItemsKey` items encrypted under `masterKey`. Each items_key (K) is used to encrypt notes and tags: a per-item random key K' is generated, the content is AEAD-encrypted under K' (XChaCha20-Poly1305 IETF), and K' itself is AEAD-encrypted under K. Payloads are serialized as `004:<nonce_hex>:<ciphertext_b64>:<aad_b64>:<additional_data_b64>`. The AAD is the UTF-8 bytes of the base64-encoded `{u: item_uuid, v: "004"}` JSON object. Signing (Ed25519 over plaintext hash) is required only for items in shared vaults; personal items use `{}` for `additional_data`.
|
|
41
|
+
|
|
42
|
+
## Tag hierarchy (folders) on the wire
|
|
43
|
+
|
|
44
|
+
Nested tags aren't a separate object type in SN. The parent link is a
|
|
45
|
+
`content.references[]` entry stored on the **child** tag:
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"uuid": "<parent-tag-uuid>",
|
|
50
|
+
"content_type": "SN|Tag",
|
|
51
|
+
"reference_type": "TagToParentTag"
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
A tag has at most one parent (`SNTag.parentId` returns the first
|
|
56
|
+
`TagToParentTag` reference — see [`app/packages/models/.../Tag.ts`](https://github.com/standardnotes/app/blob/main/packages/models/src/Domain/Syncable/Tag/Tag.ts)). Older payloads
|
|
57
|
+
predating `reference_type` used a bare `{ uuid, content_type: "SN|Tag" }`;
|
|
58
|
+
that legacy shape only ever meant "parent of", so we accept it on reads.
|
|
59
|
+
On writes we always emit the modern `reference_type: "TagToParentTag"`
|
|
60
|
+
form. Handling of both shapes lives in [`src/sn/tagHierarchy.ts`](../src/sn/tagHierarchy.ts).
|
|
61
|
+
|
|
62
|
+
## Deliberately out of scope
|
|
63
|
+
|
|
64
|
+
- **Reimplementing any cryptographic primitive.** All primitives come from `libsodium-wrappers-sumo`. We only parse/serialize the protocol 004 framing.
|
|
65
|
+
- **Legacy protocol 003** accounts. Rejected at login with a clear error. Upgrade via the official Standard Notes app.
|
|
66
|
+
- **Network transport** for the MCP server (HTTP/WebSocket/etc.). stdio only. Users wanting mobile access should keep using the official Standard Notes app.
|
|
67
|
+
|
|
68
|
+
## References
|
|
69
|
+
|
|
70
|
+
- Standard Notes [encryption whitepaper](https://standardnotes.com/help/security/encryption)
|
|
71
|
+
- SNJS [specification](https://github.com/standardnotes/snjs/blob/main/packages/snjs/specification.md)
|
|
72
|
+
- Source: [`src/sn/protocol004.ts`](../src/sn/protocol004.ts)
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Using standardnotes-mcp with a self-hosted Standard Notes server
|
|
2
|
+
|
|
3
|
+
You can point this MCP server at any Standard Notes server you control — your own [`standardnotes/server`](https://github.com/standardnotes/server) instance, a homelab deployment, or a company-internal mirror.
|
|
4
|
+
|
|
5
|
+
## Bring up a Standard Notes server with docker-compose
|
|
6
|
+
|
|
7
|
+
The fastest way is the upstream recipe.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
git clone https://github.com/standardnotes/server.git
|
|
11
|
+
cd server
|
|
12
|
+
cp .env.sample .env
|
|
13
|
+
# Edit .env: pick strong values for SECRET_KEY_BASE, JWT_SECRET, AUTH_JWT_SECRET, etc.
|
|
14
|
+
docker compose up -d
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
By default the API is exposed on `http://localhost:3000`. For production you want it behind TLS — typically Caddy or nginx with Let's Encrypt sitting in front of the docker network.
|
|
18
|
+
|
|
19
|
+
> **Security notice:** this MCP does not refuse `http://` server URLs. Over plain HTTP your note contents stay end-to-end encrypted, but the login exchange and session tokens travel unencrypted, so anyone on the network path could take over the session. Use `https://` for anything other than `localhost`, and consider pinning the certificate (step 3 below).
|
|
20
|
+
|
|
21
|
+
See the [official self-hosting docs](https://standardnotes.com/help/47/can-i-self-host-standard-notes) for the full walkthrough, including the Files server (optional) and a web client.
|
|
22
|
+
|
|
23
|
+
## Point this MCP at it
|
|
24
|
+
|
|
25
|
+
### 1. Create your account
|
|
26
|
+
|
|
27
|
+
Use the official Standard Notes app (web or desktop) and register against your server URL. Make sure you end up on protocol 004 — it's the default for new accounts since 2020.
|
|
28
|
+
|
|
29
|
+
### 2. Configure standardnotes-mcp
|
|
30
|
+
|
|
31
|
+
Pass `SN_SERVER_URL` when running the login and the server:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
SN_SERVER_URL=https://sn.example.com SN_EMAIL=you@example.com npm run login
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Then in your MCP client config:
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"mcpServers": {
|
|
42
|
+
"standardnotes-mcp": {
|
|
43
|
+
"type": "stdio",
|
|
44
|
+
"command": "node",
|
|
45
|
+
"args": ["/absolute/path/to/standardnotes-mcp/dist/index.js"],
|
|
46
|
+
"env": {
|
|
47
|
+
"SN_EMAIL": "you@example.com",
|
|
48
|
+
"SN_SERVER_URL": "https://sn.example.com"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 3. Pin the TLS certificate (recommended)
|
|
56
|
+
|
|
57
|
+
For self-hosted servers — especially homelab setups with self-signed or short-lived certs — set `SN_CERT_FINGERPRINT` to the SHA-256 fingerprint of the server's leaf certificate. The MCP will refuse to talk to any other certificate, even if a CA in your trust store would otherwise vouch for it.
|
|
58
|
+
|
|
59
|
+
Get the fingerprint from your server:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
echo | openssl s_client -connect sn.example.com:443 -servername sn.example.com 2>/dev/null \
|
|
63
|
+
| openssl x509 -noout -fingerprint -sha256 \
|
|
64
|
+
| sed 's/^.*=//; s/://g; y/ABCDEF/abcdef/'
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Output looks like `7a3c9b...` (64 hex chars). Set it in your env:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
SN_CERT_FINGERPRINT=7a3c9b... SN_SERVER_URL=https://sn.example.com npm run login
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
And mirror it into your MCP client config's `env` block. Re-run the fingerprint extraction after every cert renewal.
|
|
74
|
+
|
|
75
|
+
## Account / users-per-server
|
|
76
|
+
|
|
77
|
+
Each MCP instance is single-account. If you host multiple users on the same SN server, run one `standardnotes-mcp` per user (one MCP client config entry each, distinct `KEYCHAIN_SERVICE` values to avoid keychain collisions).
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"mcpServers": {
|
|
82
|
+
"alice-notes": {
|
|
83
|
+
"command": "node",
|
|
84
|
+
"args": ["/path/to/standardnotes-mcp/dist/index.js"],
|
|
85
|
+
"env": {
|
|
86
|
+
"SN_EMAIL": "alice@example.com",
|
|
87
|
+
"SN_SERVER_URL": "https://sn.example.com",
|
|
88
|
+
"KEYCHAIN_SERVICE": "mcp-sn-alice"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"bob-notes": {
|
|
92
|
+
"command": "node",
|
|
93
|
+
"args": ["/path/to/standardnotes-mcp/dist/index.js"],
|
|
94
|
+
"env": {
|
|
95
|
+
"SN_EMAIL": "bob@example.com",
|
|
96
|
+
"SN_SERVER_URL": "https://sn.example.com",
|
|
97
|
+
"KEYCHAIN_SERVICE": "mcp-sn-bob"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Paid features on a self-hosted server
|
|
105
|
+
|
|
106
|
+
This MCP reads the account's plan from the roles your server reports (`meta.auth.roles`): `CORE_USER` alone means free, `PLUS_USER` or `PRO_USER` means paid. A fresh self-hosted account has no subscription, so it's treated as **free**: new notes are plain text, folders stay top-level, and [[wikilinks]] stand in for native note links (see the README's *Free vs paid* section).
|
|
107
|
+
|
|
108
|
+
If you've given your account a subscription on your own server, following Standard Notes' self-hosting documentation, the server reports the paid role and paid features work here automatically. There's no setting in this MCP to override the plan, by design. Check what it detected with the `server_status` tool or the `sn://status` resource (`plan.standardNotes`).
|
|
109
|
+
|
|
110
|
+
## Operational notes
|
|
111
|
+
|
|
112
|
+
- **Backups.** This MCP keeps no state of its own beyond the keychain entry — backups are 100% your SN server's job. Use the upstream backup recipe.
|
|
113
|
+
- **Rate limiting.** Self-hosted servers usually have looser limits than the cloud, but the MCP still respects 429 responses.
|
|
114
|
+
- **Files server.** Not yet supported — this MCP only handles notes and tags. File uploads/downloads remain in the official app.
|
|
115
|
+
- **CI against your server.** Don't. Run integration tests against an ephemeral docker-compose instance only.
|
|
116
|
+
|
|
117
|
+
## Troubleshooting
|
|
118
|
+
|
|
119
|
+
If you can log in via the official SN app but `npm run login` fails, the most common causes are:
|
|
120
|
+
|
|
121
|
+
- `SN_SERVER_URL` includes a trailing slash or wrong scheme — drop the slash, use `https://`.
|
|
122
|
+
- 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.
|
|
123
|
+
- Account is on legacy protocol 003: upgrade via the SN app (Preferences → Security → Upgrade Encryption).
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Troubleshooting
|
|
2
|
+
|
|
3
|
+
### "No session found. Run `npm run 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": ["/absolute/path/to/standardnotes-mcp/dist/index.js"],
|
|
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 - MCP clients capture and display them. Former location of the line: `the server log (MCP clients capture 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 `npm install`; a corrupted cache is fixed by `rm -rf node_modules && npm install`.
|
|
48
|
+
|
|
49
|
+
### Linux: secret store fails or hangs, or MCP cannot read the session
|
|
50
|
+
|
|
51
|
+
keytar 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 `npm run 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
|
+
SN_EMAIL=old@example.com npm run logout
|
|
65
|
+
SN_EMAIL=new@example.com npm run 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 `npm run 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
|
+
```
|