@knowledgine/mcp-server 0.0.1 → 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 +9 -3
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +45 -7
- 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 +12 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +164 -51
- package/dist/server.js.map +1 -1
- package/package.json +10 -4
package/dist/helpers.d.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import { KnowledgeRepository } from "@knowledgine/core";
|
|
2
|
-
import type { KnowledgineConfig } from "@knowledgine/core";
|
|
1
|
+
import { KnowledgeRepository, GraphRepository, FeedbackRepository } from "@knowledgine/core";
|
|
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
|
+
repository: KnowledgeRepository;
|
|
6
|
+
embeddingProvider: EmbeddingProvider | undefined;
|
|
7
|
+
graphRepository: GraphRepository;
|
|
8
|
+
feedbackRepository: FeedbackRepository;
|
|
9
|
+
db: import("better-sqlite3").Database;
|
|
10
|
+
}>;
|
|
5
11
|
export declare function formatToolResult(data: unknown): {
|
|
6
12
|
content: Array<{
|
|
7
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,16 +1,54 @@
|
|
|
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) {
|
|
27
|
+
export async function initializeDependencies(config) {
|
|
28
|
+
// 1. Create database without sqlite-vec (loaded async below if needed)
|
|
11
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
|
|
12
35
|
new Migrator(db, ALL_MIGRATIONS).migrate();
|
|
13
|
-
|
|
36
|
+
const repository = new KnowledgeRepository(db);
|
|
37
|
+
const graphRepository = new GraphRepository(db);
|
|
38
|
+
const feedbackRepository = new FeedbackRepository(db);
|
|
39
|
+
// 4. EmbeddingProvider initialization (only if model exists)
|
|
40
|
+
let embeddingProvider;
|
|
41
|
+
if (config.embedding?.enabled) {
|
|
42
|
+
const modelManager = new ModelManager();
|
|
43
|
+
if (modelManager.isModelAvailable(config.embedding.modelName)) {
|
|
44
|
+
embeddingProvider = new OnnxEmbeddingProvider(config.embedding.modelName, modelManager);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
console.error(`[knowledgine] Embedding model "${config.embedding.modelName}" not found. ` +
|
|
48
|
+
"Semantic search will be unavailable. Run: knowledgine upgrade --semantic");
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return { repository, embeddingProvider, graphRepository, feedbackRepository, db };
|
|
14
52
|
}
|
|
15
53
|
export function formatToolResult(data) {
|
|
16
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,IAAI,YAAY,EAAE,CAAC;QACxC,IAAI,YAAY,CAAC,gBAAgB,CAAC,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,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 = 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,aAAa,CAAC;AAEzD,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"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AAK,CAAC,CAAC;QACpD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/server.d.ts
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
import type { KnowledgeRepository } from "@knowledgine/core";
|
|
3
|
-
|
|
2
|
+
import type { KnowledgeRepository, EmbeddingProvider } from "@knowledgine/core";
|
|
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;
|
|
4
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,MAAM,mBAAmB,CAAC;
|
|
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,32 +1,29 @@
|
|
|
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:
|
|
5
|
+
export function createKnowledgineMcpServer(options) {
|
|
6
|
+
const server = new McpServer({ name: "knowledgine", version: VERSION });
|
|
7
|
+
const service = new KnowledgeService(options);
|
|
7
8
|
// Tool 1: search_knowledge
|
|
8
9
|
server.registerTool("search_knowledge", {
|
|
9
|
-
description: "
|
|
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.",
|
|
10
11
|
inputSchema: {
|
|
11
|
-
query: z.string().describe("
|
|
12
|
-
limit: z.number().int().positive().optional().describe("
|
|
12
|
+
query: z.string().describe("Search query"),
|
|
13
|
+
limit: z.number().int().positive().optional().describe("Maximum number of results"),
|
|
14
|
+
mode: z
|
|
15
|
+
.enum(["keyword", "semantic", "hybrid"])
|
|
16
|
+
.optional()
|
|
17
|
+
.describe("Search mode (default: keyword)"),
|
|
13
18
|
},
|
|
14
19
|
}, async (input) => {
|
|
15
20
|
try {
|
|
16
|
-
const
|
|
17
|
-
const results = searcher.search({ query: input.query, limit: input.limit ?? 20 });
|
|
18
|
-
return formatToolResult({
|
|
21
|
+
const result = await service.search({
|
|
19
22
|
query: input.query,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
noteId: r.note.id,
|
|
23
|
-
filePath: r.note.file_path,
|
|
24
|
-
title: r.note.title,
|
|
25
|
-
score: r.score,
|
|
26
|
-
matchReason: r.matchReason,
|
|
27
|
-
createdAt: r.note.created_at,
|
|
28
|
-
})),
|
|
23
|
+
limit: input.limit ?? 20,
|
|
24
|
+
mode: input.mode ?? "keyword",
|
|
29
25
|
});
|
|
26
|
+
return formatToolResult(result);
|
|
30
27
|
}
|
|
31
28
|
catch (error) {
|
|
32
29
|
return formatToolError(error instanceof Error ? error.message : String(error));
|
|
@@ -34,53 +31,169 @@ export function createKnowledgineMcpServer(repository, rootPath) {
|
|
|
34
31
|
});
|
|
35
32
|
// Tool 2: find_related
|
|
36
33
|
server.registerTool("find_related", {
|
|
37
|
-
description: "
|
|
34
|
+
description: "Find related notes and problem-solution pairs for a given note by ID or file path. Optionally traverses the knowledge graph.",
|
|
38
35
|
inputSchema: {
|
|
39
|
-
noteId: z.number().int().positive().optional().describe("
|
|
40
|
-
filePath: z.string().optional().describe("
|
|
41
|
-
limit: z.number().int().positive().optional().describe("
|
|
36
|
+
noteId: z.number().int().positive().optional().describe("Note ID"),
|
|
37
|
+
filePath: z.string().optional().describe("File path"),
|
|
38
|
+
limit: z.number().int().positive().optional().describe("Maximum number of results"),
|
|
39
|
+
maxHops: z
|
|
40
|
+
.number()
|
|
41
|
+
.int()
|
|
42
|
+
.min(1)
|
|
43
|
+
.max(3)
|
|
44
|
+
.optional()
|
|
45
|
+
.describe("Graph traversal hops (default: 1, max: 3)"),
|
|
42
46
|
},
|
|
43
47
|
}, async (input) => {
|
|
44
48
|
try {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const { relative, isAbsolute } = await import("path");
|
|
51
|
-
if (isAbsolute(normalizedPath)) {
|
|
52
|
-
normalizedPath = relative(rootPath, normalizedPath);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
const note = repository.getNoteByPath(normalizedPath);
|
|
56
|
-
if (!note) {
|
|
57
|
-
return formatToolError(`Note not found for path: ${input.filePath}`);
|
|
58
|
-
}
|
|
59
|
-
resolvedNoteId = note.id;
|
|
60
|
-
}
|
|
61
|
-
if (!resolvedNoteId) {
|
|
62
|
-
return formatToolError("Either noteId or filePath is required");
|
|
63
|
-
}
|
|
64
|
-
const linkGenerator = new LocalLinkGenerator(repository);
|
|
65
|
-
const relatedNotes = linkGenerator.findRelatedNotes(resolvedNoteId, input.limit ?? 5);
|
|
66
|
-
const problemSolutionPairs = repository.getProblemSolutionPairsByNoteId(resolvedNoteId);
|
|
67
|
-
return formatToolResult({
|
|
68
|
-
noteId: resolvedNoteId,
|
|
69
|
-
relatedNotes,
|
|
70
|
-
problemSolutionPairs,
|
|
49
|
+
const result = await service.findRelated({
|
|
50
|
+
noteId: input.noteId,
|
|
51
|
+
filePath: input.filePath,
|
|
52
|
+
limit: input.limit ?? 5,
|
|
53
|
+
maxHops: input.maxHops ?? 1,
|
|
71
54
|
});
|
|
55
|
+
return formatToolResult(result);
|
|
72
56
|
}
|
|
73
57
|
catch (error) {
|
|
74
|
-
|
|
58
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
59
|
+
// findRelated throws Error for user-facing errors
|
|
60
|
+
return formatToolError(msg);
|
|
75
61
|
}
|
|
76
62
|
});
|
|
77
63
|
// Tool 3: get_stats
|
|
78
64
|
server.registerTool("get_stats", {
|
|
79
|
-
description: "
|
|
65
|
+
description: "Get statistics for the knowledge base including note counts, embedding status, and knowledge graph stats.",
|
|
80
66
|
inputSchema: {},
|
|
81
67
|
}, async () => {
|
|
82
68
|
try {
|
|
83
|
-
|
|
69
|
+
const result = service.getStats();
|
|
70
|
+
return formatToolResult(result);
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
return formatToolError(error instanceof Error ? error.message : String(error));
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
// Tool 4: search_entities
|
|
77
|
+
server.registerTool("search_entities", {
|
|
78
|
+
description: "Search for entities (people, technologies, projects, concepts) in the knowledge graph.",
|
|
79
|
+
inputSchema: {
|
|
80
|
+
query: z.string().describe("Entity name or description to search for"),
|
|
81
|
+
limit: z.number().int().positive().optional().describe("Maximum number of results"),
|
|
82
|
+
},
|
|
83
|
+
}, async (input) => {
|
|
84
|
+
try {
|
|
85
|
+
if (!options.graphRepository) {
|
|
86
|
+
return formatToolError("Knowledge graph is not available");
|
|
87
|
+
}
|
|
88
|
+
const result = service.searchEntities({ query: input.query, limit: input.limit ?? 20 });
|
|
89
|
+
return formatToolResult(result);
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
return formatToolError(error instanceof Error ? error.message : String(error));
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
// Tool 5: get_entity_graph
|
|
96
|
+
server.registerTool("get_entity_graph", {
|
|
97
|
+
description: "Get full graph data for a specific entity including observations, relations, and linked notes.",
|
|
98
|
+
inputSchema: {
|
|
99
|
+
entityId: z.number().int().positive().optional().describe("Entity ID"),
|
|
100
|
+
entityName: z.string().optional().describe("Entity name (case-insensitive)"),
|
|
101
|
+
},
|
|
102
|
+
}, async (input) => {
|
|
103
|
+
try {
|
|
104
|
+
if (!options.graphRepository) {
|
|
105
|
+
return formatToolError("Knowledge graph is not available");
|
|
106
|
+
}
|
|
107
|
+
if (!input.entityId && !input.entityName) {
|
|
108
|
+
return formatToolError("Either entityId or entityName is required");
|
|
109
|
+
}
|
|
110
|
+
const graph = service.getEntityGraph({
|
|
111
|
+
entityId: input.entityId,
|
|
112
|
+
entityName: input.entityName,
|
|
113
|
+
});
|
|
114
|
+
if (!graph) {
|
|
115
|
+
if (input.entityName) {
|
|
116
|
+
return formatToolError(`Entity not found: ${input.entityName}`);
|
|
117
|
+
}
|
|
118
|
+
return formatToolError(`Entity not found: id=${input.entityId}`);
|
|
119
|
+
}
|
|
120
|
+
return formatToolResult(graph);
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
return formatToolError(error instanceof Error ? error.message : String(error));
|
|
124
|
+
}
|
|
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
|
+
});
|
|
84
197
|
}
|
|
85
198
|
catch (error) {
|
|
86
199
|
return formatToolError(error instanceof Error ? error.message : String(error));
|
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,"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{
|
|
2
2
|
"name": "@knowledgine/mcp-server",
|
|
3
|
-
"version": "0.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.0
|
|
19
|
+
"@knowledgine/core": "0.2.0",
|
|
20
|
+
"@knowledgine/ingest": "0.2.0"
|
|
20
21
|
},
|
|
21
22
|
"files": [
|
|
22
23
|
"dist"
|
|
@@ -26,8 +27,10 @@
|
|
|
26
27
|
"mcp",
|
|
27
28
|
"model-context-protocol",
|
|
28
29
|
"knowledge",
|
|
29
|
-
"
|
|
30
|
-
"search"
|
|
30
|
+
"markdown",
|
|
31
|
+
"search",
|
|
32
|
+
"mcp-server",
|
|
33
|
+
"developer-tools"
|
|
31
34
|
],
|
|
32
35
|
"license": "MIT",
|
|
33
36
|
"repository": {
|
|
@@ -39,6 +42,9 @@
|
|
|
39
42
|
"bugs": {
|
|
40
43
|
"url": "https://github.com/3062-in-zamud/knowledgine/issues"
|
|
41
44
|
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/better-sqlite3": "^7.0.0"
|
|
47
|
+
},
|
|
42
48
|
"engines": {
|
|
43
49
|
"node": ">=18"
|
|
44
50
|
},
|