@noesis-brain/mcp-server 2.0.1 → 2.1.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/README.md +91 -3
- package/dist/agent/runner.d.ts +29 -0
- package/dist/agent/runner.d.ts.map +1 -0
- package/dist/agent/runner.js +306 -0
- package/dist/agent/runner.js.map +1 -0
- package/dist/api/NoesisClient.d.ts +119 -0
- package/dist/api/NoesisClient.d.ts.map +1 -1
- package/dist/api/NoesisClient.js +130 -6
- package/dist/api/NoesisClient.js.map +1 -1
- package/dist/cli/setup.d.ts.map +1 -1
- package/dist/cli/setup.js +409 -35
- package/dist/cli/setup.js.map +1 -1
- package/dist/index.js +31 -1
- package/dist/index.js.map +1 -1
- package/dist/resolve/noteRef.d.ts +101 -0
- package/dist/resolve/noteRef.d.ts.map +1 -0
- package/dist/resolve/noteRef.js +186 -0
- package/dist/resolve/noteRef.js.map +1 -0
- package/dist/resolve/rootsFormat.d.ts +12 -0
- package/dist/resolve/rootsFormat.d.ts.map +1 -0
- package/dist/resolve/rootsFormat.js +63 -0
- package/dist/resolve/rootsFormat.js.map +1 -0
- package/dist/tools/backlog.d.ts +4 -0
- package/dist/tools/backlog.d.ts.map +1 -0
- package/dist/tools/backlog.js +161 -0
- package/dist/tools/backlog.js.map +1 -0
- package/dist/tools/index.d.ts +92 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +529 -207
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/navis.d.ts.map +1 -1
- package/dist/tools/navis.js +4 -0
- package/dist/tools/navis.js.map +1 -1
- package/package.json +8 -3
- package/scripts/agent-e2e.mjs +69 -0
- package/scripts/noesis-capture-session-end.mjs +94 -0
- package/scripts/noesis-capture-watcher.mjs +953 -0
- package/skill-templates/noesis-capture.md +166 -0
- package/skill-templates/noesis-create-study-note.md +149 -0
- package/skill-templates/noesis-find-related.md +89 -0
- package/skill-templates/noesis-investigate.md +90 -0
- package/skill-templates/noesis-manage-news.md +80 -0
- package/skill-templates/noesis-skim-read.md +72 -0
- package/templates/claude-md-block.md +5 -1
- package/templates/claude-md-restructure-on-sync.md +10 -0
package/dist/tools/index.d.ts
CHANGED
|
@@ -2,7 +2,27 @@
|
|
|
2
2
|
* Tool registry for md-manager MCP server
|
|
3
3
|
*/
|
|
4
4
|
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
5
|
-
import { NoesisClient } from '../api/NoesisClient.js';
|
|
5
|
+
import { NoesisClient, type Note } from '../api/NoesisClient.js';
|
|
6
|
+
/**
|
|
7
|
+
* Resolve a user-supplied file path to a registered root + relative path,
|
|
8
|
+
* mirroring the sync resolver (see sync_notes): expand `~` / `%USERPROFILE%`
|
|
9
|
+
* against this machine's home, resolve to absolute, then prefix-match the input
|
|
10
|
+
* against each root's active path, preferring the longest (most specific) match.
|
|
11
|
+
* Returns null if the path isn't inside any known root.
|
|
12
|
+
*
|
|
13
|
+
* This is what lets get_note resolve an absolute clipboard path
|
|
14
|
+
* (e.g. C:\Users\me\Noesis\foo.md) against a tilde-stored cloud root (~/Noesis):
|
|
15
|
+
* the backend /notes/by-path route does a literal prefix compare and never
|
|
16
|
+
* expands `~`, so absolute paths can't match cloud roots there — resolving
|
|
17
|
+
* client-side and calling /notes/by-relative instead sidesteps that.
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolvePathToRoot(filePath: string, roots: Array<{
|
|
20
|
+
id: number;
|
|
21
|
+
path?: string;
|
|
22
|
+
}>): {
|
|
23
|
+
rootId: number;
|
|
24
|
+
relativePath: string;
|
|
25
|
+
} | null;
|
|
6
26
|
export interface ToolServices {
|
|
7
27
|
client: NoesisClient;
|
|
8
28
|
geminiApiKey?: string;
|
|
@@ -11,4 +31,75 @@ export interface ToolServices {
|
|
|
11
31
|
* Register all MCP tools with the server
|
|
12
32
|
*/
|
|
13
33
|
export declare function registerTools(server: McpServer, services: ToolServices): void;
|
|
34
|
+
/**
|
|
35
|
+
* A cloud note in the exact shape the sync branches consume (matching the old
|
|
36
|
+
* getNotesForSync element). Built by adaptCloudNote from a single-note fetch
|
|
37
|
+
* (content + metadata) plus the authoritative hash from the root hash map.
|
|
38
|
+
*/
|
|
39
|
+
type CloudNoteRow = {
|
|
40
|
+
id: number;
|
|
41
|
+
relative_path: string;
|
|
42
|
+
hash: string;
|
|
43
|
+
modified_at: string;
|
|
44
|
+
content: string;
|
|
45
|
+
title: string | null;
|
|
46
|
+
description: string | null;
|
|
47
|
+
keywords: string | string[] | null;
|
|
48
|
+
edited_online_at: string | null;
|
|
49
|
+
};
|
|
50
|
+
/** Adapt a by-relative Note (+ its hash from the root hash map) into CloudNoteRow. */
|
|
51
|
+
export declare function adaptCloudNote(n: Note, relativePath: string, hash: string): CloudNoteRow;
|
|
52
|
+
/**
|
|
53
|
+
* Sync specific files by path (single-file or multi-file sync mode)
|
|
54
|
+
* @param force - If true, bypass hash check and always re-sync (useful for metadata regeneration)
|
|
55
|
+
* @param regenerateMetadata - If true, backend AI regenerates all metadata fields, overwriting existing values
|
|
56
|
+
*/
|
|
57
|
+
export declare function syncSpecificFiles(filePaths: string[], dryRun: boolean, client: NoesisClient, force?: boolean, regenerateMetadata?: boolean): Promise<{
|
|
58
|
+
content: Array<{
|
|
59
|
+
type: 'text';
|
|
60
|
+
text: string;
|
|
61
|
+
}>;
|
|
62
|
+
isError?: boolean;
|
|
63
|
+
}>;
|
|
64
|
+
/**
|
|
65
|
+
* Split leading YAML frontmatter from a markdown document.
|
|
66
|
+
*
|
|
67
|
+
* The opening `---` must be the very first line and the closing `---` must be on its
|
|
68
|
+
* own line (line-anchored). This deliberately does NOT use `indexOf('---', 3)`: a bare
|
|
69
|
+
* substring search matches a `---` inside a frontmatter value, a `---`/`----` thematic
|
|
70
|
+
* break in the body, or a `---` inside a code fence — which previously caused notes to
|
|
71
|
+
* be truncated / their frontmatter duplicated on sync.
|
|
72
|
+
*
|
|
73
|
+
* @returns raw = whole matched block incl. fences + trailing newline; inner = the YAML
|
|
74
|
+
* between the fences; body = everything after the block. If there is no valid
|
|
75
|
+
* leading frontmatter, raw/inner are '' and body is the full content.
|
|
76
|
+
*/
|
|
77
|
+
export declare function splitFrontmatter(content: string): {
|
|
78
|
+
raw: string;
|
|
79
|
+
inner: string;
|
|
80
|
+
body: string;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Update frontmatter in file content with new metadata values
|
|
84
|
+
* Preserves existing frontmatter structure and only updates specified fields
|
|
85
|
+
*/
|
|
86
|
+
export declare function updateFrontmatter(content: string, updates: {
|
|
87
|
+
title?: string;
|
|
88
|
+
description?: string;
|
|
89
|
+
keywords?: string[];
|
|
90
|
+
}): string;
|
|
91
|
+
/**
|
|
92
|
+
* Parse markdown content into structure: frontmatter, H1 heading, and body
|
|
93
|
+
*/
|
|
94
|
+
export declare function parseMarkdownStructure(content: string): {
|
|
95
|
+
frontmatter: string;
|
|
96
|
+
h1: string | null;
|
|
97
|
+
body: string;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Merge local content with cloud content
|
|
101
|
+
* Strategy: Cloud's H1 wins (Noesis edits), Local's body wins (local edits)
|
|
102
|
+
*/
|
|
103
|
+
export declare function mergeContent(localContent: string, cloudContent: string): string;
|
|
104
|
+
export {};
|
|
14
105
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAyC,KAAK,IAAI,EAA2D,MAAM,wBAAwB,CAA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