@ai-devkit/memory 0.8.0 → 0.10.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/README.md +2 -2
- package/dist/server.d.ts +57 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +16 -6
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ Add to your MCP client configuration (e.g., Claude Code, Cursor):
|
|
|
38
38
|
|
|
39
39
|
```json
|
|
40
40
|
{
|
|
41
|
-
"tool": "
|
|
41
|
+
"tool": "memory_storeKnowledge",
|
|
42
42
|
"arguments": {
|
|
43
43
|
"title": "Always use Response DTOs for API endpoints",
|
|
44
44
|
"content": "When building REST APIs, always use Response DTOs instead of returning domain entities directly.",
|
|
@@ -52,7 +52,7 @@ Add to your MCP client configuration (e.g., Claude Code, Cursor):
|
|
|
52
52
|
|
|
53
53
|
```json
|
|
54
54
|
{
|
|
55
|
-
"tool": "
|
|
55
|
+
"tool": "memory_searchKnowledge",
|
|
56
56
|
"arguments": {
|
|
57
57
|
"query": "building an API endpoint",
|
|
58
58
|
"contextTags": ["api"],
|
package/dist/server.d.ts
CHANGED
|
@@ -1,4 +1,61 @@
|
|
|
1
1
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
|
+
export declare const TOOLS: ({
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object";
|
|
7
|
+
properties: {
|
|
8
|
+
title: {
|
|
9
|
+
type: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
content: {
|
|
13
|
+
type: string;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
tags: {
|
|
17
|
+
type: string;
|
|
18
|
+
items: {
|
|
19
|
+
type: string;
|
|
20
|
+
};
|
|
21
|
+
description: string;
|
|
22
|
+
};
|
|
23
|
+
scope: {
|
|
24
|
+
type: string;
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
required: string[];
|
|
29
|
+
};
|
|
30
|
+
} | {
|
|
31
|
+
name: string;
|
|
32
|
+
description: string;
|
|
33
|
+
inputSchema: {
|
|
34
|
+
type: "object";
|
|
35
|
+
properties: {
|
|
36
|
+
query: {
|
|
37
|
+
type: string;
|
|
38
|
+
description: string;
|
|
39
|
+
};
|
|
40
|
+
contextTags: {
|
|
41
|
+
type: string;
|
|
42
|
+
items: {
|
|
43
|
+
type: string;
|
|
44
|
+
};
|
|
45
|
+
description: string;
|
|
46
|
+
};
|
|
47
|
+
scope: {
|
|
48
|
+
type: string;
|
|
49
|
+
description: string;
|
|
50
|
+
};
|
|
51
|
+
limit: {
|
|
52
|
+
type: string;
|
|
53
|
+
description: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
required: string[];
|
|
57
|
+
};
|
|
58
|
+
})[];
|
|
2
59
|
export declare function createServer(): Server;
|
|
3
60
|
export declare function runServer(): Promise<void>;
|
|
4
61
|
//# 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,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAuGnE,wBAAgB,YAAY,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAuGnE,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAyC,CAAC;AAE5D,wBAAgB,YAAY,IAAI,MAAM,CA6FrC;AAED,wBAAsB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAI/C"}
|
package/dist/server.js
CHANGED
|
@@ -9,6 +9,9 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
+
get TOOLS () {
|
|
13
|
+
return TOOLS;
|
|
14
|
+
},
|
|
12
15
|
get createServer () {
|
|
13
16
|
return createServer;
|
|
14
17
|
},
|
|
@@ -26,7 +29,7 @@ const _errors = require("./utils/errors");
|
|
|
26
29
|
const SERVER_NAME = 'ai-devkit-memory';
|
|
27
30
|
const SERVER_VERSION = '0.1.0';
|
|
28
31
|
const STORE_TOOL = {
|
|
29
|
-
name: '
|
|
32
|
+
name: 'memory_storeKnowledge',
|
|
30
33
|
description: 'Store a new knowledge item. Use this to save actionable guidelines, rules, or patterns for future reference.',
|
|
31
34
|
inputSchema: {
|
|
32
35
|
type: 'object',
|
|
@@ -58,7 +61,7 @@ const STORE_TOOL = {
|
|
|
58
61
|
}
|
|
59
62
|
};
|
|
60
63
|
const UPDATE_TOOL = {
|
|
61
|
-
name: '
|
|
64
|
+
name: 'memory_updateKnowledge',
|
|
62
65
|
description: 'Update an existing knowledge item by ID. Use this to correct outdated or inaccurate knowledge.',
|
|
63
66
|
inputSchema: {
|
|
64
67
|
type: 'object',
|
|
@@ -93,7 +96,7 @@ const UPDATE_TOOL = {
|
|
|
93
96
|
}
|
|
94
97
|
};
|
|
95
98
|
const SEARCH_TOOL = {
|
|
96
|
-
name: '
|
|
99
|
+
name: 'memory_searchKnowledge',
|
|
97
100
|
description: 'Search for relevant knowledge based on a task description. Returns ranked results.',
|
|
98
101
|
inputSchema: {
|
|
99
102
|
type: 'object',
|
|
@@ -123,6 +126,11 @@ const SEARCH_TOOL = {
|
|
|
123
126
|
]
|
|
124
127
|
}
|
|
125
128
|
};
|
|
129
|
+
const TOOLS = [
|
|
130
|
+
STORE_TOOL,
|
|
131
|
+
UPDATE_TOOL,
|
|
132
|
+
SEARCH_TOOL
|
|
133
|
+
];
|
|
126
134
|
function createServer() {
|
|
127
135
|
const server = new _index.Server({
|
|
128
136
|
name: SERVER_NAME,
|
|
@@ -146,7 +154,9 @@ function createServer() {
|
|
|
146
154
|
server.setRequestHandler(_types.CallToolRequestSchema, async (request)=>{
|
|
147
155
|
const { name, arguments: args } = request.params;
|
|
148
156
|
try {
|
|
149
|
-
|
|
157
|
+
// Backward-compat: accept deprecated dotted names so agents with
|
|
158
|
+
// stale prompts/templates continue to work. Remove in next major.
|
|
159
|
+
if (name === 'memory_storeKnowledge' || name === 'memory.storeKnowledge') {
|
|
150
160
|
const input = args;
|
|
151
161
|
const result = (0, _store.storeKnowledge)(input);
|
|
152
162
|
return {
|
|
@@ -158,7 +168,7 @@ function createServer() {
|
|
|
158
168
|
]
|
|
159
169
|
};
|
|
160
170
|
}
|
|
161
|
-
if (name === 'memory.updateKnowledge') {
|
|
171
|
+
if (name === 'memory_updateKnowledge' || name === 'memory.updateKnowledge') {
|
|
162
172
|
const input = args;
|
|
163
173
|
const result = (0, _update.updateKnowledge)(input);
|
|
164
174
|
return {
|
|
@@ -170,7 +180,7 @@ function createServer() {
|
|
|
170
180
|
]
|
|
171
181
|
};
|
|
172
182
|
}
|
|
173
|
-
if (name === 'memory.searchKnowledge') {
|
|
183
|
+
if (name === 'memory_searchKnowledge' || name === 'memory.searchKnowledge') {
|
|
174
184
|
const input = args;
|
|
175
185
|
const result = (0, _search.searchKnowledge)(input);
|
|
176
186
|
return {
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/server.ts"],"sourcesContent":["import { Server } from '@modelcontextprotocol/sdk/server/index.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport {\n CallToolRequestSchema,\n ListToolsRequestSchema,\n} from '@modelcontextprotocol/sdk/types.js';\nimport { storeKnowledge } from './handlers/store';\nimport { searchKnowledge } from './handlers/search';\nimport { updateKnowledge } from './handlers/update';\nimport { KnowledgeMemoryError } from './utils/errors';\nimport type { StoreKnowledgeInput, SearchKnowledgeInput, UpdateKnowledgeInput } from './types';\n\nconst SERVER_NAME = 'ai-devkit-memory';\nconst SERVER_VERSION = '0.1.0';\n\nconst STORE_TOOL = {\n name: 'memory.storeKnowledge',\n description: 'Store a new knowledge item. Use this to save actionable guidelines, rules, or patterns for future reference.',\n inputSchema: {\n type: 'object' as const,\n properties: {\n title: {\n type: 'string',\n description: 'Short, explicit description of the rule (5-12 words, 10-100 chars)',\n },\n content: {\n type: 'string',\n description: 'Detailed explanation in markdown format. Supports code blocks and examples. (50-5000 chars)',\n },\n tags: {\n type: 'array',\n items: { type: 'string' },\n description: 'Optional domain keywords (e.g., [\"api\", \"backend\"]). Max 10 tags.',\n },\n scope: {\n type: 'string',\n description: 'Optional scope: \"global\", \"project:<name>\", or \"repo:<name>\". Default: \"global\"',\n },\n },\n required: ['title', 'content'],\n },\n};\n\nconst UPDATE_TOOL = {\n name: 'memory.updateKnowledge',\n description: 'Update an existing knowledge item by ID. Use this to correct outdated or inaccurate knowledge.',\n inputSchema: {\n type: 'object' as const,\n properties: {\n id: {\n type: 'string',\n description: 'UUID of the knowledge item to update',\n },\n title: {\n type: 'string',\n description: 'New title (10-100 chars). Only provide if changing.',\n },\n content: {\n type: 'string',\n description: 'New content in markdown format (50-5000 chars). Only provide if changing.',\n },\n tags: {\n type: 'array',\n items: { type: 'string' },\n description: 'New tags (replaces existing). Only provide if changing. Max 10 tags.',\n },\n scope: {\n type: 'string',\n description: 'New scope: \"global\", \"project:<name>\", or \"repo:<name>\". Only provide if changing.',\n },\n },\n required: ['id'],\n },\n};\n\nconst SEARCH_TOOL = {\n name: 'memory.searchKnowledge',\n description: 'Search for relevant knowledge based on a task description. Returns ranked results.',\n inputSchema: {\n type: 'object' as const,\n properties: {\n query: {\n type: 'string',\n description: 'Natural language task description to search for relevant knowledge (3-500 chars)',\n },\n contextTags: {\n type: 'array',\n items: { type: 'string' },\n description: 'Optional tags to boost matching results (e.g., [\"api\", \"backend\"])',\n },\n scope: {\n type: 'string',\n description: 'Optional project/repo scope filter. Results from this scope are prioritized.',\n },\n limit: {\n type: 'number',\n description: 'Maximum number of results to return (1-20, default: 5)',\n },\n },\n required: ['query'],\n },\n};\n\nexport function createServer(): Server {\n const server = new Server(\n {\n name: SERVER_NAME,\n version: SERVER_VERSION,\n },\n {\n capabilities: {\n tools: {},\n },\n }\n );\n\n // List available tools\n server.setRequestHandler(ListToolsRequestSchema, async () => {\n return {\n tools: [STORE_TOOL, UPDATE_TOOL, SEARCH_TOOL],\n };\n });\n\n // Handle tool calls\n server.setRequestHandler(CallToolRequestSchema, async (request) => {\n const { name, arguments: args } = request.params;\n\n try {\n if (name === 'memory.storeKnowledge') {\n const input = args as unknown as StoreKnowledgeInput;\n const result = storeKnowledge(input);\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify(result, null, 2),\n },\n ],\n };\n }\n\n if (name === 'memory.updateKnowledge') {\n const input = args as unknown as UpdateKnowledgeInput;\n const result = updateKnowledge(input);\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify(result, null, 2),\n },\n ],\n };\n }\n\n if (name === 'memory.searchKnowledge') {\n const input = args as unknown as SearchKnowledgeInput;\n const result = searchKnowledge(input);\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify(result, null, 2),\n },\n ],\n };\n }\n\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify({ error: 'UNKNOWN_TOOL', message: `Unknown tool: ${name}` }),\n },\n ],\n isError: true,\n };\n } catch (error) {\n const errorResponse = error instanceof KnowledgeMemoryError\n ? error.toJSON()\n : { error: 'INTERNAL_ERROR', message: error instanceof Error ? error.message : String(error) };\n\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify(errorResponse, null, 2),\n },\n ],\n isError: true,\n };\n }\n });\n\n return server;\n}\n\nexport async function runServer(): Promise<void> {\n const server = createServer();\n const transport = new StdioServerTransport();\n await server.connect(transport);\n}\n"],"names":["createServer","runServer","SERVER_NAME","SERVER_VERSION","STORE_TOOL","name","description","inputSchema","type","properties","title","content","tags","items","scope","required","UPDATE_TOOL","id","SEARCH_TOOL","query","contextTags","limit","server","Server","version","capabilities","tools","setRequestHandler","ListToolsRequestSchema","CallToolRequestSchema","request","arguments","args","params","input","result","storeKnowledge","text","JSON","stringify","updateKnowledge","searchKnowledge","error","message","isError","errorResponse","KnowledgeMemoryError","toJSON","Error","String","transport","StdioServerTransport","connect"],"mappings":";;;;;;;;;;;QAuGgBA;eAAAA;;QA6FMC;eAAAA;;;uBApMC;uBACc;uBAI9B;uBACwB;wBACC;wBACA;wBACK;AAGrC,MAAMC,cAAc;AACpB,MAAMC,iBAAiB;AAEvB,MAAMC,aAAa;IACfC,MAAM;IACNC,aAAa;IACbC,aAAa;QACTC,MAAM;QACNC,YAAY;YACRC,OAAO;gBACHF,MAAM;gBACNF,aAAa;YACjB;YACAK,SAAS;gBACLH,MAAM;gBACNF,aAAa;YACjB;YACAM,MAAM;gBACFJ,MAAM;gBACNK,OAAO;oBAAEL,MAAM;gBAAS;gBACxBF,aAAa;YACjB;YACAQ,OAAO;gBACHN,MAAM;gBACNF,aAAa;YACjB;QACJ;QACAS,UAAU;YAAC;YAAS;SAAU;IAClC;AACJ;AAEA,MAAMC,cAAc;IAChBX,MAAM;IACNC,aAAa;IACbC,aAAa;QACTC,MAAM;QACNC,YAAY;YACRQ,IAAI;gBACAT,MAAM;gBACNF,aAAa;YACjB;YACAI,OAAO;gBACHF,MAAM;gBACNF,aAAa;YACjB;YACAK,SAAS;gBACLH,MAAM;gBACNF,aAAa;YACjB;YACAM,MAAM;gBACFJ,MAAM;gBACNK,OAAO;oBAAEL,MAAM;gBAAS;gBACxBF,aAAa;YACjB;YACAQ,OAAO;gBACHN,MAAM;gBACNF,aAAa;YACjB;QACJ;QACAS,UAAU;YAAC;SAAK;IACpB;AACJ;AAEA,MAAMG,cAAc;IAChBb,MAAM;IACNC,aAAa;IACbC,aAAa;QACTC,MAAM;QACNC,YAAY;YACRU,OAAO;gBACHX,MAAM;g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AAKC,SAAS,CAACJ,QAAQ,MAAM;wBACvC;qBACH;gBACL;YACJ;YAEA,OAAO;gBACHxB,SAAS;oBACL;wBACIH,MAAM;wBACN6B,MAAMC,KAAKC,SAAS,CAAC;4BAAEG,OAAO;4BAAgBC,SAAS,CAAC,cAAc,EAAEtC,MAAM;wBAAC;oBACnF;iBACH;gBACDuC,SAAS;YACb;QACJ,EAAE,OAAOF,OAAO;YACZ,MAAMG,gBAAgBH,iBAAiBI,4BAAoB,GACrDJ,MAAMK,MAAM,KACZ;gBAAEL,OAAO;gBAAkBC,SAASD,iBAAiBM,QAAQN,MAAMC,OAAO,GAAGM,OAAOP;YAAO;YAEjG,OAAO;gBACH/B,SAAS;oBACL;wBACIH,MAAM;wBACN6B,MAAMC,KAAKC,SAAS,CAACM,eAAe,MAAM;oBAC9C;iBACH;gBACDD,SAAS;YACb;QACJ;IACJ;IAEA,OAAOtB;AACX;AAEO,eAAerB;IAClB,MAAMqB,SAAStB;IACf,MAAMkD,YAAY,IAAIC,2BAAoB;IAC1C,MAAM7B,OAAO8B,OAAO,CAACF;AACzB"}
|
|
1
|
+
{"version":3,"sources":["../src/server.ts"],"sourcesContent":["import { Server } from '@modelcontextprotocol/sdk/server/index.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport {\n CallToolRequestSchema,\n ListToolsRequestSchema,\n} from '@modelcontextprotocol/sdk/types.js';\nimport { storeKnowledge } from './handlers/store';\nimport { searchKnowledge } from './handlers/search';\nimport { updateKnowledge } from './handlers/update';\nimport { KnowledgeMemoryError } from './utils/errors';\nimport type { StoreKnowledgeInput, SearchKnowledgeInput, UpdateKnowledgeInput } from './types';\n\nconst SERVER_NAME = 'ai-devkit-memory';\nconst SERVER_VERSION = '0.1.0';\n\nconst STORE_TOOL = {\n name: 'memory_storeKnowledge',\n description: 'Store a new knowledge item. Use this to save actionable guidelines, rules, or patterns for future reference.',\n inputSchema: {\n type: 'object' as const,\n properties: {\n title: {\n type: 'string',\n description: 'Short, explicit description of the rule (5-12 words, 10-100 chars)',\n },\n content: {\n type: 'string',\n description: 'Detailed explanation in markdown format. Supports code blocks and examples. (50-5000 chars)',\n },\n tags: {\n type: 'array',\n items: { type: 'string' },\n description: 'Optional domain keywords (e.g., [\"api\", \"backend\"]). Max 10 tags.',\n },\n scope: {\n type: 'string',\n description: 'Optional scope: \"global\", \"project:<name>\", or \"repo:<name>\". Default: \"global\"',\n },\n },\n required: ['title', 'content'],\n },\n};\n\nconst UPDATE_TOOL = {\n name: 'memory_updateKnowledge',\n description: 'Update an existing knowledge item by ID. Use this to correct outdated or inaccurate knowledge.',\n inputSchema: {\n type: 'object' as const,\n properties: {\n id: {\n type: 'string',\n description: 'UUID of the knowledge item to update',\n },\n title: {\n type: 'string',\n description: 'New title (10-100 chars). Only provide if changing.',\n },\n content: {\n type: 'string',\n description: 'New content in markdown format (50-5000 chars). Only provide if changing.',\n },\n tags: {\n type: 'array',\n items: { type: 'string' },\n description: 'New tags (replaces existing). Only provide if changing. Max 10 tags.',\n },\n scope: {\n type: 'string',\n description: 'New scope: \"global\", \"project:<name>\", or \"repo:<name>\". Only provide if changing.',\n },\n },\n required: ['id'],\n },\n};\n\nconst SEARCH_TOOL = {\n name: 'memory_searchKnowledge',\n description: 'Search for relevant knowledge based on a task description. Returns ranked results.',\n inputSchema: {\n type: 'object' as const,\n properties: {\n query: {\n type: 'string',\n description: 'Natural language task description to search for relevant knowledge (3-500 chars)',\n },\n contextTags: {\n type: 'array',\n items: { type: 'string' },\n description: 'Optional tags to boost matching results (e.g., [\"api\", \"backend\"])',\n },\n scope: {\n type: 'string',\n description: 'Optional project/repo scope filter. Results from this scope are prioritized.',\n },\n limit: {\n type: 'number',\n description: 'Maximum number of results to return (1-20, default: 5)',\n },\n },\n required: ['query'],\n },\n};\n\nexport const TOOLS = [STORE_TOOL, UPDATE_TOOL, SEARCH_TOOL];\n\nexport function createServer(): Server {\n const server = new Server(\n {\n name: SERVER_NAME,\n version: SERVER_VERSION,\n },\n {\n capabilities: {\n tools: {},\n },\n }\n );\n\n // List available tools\n server.setRequestHandler(ListToolsRequestSchema, async () => {\n return {\n tools: [STORE_TOOL, UPDATE_TOOL, SEARCH_TOOL],\n };\n });\n\n // Handle tool calls\n server.setRequestHandler(CallToolRequestSchema, async (request) => {\n const { name, arguments: args } = request.params;\n\n try {\n // Backward-compat: accept deprecated dotted names so agents with\n // stale prompts/templates continue to work. Remove in next major.\n if (name === 'memory_storeKnowledge' || name === 'memory.storeKnowledge') {\n const input = args as unknown as StoreKnowledgeInput;\n const result = storeKnowledge(input);\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify(result, null, 2),\n },\n ],\n };\n }\n\n if (name === 'memory_updateKnowledge' || name === 'memory.updateKnowledge') {\n const input = args as unknown as UpdateKnowledgeInput;\n const result = updateKnowledge(input);\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify(result, null, 2),\n },\n ],\n };\n }\n\n if (name === 'memory_searchKnowledge' || name === 'memory.searchKnowledge') {\n const input = args as unknown as SearchKnowledgeInput;\n const result = searchKnowledge(input);\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify(result, null, 2),\n },\n ],\n };\n }\n\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify({ error: 'UNKNOWN_TOOL', message: `Unknown tool: ${name}` }),\n },\n ],\n isError: true,\n };\n } catch (error) {\n const errorResponse = error instanceof KnowledgeMemoryError\n ? error.toJSON()\n : { error: 'INTERNAL_ERROR', message: error instanceof Error ? error.message : String(error) };\n\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify(errorResponse, null, 2),\n },\n ],\n isError: true,\n };\n }\n });\n\n return server;\n}\n\nexport async function runServer(): Promise<void> {\n const server = createServer();\n const transport = new StdioServerTransport();\n await server.connect(transport);\n}\n"],"names":["TOOLS","createServer","runServer","SERVER_NAME","SERVER_VERSION","STORE_TOOL","name","description","inputSchema","type","properties","title","content","tags","items","scope","required","UPDATE_TOOL","id","SEARCH_TOOL","query","contextTags","limit","server","Server","version","capabilities","tools","setRequestHandler","ListToolsRequestSchema","CallToolRequestSchema","request","arguments","args","params","input","result","storeKnowledge","text","JSON","stringify","updateKnowledge","searchKnowledge","error","message","isError","errorResponse","KnowledgeMemoryError","toJSON","Error","String","transport","StdioServerTransport","connect"],"mappings":";;;;;;;;;;;QAuGaA;eAAAA;;QAEGC;eAAAA;;QA+FMC;eAAAA;;;uBAxMC;uBACc;uBAI9B;uBACwB;wBACC;wBACA;wBACK;AAGrC,MAAMC,cAAc;AACpB,MAAMC,iBAAiB;AAEvB,MAAMC,aAAa;IACfC,MAAM;IACNC,aAAa;IACbC,aAAa;QACTC,MAAM;QACNC,YAAY;YACRC,OAAO;gBACHF,MAAM;gBACNF,aAAa;YACjB;YACAK,SAAS;gBACLH,MAAM;gBACNF,aAAa;YACjB;YACAM,MAAM;gBACFJ,MAAM;gBACNK,OAAO;oBAAEL,MAAM;gBAAS;gBACxBF,aAAa;YACjB;YACAQ,OAAO;gBACHN,MAAM;gBACNF,aAAa;YACjB;QACJ;QACAS,UAAU;YAAC;YAAS;SAAU;IAClC;AACJ;AAEA,MAAMC,cAAc;IAChBX,MAAM;IACNC,aAAa;IACbC,aAAa;QACTC,MAAM;QACNC,YAAY;YACRQ,IAAI;gBACAT,MAAM;gBACNF,aAAa;YACjB;YACAI,OAAO;gBACHF,MAAM;gBACNF,aAAa;YACjB;YACAK,SAAS;gBACLH,MAAM;gBACNF,aAAa;YACjB;YACAM,MAAM;gBACFJ,MAAM;gBACNK,OAAO;oBAAEL,MAAM;gBAAS;gBACxBF,aAAa;YACjB;YACAQ,OAAO;gBACHN,MAAM;gBACNF,aAAa;YACjB;QACJ;QACAS,UAAU;YAAC;SAAK;IACpB;AACJ;AAEA,MAAMG,cAAc;IAChBb,MAAM;IACNC,aAAa;IACbC,aAAa;QACTC,MAAM;QACNC,YAAY;YACRU,OAAO;gBACHX,MAAM;gBACNF,aAAa;YACjB;YACAc,aAAa;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