@brain-protocol/mcp 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +216 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +41 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas.d.ts +96 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +52 -0
- package/dist/schemas.js.map +1 -0
- package/dist/server.d.ts +4 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +27 -0
- package/dist/server.js.map +1 -0
- package/dist/store/adapter.d.ts +19 -0
- package/dist/store/adapter.d.ts.map +1 -0
- package/dist/store/adapter.js +2 -0
- package/dist/store/adapter.js.map +1 -0
- package/dist/store/cloud.d.ts +25 -0
- package/dist/store/cloud.d.ts.map +1 -0
- package/dist/store/cloud.js +151 -0
- package/dist/store/cloud.js.map +1 -0
- package/dist/store/paths.d.ts +4 -0
- package/dist/store/paths.d.ts.map +1 -0
- package/dist/store/paths.js +33 -0
- package/dist/store/paths.js.map +1 -0
- package/dist/store/sqlite.d.ts +22 -0
- package/dist/store/sqlite.d.ts.map +1 -0
- package/dist/store/sqlite.js +292 -0
- package/dist/store/sqlite.js.map +1 -0
- package/dist/tools/archive.d.ts +3 -0
- package/dist/tools/archive.d.ts.map +1 -0
- package/dist/tools/archive.js +6 -0
- package/dist/tools/archive.js.map +1 -0
- package/dist/tools/edge.d.ts +3 -0
- package/dist/tools/edge.d.ts.map +1 -0
- package/dist/tools/edge.js +6 -0
- package/dist/tools/edge.js.map +1 -0
- package/dist/tools/export.d.ts +3 -0
- package/dist/tools/export.d.ts.map +1 -0
- package/dist/tools/export.js +6 -0
- package/dist/tools/export.js.map +1 -0
- package/dist/tools/graph.d.ts +3 -0
- package/dist/tools/graph.d.ts.map +1 -0
- package/dist/tools/graph.js +6 -0
- package/dist/tools/graph.js.map +1 -0
- package/dist/tools/index.d.ts +236 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +136 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/prove.d.ts +5 -0
- package/dist/tools/prove.d.ts.map +1 -0
- package/dist/tools/prove.js +10 -0
- package/dist/tools/prove.js.map +1 -0
- package/dist/tools/query.d.ts +6 -0
- package/dist/tools/query.d.ts.map +1 -0
- package/dist/tools/query.js +6 -0
- package/dist/tools/query.js.map +1 -0
- package/dist/tools/stats.d.ts +3 -0
- package/dist/tools/stats.d.ts.map +1 -0
- package/dist/tools/stats.js +4 -0
- package/dist/tools/stats.js.map +1 -0
- package/dist/tools/verify.d.ts +5 -0
- package/dist/tools/verify.d.ts.map +1 -0
- package/dist/tools/verify.js +10 -0
- package/dist/tools/verify.js.map +1 -0
- package/dist/types.d.ts +81 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +47 -0
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import type { StoreAdapter } from "../store/adapter.js";
|
|
2
|
+
export declare const toolDefinitions: ({
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object";
|
|
7
|
+
properties: {
|
|
8
|
+
q: {
|
|
9
|
+
type: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
category: {
|
|
13
|
+
type: string;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
author: {
|
|
17
|
+
type: string;
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
tags: {
|
|
21
|
+
type: string;
|
|
22
|
+
description: string;
|
|
23
|
+
items?: undefined;
|
|
24
|
+
};
|
|
25
|
+
limit: {
|
|
26
|
+
type: string;
|
|
27
|
+
description: string;
|
|
28
|
+
};
|
|
29
|
+
offset: {
|
|
30
|
+
type: string;
|
|
31
|
+
description: string;
|
|
32
|
+
};
|
|
33
|
+
content?: undefined;
|
|
34
|
+
content_type?: undefined;
|
|
35
|
+
confidence?: undefined;
|
|
36
|
+
source_id?: undefined;
|
|
37
|
+
target_id?: undefined;
|
|
38
|
+
edge_type?: undefined;
|
|
39
|
+
entry_id?: undefined;
|
|
40
|
+
depth?: undefined;
|
|
41
|
+
format?: undefined;
|
|
42
|
+
};
|
|
43
|
+
required?: undefined;
|
|
44
|
+
};
|
|
45
|
+
} | {
|
|
46
|
+
name: string;
|
|
47
|
+
description: string;
|
|
48
|
+
inputSchema: {
|
|
49
|
+
type: "object";
|
|
50
|
+
properties: {
|
|
51
|
+
content: {
|
|
52
|
+
type: string;
|
|
53
|
+
description: string;
|
|
54
|
+
};
|
|
55
|
+
content_type: {
|
|
56
|
+
type: string;
|
|
57
|
+
description: string;
|
|
58
|
+
};
|
|
59
|
+
author: {
|
|
60
|
+
type: string;
|
|
61
|
+
description: string;
|
|
62
|
+
};
|
|
63
|
+
category: {
|
|
64
|
+
type: string;
|
|
65
|
+
description: string;
|
|
66
|
+
};
|
|
67
|
+
tags: {
|
|
68
|
+
type: string;
|
|
69
|
+
items: {
|
|
70
|
+
type: string;
|
|
71
|
+
};
|
|
72
|
+
description: string;
|
|
73
|
+
};
|
|
74
|
+
confidence: {
|
|
75
|
+
type: string;
|
|
76
|
+
description: string;
|
|
77
|
+
};
|
|
78
|
+
q?: undefined;
|
|
79
|
+
limit?: undefined;
|
|
80
|
+
offset?: undefined;
|
|
81
|
+
source_id?: undefined;
|
|
82
|
+
target_id?: undefined;
|
|
83
|
+
edge_type?: undefined;
|
|
84
|
+
entry_id?: undefined;
|
|
85
|
+
depth?: undefined;
|
|
86
|
+
format?: undefined;
|
|
87
|
+
};
|
|
88
|
+
required: string[];
|
|
89
|
+
};
|
|
90
|
+
} | {
|
|
91
|
+
name: string;
|
|
92
|
+
description: string;
|
|
93
|
+
inputSchema: {
|
|
94
|
+
type: "object";
|
|
95
|
+
properties: {
|
|
96
|
+
source_id: {
|
|
97
|
+
type: string;
|
|
98
|
+
description: string;
|
|
99
|
+
};
|
|
100
|
+
target_id: {
|
|
101
|
+
type: string;
|
|
102
|
+
description: string;
|
|
103
|
+
};
|
|
104
|
+
edge_type: {
|
|
105
|
+
type: string;
|
|
106
|
+
description: string;
|
|
107
|
+
};
|
|
108
|
+
confidence: {
|
|
109
|
+
type: string;
|
|
110
|
+
description: string;
|
|
111
|
+
};
|
|
112
|
+
q?: undefined;
|
|
113
|
+
category?: undefined;
|
|
114
|
+
author?: undefined;
|
|
115
|
+
tags?: undefined;
|
|
116
|
+
limit?: undefined;
|
|
117
|
+
offset?: undefined;
|
|
118
|
+
content?: undefined;
|
|
119
|
+
content_type?: undefined;
|
|
120
|
+
entry_id?: undefined;
|
|
121
|
+
depth?: undefined;
|
|
122
|
+
format?: undefined;
|
|
123
|
+
};
|
|
124
|
+
required: string[];
|
|
125
|
+
};
|
|
126
|
+
} | {
|
|
127
|
+
name: string;
|
|
128
|
+
description: string;
|
|
129
|
+
inputSchema: {
|
|
130
|
+
type: "object";
|
|
131
|
+
properties: {
|
|
132
|
+
entry_id: {
|
|
133
|
+
type: string;
|
|
134
|
+
description: string;
|
|
135
|
+
};
|
|
136
|
+
depth: {
|
|
137
|
+
type: string;
|
|
138
|
+
description: string;
|
|
139
|
+
};
|
|
140
|
+
q?: undefined;
|
|
141
|
+
category?: undefined;
|
|
142
|
+
author?: undefined;
|
|
143
|
+
tags?: undefined;
|
|
144
|
+
limit?: undefined;
|
|
145
|
+
offset?: undefined;
|
|
146
|
+
content?: undefined;
|
|
147
|
+
content_type?: undefined;
|
|
148
|
+
confidence?: undefined;
|
|
149
|
+
source_id?: undefined;
|
|
150
|
+
target_id?: undefined;
|
|
151
|
+
edge_type?: undefined;
|
|
152
|
+
format?: undefined;
|
|
153
|
+
};
|
|
154
|
+
required: string[];
|
|
155
|
+
};
|
|
156
|
+
} | {
|
|
157
|
+
name: string;
|
|
158
|
+
description: string;
|
|
159
|
+
inputSchema: {
|
|
160
|
+
type: "object";
|
|
161
|
+
properties: {
|
|
162
|
+
q?: undefined;
|
|
163
|
+
category?: undefined;
|
|
164
|
+
author?: undefined;
|
|
165
|
+
tags?: undefined;
|
|
166
|
+
limit?: undefined;
|
|
167
|
+
offset?: undefined;
|
|
168
|
+
content?: undefined;
|
|
169
|
+
content_type?: undefined;
|
|
170
|
+
confidence?: undefined;
|
|
171
|
+
source_id?: undefined;
|
|
172
|
+
target_id?: undefined;
|
|
173
|
+
edge_type?: undefined;
|
|
174
|
+
entry_id?: undefined;
|
|
175
|
+
depth?: undefined;
|
|
176
|
+
format?: undefined;
|
|
177
|
+
};
|
|
178
|
+
required?: undefined;
|
|
179
|
+
};
|
|
180
|
+
} | {
|
|
181
|
+
name: string;
|
|
182
|
+
description: string;
|
|
183
|
+
inputSchema: {
|
|
184
|
+
type: "object";
|
|
185
|
+
properties: {
|
|
186
|
+
entry_id: {
|
|
187
|
+
type: string;
|
|
188
|
+
description: string;
|
|
189
|
+
};
|
|
190
|
+
q?: undefined;
|
|
191
|
+
category?: undefined;
|
|
192
|
+
author?: undefined;
|
|
193
|
+
tags?: undefined;
|
|
194
|
+
limit?: undefined;
|
|
195
|
+
offset?: undefined;
|
|
196
|
+
content?: undefined;
|
|
197
|
+
content_type?: undefined;
|
|
198
|
+
confidence?: undefined;
|
|
199
|
+
source_id?: undefined;
|
|
200
|
+
target_id?: undefined;
|
|
201
|
+
edge_type?: undefined;
|
|
202
|
+
depth?: undefined;
|
|
203
|
+
format?: undefined;
|
|
204
|
+
};
|
|
205
|
+
required: string[];
|
|
206
|
+
};
|
|
207
|
+
} | {
|
|
208
|
+
name: string;
|
|
209
|
+
description: string;
|
|
210
|
+
inputSchema: {
|
|
211
|
+
type: "object";
|
|
212
|
+
properties: {
|
|
213
|
+
format: {
|
|
214
|
+
type: string;
|
|
215
|
+
description: string;
|
|
216
|
+
};
|
|
217
|
+
q?: undefined;
|
|
218
|
+
category?: undefined;
|
|
219
|
+
author?: undefined;
|
|
220
|
+
tags?: undefined;
|
|
221
|
+
limit?: undefined;
|
|
222
|
+
offset?: undefined;
|
|
223
|
+
content?: undefined;
|
|
224
|
+
content_type?: undefined;
|
|
225
|
+
confidence?: undefined;
|
|
226
|
+
source_id?: undefined;
|
|
227
|
+
target_id?: undefined;
|
|
228
|
+
edge_type?: undefined;
|
|
229
|
+
entry_id?: undefined;
|
|
230
|
+
depth?: undefined;
|
|
231
|
+
};
|
|
232
|
+
required?: undefined;
|
|
233
|
+
};
|
|
234
|
+
})[];
|
|
235
|
+
export declare function handleTool(store: StoreAdapter, name: string, args: Record<string, unknown>): Promise<unknown>;
|
|
236
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAUxD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAwG3B,CAAC;AAEF,wBAAsB,UAAU,CAC9B,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC,OAAO,CAAC,CAqBlB"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { archiveKnowledge } from "./archive.js";
|
|
2
|
+
import { createEdge } from "./edge.js";
|
|
3
|
+
import { exportData } from "./export.js";
|
|
4
|
+
import { getGraph } from "./graph.js";
|
|
5
|
+
import { prove } from "./prove.js";
|
|
6
|
+
import { queryKnowledge } from "./query.js";
|
|
7
|
+
import { getStats } from "./stats.js";
|
|
8
|
+
import { verify } from "./verify.js";
|
|
9
|
+
export const toolDefinitions = [
|
|
10
|
+
{
|
|
11
|
+
name: "query_knowledge",
|
|
12
|
+
description: "Search the knowledge base using full-text search with filters",
|
|
13
|
+
inputSchema: {
|
|
14
|
+
type: "object",
|
|
15
|
+
properties: {
|
|
16
|
+
q: { type: "string", description: "Search query" },
|
|
17
|
+
category: { type: "string", description: "Filter by category" },
|
|
18
|
+
author: { type: "string", description: "Filter by author" },
|
|
19
|
+
tags: { type: "string", description: "Filter by tags (comma-separated)" },
|
|
20
|
+
limit: { type: "number", description: "Max results (default 10, max 100)" },
|
|
21
|
+
offset: { type: "number", description: "Offset for pagination (default 0)" },
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: "archive_knowledge",
|
|
27
|
+
description: "Store a new knowledge entry",
|
|
28
|
+
inputSchema: {
|
|
29
|
+
type: "object",
|
|
30
|
+
properties: {
|
|
31
|
+
content: { type: "string", description: "Knowledge content" },
|
|
32
|
+
content_type: {
|
|
33
|
+
type: "string",
|
|
34
|
+
description: "Type: markdown, code, decision, pattern, documentation, git_commit, json, structured_data",
|
|
35
|
+
},
|
|
36
|
+
author: { type: "string", description: "Author name" },
|
|
37
|
+
category: { type: "string", description: "Category" },
|
|
38
|
+
tags: { type: "array", items: { type: "string" }, description: "Tags" },
|
|
39
|
+
confidence: { type: "number", description: "Confidence 0-1" },
|
|
40
|
+
},
|
|
41
|
+
required: ["content"],
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "create_edge",
|
|
46
|
+
description: "Create a relationship edge between two knowledge entries",
|
|
47
|
+
inputSchema: {
|
|
48
|
+
type: "object",
|
|
49
|
+
properties: {
|
|
50
|
+
source_id: { type: "string", description: "Source entry UUID" },
|
|
51
|
+
target_id: { type: "string", description: "Target entry UUID" },
|
|
52
|
+
edge_type: {
|
|
53
|
+
type: "string",
|
|
54
|
+
description: "Edge type: derives_from, conflicts_with, validates, extends, implements, supersedes, tested_by, documented_by, optimizes, related_to",
|
|
55
|
+
},
|
|
56
|
+
confidence: { type: "number", description: "Edge confidence 0-1" },
|
|
57
|
+
},
|
|
58
|
+
required: ["source_id", "target_id", "edge_type"],
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: "get_graph",
|
|
63
|
+
description: "Traverse the knowledge graph from an entry",
|
|
64
|
+
inputSchema: {
|
|
65
|
+
type: "object",
|
|
66
|
+
properties: {
|
|
67
|
+
entry_id: { type: "string", description: "Starting entry UUID" },
|
|
68
|
+
depth: { type: "number", description: "Max traversal depth (default 3, max 5)" },
|
|
69
|
+
},
|
|
70
|
+
required: ["entry_id"],
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: "get_stats",
|
|
75
|
+
description: "Get knowledge base statistics",
|
|
76
|
+
inputSchema: {
|
|
77
|
+
type: "object",
|
|
78
|
+
properties: {},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: "prove",
|
|
83
|
+
description: "Anchor a knowledge entry on Starknet for verifiable proof (cloud mode only)",
|
|
84
|
+
inputSchema: {
|
|
85
|
+
type: "object",
|
|
86
|
+
properties: {
|
|
87
|
+
entry_id: { type: "string", description: "Entry UUID to anchor" },
|
|
88
|
+
},
|
|
89
|
+
required: ["entry_id"],
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: "verify",
|
|
94
|
+
description: "Verify a knowledge entry's on-chain proof (cloud mode only)",
|
|
95
|
+
inputSchema: {
|
|
96
|
+
type: "object",
|
|
97
|
+
properties: {
|
|
98
|
+
entry_id: { type: "string", description: "Entry UUID to verify" },
|
|
99
|
+
},
|
|
100
|
+
required: ["entry_id"],
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: "export",
|
|
105
|
+
description: "Export all knowledge entries and edges",
|
|
106
|
+
inputSchema: {
|
|
107
|
+
type: "object",
|
|
108
|
+
properties: {
|
|
109
|
+
format: { type: "string", description: "Export format (json)" },
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
];
|
|
114
|
+
export async function handleTool(store, name, args) {
|
|
115
|
+
switch (name) {
|
|
116
|
+
case "query_knowledge":
|
|
117
|
+
return queryKnowledge(store, args);
|
|
118
|
+
case "archive_knowledge":
|
|
119
|
+
return archiveKnowledge(store, args);
|
|
120
|
+
case "create_edge":
|
|
121
|
+
return createEdge(store, args);
|
|
122
|
+
case "get_graph":
|
|
123
|
+
return getGraph(store, args);
|
|
124
|
+
case "get_stats":
|
|
125
|
+
return getStats(store);
|
|
126
|
+
case "prove":
|
|
127
|
+
return prove(store, args);
|
|
128
|
+
case "verify":
|
|
129
|
+
return verify(store, args);
|
|
130
|
+
case "export":
|
|
131
|
+
return exportData(store, args);
|
|
132
|
+
default:
|
|
133
|
+
return { error: `Unknown tool: ${name}` };
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AA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,IAAI,EAAE,EAAE,CAAC;IAC9C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prove.d.ts","sourceRoot":"","sources":["../../src/tools/prove.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAIxD,wBAAsB,KAAK,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;GAQ7E"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { proveSchema } from "../schemas.js";
|
|
2
|
+
const CLOUD_REQUIRED_MSG = "prove requires cloud mode. Set BRAIN_API_URL=https://brain.api.vauban.tech";
|
|
3
|
+
export async function prove(store, args) {
|
|
4
|
+
const input = proveSchema.parse(args);
|
|
5
|
+
if (!store.prove) {
|
|
6
|
+
return { error: CLOUD_REQUIRED_MSG };
|
|
7
|
+
}
|
|
8
|
+
return store.prove(input.entry_id);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=prove.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prove.js","sourceRoot":"","sources":["../../src/tools/prove.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,MAAM,kBAAkB,GAAG,4EAA4E,CAAC;AAExG,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,KAAmB,EAAE,IAA6B;IAC5E,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAEtC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACjB,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,CAAC;IACvC,CAAC;IAED,OAAO,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { StoreAdapter } from "../store/adapter.js";
|
|
2
|
+
export declare function queryKnowledge(store: StoreAdapter, args: Record<string, unknown>): Promise<{
|
|
3
|
+
entries: import("../types.js").KnowledgeEntry[];
|
|
4
|
+
total: number;
|
|
5
|
+
}>;
|
|
6
|
+
//# sourceMappingURL=query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/tools/query.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,wBAAsB,cAAc,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;GAGtF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../src/tools/query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAGrD,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,KAAmB,EAAE,IAA6B;IACrF,MAAM,KAAK,GAAG,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC/C,OAAO,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../src/tools/stats.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,wBAAsB,QAAQ,CAAC,KAAK,EAAE,YAAY,6CAEjD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stats.js","sourceRoot":"","sources":["../../src/tools/stats.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,KAAmB;IAChD,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../src/tools/verify.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAIxD,wBAAsB,MAAM,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;GAQ9E"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { verifySchema } from "../schemas.js";
|
|
2
|
+
const CLOUD_REQUIRED_MSG = "verify requires cloud mode. Set BRAIN_API_URL=https://brain.api.vauban.tech";
|
|
3
|
+
export async function verify(store, args) {
|
|
4
|
+
const input = verifySchema.parse(args);
|
|
5
|
+
if (!store.verify) {
|
|
6
|
+
return { error: CLOUD_REQUIRED_MSG };
|
|
7
|
+
}
|
|
8
|
+
return store.verify(input.entry_id);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=verify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify.js","sourceRoot":"","sources":["../../src/tools/verify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG7C,MAAM,kBAAkB,GAAG,6EAA6E,CAAC;AAEzG,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,KAAmB,EAAE,IAA6B;IAC7E,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAEvC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QAClB,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,CAAC;IACvC,CAAC;IAED,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AACtC,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export type ContentType = "markdown" | "code" | "decision" | "pattern" | "documentation" | "git_commit" | "json" | "structured_data";
|
|
2
|
+
export type EdgeType = "derives_from" | "conflicts_with" | "validates" | "extends" | "implements" | "supersedes" | "tested_by" | "documented_by" | "optimizes" | "related_to";
|
|
3
|
+
export interface KnowledgeEntry {
|
|
4
|
+
id: string;
|
|
5
|
+
content: string;
|
|
6
|
+
content_type: ContentType;
|
|
7
|
+
author: string;
|
|
8
|
+
category: string;
|
|
9
|
+
tags: string[];
|
|
10
|
+
metadata: Record<string, unknown>;
|
|
11
|
+
confidence: number;
|
|
12
|
+
created_at: string;
|
|
13
|
+
updated_at: string;
|
|
14
|
+
}
|
|
15
|
+
export interface KnowledgeEdge {
|
|
16
|
+
id: string;
|
|
17
|
+
source_id: string;
|
|
18
|
+
target_id: string;
|
|
19
|
+
edge_type: string;
|
|
20
|
+
confidence: number | null;
|
|
21
|
+
created_at: string;
|
|
22
|
+
}
|
|
23
|
+
export interface GraphNode {
|
|
24
|
+
entry: KnowledgeEntry;
|
|
25
|
+
edges: KnowledgeEdge[];
|
|
26
|
+
depth: number;
|
|
27
|
+
}
|
|
28
|
+
export interface GraphResult {
|
|
29
|
+
nodes: GraphNode[];
|
|
30
|
+
totalNodes: number;
|
|
31
|
+
totalEdges: number;
|
|
32
|
+
}
|
|
33
|
+
export interface StoreStats {
|
|
34
|
+
totalEntries: number;
|
|
35
|
+
totalEdges: number;
|
|
36
|
+
categories: Record<string, number>;
|
|
37
|
+
avgConfidence: number;
|
|
38
|
+
oldestEntry: string | null;
|
|
39
|
+
newestEntry: string | null;
|
|
40
|
+
}
|
|
41
|
+
export interface ExportData {
|
|
42
|
+
entries: KnowledgeEntry[];
|
|
43
|
+
edges: KnowledgeEdge[];
|
|
44
|
+
exportedAt: string;
|
|
45
|
+
mode: "local" | "cloud";
|
|
46
|
+
}
|
|
47
|
+
export interface QueryOptions {
|
|
48
|
+
q?: string;
|
|
49
|
+
category?: string;
|
|
50
|
+
author?: string;
|
|
51
|
+
tags?: string;
|
|
52
|
+
limit?: number;
|
|
53
|
+
offset?: number;
|
|
54
|
+
}
|
|
55
|
+
export interface CreateEntryInput {
|
|
56
|
+
content: string;
|
|
57
|
+
content_type?: ContentType;
|
|
58
|
+
author?: string;
|
|
59
|
+
category?: string;
|
|
60
|
+
tags?: string[];
|
|
61
|
+
confidence?: number;
|
|
62
|
+
metadata?: Record<string, unknown>;
|
|
63
|
+
}
|
|
64
|
+
export interface CreateEdgeInput {
|
|
65
|
+
source_id: string;
|
|
66
|
+
target_id: string;
|
|
67
|
+
edge_type: string;
|
|
68
|
+
confidence?: number;
|
|
69
|
+
}
|
|
70
|
+
export interface ProveResult {
|
|
71
|
+
contentHash: string;
|
|
72
|
+
txHash: string;
|
|
73
|
+
anchorId: number;
|
|
74
|
+
}
|
|
75
|
+
export interface VerifyResult {
|
|
76
|
+
verified: boolean;
|
|
77
|
+
contentHash: string | null;
|
|
78
|
+
txHash: string | null;
|
|
79
|
+
anchorId: number | null;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GACnB,UAAU,GACV,MAAM,GACN,UAAU,GACV,SAAS,GACT,eAAe,GACf,YAAY,GACZ,MAAM,GACN,iBAAiB,CAAC;AAEtB,MAAM,MAAM,QAAQ,GAChB,cAAc,GACd,gBAAgB,GAChB,WAAW,GACX,SAAS,GACT,YAAY,GACZ,YAAY,GACZ,WAAW,GACX,eAAe,GACf,WAAW,GACX,YAAY,CAAC;AAEjB,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,WAAW,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,QAAQ,EAAE,MA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C,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@brain-protocol/mcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Verifiable Memory-as-a-Service for AI Agents — MCP server with local SQLite or cloud mode",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"bin": {
|
|
8
|
+
"brain-mcp": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"main": "dist/index.js",
|
|
11
|
+
"types": "dist/index.d.ts",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"README.md",
|
|
15
|
+
"LICENSE"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc",
|
|
19
|
+
"dev": "tsx src/index.ts",
|
|
20
|
+
"test": "vitest run",
|
|
21
|
+
"test:watch": "vitest",
|
|
22
|
+
"lint": "tsc --noEmit"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@modelcontextprotocol/sdk": "^1.25.0",
|
|
26
|
+
"better-sqlite3": "^11.0.0",
|
|
27
|
+
"zod": "^3.23.0"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/better-sqlite3": "^7.6.0",
|
|
31
|
+
"@types/node": "^22.0.0",
|
|
32
|
+
"typescript": "^5.7.0",
|
|
33
|
+
"vitest": "^2.1.0",
|
|
34
|
+
"tsx": "^4.19.0"
|
|
35
|
+
},
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=20"
|
|
38
|
+
},
|
|
39
|
+
"keywords": [
|
|
40
|
+
"mcp",
|
|
41
|
+
"brain-protocol",
|
|
42
|
+
"knowledge-management",
|
|
43
|
+
"ai-agents",
|
|
44
|
+
"sqlite",
|
|
45
|
+
"verifiable-memory"
|
|
46
|
+
]
|
|
47
|
+
}
|