memoryai-mcp 2.4.1 → 2.4.3
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.js +14 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -344,7 +344,7 @@ DNA memories (preference/decision/identity) **never decay, never get deleted, ne
|
|
|
344
344
|
| Free | Basic store/recall, 100 memories | Free |
|
|
345
345
|
| Pro | Full brain (reasoning, consolidation, personality) | Paid |
|
|
346
346
|
| ProMax | Multi-agent mesh, advanced features | Paid |
|
|
347
|
-
|
|
|
347
|
+
| Enterprise | Everything + deep graph traversal + on-prem | Custom |
|
|
348
348
|
|
|
349
349
|
Get started free: https://memoryai.dev
|
|
350
350
|
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import { z } from "zod";
|
|
|
11
11
|
const API_URL = process.env.MEMORYAI_ENDPOINT || process.env.HM_ENDPOINT || "http://localhost:8420";
|
|
12
12
|
const API_KEY = process.env.MEMORYAI_API_KEY || process.env.HM_API_KEY || "";
|
|
13
13
|
const REQUEST_TIMEOUT_MS = 30_000; // P2 #6: 30s default timeout for API requests
|
|
14
|
-
const MCP_VERSION = "2.4.
|
|
14
|
+
const MCP_VERSION = "2.4.3";
|
|
15
15
|
// Context Guard — per-IDE settings via env vars.
|
|
16
16
|
// HM_COMPACT_AT and HM_CRITICAL_AT are now ABSOLUTE token counts (e.g. "100000",
|
|
17
17
|
// "150000"). The legacy meaning ("30" = 30%) is detected automatically: any
|
|
@@ -24,6 +24,13 @@ const MCP_VERSION = "2.4.1";
|
|
|
24
24
|
const CG_CONTEXT_CAP = parseInt(process.env.MEMORYAI_CONTEXT_CAP || process.env.HM_CONTEXT_CAP || "0", 10);
|
|
25
25
|
const CG_COMPACT_RAW = parseInt(process.env.MEMORYAI_COMPACT_AT || process.env.HM_COMPACT_AT || "0", 10);
|
|
26
26
|
const CG_CRITICAL_RAW = parseInt(process.env.MEMORYAI_CRITICAL_AT || process.env.HM_CRITICAL_AT || "0", 10);
|
|
27
|
+
// Model hint for server-side window auto-detection. When set, the server
|
|
28
|
+
// resolves the context window from the model name and picks the adaptive
|
|
29
|
+
// trigger percentage (<=200K → 95%, >200K → 30%). Falls back to the model
|
|
30
|
+
// the caller passes per-request, then to the 200K default.
|
|
31
|
+
// e.g. MEMORYAI_MODEL=claude-opus-4-6[1m] → 1M window → 30% trigger
|
|
32
|
+
// MEMORYAI_MODEL=claude-sonnet-4-6 → 200K window → 95% trigger
|
|
33
|
+
const CG_MODEL = (process.env.MEMORYAI_MODEL || process.env.HM_MODEL || "").trim() || null;
|
|
27
34
|
// Heuristic: small numbers are legacy percentages; large numbers are absolute tokens.
|
|
28
35
|
// Threshold "<= 100" is generous enough to catch any sensible % (max 95%) and
|
|
29
36
|
// well below any sensible absolute count (min would be ~10K tokens).
|
|
@@ -152,7 +159,7 @@ function err(e) {
|
|
|
152
159
|
return { content, isError: true };
|
|
153
160
|
}
|
|
154
161
|
// --- MCP Server ---
|
|
155
|
-
const server = new McpServer({ name: "memoryai", version: "2.4.
|
|
162
|
+
const server = new McpServer({ name: "memoryai", version: "2.4.3" }, {
|
|
156
163
|
capabilities: { tools: {} },
|
|
157
164
|
instructions: "MemoryAI persistent memory. Call memory_bootstrap on session start. After decisions/preferences, call memory_store. Context compaction is automatic via piggybacking — follow any [Context Guard] directives in tool responses.",
|
|
158
165
|
});
|
|
@@ -1013,12 +1020,13 @@ server.tool("context_guard_check", "[CORE] Check context pressure — returns re
|
|
|
1013
1020
|
model: z.string().optional().describe("Model name for auto-detecting context window size (e.g. claude-sonnet-4-6)"),
|
|
1014
1021
|
}, async (args) => {
|
|
1015
1022
|
try {
|
|
1016
|
-
// Use env var HM_CONTEXT_CAP as default if max_tokens not provided
|
|
1023
|
+
// Use env var HM_CONTEXT_CAP as default if max_tokens not provided.
|
|
1024
|
+
// 0 → server auto-detects the window from the model name.
|
|
1017
1025
|
const maxTokens = args.max_tokens || CG_CONTEXT_CAP || 0;
|
|
1018
1026
|
const payload = {
|
|
1019
1027
|
estimated_tokens: args.estimated_tokens,
|
|
1020
1028
|
max_tokens: maxTokens,
|
|
1021
|
-
model: args.model ||
|
|
1029
|
+
model: args.model || CG_MODEL,
|
|
1022
1030
|
};
|
|
1023
1031
|
// Per-IDE threshold overrides. Absolute (CG_*_AT_TOKENS) is preferred —
|
|
1024
1032
|
// server treats it as the authoritative trigger. Decimal % is the
|
|
@@ -1097,7 +1105,7 @@ server.tool("ide_turn_check", "[CORE] Server-authoritative context check for IDE
|
|
|
1097
1105
|
max_tokens: args.max_tokens ?? CG_CONTEXT_CAP ?? 200_000,
|
|
1098
1106
|
avg_tokens_per_turn: args.avg_tokens_per_turn ?? 8000,
|
|
1099
1107
|
skip_below_turns: args.skip_below_turns ?? 10,
|
|
1100
|
-
model: args.model ??
|
|
1108
|
+
model: args.model ?? CG_MODEL,
|
|
1101
1109
|
};
|
|
1102
1110
|
// Per-IDE threshold overrides. Absolute first (preferred), % fallback.
|
|
1103
1111
|
if (CG_COMPACT_AT_TOKENS > 0)
|
|
@@ -1210,7 +1218,7 @@ server.tool("bot_guard_check", "Advanced: Bot context guard — checks context p
|
|
|
1210
1218
|
const payload = {
|
|
1211
1219
|
estimated_tokens: args.estimated_tokens,
|
|
1212
1220
|
max_tokens: args.max_tokens || CG_CONTEXT_CAP || 200000,
|
|
1213
|
-
model: args.model ||
|
|
1221
|
+
model: args.model || CG_MODEL,
|
|
1214
1222
|
};
|
|
1215
1223
|
if (args.compress_threshold)
|
|
1216
1224
|
payload.compress_threshold = args.compress_threshold;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "memoryai-mcp",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.3",
|
|
4
4
|
"description": "MCP server for MemoryAI v2.3 — One brain. Every AI you use. Forever. Persistent memory and context guard tools for IDEs and bots.",
|
|
5
5
|
"homepage": "https://memoryai.dev",
|
|
6
6
|
"repository": {
|