@scitrera/memorylayer-mcp-server 0.0.5 → 0.2.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/LICENSE +177 -0
- package/README.md +14 -2
- package/dist/src/client.d.ts +82 -1
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/client.js +172 -8
- package/dist/src/client.js.map +1 -1
- package/dist/src/handlers.d.ts +15 -0
- package/dist/src/handlers.d.ts.map +1 -1
- package/dist/src/handlers.js +185 -3
- package/dist/src/handlers.js.map +1 -1
- package/dist/src/server.d.ts.map +1 -1
- package/dist/src/server.js +17 -2
- package/dist/src/server.js.map +1 -1
- package/dist/src/tools.d.ts +1297 -150
- package/dist/src/tools.d.ts.map +1 -1
- package/dist/src/tools.js +559 -3
- package/dist/src/tools.js.map +1 -1
- package/dist/src/types.d.ts +5 -1
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js.map +1 -1
- package/package.json +8 -4
- package/examples/client-usage.ts +0 -93
- package/tests/server.test.ts +0 -130
- package/tests/session.test.ts +0 -152
- package/tests/tools.test.ts +0 -191
- package/vitest.config.ts +0 -15
package/tests/tools.test.ts
DELETED
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for MCP tool definitions
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { describe, it, expect } from "vitest";
|
|
6
|
-
import { TOOLS, SESSION_TOOLS, CONTEXT_ENVIRONMENT_TOOLS, CORE_TOOLS, EXTENDED_TOOLS } from "../src/tools.js";
|
|
7
|
-
|
|
8
|
-
describe("Tool Definitions", () => {
|
|
9
|
-
describe("TOOLS", () => {
|
|
10
|
-
it("should export core memory tools", () => {
|
|
11
|
-
const toolNames = TOOLS.map(t => t.name);
|
|
12
|
-
|
|
13
|
-
expect(toolNames).toContain("memory_remember");
|
|
14
|
-
expect(toolNames).toContain("memory_recall");
|
|
15
|
-
expect(toolNames).toContain("memory_reflect");
|
|
16
|
-
expect(toolNames).toContain("memory_forget");
|
|
17
|
-
expect(toolNames).toContain("memory_associate");
|
|
18
|
-
expect(toolNames).toContain("memory_briefing");
|
|
19
|
-
expect(toolNames).toContain("memory_statistics");
|
|
20
|
-
expect(toolNames).toContain("memory_graph_query");
|
|
21
|
-
expect(toolNames).toContain("memory_audit");
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it("should have valid input schemas", () => {
|
|
25
|
-
for (const tool of TOOLS) {
|
|
26
|
-
expect(tool.inputSchema).toBeDefined();
|
|
27
|
-
expect(tool.inputSchema.type).toBe("object");
|
|
28
|
-
expect(tool.inputSchema.properties).toBeDefined();
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it("should have descriptions for all tools", () => {
|
|
33
|
-
for (const tool of TOOLS) {
|
|
34
|
-
expect(tool.description).toBeDefined();
|
|
35
|
-
expect(tool.description.length).toBeGreaterThan(10);
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
describe("SESSION_TOOLS", () => {
|
|
41
|
-
it("should export session management tools", () => {
|
|
42
|
-
const toolNames = SESSION_TOOLS.map(t => t.name);
|
|
43
|
-
|
|
44
|
-
expect(toolNames).toContain("memory_session_start");
|
|
45
|
-
expect(toolNames).toContain("memory_session_end");
|
|
46
|
-
expect(toolNames).toContain("memory_session_commit");
|
|
47
|
-
expect(toolNames).toContain("memory_session_status");
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it("should have valid input schemas", () => {
|
|
51
|
-
for (const tool of SESSION_TOOLS) {
|
|
52
|
-
expect(tool.inputSchema).toBeDefined();
|
|
53
|
-
expect(tool.inputSchema.type).toBe("object");
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it("should have descriptions for all tools", () => {
|
|
58
|
-
for (const tool of SESSION_TOOLS) {
|
|
59
|
-
expect(tool.description).toBeDefined();
|
|
60
|
-
expect(tool.description.length).toBeGreaterThan(10);
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
describe("CONTEXT_ENVIRONMENT_TOOLS", () => {
|
|
66
|
-
it("should export context environment tools", () => {
|
|
67
|
-
const toolNames = CONTEXT_ENVIRONMENT_TOOLS.map(t => t.name);
|
|
68
|
-
|
|
69
|
-
expect(toolNames).toContain("memory_context_exec");
|
|
70
|
-
expect(toolNames).toContain("memory_context_inspect");
|
|
71
|
-
expect(toolNames).toContain("memory_context_load");
|
|
72
|
-
expect(toolNames).toContain("memory_context_inject");
|
|
73
|
-
expect(toolNames).toContain("memory_context_query");
|
|
74
|
-
expect(toolNames).toContain("memory_context_rlm");
|
|
75
|
-
expect(toolNames).toContain("memory_context_status");
|
|
76
|
-
expect(toolNames).toContain("memory_context_checkpoint");
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it("should have valid input schemas", () => {
|
|
80
|
-
for (const tool of CONTEXT_ENVIRONMENT_TOOLS) {
|
|
81
|
-
expect(tool.inputSchema).toBeDefined();
|
|
82
|
-
expect(tool.inputSchema.type).toBe("object");
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
it("should have descriptions for all tools", () => {
|
|
87
|
-
for (const tool of CONTEXT_ENVIRONMENT_TOOLS) {
|
|
88
|
-
expect(tool.description).toBeDefined();
|
|
89
|
-
expect(tool.description.length).toBeGreaterThan(10);
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
describe("memory_remember tool", () => {
|
|
95
|
-
const tool = TOOLS.find(t => t.name === "memory_remember");
|
|
96
|
-
|
|
97
|
-
it("should require content", () => {
|
|
98
|
-
expect(tool?.inputSchema.required).toContain("content");
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it("should have memory type enum", () => {
|
|
102
|
-
const typeProperty = tool?.inputSchema.properties?.type;
|
|
103
|
-
expect(typeProperty?.enum).toContain("episodic");
|
|
104
|
-
expect(typeProperty?.enum).toContain("semantic");
|
|
105
|
-
expect(typeProperty?.enum).toContain("procedural");
|
|
106
|
-
expect(typeProperty?.enum).toContain("working");
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
it("should have importance range", () => {
|
|
110
|
-
const importance = tool?.inputSchema.properties?.importance;
|
|
111
|
-
expect(importance?.minimum).toBe(0);
|
|
112
|
-
expect(importance?.maximum).toBe(1);
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
describe("memory_recall tool", () => {
|
|
117
|
-
const tool = TOOLS.find(t => t.name === "memory_recall");
|
|
118
|
-
|
|
119
|
-
it("should require query", () => {
|
|
120
|
-
expect(tool?.inputSchema.required).toContain("query");
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
it("should have limit constraints", () => {
|
|
124
|
-
const limit = tool?.inputSchema.properties?.limit;
|
|
125
|
-
expect(limit?.minimum).toBe(1);
|
|
126
|
-
expect(limit?.maximum).toBe(100);
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
describe("memory_associate tool", () => {
|
|
131
|
-
const tool = TOOLS.find(t => t.name === "memory_associate");
|
|
132
|
-
|
|
133
|
-
it("should require source_id, target_id, and relationship", () => {
|
|
134
|
-
expect(tool?.inputSchema.required).toContain("source_id");
|
|
135
|
-
expect(tool?.inputSchema.required).toContain("target_id");
|
|
136
|
-
expect(tool?.inputSchema.required).toContain("relationship");
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
it("should have relationship description", () => {
|
|
140
|
-
const relationship = tool?.inputSchema.properties?.relationship;
|
|
141
|
-
expect(relationship?.type).toBe("string");
|
|
142
|
-
expect(relationship?.description).toBeDefined();
|
|
143
|
-
});
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
describe("memory_context_exec tool", () => {
|
|
147
|
-
const tool = CONTEXT_ENVIRONMENT_TOOLS.find(t => t.name === "memory_context_exec");
|
|
148
|
-
|
|
149
|
-
it("should require code", () => {
|
|
150
|
-
expect(tool?.inputSchema.required).toContain("code");
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
it("should have return_result option", () => {
|
|
154
|
-
const returnResult = tool?.inputSchema.properties?.return_result;
|
|
155
|
-
expect(returnResult?.type).toBe("boolean");
|
|
156
|
-
});
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
describe("memory_session_end tool", () => {
|
|
160
|
-
const tool = SESSION_TOOLS.find(t => t.name === "memory_session_end");
|
|
161
|
-
|
|
162
|
-
it("should have commit option", () => {
|
|
163
|
-
expect(tool?.inputSchema.properties?.commit).toBeDefined();
|
|
164
|
-
expect(tool?.inputSchema.properties?.commit?.type).toBe("boolean");
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
it("should have importance_threshold option", () => {
|
|
168
|
-
const threshold = tool?.inputSchema.properties?.importance_threshold;
|
|
169
|
-
expect(threshold?.minimum).toBe(0);
|
|
170
|
-
expect(threshold?.maximum).toBe(1);
|
|
171
|
-
});
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
describe("Legacy exports", () => {
|
|
175
|
-
it("should export CORE_TOOLS as filtered subset of TOOLS", () => {
|
|
176
|
-
const coreNames = CORE_TOOLS.map(t => t.name);
|
|
177
|
-
expect(coreNames).toEqual([
|
|
178
|
-
"memory_remember", "memory_recall", "memory_reflect",
|
|
179
|
-
"memory_forget", "memory_associate"
|
|
180
|
-
]);
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
it("should export EXTENDED_TOOLS as filtered subset of TOOLS", () => {
|
|
184
|
-
const extNames = EXTENDED_TOOLS.map(t => t.name);
|
|
185
|
-
expect(extNames).toEqual([
|
|
186
|
-
"memory_briefing", "memory_statistics",
|
|
187
|
-
"memory_graph_query", "memory_audit"
|
|
188
|
-
]);
|
|
189
|
-
});
|
|
190
|
-
});
|
|
191
|
-
});
|
package/vitest.config.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from "vitest/config";
|
|
2
|
-
|
|
3
|
-
export default defineConfig({
|
|
4
|
-
test: {
|
|
5
|
-
globals: true,
|
|
6
|
-
environment: "node",
|
|
7
|
-
include: ["tests/**/*.test.ts"],
|
|
8
|
-
coverage: {
|
|
9
|
-
provider: "v8",
|
|
10
|
-
reporter: ["text", "json", "html"],
|
|
11
|
-
include: ["src/**/*.ts"],
|
|
12
|
-
exclude: ["src/index.ts", "src/types.ts"],
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
});
|