@knowledgine/mcp-server 0.1.0 → 0.2.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/dist/helpers.d.ts +5 -3
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +34 -12
- package/dist/helpers.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +11 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +106 -101
- package/dist/server.js.map +1 -1
- package/package.json +6 -2
package/dist/helpers.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { KnowledgeRepository, GraphRepository } from "@knowledgine/core";
|
|
1
|
+
import { KnowledgeRepository, GraphRepository, FeedbackRepository } from "@knowledgine/core";
|
|
2
2
|
import type { KnowledgineConfig, EmbeddingProvider } from "@knowledgine/core";
|
|
3
3
|
export declare function resolveConfig(): KnowledgineConfig;
|
|
4
|
-
export declare function initializeDependencies(config: KnowledgineConfig): {
|
|
4
|
+
export declare function initializeDependencies(config: KnowledgineConfig): Promise<{
|
|
5
5
|
repository: KnowledgeRepository;
|
|
6
6
|
embeddingProvider: EmbeddingProvider | undefined;
|
|
7
7
|
graphRepository: GraphRepository;
|
|
8
|
-
|
|
8
|
+
feedbackRepository: FeedbackRepository;
|
|
9
|
+
db: import("better-sqlite3").Database;
|
|
10
|
+
}>;
|
|
9
11
|
export declare function formatToolResult(data: unknown): {
|
|
10
12
|
content: Array<{
|
|
11
13
|
type: "text";
|
package/dist/helpers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAInB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE9E,wBAAgB,aAAa,IAAI,iBAAiB,CA2BjD;AAED,wBAAsB,sBAAsB,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC;IAC/E,UAAU,EAAE,mBAAmB,CAAC;IAChC,iBAAiB,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACjD,eAAe,EAAE,eAAe,CAAC;IACjC,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,EAAE,EAAE,OAAO,gBAAgB,EAAE,QAAQ,CAAC;CACvC,CAAC,CA+BD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG;IAC/C,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAChD,CAIA;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG;IAChD,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,OAAO,EAAE,IAAI,CAAC;CACf,CAKA"}
|
package/dist/helpers.js
CHANGED
|
@@ -1,20 +1,42 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { loadConfig, loadSqliteVecExtension, createDatabase, Migrator, KnowledgeRepository, GraphRepository, FeedbackRepository, ALL_MIGRATIONS, OnnxEmbeddingProvider, ModelManager, } from "@knowledgine/core";
|
|
2
2
|
export function resolveConfig() {
|
|
3
3
|
const dbPath = process.env["KNOWLEDGINE_DB_PATH"];
|
|
4
4
|
const rootPath = process.env["KNOWLEDGINE_ROOT_PATH"] ?? process.cwd();
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
const config = loadConfig(rootPath);
|
|
6
|
+
// Override dbPath from env if set
|
|
7
|
+
if (dbPath) {
|
|
8
|
+
config.dbPath = dbPath;
|
|
9
|
+
}
|
|
10
|
+
// Model auto-detection for backward compatibility:
|
|
11
|
+
// If semantic is not explicitly enabled, check if model is already downloaded
|
|
12
|
+
if (!config.embedding.enabled) {
|
|
13
|
+
const modelManager = new ModelManager();
|
|
14
|
+
if (modelManager.isModelAvailable(config.embedding.modelName)) {
|
|
15
|
+
config.embedding.enabled = true;
|
|
16
|
+
console.error("[knowledgine] Semantic search enabled (model detected)");
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
console.error("[knowledgine] Semantic search disabled (no model). Set KNOWLEDGINE_SEMANTIC=true or run 'knowledgine upgrade --semantic'");
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
console.error("[knowledgine] Semantic search enabled (configured)");
|
|
24
|
+
}
|
|
25
|
+
return config;
|
|
9
26
|
}
|
|
10
|
-
export function initializeDependencies(config) {
|
|
11
|
-
// 1. sqlite-vec
|
|
12
|
-
const db = createDatabase(config.dbPath
|
|
13
|
-
// 2.
|
|
27
|
+
export async function initializeDependencies(config) {
|
|
28
|
+
// 1. Create database without sqlite-vec (loaded async below if needed)
|
|
29
|
+
const db = createDatabase(config.dbPath);
|
|
30
|
+
// 2. Load sqlite-vec if semantic search is enabled
|
|
31
|
+
if (config.embedding.enabled) {
|
|
32
|
+
await loadSqliteVecExtension(db);
|
|
33
|
+
}
|
|
34
|
+
// 3. Run migrations
|
|
14
35
|
new Migrator(db, ALL_MIGRATIONS).migrate();
|
|
15
36
|
const repository = new KnowledgeRepository(db);
|
|
16
37
|
const graphRepository = new GraphRepository(db);
|
|
17
|
-
|
|
38
|
+
const feedbackRepository = new FeedbackRepository(db);
|
|
39
|
+
// 4. EmbeddingProvider initialization (only if model exists)
|
|
18
40
|
let embeddingProvider;
|
|
19
41
|
if (config.embedding?.enabled) {
|
|
20
42
|
const modelManager = new ModelManager();
|
|
@@ -23,10 +45,10 @@ export function initializeDependencies(config) {
|
|
|
23
45
|
}
|
|
24
46
|
else {
|
|
25
47
|
console.error(`[knowledgine] Embedding model "${config.embedding.modelName}" not found. ` +
|
|
26
|
-
"Semantic search will be unavailable. Run:
|
|
48
|
+
"Semantic search will be unavailable. Run: knowledgine upgrade --semantic");
|
|
27
49
|
}
|
|
28
50
|
}
|
|
29
|
-
return { repository, embeddingProvider, graphRepository };
|
|
51
|
+
return { repository, embeddingProvider, graphRepository, feedbackRepository, db };
|
|
30
52
|
}
|
|
31
53
|
export function formatToolResult(data) {
|
|
32
54
|
return {
|
package/dist/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,sBAAsB,EACtB,cAAc,EACd,QAAQ,EACR,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,YAAY,GACb,MAAM,mBAAmB,CAAC;AAG3B,MAAM,UAAU,aAAa;IAC3B,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;IAClD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IACvE,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;IAEpC,kCAAkC;IAClC,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAED,mDAAmD;IACnD,8EAA8E;IAC9E,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QAC9B,MAAM,YAAY,GAAG,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C,MAAM,CAAC,SAAS,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;QAC1F,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CACX,kCAAkC,MAAM,CAAC,SAAS,CAAC,SAAS,eAAe;gBACzE,0EAA0E,CAC7E,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,eAAe,EAAE,kBAAkB,EAAE,EAAE,EAAE,CAAC;AACpF,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAa;IAG5C,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;KACjE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,OAAe;IAI7C,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;QAC1C,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
export { createKnowledgineMcpServer } from "./server.js";
|
|
3
|
+
export type { McpServerOptions } from "./server.js";
|
|
3
4
|
export { resolveConfig, initializeDependencies, formatToolResult, formatToolError, } from "./helpers.js";
|
|
4
5
|
export { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,gBAAgB,EAChB,eAAe,GAChB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AACzD,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,gBAAgB,EAChB,eAAe,GAChB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -7,8 +7,15 @@ export { resolveConfig, initializeDependencies, formatToolResult, formatToolErro
|
|
|
7
7
|
export { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
8
8
|
async function main() {
|
|
9
9
|
const config = resolveConfig();
|
|
10
|
-
const { repository, embeddingProvider, graphRepository } = initializeDependencies(config);
|
|
11
|
-
const server = createKnowledgineMcpServer(
|
|
10
|
+
const { repository, embeddingProvider, graphRepository, feedbackRepository, db } = await initializeDependencies(config);
|
|
11
|
+
const server = createKnowledgineMcpServer({
|
|
12
|
+
repository,
|
|
13
|
+
rootPath: config.rootPath,
|
|
14
|
+
embeddingProvider,
|
|
15
|
+
graphRepository,
|
|
16
|
+
feedbackRepository,
|
|
17
|
+
db,
|
|
18
|
+
});
|
|
12
19
|
const transport = new StdioServerTransport();
|
|
13
20
|
await server.connect(transport);
|
|
14
21
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAA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KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QACrB,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC;QACpD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/server.d.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
2
|
import type { KnowledgeRepository, EmbeddingProvider } from "@knowledgine/core";
|
|
3
|
-
import type { GraphRepository } from "@knowledgine/core";
|
|
4
|
-
|
|
3
|
+
import type { GraphRepository, FeedbackRepository } from "@knowledgine/core";
|
|
4
|
+
import type Database from "better-sqlite3";
|
|
5
|
+
export interface McpServerOptions {
|
|
6
|
+
repository: KnowledgeRepository;
|
|
7
|
+
rootPath?: string;
|
|
8
|
+
embeddingProvider?: EmbeddingProvider;
|
|
9
|
+
graphRepository?: GraphRepository;
|
|
10
|
+
feedbackRepository?: FeedbackRepository;
|
|
11
|
+
db?: Database.Database;
|
|
12
|
+
}
|
|
13
|
+
export declare function createKnowledgineMcpServer(options: McpServerOptions): McpServer;
|
|
5
14
|
//# sourceMappingURL=server.d.ts.map
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGpE,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGpE,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAqB,MAAM,mBAAmB,CAAC;AACnG,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAG3C,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,mBAAmB,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,EAAE,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC;CACxB;AAED,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,gBAAgB,GAAG,SAAS,CA0O/E"}
|
package/dist/server.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import {
|
|
3
|
+
import { KnowledgeService, VERSION } from "@knowledgine/core";
|
|
4
4
|
import { formatToolResult, formatToolError } from "./helpers.js";
|
|
5
|
-
export function createKnowledgineMcpServer(
|
|
6
|
-
const server = new McpServer({ name: "knowledgine", version:
|
|
7
|
-
const
|
|
5
|
+
export function createKnowledgineMcpServer(options) {
|
|
6
|
+
const server = new McpServer({ name: "knowledgine", version: VERSION });
|
|
7
|
+
const service = new KnowledgeService(options);
|
|
8
8
|
// Tool 1: search_knowledge
|
|
9
9
|
server.registerTool("search_knowledge", {
|
|
10
10
|
description: "Full-text and semantic search across notes in the knowledge base. Use mode='keyword' for exact matches, 'semantic' for conceptual similarity, or 'hybrid' to combine both.",
|
|
@@ -18,24 +18,12 @@ export function createKnowledgineMcpServer(repository, rootPath, embeddingProvid
|
|
|
18
18
|
},
|
|
19
19
|
}, async (input) => {
|
|
20
20
|
try {
|
|
21
|
-
const
|
|
21
|
+
const result = await service.search({
|
|
22
22
|
query: input.query,
|
|
23
23
|
limit: input.limit ?? 20,
|
|
24
24
|
mode: input.mode ?? "keyword",
|
|
25
25
|
});
|
|
26
|
-
return formatToolResult(
|
|
27
|
-
query: input.query,
|
|
28
|
-
mode: input.mode ?? "keyword",
|
|
29
|
-
totalResults: results.length,
|
|
30
|
-
results: results.map((r) => ({
|
|
31
|
-
noteId: r.note.id,
|
|
32
|
-
filePath: r.note.file_path,
|
|
33
|
-
title: r.note.title,
|
|
34
|
-
score: r.score,
|
|
35
|
-
matchReason: r.matchReason,
|
|
36
|
-
createdAt: r.note.created_at,
|
|
37
|
-
})),
|
|
38
|
-
});
|
|
26
|
+
return formatToolResult(result);
|
|
39
27
|
}
|
|
40
28
|
catch (error) {
|
|
41
29
|
return formatToolError(error instanceof Error ? error.message : String(error));
|
|
@@ -58,54 +46,18 @@ export function createKnowledgineMcpServer(repository, rootPath, embeddingProvid
|
|
|
58
46
|
},
|
|
59
47
|
}, async (input) => {
|
|
60
48
|
try {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const { relative, isAbsolute } = await import("path");
|
|
67
|
-
if (isAbsolute(normalizedPath)) {
|
|
68
|
-
normalizedPath = relative(rootPath, normalizedPath);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
const note = repository.getNoteByPath(normalizedPath);
|
|
72
|
-
if (!note) {
|
|
73
|
-
return formatToolError(`Note not found for path: ${input.filePath}`);
|
|
74
|
-
}
|
|
75
|
-
resolvedNoteId = note.id;
|
|
76
|
-
}
|
|
77
|
-
if (!resolvedNoteId) {
|
|
78
|
-
return formatToolError("Either noteId or filePath is required");
|
|
79
|
-
}
|
|
80
|
-
const linkGenerator = new LocalLinkGenerator(repository, graphRepository);
|
|
81
|
-
const relatedNotes = linkGenerator.findRelatedNotes(resolvedNoteId, input.limit ?? 5);
|
|
82
|
-
const problemSolutionPairs = repository.getProblemSolutionPairsByNoteId(resolvedNoteId);
|
|
83
|
-
// Graph relations if available
|
|
84
|
-
let graphRelations = [];
|
|
85
|
-
if (graphRepository) {
|
|
86
|
-
const linkedEntities = graphRepository.getLinkedEntities(resolvedNoteId);
|
|
87
|
-
const maxHops = input.maxHops ?? 1;
|
|
88
|
-
graphRelations = linkedEntities.map((entity) => ({
|
|
89
|
-
entityId: entity.id,
|
|
90
|
-
name: entity.name,
|
|
91
|
-
entityType: entity.entityType,
|
|
92
|
-
relatedEntities: graphRepository.findRelatedEntities(entity.id, maxHops).map((e) => ({
|
|
93
|
-
id: e.id,
|
|
94
|
-
name: e.name,
|
|
95
|
-
entityType: e.entityType,
|
|
96
|
-
hops: e.hops,
|
|
97
|
-
})),
|
|
98
|
-
}));
|
|
99
|
-
}
|
|
100
|
-
return formatToolResult({
|
|
101
|
-
noteId: resolvedNoteId,
|
|
102
|
-
relatedNotes,
|
|
103
|
-
problemSolutionPairs,
|
|
104
|
-
graphRelations,
|
|
49
|
+
const result = await service.findRelated({
|
|
50
|
+
noteId: input.noteId,
|
|
51
|
+
filePath: input.filePath,
|
|
52
|
+
limit: input.limit ?? 5,
|
|
53
|
+
maxHops: input.maxHops ?? 1,
|
|
105
54
|
});
|
|
55
|
+
return formatToolResult(result);
|
|
106
56
|
}
|
|
107
57
|
catch (error) {
|
|
108
|
-
|
|
58
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
59
|
+
// findRelated throws Error for user-facing errors
|
|
60
|
+
return formatToolError(msg);
|
|
109
61
|
}
|
|
110
62
|
});
|
|
111
63
|
// Tool 3: get_stats
|
|
@@ -114,19 +66,8 @@ export function createKnowledgineMcpServer(repository, rootPath, embeddingProvid
|
|
|
114
66
|
inputSchema: {},
|
|
115
67
|
}, async () => {
|
|
116
68
|
try {
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
? repository.getNotesWithoutEmbeddings().length
|
|
120
|
-
: null;
|
|
121
|
-
const graphStats = graphRepository ? graphRepository.getGraphStats() : null;
|
|
122
|
-
return formatToolResult({
|
|
123
|
-
...stats,
|
|
124
|
-
embeddingStatus: {
|
|
125
|
-
available: embeddingProvider != null,
|
|
126
|
-
notesWithoutEmbeddings,
|
|
127
|
-
},
|
|
128
|
-
graphStats,
|
|
129
|
-
});
|
|
69
|
+
const result = service.getStats();
|
|
70
|
+
return formatToolResult(result);
|
|
130
71
|
}
|
|
131
72
|
catch (error) {
|
|
132
73
|
return formatToolError(error instanceof Error ? error.message : String(error));
|
|
@@ -141,21 +82,11 @@ export function createKnowledgineMcpServer(repository, rootPath, embeddingProvid
|
|
|
141
82
|
},
|
|
142
83
|
}, async (input) => {
|
|
143
84
|
try {
|
|
144
|
-
if (!graphRepository) {
|
|
85
|
+
if (!options.graphRepository) {
|
|
145
86
|
return formatToolError("Knowledge graph is not available");
|
|
146
87
|
}
|
|
147
|
-
const
|
|
148
|
-
return formatToolResult(
|
|
149
|
-
query: input.query,
|
|
150
|
-
totalResults: entities.length,
|
|
151
|
-
entities: entities.map((e) => ({
|
|
152
|
-
id: e.id,
|
|
153
|
-
name: e.name,
|
|
154
|
-
entityType: e.entityType,
|
|
155
|
-
description: e.description,
|
|
156
|
-
createdAt: e.createdAt,
|
|
157
|
-
})),
|
|
158
|
-
});
|
|
88
|
+
const result = service.searchEntities({ query: input.query, limit: input.limit ?? 20 });
|
|
89
|
+
return formatToolResult(result);
|
|
159
90
|
}
|
|
160
91
|
catch (error) {
|
|
161
92
|
return formatToolError(error instanceof Error ? error.message : String(error));
|
|
@@ -170,23 +101,21 @@ export function createKnowledgineMcpServer(repository, rootPath, embeddingProvid
|
|
|
170
101
|
},
|
|
171
102
|
}, async (input) => {
|
|
172
103
|
try {
|
|
173
|
-
if (!graphRepository) {
|
|
104
|
+
if (!options.graphRepository) {
|
|
174
105
|
return formatToolError("Knowledge graph is not available");
|
|
175
106
|
}
|
|
176
|
-
|
|
177
|
-
if (!entityId && input.entityName) {
|
|
178
|
-
const entity = graphRepository.getEntityByName(input.entityName);
|
|
179
|
-
if (!entity) {
|
|
180
|
-
return formatToolError(`Entity not found: ${input.entityName}`);
|
|
181
|
-
}
|
|
182
|
-
entityId = entity.id;
|
|
183
|
-
}
|
|
184
|
-
if (!entityId) {
|
|
107
|
+
if (!input.entityId && !input.entityName) {
|
|
185
108
|
return formatToolError("Either entityId or entityName is required");
|
|
186
109
|
}
|
|
187
|
-
const graph =
|
|
110
|
+
const graph = service.getEntityGraph({
|
|
111
|
+
entityId: input.entityId,
|
|
112
|
+
entityName: input.entityName,
|
|
113
|
+
});
|
|
188
114
|
if (!graph) {
|
|
189
|
-
|
|
115
|
+
if (input.entityName) {
|
|
116
|
+
return formatToolError(`Entity not found: ${input.entityName}`);
|
|
117
|
+
}
|
|
118
|
+
return formatToolError(`Entity not found: id=${input.entityId}`);
|
|
190
119
|
}
|
|
191
120
|
return formatToolResult(graph);
|
|
192
121
|
}
|
|
@@ -194,6 +123,82 @@ export function createKnowledgineMcpServer(repository, rootPath, embeddingProvid
|
|
|
194
123
|
return formatToolError(error instanceof Error ? error.message : String(error));
|
|
195
124
|
}
|
|
196
125
|
});
|
|
126
|
+
// Tool 6: report_extraction_error
|
|
127
|
+
server.registerTool("report_extraction_error", {
|
|
128
|
+
description: "Report an extraction error for feedback. Helps improve entity extraction accuracy.",
|
|
129
|
+
inputSchema: {
|
|
130
|
+
entityName: z.string().describe("Name of the entity with the error"),
|
|
131
|
+
errorType: z
|
|
132
|
+
.enum(["false_positive", "wrong_type", "missed_entity"])
|
|
133
|
+
.describe("Type of error"),
|
|
134
|
+
entityType: z.string().optional().describe("Current entity type"),
|
|
135
|
+
correctType: z.string().optional().describe("Correct type (for wrong_type errors)"),
|
|
136
|
+
noteId: z
|
|
137
|
+
.number()
|
|
138
|
+
.int()
|
|
139
|
+
.positive()
|
|
140
|
+
.optional()
|
|
141
|
+
.describe("Note ID where the error was found"),
|
|
142
|
+
details: z.string().optional().describe("Additional details"),
|
|
143
|
+
},
|
|
144
|
+
}, async (input) => {
|
|
145
|
+
try {
|
|
146
|
+
const result = service.reportExtractionError({
|
|
147
|
+
entityName: input.entityName,
|
|
148
|
+
errorType: input.errorType,
|
|
149
|
+
entityType: input.entityType,
|
|
150
|
+
correctType: input.correctType,
|
|
151
|
+
noteId: input.noteId,
|
|
152
|
+
details: input.details,
|
|
153
|
+
});
|
|
154
|
+
return formatToolResult(result);
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
return formatToolError(error instanceof Error ? error.message : String(error));
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
// Tool 7: capture_knowledge
|
|
161
|
+
server.registerTool("capture_knowledge", {
|
|
162
|
+
description: "Capture and store knowledge. Use after solving problems, making decisions, or discovering patterns.",
|
|
163
|
+
inputSchema: {
|
|
164
|
+
content: z.string().describe("Knowledge content to capture"),
|
|
165
|
+
title: z.string().optional().describe("Optional title"),
|
|
166
|
+
tags: z.array(z.string()).optional().describe("Optional tags"),
|
|
167
|
+
source: z.string().optional().describe("Optional source description"),
|
|
168
|
+
},
|
|
169
|
+
}, async (input) => {
|
|
170
|
+
try {
|
|
171
|
+
if (!options.db) {
|
|
172
|
+
return formatToolError("Database not available for capture");
|
|
173
|
+
}
|
|
174
|
+
const { EventWriter, sanitizeContent } = await import("@knowledgine/ingest");
|
|
175
|
+
const writer = new EventWriter(options.db, options.repository);
|
|
176
|
+
const title = input.title || input.content.slice(0, 50).replace(/\n/g, " ").trim();
|
|
177
|
+
const sourceUri = input.source ? `capture://${input.source}` : "capture://mcp";
|
|
178
|
+
const event = {
|
|
179
|
+
sourceUri,
|
|
180
|
+
eventType: "capture",
|
|
181
|
+
title,
|
|
182
|
+
content: sanitizeContent(input.content),
|
|
183
|
+
timestamp: new Date(),
|
|
184
|
+
metadata: {
|
|
185
|
+
sourcePlugin: "capture",
|
|
186
|
+
sourceId: `capture-${Date.now()}`,
|
|
187
|
+
tags: input.tags,
|
|
188
|
+
},
|
|
189
|
+
};
|
|
190
|
+
const result = writer.writeEvent(event);
|
|
191
|
+
return formatToolResult({
|
|
192
|
+
id: result.id,
|
|
193
|
+
title,
|
|
194
|
+
tags: input.tags ?? [],
|
|
195
|
+
sourceUri,
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
catch (error) {
|
|
199
|
+
return formatToolError(error instanceof Error ? error.message : String(error));
|
|
200
|
+
}
|
|
201
|
+
});
|
|
197
202
|
return server;
|
|
198
203
|
}
|
|
199
204
|
//# sourceMappingURL=server.js.map
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAI9D,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAWjE,MAAM,UAAU,0BAA0B,CAAC,OAAyB;IAClE,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IACxE,MAAM,OAAO,GAAG,IAAI,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAE9C,2BAA2B;IAC3B,MAAM,CAAC,YAAY,CACjB,kBAAkB,EAClB;QACE,WAAW,EACT,4KAA4K;QAC9K,WAAW,EAAE;YACX,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC;YAC1C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC;YACn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CAAC;gBACtB,EAAE,EAAE,MAAM,CAAC,EAAE;gBACb,KAAK;gBACL,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,EAAE;gBACtB,SAAS;aACV,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,eAAe,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACjF,CAAC;IACH,CAAC,CACF,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knowledgine/mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
18
18
|
"zod": "^4.3.6",
|
|
19
|
-
"@knowledgine/core": "0.
|
|
19
|
+
"@knowledgine/core": "0.2.0",
|
|
20
|
+
"@knowledgine/ingest": "0.2.0"
|
|
20
21
|
},
|
|
21
22
|
"files": [
|
|
22
23
|
"dist"
|
|
@@ -41,6 +42,9 @@
|
|
|
41
42
|
"bugs": {
|
|
42
43
|
"url": "https://github.com/3062-in-zamud/knowledgine/issues"
|
|
43
44
|
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/better-sqlite3": "^7.0.0"
|
|
47
|
+
},
|
|
44
48
|
"engines": {
|
|
45
49
|
"node": ">=18"
|
|
46
50
|
},
|