@synth-coder/memhub 0.1.4 → 0.1.6
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/README.zh-CN.md +1 -1
- package/package.json +1 -1
- package/src/contracts/mcp.ts +9 -8
- package/src/server/mcp-server.ts +3 -1
package/README.md
CHANGED
|
@@ -72,7 +72,7 @@ Example MCP client config:
|
|
|
72
72
|
"command": "npx",
|
|
73
73
|
"args": ["-y", "@synth-coder/memhub"],
|
|
74
74
|
"env": {
|
|
75
|
-
"MEMHUB_STORAGE_PATH": "/absolute/path/to
|
|
75
|
+
"MEMHUB_STORAGE_PATH": "/absolute/path/to/.memhub",
|
|
76
76
|
"MEMHUB_LOG_LEVEL": "info"
|
|
77
77
|
}
|
|
78
78
|
}
|
|
@@ -97,7 +97,7 @@ Example MCP client config:
|
|
|
97
97
|
|
|
98
98
|
## Environment Variables
|
|
99
99
|
|
|
100
|
-
- `MEMHUB_STORAGE_PATH` (default:
|
|
100
|
+
- `MEMHUB_STORAGE_PATH` (default: `~/.memhub`)
|
|
101
101
|
- `MEMHUB_LOG_LEVEL` (default: `info`, options: `debug|info|warn|error`)
|
|
102
102
|
|
|
103
103
|
---
|
package/README.zh-CN.md
CHANGED
package/package.json
CHANGED
package/src/contracts/mcp.ts
CHANGED
|
@@ -52,14 +52,14 @@ export const TOOL_DEFINITIONS: readonly Tool[] = [
|
|
|
52
52
|
{
|
|
53
53
|
name: 'memory_load',
|
|
54
54
|
description:
|
|
55
|
-
'STM first
|
|
55
|
+
'MANDATORY STM step #1 (stability-first). Call memory_load as the FIRST tool call after each new user prompt, before analysis or planning. Goal: recover short-term memory for the current task so the next 1-3 turns stay coherent and do not repeat user input. Prefer { sessionId, scope:"stm", limit:20 }; add { date } for date-scoped tasks and { query } for keyword-driven tasks. If unavailable, continue the task and still provide a final answer.',
|
|
56
56
|
inputSchema: {
|
|
57
57
|
type: 'object',
|
|
58
58
|
properties: {
|
|
59
59
|
id: { type: 'string', description: 'Optional memory id for direct fetch' },
|
|
60
60
|
sessionId: {
|
|
61
61
|
type: 'string',
|
|
62
|
-
description: '
|
|
62
|
+
description: 'Recommended. Stable session UUID for this task/thread. Reuse same value across memory_load/memory_update.',
|
|
63
63
|
},
|
|
64
64
|
date: { type: 'string', description: 'Optional date filter (YYYY-MM-DD)' },
|
|
65
65
|
query: { type: 'string', description: 'Optional text query for relevant context' },
|
|
@@ -69,7 +69,7 @@ export const TOOL_DEFINITIONS: readonly Tool[] = [
|
|
|
69
69
|
scope: {
|
|
70
70
|
type: 'string',
|
|
71
71
|
enum: ['stm', 'all'],
|
|
72
|
-
description: 'stm for
|
|
72
|
+
description: 'Use "stm" by default for current-task context expected to be reused in ~3 turns. Use "all" only when broad historical recall is required.',
|
|
73
73
|
},
|
|
74
74
|
},
|
|
75
75
|
additionalProperties: false,
|
|
@@ -78,22 +78,23 @@ export const TOOL_DEFINITIONS: readonly Tool[] = [
|
|
|
78
78
|
{
|
|
79
79
|
name: 'memory_update',
|
|
80
80
|
description:
|
|
81
|
-
'STM
|
|
81
|
+
'MANDATORY STM step #2 (closed loop). Call memory_update as the FINAL tool call before your final user answer. Write only high-value short-term updates likely reused in the next 1-3 turns: decisions made, preference/constraint changes, task state transitions, and reusable conclusions. Keep content concise, factual, and task-bound. Never store secrets or credentials. If unavailable, still return the final user answer.',
|
|
82
82
|
inputSchema: {
|
|
83
83
|
type: 'object',
|
|
84
84
|
properties: {
|
|
85
85
|
id: { type: 'string', description: 'Optional id. Present = update existing record' },
|
|
86
|
-
sessionId: { type: 'string', description: '
|
|
87
|
-
mode: { type: 'string', enum: ['append', 'upsert'], description: '
|
|
86
|
+
sessionId: { type: 'string', description: 'Recommended. Same session UUID used in memory_load. Auto-created if omitted.' },
|
|
87
|
+
mode: { type: 'string', enum: ['append', 'upsert'], description: 'append = add new STM item (default). upsert = update existing item, usually with id.' },
|
|
88
88
|
entryType: {
|
|
89
89
|
type: 'string',
|
|
90
90
|
enum: ['decision', 'preference', 'knowledge', 'todo', 'state_change'],
|
|
91
|
+
description: 'Use the most specific type to improve next-turn retrieval quality: decision/preference/knowledge/todo/state_change.',
|
|
91
92
|
},
|
|
92
93
|
title: { type: 'string', description: 'Optional title' },
|
|
93
|
-
content: { type: 'string', description: 'Required
|
|
94
|
+
content: { type: 'string', description: 'Required. Concise reusable summary (for next ~3 turns), not full transcript.' },
|
|
94
95
|
tags: { type: 'array', items: { type: 'string' } },
|
|
95
96
|
category: { type: 'string' },
|
|
96
|
-
importance: { type: 'number' },
|
|
97
|
+
importance: { type: 'number', description: 'Optional priority score (1-5). Use higher values for likely near-term reuse.' },
|
|
97
98
|
},
|
|
98
99
|
required: ['content'],
|
|
99
100
|
additionalProperties: false,
|
package/src/server/mcp-server.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import { readFileSync } from 'fs';
|
|
8
8
|
import { join, dirname } from 'path';
|
|
9
9
|
import { fileURLToPath } from 'url';
|
|
10
|
+
import { homedir } from 'os';
|
|
10
11
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
11
12
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
12
13
|
import {
|
|
@@ -37,7 +38,8 @@ const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8')) as Packag
|
|
|
37
38
|
* Create McpServer instance using SDK
|
|
38
39
|
*/
|
|
39
40
|
export function createMcpServer(): Server {
|
|
40
|
-
const
|
|
41
|
+
const defaultStoragePath = join(homedir(), '.memhub');
|
|
42
|
+
const storagePath = process.env.MEMHUB_STORAGE_PATH || defaultStoragePath;
|
|
41
43
|
const memoryService = new MemoryService({ storagePath });
|
|
42
44
|
|
|
43
45
|
// Create server using SDK
|