@chinjinyu/mcp-knowledge-graph-plus 0.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 +700 -0
- package/dist/application/services/FactService.d.ts +16 -0
- package/dist/application/services/FactService.d.ts.map +1 -0
- package/dist/application/services/FactService.js +50 -0
- package/dist/application/services/FactService.js.map +1 -0
- package/dist/application/services/KnowledgeGraphService.d.ts +33 -0
- package/dist/application/services/KnowledgeGraphService.d.ts.map +1 -0
- package/dist/application/services/KnowledgeGraphService.js +271 -0
- package/dist/application/services/KnowledgeGraphService.js.map +1 -0
- package/dist/application/services/LinkService.d.ts +17 -0
- package/dist/application/services/LinkService.d.ts.map +1 -0
- package/dist/application/services/LinkService.js +53 -0
- package/dist/application/services/LinkService.js.map +1 -0
- package/dist/application/services/NodeService.d.ts +31 -0
- package/dist/application/services/NodeService.d.ts.map +1 -0
- package/dist/application/services/NodeService.js +69 -0
- package/dist/application/services/NodeService.js.map +1 -0
- package/dist/core/config/index.d.ts +34 -0
- package/dist/core/config/index.d.ts.map +1 -0
- package/dist/core/config/index.js +60 -0
- package/dist/core/config/index.js.map +1 -0
- package/dist/core/errors/index.d.ts +70 -0
- package/dist/core/errors/index.d.ts.map +1 -0
- package/dist/core/errors/index.js +120 -0
- package/dist/core/errors/index.js.map +1 -0
- package/dist/core/types/index.d.ts +119 -0
- package/dist/core/types/index.d.ts.map +1 -0
- package/dist/core/types/index.js +5 -0
- package/dist/core/types/index.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +117 -0
- package/dist/index.js.map +1 -0
- package/dist/infrastructure/database/DatabaseManager.d.ts +13 -0
- package/dist/infrastructure/database/DatabaseManager.d.ts.map +1 -0
- package/dist/infrastructure/database/DatabaseManager.js +101 -0
- package/dist/infrastructure/database/DatabaseManager.js.map +1 -0
- package/dist/infrastructure/di/Container.d.ts +21 -0
- package/dist/infrastructure/di/Container.d.ts.map +1 -0
- package/dist/infrastructure/di/Container.js +45 -0
- package/dist/infrastructure/di/Container.js.map +1 -0
- package/dist/infrastructure/repositories/BaseRepository.d.ts +23 -0
- package/dist/infrastructure/repositories/BaseRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/BaseRepository.js +84 -0
- package/dist/infrastructure/repositories/BaseRepository.js.map +1 -0
- package/dist/infrastructure/repositories/FactRepository.d.ts +28 -0
- package/dist/infrastructure/repositories/FactRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/FactRepository.js +101 -0
- package/dist/infrastructure/repositories/FactRepository.js.map +1 -0
- package/dist/infrastructure/repositories/LinkRepository.d.ts +28 -0
- package/dist/infrastructure/repositories/LinkRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/LinkRepository.js +107 -0
- package/dist/infrastructure/repositories/LinkRepository.js.map +1 -0
- package/dist/infrastructure/repositories/NodeRepository.d.ts +28 -0
- package/dist/infrastructure/repositories/NodeRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/NodeRepository.js +143 -0
- package/dist/infrastructure/repositories/NodeRepository.js.map +1 -0
- package/dist/interfaces/mcp/commands/BaseCommand.d.ts +55 -0
- package/dist/interfaces/mcp/commands/BaseCommand.d.ts.map +1 -0
- package/dist/interfaces/mcp/commands/BaseCommand.js +42 -0
- package/dist/interfaces/mcp/commands/BaseCommand.js.map +1 -0
- package/dist/interfaces/mcp/commands/FactAddCommand.d.ts +42 -0
- package/dist/interfaces/mcp/commands/FactAddCommand.d.ts.map +1 -0
- package/dist/interfaces/mcp/commands/FactAddCommand.js +73 -0
- package/dist/interfaces/mcp/commands/FactAddCommand.js.map +1 -0
- package/dist/interfaces/mcp/commands/FactDelCommand.d.ts +42 -0
- package/dist/interfaces/mcp/commands/FactDelCommand.d.ts.map +1 -0
- package/dist/interfaces/mcp/commands/FactDelCommand.js +68 -0
- package/dist/interfaces/mcp/commands/FactDelCommand.js.map +1 -0
- package/dist/interfaces/mcp/commands/FactEditCommand.d.ts +43 -0
- package/dist/interfaces/mcp/commands/FactEditCommand.d.ts.map +1 -0
- package/dist/interfaces/mcp/commands/FactEditCommand.js +68 -0
- package/dist/interfaces/mcp/commands/FactEditCommand.js.map +1 -0
- package/dist/interfaces/mcp/commands/LinkAddCommand.d.ts +43 -0
- package/dist/interfaces/mcp/commands/LinkAddCommand.d.ts.map +1 -0
- package/dist/interfaces/mcp/commands/LinkAddCommand.js +63 -0
- package/dist/interfaces/mcp/commands/LinkAddCommand.js.map +1 -0
- package/dist/interfaces/mcp/commands/LinkDelCommand.d.ts +43 -0
- package/dist/interfaces/mcp/commands/LinkDelCommand.d.ts.map +1 -0
- package/dist/interfaces/mcp/commands/LinkDelCommand.js +65 -0
- package/dist/interfaces/mcp/commands/LinkDelCommand.js.map +1 -0
- package/dist/interfaces/mcp/commands/LinkEditCommand.d.ts +47 -0
- package/dist/interfaces/mcp/commands/LinkEditCommand.d.ts.map +1 -0
- package/dist/interfaces/mcp/commands/LinkEditCommand.js +75 -0
- package/dist/interfaces/mcp/commands/LinkEditCommand.js.map +1 -0
- package/dist/interfaces/mcp/commands/ListCommand.d.ts +33 -0
- package/dist/interfaces/mcp/commands/ListCommand.d.ts.map +1 -0
- package/dist/interfaces/mcp/commands/ListCommand.js +57 -0
- package/dist/interfaces/mcp/commands/ListCommand.js.map +1 -0
- package/dist/interfaces/mcp/commands/NodeAddCommand.d.ts +46 -0
- package/dist/interfaces/mcp/commands/NodeAddCommand.d.ts.map +1 -0
- package/dist/interfaces/mcp/commands/NodeAddCommand.js +67 -0
- package/dist/interfaces/mcp/commands/NodeAddCommand.js.map +1 -0
- package/dist/interfaces/mcp/commands/NodeDelCommand.d.ts +32 -0
- package/dist/interfaces/mcp/commands/NodeDelCommand.d.ts.map +1 -0
- package/dist/interfaces/mcp/commands/NodeDelCommand.js +63 -0
- package/dist/interfaces/mcp/commands/NodeDelCommand.js.map +1 -0
- package/dist/interfaces/mcp/commands/NodeEditCommand.d.ts +43 -0
- package/dist/interfaces/mcp/commands/NodeEditCommand.d.ts.map +1 -0
- package/dist/interfaces/mcp/commands/NodeEditCommand.js +63 -0
- package/dist/interfaces/mcp/commands/NodeEditCommand.js.map +1 -0
- package/dist/interfaces/mcp/commands/NodeGetCommand.d.ts +40 -0
- package/dist/interfaces/mcp/commands/NodeGetCommand.d.ts.map +1 -0
- package/dist/interfaces/mcp/commands/NodeGetCommand.js +72 -0
- package/dist/interfaces/mcp/commands/NodeGetCommand.js.map +1 -0
- package/dist/interfaces/mcp/commands/SearchCommand.d.ts +53 -0
- package/dist/interfaces/mcp/commands/SearchCommand.d.ts.map +1 -0
- package/dist/interfaces/mcp/commands/SearchCommand.js +91 -0
- package/dist/interfaces/mcp/commands/SearchCommand.js.map +1 -0
- package/package.json +10 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { BaseCommand } from './BaseCommand.js';
|
|
2
|
+
export class NodeDelCommand extends BaseCommand {
|
|
3
|
+
nodeService;
|
|
4
|
+
factRepo;
|
|
5
|
+
linkRepo;
|
|
6
|
+
name = 'kg_node_del';
|
|
7
|
+
description = `Delete nodes from the knowledge graph. This will cascade delete all facts attached to the node and all links connected to it. Non-existent nodes are silently ignored.
|
|
8
|
+
|
|
9
|
+
Examples:
|
|
10
|
+
1. Delete a single node:
|
|
11
|
+
{ "names": ["Alice"] }
|
|
12
|
+
|
|
13
|
+
2. Delete multiple nodes:
|
|
14
|
+
{ "names": ["Alice", "Bob", "OldProject"] }
|
|
15
|
+
|
|
16
|
+
3. Delete with cleanup (all related data will be removed):
|
|
17
|
+
{ "names": ["DeprecatedSystem"] }`;
|
|
18
|
+
inputSchema = {
|
|
19
|
+
type: 'object',
|
|
20
|
+
properties: {
|
|
21
|
+
names: {
|
|
22
|
+
type: 'array',
|
|
23
|
+
description: 'Array of node names to delete. Non-existent names will be ignored.',
|
|
24
|
+
items: { type: 'string' },
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
required: ['names'],
|
|
28
|
+
};
|
|
29
|
+
constructor(nodeService, factRepo, linkRepo) {
|
|
30
|
+
super();
|
|
31
|
+
this.nodeService = nodeService;
|
|
32
|
+
this.factRepo = factRepo;
|
|
33
|
+
this.linkRepo = linkRepo;
|
|
34
|
+
}
|
|
35
|
+
async execute(input) {
|
|
36
|
+
// Validate array parameters
|
|
37
|
+
this.validateArray(input.names, 'names', {
|
|
38
|
+
description: 'Provide an array of node names to delete',
|
|
39
|
+
example: '{"names": ["Alice", "Bob"]}',
|
|
40
|
+
});
|
|
41
|
+
const nodes = [];
|
|
42
|
+
for (const name of input.names) {
|
|
43
|
+
const node = await this.nodeService.findByName(name);
|
|
44
|
+
if (node) {
|
|
45
|
+
const factsCount = await this.factRepo.countByNodeId(node.id);
|
|
46
|
+
const links = await this.linkRepo.findByNodeId(node.id);
|
|
47
|
+
const linksCount = links.length;
|
|
48
|
+
nodes.push({ name: node.name, type: node.type, factsCount, linksCount });
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const count = await this.nodeService.deleteNodesByNames(input.names);
|
|
52
|
+
return {
|
|
53
|
+
content: [{
|
|
54
|
+
type: 'text',
|
|
55
|
+
text: JSON.stringify({
|
|
56
|
+
deleted: count,
|
|
57
|
+
nodes: nodes.filter(n => input.names.includes(n.name)),
|
|
58
|
+
}),
|
|
59
|
+
}],
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=NodeDelCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeDelCommand.js","sourceRoot":"","sources":["../../../../src/interfaces/mcp/commands/NodeDelCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAK/C,MAAM,OAAO,cAAe,SAAQ,WAAqB;IA0BpC;IACA;IACA;IA3BV,IAAI,GAAG,aAAa,CAAC;IACrB,WAAW,GAAG;;;;;;;;;;qCAUY,CAAC;IAC3B,WAAW,GAAG;QAC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,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAErE,OAAO;YACL,OAAO,EAAE,CAAC;oBACR,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;wBACnB,OAAO,EAAE,KAAK;wBACd,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;qBACvD,CAAC;iBACH,CAAC;SACH,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { BaseCommand } from './BaseCommand.js';
|
|
2
|
+
import type { NodeService } from '../../../application/services/NodeService.js';
|
|
3
|
+
export declare class NodeEditCommand extends BaseCommand<any, any> {
|
|
4
|
+
private readonly nodeService;
|
|
5
|
+
readonly name = "kg_node_edit";
|
|
6
|
+
readonly description = "Edit existing node's name and/or type. You must provide the current name to identify the node, and at least one of newName or newType to update.\n\nExamples:\n1. Rename a node:\n { \"nodes\": [{ \"name\": \"Alice\", \"newName\": \"Alice_Smith\" }] }\n\n2. Change node type:\n { \"nodes\": [{ \"name\": \"TechCorp\", \"newType\": \"tech_company\" }] }\n\n3. Update both name and type:\n { \"nodes\": [{ \"name\": \"OldProject\", \"newName\": \"NewProject\", \"newType\": \"active_project\" }] }";
|
|
7
|
+
readonly inputSchema: {
|
|
8
|
+
type: string;
|
|
9
|
+
properties: {
|
|
10
|
+
nodes: {
|
|
11
|
+
type: string;
|
|
12
|
+
description: string;
|
|
13
|
+
items: {
|
|
14
|
+
type: string;
|
|
15
|
+
properties: {
|
|
16
|
+
name: {
|
|
17
|
+
type: string;
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
newName: {
|
|
21
|
+
type: string;
|
|
22
|
+
description: string;
|
|
23
|
+
};
|
|
24
|
+
newType: {
|
|
25
|
+
type: string;
|
|
26
|
+
description: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
required: string[];
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
required: string[];
|
|
34
|
+
};
|
|
35
|
+
constructor(nodeService: NodeService);
|
|
36
|
+
execute(input: any): Promise<{
|
|
37
|
+
content: Array<{
|
|
38
|
+
type: 'text';
|
|
39
|
+
text: string;
|
|
40
|
+
}>;
|
|
41
|
+
}>;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=NodeEditCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeEditCommand.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/mcp/commands/NodeEditCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8CAA8C,CAAC;AAEhF,qBAAa,eAAgB,SAAQ,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC;IAiC5C,OAAO,CAAC,QAAQ,CAAC,WAAW;IAhCxC,QAAQ,CAAC,IAAI,kBAAkB;IAC/B,QAAQ,CAAC,WAAW,yfAU4E;IAChG,QAAQ,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;MAkBlB;gBAE2B,WAAW,EAAE,WAAW;IAI/C,OAAO,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,CAAC;CA0BvF"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { BaseCommand } from './BaseCommand.js';
|
|
2
|
+
export class NodeEditCommand extends BaseCommand {
|
|
3
|
+
nodeService;
|
|
4
|
+
name = 'kg_node_edit';
|
|
5
|
+
description = `Edit existing node's name and/or type. You must provide the current name to identify the node, and at least one of newName or newType to update.
|
|
6
|
+
|
|
7
|
+
Examples:
|
|
8
|
+
1. Rename a node:
|
|
9
|
+
{ "nodes": [{ "name": "Alice", "newName": "Alice_Smith" }] }
|
|
10
|
+
|
|
11
|
+
2. Change node type:
|
|
12
|
+
{ "nodes": [{ "name": "TechCorp", "newType": "tech_company" }] }
|
|
13
|
+
|
|
14
|
+
3. Update both name and type:
|
|
15
|
+
{ "nodes": [{ "name": "OldProject", "newName": "NewProject", "newType": "active_project" }] }`;
|
|
16
|
+
inputSchema = {
|
|
17
|
+
type: 'object',
|
|
18
|
+
properties: {
|
|
19
|
+
nodes: {
|
|
20
|
+
type: 'array',
|
|
21
|
+
description: 'Array of nodes to edit. Each item must have "name" and at least one of "newName" or "newType".',
|
|
22
|
+
items: {
|
|
23
|
+
type: 'object',
|
|
24
|
+
properties: {
|
|
25
|
+
name: { type: 'string', description: 'Current name of the node to edit' },
|
|
26
|
+
newName: { type: 'string', description: 'New name for the node (optional)' },
|
|
27
|
+
newType: { type: 'string', description: 'New type for the node (optional)' },
|
|
28
|
+
},
|
|
29
|
+
required: ['name'],
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
required: ['nodes'],
|
|
34
|
+
};
|
|
35
|
+
constructor(nodeService) {
|
|
36
|
+
super();
|
|
37
|
+
this.nodeService = nodeService;
|
|
38
|
+
}
|
|
39
|
+
async execute(input) {
|
|
40
|
+
// Validate array parameters
|
|
41
|
+
this.validateArray(input.nodes, 'nodes', {
|
|
42
|
+
description: 'Provide an array of nodes to edit',
|
|
43
|
+
example: '{"nodes": [{"name": "Alice", "newName": "Alice_Smith"}]}',
|
|
44
|
+
});
|
|
45
|
+
// Map 'name' to 'nodeName' for NodeService
|
|
46
|
+
const updates = input.nodes.map((n) => ({
|
|
47
|
+
nodeName: n.name,
|
|
48
|
+
newName: n.newName,
|
|
49
|
+
newType: n.newType,
|
|
50
|
+
}));
|
|
51
|
+
const nodes = await this.nodeService.updateNodesByName(updates);
|
|
52
|
+
return {
|
|
53
|
+
content: [{
|
|
54
|
+
type: 'text',
|
|
55
|
+
text: JSON.stringify({
|
|
56
|
+
updated: nodes.length,
|
|
57
|
+
nodes: nodes.map(n => ({ name: n.name, type: n.type })),
|
|
58
|
+
}),
|
|
59
|
+
}],
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=NodeEditCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeEditCommand.js","sourceRoot":"","sources":["../../../../src/interfaces/mcp/commands/NodeEditCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,MAAM,OAAO,eAAgB,SAAQ,WAAqB;IAiC3B;IAhCpB,IAAI,GAAG,cAAc,CAAC;IACtB,WAAW,GAAG;;;;;;;;;;iGAUwE,CAAC;IACvF,WAAW,GAAG;QACrB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,KAAK,EAAE;gBACL,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE,gGAAgG;gBAC7G,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,kCAAkC,EAAE;wBACzE,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,kCAAkC,EAAE;wBAC5E,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,kCAAkC,EAAE;qBAC7E;oBACD,QAAQ,EAAE,CAAC,MAAM,CAAC;iBACnB;aACF;SACF;QACD,QAAQ,EAAE,CAAC,OAAO,CAAC;KACpB,CAAC;IAEF,YAA6B,WAAwB;QACnD,KAAK,EAAE,CAAC;QADmB,gBAAW,GAAX,WAAW,CAAa;IAErD,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,KAAU;QACtB,4BAA4B;QAC5B,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE;YACvC,WAAW,EAAE,mCAAmC;YAChD,OAAO,EAAE,0DAA0D;SACpE,CAAC,CAAC;QAEH,2CAA2C;QAC3C,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC;YAC3C,QAAQ,EAAE,CAAC,CAAC,IAAI;YAChB,OAAO,EAAE,CAAC,CAAC,OAAO;YAClB,OAAO,EAAE,CAAC,CAAC,OAAO;SACnB,CAAC,CAAC,CAAC;QAEJ,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAEhE,OAAO;YACL,OAAO,EAAE,CAAC;oBACR,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;wBACnB,OAAO,EAAE,KAAK,CAAC,MAAM;wBACrB,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;qBACxD,CAAC;iBACH,CAAC;SACH,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { BaseCommand } from './BaseCommand.js';
|
|
2
|
+
import type { KnowledgeGraphService } from '../../../application/services/KnowledgeGraphService.js';
|
|
3
|
+
export declare class NodeGetCommand extends BaseCommand<any, any> {
|
|
4
|
+
private readonly kgService;
|
|
5
|
+
readonly name = "kg_node_get";
|
|
6
|
+
readonly description = "Retrieve specific nodes by their names. Returns the nodes with their facts and all links involving these nodes. Link endpoints that are not in the requested list will still have their names resolved.\n\nExamples:\n1. Get a single node:\n { \"names\": [\"Alice\"], \"page\": false }\n\n2. Get multiple nodes:\n { \"names\": [\"Alice\", \"Bob\", \"TechCorp\"], \"page\": false }\n\n3. Get with pagination:\n { \"names\": [\"Alice\", \"Bob\", \"Charlie\", \"David\"], \"page\": true, \"pageNum\": 1, \"pageSize\": 2 }";
|
|
7
|
+
readonly inputSchema: {
|
|
8
|
+
type: string;
|
|
9
|
+
properties: {
|
|
10
|
+
names: {
|
|
11
|
+
type: string;
|
|
12
|
+
description: string;
|
|
13
|
+
items: {
|
|
14
|
+
type: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
page: {
|
|
18
|
+
type: string;
|
|
19
|
+
description: string;
|
|
20
|
+
};
|
|
21
|
+
pageNum: {
|
|
22
|
+
type: string;
|
|
23
|
+
description: string;
|
|
24
|
+
};
|
|
25
|
+
pageSize: {
|
|
26
|
+
type: string;
|
|
27
|
+
description: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
required: string[];
|
|
31
|
+
};
|
|
32
|
+
constructor(kgService: KnowledgeGraphService);
|
|
33
|
+
execute(input: any): Promise<{
|
|
34
|
+
content: Array<{
|
|
35
|
+
type: 'text';
|
|
36
|
+
text: string;
|
|
37
|
+
}>;
|
|
38
|
+
}>;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=NodeGetCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeGetCommand.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/mcp/commands/NodeGetCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wDAAwD,CAAC;AAEpG,qBAAa,cAAe,SAAQ,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC;IA4B3C,OAAO,CAAC,QAAQ,CAAC,SAAS;IA3BtC,QAAQ,CAAC,IAAI,iBAAiB;IAC9B,QAAQ,CAAC,WAAW,8gBAU2E;IAC/F,QAAQ,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;;;;;MAalB;gBAE2B,SAAS,EAAE,qBAAqB;IAIvD,OAAO,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,CAAC;CA0CvF"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { BaseCommand } from './BaseCommand.js';
|
|
2
|
+
export class NodeGetCommand extends BaseCommand {
|
|
3
|
+
kgService;
|
|
4
|
+
name = 'kg_node_get';
|
|
5
|
+
description = `Retrieve specific nodes by their names. Returns the nodes with their facts and all links involving these nodes. Link endpoints that are not in the requested list will still have their names resolved.
|
|
6
|
+
|
|
7
|
+
Examples:
|
|
8
|
+
1. Get a single node:
|
|
9
|
+
{ "names": ["Alice"], "page": false }
|
|
10
|
+
|
|
11
|
+
2. Get multiple nodes:
|
|
12
|
+
{ "names": ["Alice", "Bob", "TechCorp"], "page": false }
|
|
13
|
+
|
|
14
|
+
3. Get with pagination:
|
|
15
|
+
{ "names": ["Alice", "Bob", "Charlie", "David"], "page": true, "pageNum": 1, "pageSize": 2 }`;
|
|
16
|
+
inputSchema = {
|
|
17
|
+
type: 'object',
|
|
18
|
+
properties: {
|
|
19
|
+
names: {
|
|
20
|
+
type: 'array',
|
|
21
|
+
description: 'Array of node names to retrieve',
|
|
22
|
+
items: { type: 'string' },
|
|
23
|
+
},
|
|
24
|
+
page: { type: 'boolean', description: 'Set to true to enable pagination, false to return all results' },
|
|
25
|
+
pageNum: { type: 'number', description: 'Page number (default: 1), only used when page=true' },
|
|
26
|
+
pageSize: { type: 'number', description: 'Number of nodes per page (default: 10), only used when page=true' },
|
|
27
|
+
},
|
|
28
|
+
required: ['names', 'page'],
|
|
29
|
+
};
|
|
30
|
+
constructor(kgService) {
|
|
31
|
+
super();
|
|
32
|
+
this.kgService = kgService;
|
|
33
|
+
}
|
|
34
|
+
async execute(input) {
|
|
35
|
+
// Validate array parameters
|
|
36
|
+
this.validateArray(input.names, 'names', {
|
|
37
|
+
description: 'Provide an array of node names to retrieve',
|
|
38
|
+
example: '{"names": ["Alice", "Bob"], "page": false}',
|
|
39
|
+
});
|
|
40
|
+
const enablePagination = input.page === true;
|
|
41
|
+
const pagination = enablePagination ? {
|
|
42
|
+
page: input.pageNum || 1,
|
|
43
|
+
pageSize: input.pageSize || 10,
|
|
44
|
+
} : undefined;
|
|
45
|
+
const result = await this.kgService.getByNames(input.names || [], pagination);
|
|
46
|
+
const output = {
|
|
47
|
+
nodes: result.data.nodes.map((n) => ({
|
|
48
|
+
name: n.name,
|
|
49
|
+
type: n.type,
|
|
50
|
+
facts: n.facts.map((f) => f.content),
|
|
51
|
+
})),
|
|
52
|
+
links: result.data.links.map((l) => ({
|
|
53
|
+
from: l.from,
|
|
54
|
+
to: l.to,
|
|
55
|
+
type: l.type,
|
|
56
|
+
})),
|
|
57
|
+
};
|
|
58
|
+
if (enablePagination) {
|
|
59
|
+
const info = result.pagination;
|
|
60
|
+
output.pagination = {
|
|
61
|
+
page: info.page,
|
|
62
|
+
pageSize: info.pageSize,
|
|
63
|
+
total: info.totalItems,
|
|
64
|
+
pages: info.totalPages,
|
|
65
|
+
hasNext: info.hasNextPage,
|
|
66
|
+
hasPrev: info.hasPrevPage,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
return { content: [{ type: 'text', text: JSON.stringify(output) }] };
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=NodeGetCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeGetCommand.js","sourceRoot":"","sources":["../../../../src/interfaces/mcp/commands/NodeGetCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,MAAM,OAAO,cAAe,SAAQ,WAAqB;IA4B1B;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;YAClB,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC;gBACxC,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;aAC1C,CAAC,CAAC;YACH,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC;gBACxC,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,EAAE,EAAE,CAAC,CAAC,EAAE;gBACR,IAAI,EAAE,CAAC,CAAC,IAAI;aACb,CAAC,CAAC;SACJ,CAAC;QAEF,IAAI,gBAAgB,EAAE,CAAC;YACrB,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC;YAC/B,MAAM,CAAC,UAAU,GAAG;gBAClB,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,KAAK,EAAE,IAAI,CAAC,UAAU;gBACtB,KAAK,EAAE,IAAI,CAAC,UAAU;gBACtB,OAAO,EAAE,IAAI,CAAC,WAAW;gBACzB,OAAO,EAAE,IAAI,CAAC,WAAW;aAC1B,CAAC;QACJ,CAAC;QAED,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;IACvE,CAAC;CACF"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { BaseCommand } from './BaseCommand.js';
|
|
2
|
+
import type { KnowledgeGraphService } from '../../../application/services/KnowledgeGraphService.js';
|
|
3
|
+
export declare class SearchCommand extends BaseCommand<any, any> {
|
|
4
|
+
private readonly kgService;
|
|
5
|
+
readonly name = "kg_search";
|
|
6
|
+
readonly description = "Search for nodes by keywords. You can search in node names, types, or facts. Supports OR logic (match any keyword) or AND logic (match all keywords). By default searches in name, type, and fact fields.\n\nExamples:\n1. Simple search (OR logic, any match):\n { \"queries\": [\"Python\", \"engineer\"], \"page\": false }\n\n2. Search with AND logic (all keywords must match):\n { \"queries\": [\"engineer\", \"Python\"], \"logic\": \"and\", \"page\": false }\n\n3. Search in specific fields:\n { \"queries\": [\"works_at\"], \"fields\": [\"link\"], \"page\": false }\n\n4. Search with pagination:\n { \"queries\": [\"engineer\"], \"fields\": [\"fact\"], \"page\": true, \"pageNum\": 1, \"pageSize\": 10 }";
|
|
7
|
+
readonly inputSchema: {
|
|
8
|
+
type: string;
|
|
9
|
+
properties: {
|
|
10
|
+
queries: {
|
|
11
|
+
type: string;
|
|
12
|
+
items: {
|
|
13
|
+
type: string;
|
|
14
|
+
};
|
|
15
|
+
description: string;
|
|
16
|
+
};
|
|
17
|
+
page: {
|
|
18
|
+
type: string;
|
|
19
|
+
description: string;
|
|
20
|
+
};
|
|
21
|
+
pageNum: {
|
|
22
|
+
type: string;
|
|
23
|
+
description: string;
|
|
24
|
+
};
|
|
25
|
+
pageSize: {
|
|
26
|
+
type: string;
|
|
27
|
+
description: string;
|
|
28
|
+
};
|
|
29
|
+
logic: {
|
|
30
|
+
type: string;
|
|
31
|
+
enum: string[];
|
|
32
|
+
description: string;
|
|
33
|
+
};
|
|
34
|
+
fields: {
|
|
35
|
+
type: string;
|
|
36
|
+
items: {
|
|
37
|
+
type: string;
|
|
38
|
+
enum: string[];
|
|
39
|
+
};
|
|
40
|
+
description: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
required: string[];
|
|
44
|
+
};
|
|
45
|
+
constructor(kgService: KnowledgeGraphService);
|
|
46
|
+
execute(input: any): Promise<{
|
|
47
|
+
content: Array<{
|
|
48
|
+
type: 'text';
|
|
49
|
+
text: string;
|
|
50
|
+
}>;
|
|
51
|
+
}>;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=SearchCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchCommand.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/mcp/commands/SearchCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wDAAwD,CAAC;AAEpG,qBAAa,aAAc,SAAQ,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC;IAyC1C,OAAO,CAAC,QAAQ,CAAC,SAAS;IAxCtC,QAAQ,CAAC,IAAI,eAAe;IAC5B,QAAQ,CAAC,WAAW,4sBAa0E;IAC9F,QAAQ,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAuBlB;gBAE2B,SAAS,EAAE,qBAAqB;IAIvD,OAAO,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,CAAC;CAqDvF"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { BaseCommand } from './BaseCommand.js';
|
|
2
|
+
export class SearchCommand extends BaseCommand {
|
|
3
|
+
kgService;
|
|
4
|
+
name = 'kg_search';
|
|
5
|
+
description = `Search for nodes by keywords. You can search in node names, types, or facts. Supports OR logic (match any keyword) or AND logic (match all keywords). By default searches in name, type, and fact fields.
|
|
6
|
+
|
|
7
|
+
Examples:
|
|
8
|
+
1. Simple search (OR logic, any match):
|
|
9
|
+
{ "queries": ["Python", "engineer"], "page": false }
|
|
10
|
+
|
|
11
|
+
2. Search with AND logic (all keywords must match):
|
|
12
|
+
{ "queries": ["engineer", "Python"], "logic": "and", "page": false }
|
|
13
|
+
|
|
14
|
+
3. Search in specific fields:
|
|
15
|
+
{ "queries": ["works_at"], "fields": ["link"], "page": false }
|
|
16
|
+
|
|
17
|
+
4. Search with pagination:
|
|
18
|
+
{ "queries": ["engineer"], "fields": ["fact"], "page": true, "pageNum": 1, "pageSize": 10 }`;
|
|
19
|
+
inputSchema = {
|
|
20
|
+
type: 'object',
|
|
21
|
+
properties: {
|
|
22
|
+
queries: {
|
|
23
|
+
type: 'array',
|
|
24
|
+
items: { type: 'string' },
|
|
25
|
+
description: 'Array of search keywords. Case-insensitive partial matching.'
|
|
26
|
+
},
|
|
27
|
+
page: { type: 'boolean', description: 'Set to true to enable pagination, false to return all results' },
|
|
28
|
+
pageNum: { type: 'number', description: 'Page number (default: 1), only used when page=true' },
|
|
29
|
+
pageSize: { type: 'number', description: 'Number of nodes per page (default: 10), only used when page=true' },
|
|
30
|
+
logic: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
enum: ['or', 'and'],
|
|
33
|
+
description: 'Search logic: "or" matches any keyword, "and" matches all keywords (default: "or")'
|
|
34
|
+
},
|
|
35
|
+
fields: {
|
|
36
|
+
type: 'array',
|
|
37
|
+
items: { type: 'string', enum: ['name', 'type', 'link', 'fact'] },
|
|
38
|
+
description: 'Fields to search in: name, type, link (relationship types), fact (fact content). Default: ["name", "type", "fact"].'
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
required: ['queries', 'page'],
|
|
42
|
+
};
|
|
43
|
+
constructor(kgService) {
|
|
44
|
+
super();
|
|
45
|
+
this.kgService = kgService;
|
|
46
|
+
}
|
|
47
|
+
async execute(input) {
|
|
48
|
+
// Validate array parameters
|
|
49
|
+
this.validateArray(input.queries, 'queries', {
|
|
50
|
+
description: 'Provide an array of search keywords',
|
|
51
|
+
example: '{"queries": ["keyword1", "keyword2"], "page": false}',
|
|
52
|
+
});
|
|
53
|
+
if (input.fields !== undefined) {
|
|
54
|
+
this.validateArray(input.fields, 'fields', {
|
|
55
|
+
description: 'Provide an array of field names to search in',
|
|
56
|
+
example: '{"queries": ["test"], "fields": ["name", "type"], "page": false}',
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
const enablePagination = input.page === true;
|
|
60
|
+
const pagination = enablePagination ? {
|
|
61
|
+
page: input.pageNum || 1,
|
|
62
|
+
pageSize: input.pageSize || 10,
|
|
63
|
+
} : undefined;
|
|
64
|
+
const result = await this.kgService.search(input.queries || [], input.logic || 'or', input.fields, pagination);
|
|
65
|
+
const output = {
|
|
66
|
+
nodes: result.data.nodes.map((n) => ({
|
|
67
|
+
name: n.name,
|
|
68
|
+
type: n.type,
|
|
69
|
+
facts: n.facts.map((f) => f.content),
|
|
70
|
+
})),
|
|
71
|
+
links: result.data.links.map((l) => ({
|
|
72
|
+
from: l.from,
|
|
73
|
+
to: l.to,
|
|
74
|
+
type: l.type,
|
|
75
|
+
})),
|
|
76
|
+
};
|
|
77
|
+
if (enablePagination) {
|
|
78
|
+
const info = result.pagination;
|
|
79
|
+
output.pagination = {
|
|
80
|
+
page: info.page,
|
|
81
|
+
pageSize: info.pageSize,
|
|
82
|
+
total: info.totalItems,
|
|
83
|
+
pages: info.totalPages,
|
|
84
|
+
hasNext: info.hasNextPage,
|
|
85
|
+
hasPrev: info.hasPrevPage,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
return { content: [{ type: 'text', text: JSON.stringify(output) }] };
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=SearchCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchCommand.js","sourceRoot":"","sources":["../../../../src/interfaces/mcp/commands/SearchCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,MAAM,OAAO,aAAc,SAAQ,WAAqB;IAyCzB;IAxCpB,IAAI,GAAG,WAAW,CAAC;IACnB,WAAW,GAAG;;;;;;;;;;;;;+FAasE,CAAC;IACrF,WAAW,G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BACvB,KAAK,EAAE,IAAI,CAAC,UAAU;gBACtB,KAAK,EAAE,IAAI,CAAC,UAAU;gBACtB,OAAO,EAAE,IAAI,CAAC,WAAW;gBACzB,OAAO,EAAE,IAAI,CAAC,WAAW;aAC1B,CAAC;QACJ,CAAC;QAED,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;IACvE,CAAC;CACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name":"@chinjinyu/mcp-knowledge-graph-plus",
|
|
3
|
+
"version":"0.1.1",
|
|
4
|
+
"description":"MCP server for persistent AI memory using SQLite database with knowledge graph",
|
|
5
|
+
"license":"MIT",
|
|
6
|
+
"type":"module",
|
|
7
|
+
"engines":{"node":">=18.0.0"},
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public"
|
|
10
|
+
},"bin":{"mcp-knowledge-graph-plus":"dist/index.js"},"files":["dist"],"scripts":{"build":"tsc && shx chmod +x dist/*.js","preinstall":"npm run build","watch":"tsc --watch","test":"node --experimental-vm-modules node_modules/jest/bin/jest.js","test:watch":"node --experimental-vm-modules node_modules/jest/bin/jest.js --watch","test:coverage":"node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage","test:ci":"node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage --ci"},"dependencies":{"@modelcontextprotocol/sdk":"^1.0.1","sqlite3":"^5.1.7"},"devDependencies":{"@types/better-sqlite3":"^7.6.12","@types/jest":"^30.0.0","@types/minimist":"^1.2.5","@types/node":"^22.9.3","jest":"^30.2.0","shx":"^0.3.4","ts-jest":"^29.4.6","typescript":"^5.6.2"}}
|