neuralmemory 1.7.0 → 1.8.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 +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.js +25 -33
- package/dist/index.js.map +1 -1
- package/openclaw.plugin.json +93 -93
- package/package.json +1 -1
- package/src/index.ts +29 -42
package/README.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,12 @@
|
|
|
11
11
|
* instead of hardcoding 6 tools. Automatically exposes every tool the
|
|
12
12
|
* MCP server provides (39+ tools in NM v2.28.0).
|
|
13
13
|
*
|
|
14
|
+
* v1.8.0: Compatible with NM v2.29.0 — RRF score fusion, graph-based
|
|
15
|
+
* query expansion, and Personalized PageRank activation.
|
|
16
|
+
*
|
|
17
|
+
* v1.8.1: Fix async register() — OpenClaw requires synchronous registration.
|
|
18
|
+
* Fallback tools registered sync; MCP connection deferred to service.start().
|
|
19
|
+
*
|
|
14
20
|
* Registers:
|
|
15
21
|
* N tools — dynamically from MCP server (fallback: 5 core tools)
|
|
16
22
|
* 1 service — MCP process lifecycle (start/stop)
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,12 @@
|
|
|
11
11
|
* instead of hardcoding 6 tools. Automatically exposes every tool the
|
|
12
12
|
* MCP server provides (39+ tools in NM v2.28.0).
|
|
13
13
|
*
|
|
14
|
+
* v1.8.0: Compatible with NM v2.29.0 — RRF score fusion, graph-based
|
|
15
|
+
* query expansion, and Personalized PageRank activation.
|
|
16
|
+
*
|
|
17
|
+
* v1.8.1: Fix async register() — OpenClaw requires synchronous registration.
|
|
18
|
+
* Fallback tools registered sync; MCP connection deferred to service.start().
|
|
19
|
+
*
|
|
14
20
|
* Registers:
|
|
15
21
|
* N tools — dynamically from MCP server (fallback: 5 core tools)
|
|
16
22
|
* 1 service — MCP process lifecycle (start/stop)
|
|
@@ -95,9 +101,9 @@ const plugin = {
|
|
|
95
101
|
id: "neuralmemory",
|
|
96
102
|
name: "NeuralMemory",
|
|
97
103
|
description: "Brain-inspired persistent memory for AI agents — neurons, synapses, and fibers",
|
|
98
|
-
version: "1.
|
|
104
|
+
version: "1.8.1",
|
|
99
105
|
kind: "memory",
|
|
100
|
-
|
|
106
|
+
register(api) {
|
|
101
107
|
const cfg = resolveConfig(api.pluginConfig);
|
|
102
108
|
const mcp = new NeuralMemoryMcpClient({
|
|
103
109
|
pythonPath: cfg.pythonPath,
|
|
@@ -106,47 +112,33 @@ const plugin = {
|
|
|
106
112
|
timeout: cfg.timeout,
|
|
107
113
|
initTimeout: cfg.initTimeout,
|
|
108
114
|
});
|
|
109
|
-
// ──
|
|
110
|
-
//
|
|
111
|
-
//
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
api.logger.info("NeuralMemory MCP connected");
|
|
116
|
-
}
|
|
117
|
-
catch (err) {
|
|
118
|
-
api.logger.error(`Failed to connect NeuralMemory MCP: ${err.message}`);
|
|
119
|
-
// Register fallback tools so the plugin is still partially usable
|
|
120
|
-
registeredTools = createFallbackTools(mcp);
|
|
121
|
-
for (const t of registeredTools) {
|
|
122
|
-
api.registerTool(t, { name: t.name });
|
|
123
|
-
}
|
|
124
|
-
api.logger.warn(`Registered ${registeredTools.length} fallback tools (MCP not connected)`);
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
// Fetch tools dynamically from MCP server
|
|
128
|
-
try {
|
|
129
|
-
registeredTools = await createToolsFromMcp(mcp);
|
|
130
|
-
api.logger.info(`Fetched ${registeredTools.length} tools from MCP server`);
|
|
131
|
-
}
|
|
132
|
-
catch (err) {
|
|
133
|
-
api.logger.warn(`Failed to fetch MCP tools, using fallback: ${err.message}`);
|
|
134
|
-
registeredTools = createFallbackTools(mcp);
|
|
135
|
-
}
|
|
136
|
-
// Register all tools with OpenClaw
|
|
115
|
+
// ── Register fallback tools synchronously ────────────
|
|
116
|
+
// OpenClaw requires register() to be synchronous.
|
|
117
|
+
// Register stable fallback tools immediately; MCP connection
|
|
118
|
+
// and dynamic tool discovery happen in service.start().
|
|
119
|
+
// Fallback tools auto-reconnect MCP on first call.
|
|
120
|
+
const registeredTools = createFallbackTools(mcp);
|
|
137
121
|
for (const t of registeredTools) {
|
|
138
122
|
api.registerTool(t, { name: t.name });
|
|
139
123
|
}
|
|
140
|
-
api.logger.info(`Registered ${registeredTools.length} NeuralMemory tools`);
|
|
124
|
+
api.logger.info(`Registered ${registeredTools.length} NeuralMemory tools (sync)`);
|
|
141
125
|
// ── Service: MCP process lifecycle ───────────────────
|
|
142
126
|
api.registerService({
|
|
143
127
|
id: "neuralmemory-mcp",
|
|
144
128
|
async start() {
|
|
145
|
-
// MCP already connected during register()
|
|
146
129
|
if (!mcp.connected) {
|
|
147
130
|
try {
|
|
148
131
|
await mcp.connect();
|
|
149
|
-
api.logger.info("NeuralMemory MCP
|
|
132
|
+
api.logger.info("NeuralMemory MCP connected in service.start()");
|
|
133
|
+
// Log discovered tools for diagnostics (cannot re-register
|
|
134
|
+
// after register() — OpenClaw freezes the tool list).
|
|
135
|
+
try {
|
|
136
|
+
const dynamicTools = await createToolsFromMcp(mcp);
|
|
137
|
+
api.logger.info(`NeuralMemory MCP discovered ${dynamicTools.length} tools`);
|
|
138
|
+
}
|
|
139
|
+
catch (err) {
|
|
140
|
+
api.logger.warn(`Tool discovery failed: ${err.message}`);
|
|
141
|
+
}
|
|
150
142
|
}
|
|
151
143
|
catch (err) {
|
|
152
144
|
api.logger.error(`Failed to start NeuralMemory MCP: ${err.message}`);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AASH,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,O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AAC,CAAC;oBAEpC,IAAI,IAAI,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;wBACrB,MAAM,GAAG,CAAC,QAAQ,CAAC,WAAW,EAAE;4BAC9B,MAAM,EAAE,SAAS;4BACjB,IAAI;yBACL,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,GAAG,CAAC,MAAM,CAAC,IAAI,CACb,wBAAyB,GAAa,CAAC,OAAO,EAAE,CACjD,CAAC;gBACJ,CAAC;YACH,CAAC,EACD,EAAE,QAAQ,EAAE,EAAE,EAAE,CACjB,CAAC;QACJ,CAAC;QAED,uDAAuD;QAEvD,GAAG,CAAC,MAAM,CAAC,IAAI,CACb,mCAAmC,GAAG,CAAC,KAAK,IAAI;YAC9C,gBAAgB,GAAG,CAAC,WAAW,kBAAkB,GAAG,CAAC,WAAW,MAAM;YACtE,4DAA4D,CAC/D,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/openclaw.plugin.json
CHANGED
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "neuralmemory",
|
|
3
|
-
"kind": "memory",
|
|
4
|
-
"name": "NeuralMemory",
|
|
5
|
-
"description": "Brain-inspired persistent memory for AI agents — neurons, synapses, and fibers. REQUIRED: set plugins.slots.memory = \"neuralmemory\" in openclaw.json to disable the default memory-core plugin and activate NeuralMemory as the exclusive memory provider.",
|
|
6
|
-
"version": "1.
|
|
7
|
-
"configSchema": {
|
|
8
|
-
"jsonSchema": {
|
|
9
|
-
"type": "object",
|
|
10
|
-
"additionalProperties": false,
|
|
11
|
-
"properties": {
|
|
12
|
-
"pythonPath": {
|
|
13
|
-
"type": "string",
|
|
14
|
-
"description": "Path to Python executable with neural-memory installed",
|
|
15
|
-
"default": "python"
|
|
16
|
-
},
|
|
17
|
-
"brain": {
|
|
18
|
-
"type": "string",
|
|
19
|
-
"pattern": "^[a-zA-Z0-9_\\-.]{1,64}$",
|
|
20
|
-
"description": "Brain name to use for this workspace",
|
|
21
|
-
"default": "default"
|
|
22
|
-
},
|
|
23
|
-
"autoContext": {
|
|
24
|
-
"type": "boolean",
|
|
25
|
-
"description": "Inject relevant memory context before each agent run",
|
|
26
|
-
"default": true
|
|
27
|
-
},
|
|
28
|
-
"autoCapture": {
|
|
29
|
-
"type": "boolean",
|
|
30
|
-
"description": "Auto-extract and store memories after each agent run",
|
|
31
|
-
"default": true
|
|
32
|
-
},
|
|
33
|
-
"contextDepth": {
|
|
34
|
-
"type": "integer",
|
|
35
|
-
"minimum": 0,
|
|
36
|
-
"maximum": 3,
|
|
37
|
-
"description": "Recall depth for auto-context: 0=instant, 1=context, 2=habit, 3=deep",
|
|
38
|
-
"default": 1
|
|
39
|
-
},
|
|
40
|
-
"maxContextTokens": {
|
|
41
|
-
"type": "integer",
|
|
42
|
-
"minimum": 100,
|
|
43
|
-
"maximum": 10000,
|
|
44
|
-
"description": "Maximum tokens for auto-context injection",
|
|
45
|
-
"default": 500
|
|
46
|
-
},
|
|
47
|
-
"timeout": {
|
|
48
|
-
"type": "integer",
|
|
49
|
-
"minimum": 5000,
|
|
50
|
-
"maximum": 120000,
|
|
51
|
-
"description": "MCP request timeout in milliseconds",
|
|
52
|
-
"default": 30000
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
"uiHints": {
|
|
57
|
-
"_setup": {
|
|
58
|
-
"label": "Required Setup",
|
|
59
|
-
"help": "Add to openclaw.json: { \"plugins\": { \"slots\": { \"memory\": \"neuralmemory\" } } } — this disables the default memory-core plugin so agents use NeuralMemory exclusively. Without this, agents may still call memory_search (memory-core) even with AGENTS.MD rules."
|
|
60
|
-
},
|
|
61
|
-
"pythonPath": {
|
|
62
|
-
"label": "Python Path",
|
|
63
|
-
"placeholder": "python",
|
|
64
|
-
"help": "Path to Python executable that has neural-memory installed (pip install neural-memory)"
|
|
65
|
-
},
|
|
66
|
-
"brain": {
|
|
67
|
-
"label": "Brain Name",
|
|
68
|
-
"placeholder": "default",
|
|
69
|
-
"help": "Which brain to use — each workspace can have its own brain"
|
|
70
|
-
},
|
|
71
|
-
"autoContext": {
|
|
72
|
-
"label": "Auto-inject Context",
|
|
73
|
-
"help": "Automatically query relevant memories and inject them before each agent run"
|
|
74
|
-
},
|
|
75
|
-
"autoCapture": {
|
|
76
|
-
"label": "Auto-capture Memories",
|
|
77
|
-
"help": "Automatically extract facts, decisions, and insights after each agent run"
|
|
78
|
-
},
|
|
79
|
-
"contextDepth": {
|
|
80
|
-
"label": "Context Depth",
|
|
81
|
-
"help": "How deep to search: 0=instant lookup, 1=contextual, 2=habit patterns, 3=full graph traversal"
|
|
82
|
-
},
|
|
83
|
-
"maxContextTokens": {
|
|
84
|
-
"label": "Max Context Tokens",
|
|
85
|
-
"help": "Maximum tokens to inject as context (higher = more context but uses more prompt space)"
|
|
86
|
-
},
|
|
87
|
-
"timeout": {
|
|
88
|
-
"label": "MCP Timeout (ms)",
|
|
89
|
-
"help": "How long to wait for MCP server responses. Increase if you see timeout errors on slow machines (default: 30000)"
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"id": "neuralmemory",
|
|
3
|
+
"kind": "memory",
|
|
4
|
+
"name": "NeuralMemory",
|
|
5
|
+
"description": "Brain-inspired persistent memory for AI agents — neurons, synapses, and fibers. REQUIRED: set plugins.slots.memory = \"neuralmemory\" in openclaw.json to disable the default memory-core plugin and activate NeuralMemory as the exclusive memory provider.",
|
|
6
|
+
"version": "1.8.0",
|
|
7
|
+
"configSchema": {
|
|
8
|
+
"jsonSchema": {
|
|
9
|
+
"type": "object",
|
|
10
|
+
"additionalProperties": false,
|
|
11
|
+
"properties": {
|
|
12
|
+
"pythonPath": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"description": "Path to Python executable with neural-memory installed",
|
|
15
|
+
"default": "python"
|
|
16
|
+
},
|
|
17
|
+
"brain": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"pattern": "^[a-zA-Z0-9_\\-.]{1,64}$",
|
|
20
|
+
"description": "Brain name to use for this workspace",
|
|
21
|
+
"default": "default"
|
|
22
|
+
},
|
|
23
|
+
"autoContext": {
|
|
24
|
+
"type": "boolean",
|
|
25
|
+
"description": "Inject relevant memory context before each agent run",
|
|
26
|
+
"default": true
|
|
27
|
+
},
|
|
28
|
+
"autoCapture": {
|
|
29
|
+
"type": "boolean",
|
|
30
|
+
"description": "Auto-extract and store memories after each agent run",
|
|
31
|
+
"default": true
|
|
32
|
+
},
|
|
33
|
+
"contextDepth": {
|
|
34
|
+
"type": "integer",
|
|
35
|
+
"minimum": 0,
|
|
36
|
+
"maximum": 3,
|
|
37
|
+
"description": "Recall depth for auto-context: 0=instant, 1=context, 2=habit, 3=deep",
|
|
38
|
+
"default": 1
|
|
39
|
+
},
|
|
40
|
+
"maxContextTokens": {
|
|
41
|
+
"type": "integer",
|
|
42
|
+
"minimum": 100,
|
|
43
|
+
"maximum": 10000,
|
|
44
|
+
"description": "Maximum tokens for auto-context injection",
|
|
45
|
+
"default": 500
|
|
46
|
+
},
|
|
47
|
+
"timeout": {
|
|
48
|
+
"type": "integer",
|
|
49
|
+
"minimum": 5000,
|
|
50
|
+
"maximum": 120000,
|
|
51
|
+
"description": "MCP request timeout in milliseconds",
|
|
52
|
+
"default": 30000
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"uiHints": {
|
|
57
|
+
"_setup": {
|
|
58
|
+
"label": "Required Setup",
|
|
59
|
+
"help": "Add to openclaw.json: { \"plugins\": { \"slots\": { \"memory\": \"neuralmemory\" } } } — this disables the default memory-core plugin so agents use NeuralMemory exclusively. Without this, agents may still call memory_search (memory-core) even with AGENTS.MD rules."
|
|
60
|
+
},
|
|
61
|
+
"pythonPath": {
|
|
62
|
+
"label": "Python Path",
|
|
63
|
+
"placeholder": "python",
|
|
64
|
+
"help": "Path to Python executable that has neural-memory installed (pip install neural-memory)"
|
|
65
|
+
},
|
|
66
|
+
"brain": {
|
|
67
|
+
"label": "Brain Name",
|
|
68
|
+
"placeholder": "default",
|
|
69
|
+
"help": "Which brain to use — each workspace can have its own brain"
|
|
70
|
+
},
|
|
71
|
+
"autoContext": {
|
|
72
|
+
"label": "Auto-inject Context",
|
|
73
|
+
"help": "Automatically query relevant memories and inject them before each agent run"
|
|
74
|
+
},
|
|
75
|
+
"autoCapture": {
|
|
76
|
+
"label": "Auto-capture Memories",
|
|
77
|
+
"help": "Automatically extract facts, decisions, and insights after each agent run"
|
|
78
|
+
},
|
|
79
|
+
"contextDepth": {
|
|
80
|
+
"label": "Context Depth",
|
|
81
|
+
"help": "How deep to search: 0=instant lookup, 1=contextual, 2=habit patterns, 3=full graph traversal"
|
|
82
|
+
},
|
|
83
|
+
"maxContextTokens": {
|
|
84
|
+
"label": "Max Context Tokens",
|
|
85
|
+
"help": "Maximum tokens to inject as context (higher = more context but uses more prompt space)"
|
|
86
|
+
},
|
|
87
|
+
"timeout": {
|
|
88
|
+
"label": "MCP Timeout (ms)",
|
|
89
|
+
"help": "How long to wait for MCP server responses. Increase if you see timeout errors on slow machines (default: 30000)"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -11,6 +11,12 @@
|
|
|
11
11
|
* instead of hardcoding 6 tools. Automatically exposes every tool the
|
|
12
12
|
* MCP server provides (39+ tools in NM v2.28.0).
|
|
13
13
|
*
|
|
14
|
+
* v1.8.0: Compatible with NM v2.29.0 — RRF score fusion, graph-based
|
|
15
|
+
* query expansion, and Personalized PageRank activation.
|
|
16
|
+
*
|
|
17
|
+
* v1.8.1: Fix async register() — OpenClaw requires synchronous registration.
|
|
18
|
+
* Fallback tools registered sync; MCP connection deferred to service.start().
|
|
19
|
+
*
|
|
14
20
|
* Registers:
|
|
15
21
|
* N tools — dynamically from MCP server (fallback: 5 core tools)
|
|
16
22
|
* 1 service — MCP process lifecycle (start/stop)
|
|
@@ -135,10 +141,10 @@ const plugin: OpenClawPluginDefinition = {
|
|
|
135
141
|
name: "NeuralMemory",
|
|
136
142
|
description:
|
|
137
143
|
"Brain-inspired persistent memory for AI agents — neurons, synapses, and fibers",
|
|
138
|
-
version: "1.
|
|
144
|
+
version: "1.8.1",
|
|
139
145
|
kind: "memory",
|
|
140
146
|
|
|
141
|
-
|
|
147
|
+
register(api: OpenClawPluginApi): void {
|
|
142
148
|
const cfg = resolveConfig(api.pluginConfig);
|
|
143
149
|
|
|
144
150
|
const mcp = new NeuralMemoryMcpClient({
|
|
@@ -149,50 +155,19 @@ const plugin: OpenClawPluginDefinition = {
|
|
|
149
155
|
initTimeout: cfg.initTimeout,
|
|
150
156
|
});
|
|
151
157
|
|
|
152
|
-
// ──
|
|
153
|
-
//
|
|
154
|
-
//
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
try {
|
|
159
|
-
await mcp.connect();
|
|
160
|
-
api.logger.info("NeuralMemory MCP connected");
|
|
161
|
-
} catch (err) {
|
|
162
|
-
api.logger.error(
|
|
163
|
-
`Failed to connect NeuralMemory MCP: ${(err as Error).message}`,
|
|
164
|
-
);
|
|
165
|
-
// Register fallback tools so the plugin is still partially usable
|
|
166
|
-
registeredTools = createFallbackTools(mcp);
|
|
167
|
-
for (const t of registeredTools) {
|
|
168
|
-
api.registerTool(t, { name: t.name });
|
|
169
|
-
}
|
|
170
|
-
api.logger.warn(
|
|
171
|
-
`Registered ${registeredTools.length} fallback tools (MCP not connected)`,
|
|
172
|
-
);
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
// Fetch tools dynamically from MCP server
|
|
177
|
-
try {
|
|
178
|
-
registeredTools = await createToolsFromMcp(mcp);
|
|
179
|
-
api.logger.info(
|
|
180
|
-
`Fetched ${registeredTools.length} tools from MCP server`,
|
|
181
|
-
);
|
|
182
|
-
} catch (err) {
|
|
183
|
-
api.logger.warn(
|
|
184
|
-
`Failed to fetch MCP tools, using fallback: ${(err as Error).message}`,
|
|
185
|
-
);
|
|
186
|
-
registeredTools = createFallbackTools(mcp);
|
|
187
|
-
}
|
|
158
|
+
// ── Register fallback tools synchronously ────────────
|
|
159
|
+
// OpenClaw requires register() to be synchronous.
|
|
160
|
+
// Register stable fallback tools immediately; MCP connection
|
|
161
|
+
// and dynamic tool discovery happen in service.start().
|
|
162
|
+
// Fallback tools auto-reconnect MCP on first call.
|
|
188
163
|
|
|
189
|
-
|
|
164
|
+
const registeredTools = createFallbackTools(mcp);
|
|
190
165
|
for (const t of registeredTools) {
|
|
191
166
|
api.registerTool(t, { name: t.name });
|
|
192
167
|
}
|
|
193
168
|
|
|
194
169
|
api.logger.info(
|
|
195
|
-
`Registered ${registeredTools.length} NeuralMemory tools`,
|
|
170
|
+
`Registered ${registeredTools.length} NeuralMemory tools (sync)`,
|
|
196
171
|
);
|
|
197
172
|
|
|
198
173
|
// ── Service: MCP process lifecycle ───────────────────
|
|
@@ -201,11 +176,23 @@ const plugin: OpenClawPluginDefinition = {
|
|
|
201
176
|
id: "neuralmemory-mcp",
|
|
202
177
|
|
|
203
178
|
async start(): Promise<void> {
|
|
204
|
-
// MCP already connected during register()
|
|
205
179
|
if (!mcp.connected) {
|
|
206
180
|
try {
|
|
207
181
|
await mcp.connect();
|
|
208
|
-
api.logger.info("NeuralMemory MCP
|
|
182
|
+
api.logger.info("NeuralMemory MCP connected in service.start()");
|
|
183
|
+
|
|
184
|
+
// Log discovered tools for diagnostics (cannot re-register
|
|
185
|
+
// after register() — OpenClaw freezes the tool list).
|
|
186
|
+
try {
|
|
187
|
+
const dynamicTools = await createToolsFromMcp(mcp);
|
|
188
|
+
api.logger.info(
|
|
189
|
+
`NeuralMemory MCP discovered ${dynamicTools.length} tools`,
|
|
190
|
+
);
|
|
191
|
+
} catch (err) {
|
|
192
|
+
api.logger.warn(
|
|
193
|
+
`Tool discovery failed: ${(err as Error).message}`,
|
|
194
|
+
);
|
|
195
|
+
}
|
|
209
196
|
} catch (err) {
|
|
210
197
|
api.logger.error(
|
|
211
198
|
`Failed to start NeuralMemory MCP: ${(err as Error).message}`,
|