@prmichaelsen/remember-mcp 0.1.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/.env.example +65 -0
- package/AGENT.md +840 -0
- package/README.md +72 -0
- package/agent/design/.gitkeep +0 -0
- package/agent/design/access-control-result-pattern.md +458 -0
- package/agent/design/action-audit-memory-types.md +637 -0
- package/agent/design/common-template-fields.md +282 -0
- package/agent/design/complete-tool-set.md +407 -0
- package/agent/design/content-types-expansion.md +521 -0
- package/agent/design/cross-database-id-strategy.md +358 -0
- package/agent/design/default-template-library.md +423 -0
- package/agent/design/firestore-wrapper-analysis.md +606 -0
- package/agent/design/llm-provider-abstraction.md +691 -0
- package/agent/design/location-handling-architecture.md +523 -0
- package/agent/design/memory-templates-design.md +364 -0
- package/agent/design/permissions-storage-architecture.md +680 -0
- package/agent/design/relationship-storage-strategy.md +361 -0
- package/agent/design/remember-mcp-implementation-tasks.md +417 -0
- package/agent/design/remember-mcp-progress.yaml +141 -0
- package/agent/design/requirements-enhancements.md +468 -0
- package/agent/design/requirements.md +56 -0
- package/agent/design/template-storage-strategy.md +412 -0
- package/agent/design/template-suggestion-system.md +853 -0
- package/agent/design/trust-escalation-prevention.md +343 -0
- package/agent/design/trust-system-implementation.md +592 -0
- package/agent/design/user-preferences.md +683 -0
- package/agent/design/weaviate-collection-strategy.md +461 -0
- package/agent/milestones/.gitkeep +0 -0
- package/agent/milestones/milestone-1-project-foundation.md +121 -0
- package/agent/milestones/milestone-2-core-memory-system.md +150 -0
- package/agent/milestones/milestone-3-relationships-graph.md +116 -0
- package/agent/milestones/milestone-4-user-preferences.md +103 -0
- package/agent/milestones/milestone-5-template-system.md +126 -0
- package/agent/milestones/milestone-6-auth-multi-tenancy.md +124 -0
- package/agent/milestones/milestone-7-trust-permissions.md +133 -0
- package/agent/milestones/milestone-8-testing-quality.md +137 -0
- package/agent/milestones/milestone-9-deployment-documentation.md +147 -0
- package/agent/patterns/.gitkeep +0 -0
- package/agent/patterns/bootstrap.md +1271 -0
- package/agent/patterns/firebase-admin-sdk-v8-usage.md +950 -0
- package/agent/patterns/firestore-users-pattern-best-practices.md +347 -0
- package/agent/patterns/library-services.md +454 -0
- package/agent/patterns/testing-colocated.md +316 -0
- package/agent/progress.yaml +395 -0
- package/agent/tasks/.gitkeep +0 -0
- package/agent/tasks/task-1-initialize-project-structure.md +266 -0
- package/agent/tasks/task-2-install-dependencies.md +199 -0
- package/agent/tasks/task-3-setup-weaviate-client.md +330 -0
- package/agent/tasks/task-4-setup-firestore-client.md +362 -0
- package/agent/tasks/task-5-create-basic-mcp-server.md +114 -0
- package/agent/tasks/task-6-create-integration-tests.md +195 -0
- package/agent/tasks/task-7-finalize-milestone-1.md +363 -0
- package/agent/tasks/task-8-setup-utility-scripts.md +382 -0
- package/agent/tasks/task-9-create-server-factory.md +404 -0
- package/dist/config.d.ts +26 -0
- package/dist/constants/content-types.d.ts +60 -0
- package/dist/firestore/init.d.ts +14 -0
- package/dist/firestore/paths.d.ts +53 -0
- package/dist/firestore/paths.spec.d.ts +2 -0
- package/dist/server-factory.d.ts +40 -0
- package/dist/server-factory.js +1741 -0
- package/dist/server-factory.spec.d.ts +2 -0
- package/dist/server.d.ts +3 -0
- package/dist/server.js +1690 -0
- package/dist/tools/create-memory.d.ts +94 -0
- package/dist/tools/delete-memory.d.ts +47 -0
- package/dist/tools/search-memory.d.ts +88 -0
- package/dist/types/memory.d.ts +183 -0
- package/dist/utils/logger.d.ts +7 -0
- package/dist/weaviate/client.d.ts +39 -0
- package/dist/weaviate/client.spec.d.ts +2 -0
- package/dist/weaviate/schema.d.ts +29 -0
- package/esbuild.build.js +60 -0
- package/esbuild.watch.js +25 -0
- package/jest.config.js +31 -0
- package/jest.e2e.config.js +17 -0
- package/package.json +68 -0
- package/src/.gitkeep +0 -0
- package/src/config.ts +56 -0
- package/src/constants/content-types.ts +454 -0
- package/src/firestore/init.ts +68 -0
- package/src/firestore/paths.spec.ts +75 -0
- package/src/firestore/paths.ts +124 -0
- package/src/server-factory.spec.ts +60 -0
- package/src/server-factory.ts +215 -0
- package/src/server.ts +243 -0
- package/src/tools/create-memory.ts +198 -0
- package/src/tools/delete-memory.ts +126 -0
- package/src/tools/search-memory.ts +216 -0
- package/src/types/memory.ts +276 -0
- package/src/utils/logger.ts +42 -0
- package/src/weaviate/client.spec.ts +58 -0
- package/src/weaviate/client.ts +114 -0
- package/src/weaviate/schema.ts +288 -0
- package/tsconfig.json +26 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* remember_create_memory tool
|
|
3
|
+
* Creates a new memory in the user's collection
|
|
4
|
+
*/
|
|
5
|
+
import type { ContentType, MemoryContext } from '../types/memory.js';
|
|
6
|
+
/**
|
|
7
|
+
* Tool definition for remember_create_memory
|
|
8
|
+
*/
|
|
9
|
+
export declare const createMemoryTool: {
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
inputSchema: {
|
|
13
|
+
type: string;
|
|
14
|
+
properties: {
|
|
15
|
+
content: {
|
|
16
|
+
type: string;
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
title: {
|
|
20
|
+
type: string;
|
|
21
|
+
description: string;
|
|
22
|
+
};
|
|
23
|
+
type: {
|
|
24
|
+
type: string;
|
|
25
|
+
description: string;
|
|
26
|
+
default: ContentType;
|
|
27
|
+
};
|
|
28
|
+
weight: {
|
|
29
|
+
type: string;
|
|
30
|
+
description: string;
|
|
31
|
+
minimum: number;
|
|
32
|
+
maximum: number;
|
|
33
|
+
};
|
|
34
|
+
trust: {
|
|
35
|
+
type: string;
|
|
36
|
+
description: string;
|
|
37
|
+
minimum: number;
|
|
38
|
+
maximum: number;
|
|
39
|
+
};
|
|
40
|
+
tags: {
|
|
41
|
+
type: string;
|
|
42
|
+
items: {
|
|
43
|
+
type: string;
|
|
44
|
+
};
|
|
45
|
+
description: string;
|
|
46
|
+
};
|
|
47
|
+
references: {
|
|
48
|
+
type: string;
|
|
49
|
+
items: {
|
|
50
|
+
type: string;
|
|
51
|
+
};
|
|
52
|
+
description: string;
|
|
53
|
+
};
|
|
54
|
+
template_id: {
|
|
55
|
+
type: string;
|
|
56
|
+
description: string;
|
|
57
|
+
};
|
|
58
|
+
skip_template_suggestion: {
|
|
59
|
+
type: string;
|
|
60
|
+
description: string;
|
|
61
|
+
default: boolean;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
required: string[];
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Create memory arguments
|
|
69
|
+
*/
|
|
70
|
+
export interface CreateMemoryArgs {
|
|
71
|
+
content: string;
|
|
72
|
+
title?: string;
|
|
73
|
+
type?: ContentType;
|
|
74
|
+
weight?: number;
|
|
75
|
+
trust?: number;
|
|
76
|
+
tags?: string[];
|
|
77
|
+
references?: string[];
|
|
78
|
+
template_id?: string;
|
|
79
|
+
skip_template_suggestion?: boolean;
|
|
80
|
+
structured_content?: Record<string, any>;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Create memory result
|
|
84
|
+
*/
|
|
85
|
+
export interface CreateMemoryResult {
|
|
86
|
+
memory_id: string;
|
|
87
|
+
created_at: string;
|
|
88
|
+
message: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Handle remember_create_memory tool
|
|
92
|
+
*/
|
|
93
|
+
export declare function handleCreateMemory(args: CreateMemoryArgs, userId: string, context?: Partial<MemoryContext>): Promise<string>;
|
|
94
|
+
//# sourceMappingURL=create-memory.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* remember_delete_memory tool
|
|
3
|
+
* Delete a memory from the user's collection
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Tool definition for remember_delete_memory
|
|
7
|
+
*/
|
|
8
|
+
export declare const deleteMemoryTool: {
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
inputSchema: {
|
|
12
|
+
type: string;
|
|
13
|
+
properties: {
|
|
14
|
+
memory_id: {
|
|
15
|
+
type: string;
|
|
16
|
+
description: string;
|
|
17
|
+
};
|
|
18
|
+
delete_relationships: {
|
|
19
|
+
type: string;
|
|
20
|
+
description: string;
|
|
21
|
+
default: boolean;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
required: string[];
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Delete memory arguments
|
|
29
|
+
*/
|
|
30
|
+
export interface DeleteMemoryArgs {
|
|
31
|
+
memory_id: string;
|
|
32
|
+
delete_relationships?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Delete memory result
|
|
36
|
+
*/
|
|
37
|
+
export interface DeleteMemoryResult {
|
|
38
|
+
memory_id: string;
|
|
39
|
+
deleted: boolean;
|
|
40
|
+
relationships_deleted?: number;
|
|
41
|
+
message: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Handle remember_delete_memory tool
|
|
45
|
+
*/
|
|
46
|
+
export declare function handleDeleteMemory(args: DeleteMemoryArgs, userId: string): Promise<string>;
|
|
47
|
+
//# sourceMappingURL=delete-memory.d.ts.map
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* remember_search_memory tool
|
|
3
|
+
* Search memories using hybrid semantic + keyword search
|
|
4
|
+
*/
|
|
5
|
+
import type { SearchOptions } from '../types/memory.js';
|
|
6
|
+
/**
|
|
7
|
+
* Tool definition for remember_search_memory
|
|
8
|
+
*/
|
|
9
|
+
export declare const searchMemoryTool: {
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
inputSchema: {
|
|
13
|
+
type: string;
|
|
14
|
+
properties: {
|
|
15
|
+
query: {
|
|
16
|
+
type: string;
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
alpha: {
|
|
20
|
+
type: string;
|
|
21
|
+
description: string;
|
|
22
|
+
minimum: number;
|
|
23
|
+
maximum: number;
|
|
24
|
+
default: number;
|
|
25
|
+
};
|
|
26
|
+
limit: {
|
|
27
|
+
type: string;
|
|
28
|
+
description: string;
|
|
29
|
+
minimum: number;
|
|
30
|
+
maximum: number;
|
|
31
|
+
default: number;
|
|
32
|
+
};
|
|
33
|
+
offset: {
|
|
34
|
+
type: string;
|
|
35
|
+
description: string;
|
|
36
|
+
minimum: number;
|
|
37
|
+
default: number;
|
|
38
|
+
};
|
|
39
|
+
filters: {
|
|
40
|
+
type: string;
|
|
41
|
+
description: string;
|
|
42
|
+
properties: {
|
|
43
|
+
types: {
|
|
44
|
+
type: string;
|
|
45
|
+
items: {
|
|
46
|
+
type: string;
|
|
47
|
+
};
|
|
48
|
+
description: string;
|
|
49
|
+
};
|
|
50
|
+
tags: {
|
|
51
|
+
type: string;
|
|
52
|
+
items: {
|
|
53
|
+
type: string;
|
|
54
|
+
};
|
|
55
|
+
description: string;
|
|
56
|
+
};
|
|
57
|
+
weight_min: {
|
|
58
|
+
type: string;
|
|
59
|
+
description: string;
|
|
60
|
+
};
|
|
61
|
+
trust_min: {
|
|
62
|
+
type: string;
|
|
63
|
+
description: string;
|
|
64
|
+
};
|
|
65
|
+
date_from: {
|
|
66
|
+
type: string;
|
|
67
|
+
description: string;
|
|
68
|
+
};
|
|
69
|
+
date_to: {
|
|
70
|
+
type: string;
|
|
71
|
+
description: string;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
include_relationships: {
|
|
76
|
+
type: string;
|
|
77
|
+
description: string;
|
|
78
|
+
default: boolean;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
required: string[];
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Handle remember_search_memory tool
|
|
86
|
+
*/
|
|
87
|
+
export declare function handleSearchMemory(args: SearchOptions, userId: string): Promise<string>;
|
|
88
|
+
//# sourceMappingURL=search-memory.d.ts.map
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Memory type definitions for remember-mcp
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Content types for memories
|
|
6
|
+
* Based on agent/design/content-types-expansion.md
|
|
7
|
+
*/
|
|
8
|
+
export type ContentType = 'code' | 'note' | 'documentation' | 'reference' | 'todo' | 'checklist' | 'project' | 'goal' | 'habit' | 'email' | 'conversation' | 'meeting' | 'person' | 'article' | 'webpage' | 'social' | 'image' | 'video' | 'audio' | 'transcript' | 'presentation' | 'spreadsheet' | 'pdf' | 'screenplay' | 'recipe' | 'idea' | 'quote' | 'journal' | 'memory' | 'event' | 'bookmark' | 'form' | 'location' | 'invoice' | 'contract' | 'system' | 'action' | 'audit' | 'history';
|
|
9
|
+
/**
|
|
10
|
+
* GPS coordinates
|
|
11
|
+
*/
|
|
12
|
+
export interface GPSCoordinates {
|
|
13
|
+
latitude: number;
|
|
14
|
+
longitude: number;
|
|
15
|
+
accuracy?: number;
|
|
16
|
+
altitude?: number;
|
|
17
|
+
timestamp: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Address information
|
|
21
|
+
*/
|
|
22
|
+
export interface Address {
|
|
23
|
+
formatted: string;
|
|
24
|
+
street?: string;
|
|
25
|
+
city?: string;
|
|
26
|
+
state?: string;
|
|
27
|
+
country?: string;
|
|
28
|
+
postal_code?: string;
|
|
29
|
+
timezone?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Location information (from platform cookies)
|
|
33
|
+
*/
|
|
34
|
+
export interface Location {
|
|
35
|
+
gps: GPSCoordinates | null;
|
|
36
|
+
address: Address | null;
|
|
37
|
+
source: 'gps' | 'ip' | 'manual' | 'cached' | 'unavailable';
|
|
38
|
+
confidence: number;
|
|
39
|
+
is_approximate: boolean;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Conversation participant
|
|
43
|
+
*/
|
|
44
|
+
export interface Participant {
|
|
45
|
+
user_id: string;
|
|
46
|
+
role: 'user' | 'assistant' | 'system';
|
|
47
|
+
name?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Source information
|
|
51
|
+
*/
|
|
52
|
+
export interface Source {
|
|
53
|
+
type: 'conversation' | 'import' | 'inference' | 'manual' | 'api';
|
|
54
|
+
platform?: string;
|
|
55
|
+
client?: string;
|
|
56
|
+
version?: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Environment information
|
|
60
|
+
*/
|
|
61
|
+
export interface Environment {
|
|
62
|
+
location?: Location;
|
|
63
|
+
device?: string;
|
|
64
|
+
user_agent?: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Context information about how/when memory was created
|
|
68
|
+
*/
|
|
69
|
+
export interface MemoryContext {
|
|
70
|
+
conversation_id?: string;
|
|
71
|
+
conversation_title?: string;
|
|
72
|
+
turn_number?: number;
|
|
73
|
+
summary?: string;
|
|
74
|
+
participants?: Participant[];
|
|
75
|
+
timestamp: string;
|
|
76
|
+
timezone?: string;
|
|
77
|
+
source: Source;
|
|
78
|
+
environment?: Environment;
|
|
79
|
+
tags?: string[];
|
|
80
|
+
notes?: string;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Core Memory interface
|
|
84
|
+
* Based on agent/design/requirements-enhancements.md
|
|
85
|
+
*/
|
|
86
|
+
export interface Memory {
|
|
87
|
+
id: string;
|
|
88
|
+
user_id: string;
|
|
89
|
+
doc_type: 'memory';
|
|
90
|
+
content: string;
|
|
91
|
+
title?: string;
|
|
92
|
+
summary?: string;
|
|
93
|
+
type: ContentType;
|
|
94
|
+
weight: number;
|
|
95
|
+
trust: number;
|
|
96
|
+
confidence?: number;
|
|
97
|
+
location: Location;
|
|
98
|
+
context: MemoryContext;
|
|
99
|
+
relationships: string[];
|
|
100
|
+
access_count: number;
|
|
101
|
+
last_accessed_at?: string;
|
|
102
|
+
access_frequency?: number;
|
|
103
|
+
created_at: string;
|
|
104
|
+
updated_at: string;
|
|
105
|
+
version: number;
|
|
106
|
+
tags: string[];
|
|
107
|
+
category?: string;
|
|
108
|
+
references?: string[];
|
|
109
|
+
template_id?: string;
|
|
110
|
+
template_version?: string;
|
|
111
|
+
structured_content?: Record<string, any>;
|
|
112
|
+
base_weight: number;
|
|
113
|
+
computed_weight?: number;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Relationship interface
|
|
117
|
+
* Stored in same collection as memories with doc_type: "relationship"
|
|
118
|
+
*/
|
|
119
|
+
export interface Relationship {
|
|
120
|
+
id: string;
|
|
121
|
+
user_id: string;
|
|
122
|
+
doc_type: 'relationship';
|
|
123
|
+
memory_ids: string[];
|
|
124
|
+
relationship_type: string;
|
|
125
|
+
observation: string;
|
|
126
|
+
strength: number;
|
|
127
|
+
confidence: number;
|
|
128
|
+
context: MemoryContext;
|
|
129
|
+
created_at: string;
|
|
130
|
+
updated_at: string;
|
|
131
|
+
version: number;
|
|
132
|
+
tags: string[];
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Union type for documents in Memory collection
|
|
136
|
+
*/
|
|
137
|
+
export type MemoryDocument = Memory | Relationship;
|
|
138
|
+
/**
|
|
139
|
+
* Partial memory for updates
|
|
140
|
+
*/
|
|
141
|
+
export type MemoryUpdate = Partial<Omit<Memory, 'id' | 'user_id' | 'doc_type' | 'created_at' | 'version'>>;
|
|
142
|
+
/**
|
|
143
|
+
* Partial relationship for updates
|
|
144
|
+
*/
|
|
145
|
+
export type RelationshipUpdate = Partial<Omit<Relationship, 'id' | 'user_id' | 'doc_type' | 'created_at' | 'version'>>;
|
|
146
|
+
/**
|
|
147
|
+
* Search filters
|
|
148
|
+
*/
|
|
149
|
+
export interface SearchFilters {
|
|
150
|
+
types?: ContentType[];
|
|
151
|
+
tags?: string[];
|
|
152
|
+
weight_min?: number;
|
|
153
|
+
weight_max?: number;
|
|
154
|
+
trust_min?: number;
|
|
155
|
+
trust_max?: number;
|
|
156
|
+
date_from?: string;
|
|
157
|
+
date_to?: string;
|
|
158
|
+
location_near?: GPSCoordinates;
|
|
159
|
+
location_radius_meters?: number;
|
|
160
|
+
has_relationships?: boolean;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Search options
|
|
164
|
+
*/
|
|
165
|
+
export interface SearchOptions {
|
|
166
|
+
query: string;
|
|
167
|
+
alpha?: number;
|
|
168
|
+
filters?: SearchFilters;
|
|
169
|
+
include_relationships?: boolean;
|
|
170
|
+
limit?: number;
|
|
171
|
+
offset?: number;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Search result
|
|
175
|
+
*/
|
|
176
|
+
export interface SearchResult {
|
|
177
|
+
memories: Memory[];
|
|
178
|
+
relationships?: Relationship[];
|
|
179
|
+
total: number;
|
|
180
|
+
offset: number;
|
|
181
|
+
limit: number;
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=memory.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const logger: {
|
|
2
|
+
debug: (message: string, ...args: any[]) => void;
|
|
3
|
+
info: (message: string, ...args: any[]) => void;
|
|
4
|
+
warn: (message: string, ...args: any[]) => void;
|
|
5
|
+
error: (message: string, ...args: any[]) => void;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { WeaviateClient } from 'weaviate-client';
|
|
2
|
+
/**
|
|
3
|
+
* Initialize Weaviate client
|
|
4
|
+
*/
|
|
5
|
+
export declare function initWeaviateClient(): Promise<WeaviateClient>;
|
|
6
|
+
/**
|
|
7
|
+
* Get Weaviate client instance
|
|
8
|
+
*/
|
|
9
|
+
export declare function getWeaviateClient(): WeaviateClient;
|
|
10
|
+
/**
|
|
11
|
+
* Test Weaviate connection
|
|
12
|
+
*/
|
|
13
|
+
export declare function testWeaviateConnection(): Promise<boolean>;
|
|
14
|
+
/**
|
|
15
|
+
* Sanitize user_id for collection name
|
|
16
|
+
* Weaviate collection names must start with uppercase letter and contain only alphanumeric
|
|
17
|
+
*/
|
|
18
|
+
export declare function sanitizeUserId(userId: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Get collection name for user's memories
|
|
21
|
+
*/
|
|
22
|
+
export declare function getMemoryCollectionName(userId: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Get collection name for user's templates
|
|
25
|
+
*/
|
|
26
|
+
export declare function getTemplateCollectionName(userId: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Get collection name for user's audit logs
|
|
29
|
+
*/
|
|
30
|
+
export declare function getAuditCollectionName(userId: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Check if collection exists
|
|
33
|
+
*/
|
|
34
|
+
export declare function collectionExists(collectionName: string): Promise<boolean>;
|
|
35
|
+
/**
|
|
36
|
+
* Close Weaviate client connection
|
|
37
|
+
*/
|
|
38
|
+
export declare function closeWeaviateClient(): Promise<void>;
|
|
39
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Weaviate schema definitions for remember-mcp
|
|
3
|
+
* Based on agent/design/weaviate-collection-strategy.md
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Create Memory collection schema for a user
|
|
7
|
+
*
|
|
8
|
+
* This collection stores BOTH memories AND relationships using doc_type discriminator.
|
|
9
|
+
* This unified approach enables:
|
|
10
|
+
* - Single query for memories with relationships
|
|
11
|
+
* - Semantic search across both memories and relationship observations
|
|
12
|
+
* - Better RAG context (LLM gets memories + connections together)
|
|
13
|
+
*
|
|
14
|
+
* @param userId - User identifier
|
|
15
|
+
*/
|
|
16
|
+
export declare function createMemoryCollection(userId: string): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Ensure Memory collection exists for user (lazy creation)
|
|
19
|
+
*/
|
|
20
|
+
export declare function ensureMemoryCollection(userId: string): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Get Memory collection for user
|
|
23
|
+
*/
|
|
24
|
+
export declare function getMemoryCollection(userId: string): import("weaviate-client").Collection<undefined, string, undefined>;
|
|
25
|
+
/**
|
|
26
|
+
* Delete Memory collection for user (use with caution!)
|
|
27
|
+
*/
|
|
28
|
+
export declare function deleteMemoryCollection(userId: string): Promise<void>;
|
|
29
|
+
//# sourceMappingURL=schema.d.ts.map
|
package/esbuild.build.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as esbuild from 'esbuild';
|
|
2
|
+
import { execSync } from 'child_process';
|
|
3
|
+
|
|
4
|
+
// Build server (standalone)
|
|
5
|
+
await esbuild.build({
|
|
6
|
+
entryPoints: ['src/server.ts'],
|
|
7
|
+
bundle: true,
|
|
8
|
+
platform: 'node',
|
|
9
|
+
target: 'node20',
|
|
10
|
+
format: 'esm',
|
|
11
|
+
outfile: 'dist/server.js',
|
|
12
|
+
sourcemap: true,
|
|
13
|
+
external: [
|
|
14
|
+
'weaviate-client',
|
|
15
|
+
'@prmichaelsen/firebase-admin-sdk-v8',
|
|
16
|
+
'@modelcontextprotocol/sdk'
|
|
17
|
+
],
|
|
18
|
+
banner: {
|
|
19
|
+
js: "import { createRequire } from 'module'; const require = createRequire(import.meta.url);"
|
|
20
|
+
},
|
|
21
|
+
alias: {
|
|
22
|
+
'@': './src'
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
// Build server factory (bundled for library usage)
|
|
27
|
+
await esbuild.build({
|
|
28
|
+
entryPoints: ['src/server-factory.ts'],
|
|
29
|
+
bundle: true,
|
|
30
|
+
platform: 'node',
|
|
31
|
+
target: 'node20',
|
|
32
|
+
format: 'esm',
|
|
33
|
+
outfile: 'dist/server-factory.js',
|
|
34
|
+
sourcemap: true,
|
|
35
|
+
external: [
|
|
36
|
+
'weaviate-client',
|
|
37
|
+
'@prmichaelsen/firebase-admin-sdk-v8',
|
|
38
|
+
'@modelcontextprotocol/sdk'
|
|
39
|
+
],
|
|
40
|
+
banner: {
|
|
41
|
+
js: "import { createRequire } from 'module'; const require = createRequire(import.meta.url);"
|
|
42
|
+
},
|
|
43
|
+
alias: {
|
|
44
|
+
'@': './src'
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
console.log('✓ JavaScript bundles built');
|
|
49
|
+
|
|
50
|
+
// Generate TypeScript declarations
|
|
51
|
+
console.log('Generating TypeScript declarations...');
|
|
52
|
+
try {
|
|
53
|
+
execSync('tsc --emitDeclarationOnly --outDir dist', { stdio: 'inherit' });
|
|
54
|
+
console.log('✓ TypeScript declarations generated');
|
|
55
|
+
} catch (error) {
|
|
56
|
+
console.error('✗ Failed to generate TypeScript declarations');
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
console.log('✓ Build complete');
|
package/esbuild.watch.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as esbuild from 'esbuild';
|
|
2
|
+
|
|
3
|
+
const ctx = await esbuild.context({
|
|
4
|
+
entryPoints: ['src/server.ts'],
|
|
5
|
+
bundle: true,
|
|
6
|
+
platform: 'node',
|
|
7
|
+
target: 'node20',
|
|
8
|
+
format: 'esm',
|
|
9
|
+
outfile: 'dist/server.js',
|
|
10
|
+
sourcemap: true,
|
|
11
|
+
external: [
|
|
12
|
+
'weaviate-client',
|
|
13
|
+
'firebase-admin',
|
|
14
|
+
'@modelcontextprotocol/sdk'
|
|
15
|
+
],
|
|
16
|
+
banner: {
|
|
17
|
+
js: "import { createRequire } from 'module'; const require = createRequire(import.meta.url);"
|
|
18
|
+
},
|
|
19
|
+
alias: {
|
|
20
|
+
'@': './src'
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
await ctx.watch();
|
|
25
|
+
console.log('👀 Watching for changes...');
|
package/jest.config.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
preset: 'ts-jest/presets/default-esm',
|
|
3
|
+
testEnvironment: 'node',
|
|
4
|
+
extensionsToTreatAsEsm: ['.ts'],
|
|
5
|
+
roots: ['<rootDir>/src'],
|
|
6
|
+
testMatch: ['**/*.spec.ts'],
|
|
7
|
+
moduleFileExtensions: ['ts', 'js'],
|
|
8
|
+
collectCoverage: true,
|
|
9
|
+
coverageDirectory: 'coverage',
|
|
10
|
+
coverageReporters: ['text', 'lcov', 'html'],
|
|
11
|
+
collectCoverageFrom: [
|
|
12
|
+
'src/**/*.ts',
|
|
13
|
+
'!src/**/*.d.ts',
|
|
14
|
+
'!src/**/*.spec.ts',
|
|
15
|
+
'!src/**/*.e2e.ts',
|
|
16
|
+
'!src/index.ts',
|
|
17
|
+
'!src/types/**/*.ts',
|
|
18
|
+
],
|
|
19
|
+
moduleNameMapper: {
|
|
20
|
+
'^@/(.*)$': '<rootDir>/src/$1',
|
|
21
|
+
'^(\\.{1,2}/.*)\\.js$': '$1',
|
|
22
|
+
},
|
|
23
|
+
transform: {
|
|
24
|
+
'^.+\\.ts$': [
|
|
25
|
+
'ts-jest',
|
|
26
|
+
{
|
|
27
|
+
useESM: true,
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
preset: 'ts-jest',
|
|
3
|
+
testEnvironment: 'node',
|
|
4
|
+
testMatch: ['**/*.e2e.ts'],
|
|
5
|
+
testTimeout: 30000, // 30 seconds for real API calls
|
|
6
|
+
roots: ['<rootDir>/src'],
|
|
7
|
+
collectCoverageFrom: [
|
|
8
|
+
'src/**/*.ts',
|
|
9
|
+
'!src/**/*.spec.ts',
|
|
10
|
+
'!src/**/*.e2e.ts',
|
|
11
|
+
'!src/types/**/*.ts',
|
|
12
|
+
'!src/index.ts',
|
|
13
|
+
],
|
|
14
|
+
moduleNameMapper: {
|
|
15
|
+
'^@/(.*)$': '<rootDir>/src/$1',
|
|
16
|
+
},
|
|
17
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@prmichaelsen/remember-mcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Multi-tenant memory system MCP server with vector search and relationships",
|
|
5
|
+
"main": "dist/server.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/server.d.ts",
|
|
10
|
+
"import": "./dist/server.js"
|
|
11
|
+
},
|
|
12
|
+
"./factory": {
|
|
13
|
+
"types": "./dist/server-factory.d.ts",
|
|
14
|
+
"import": "./dist/server-factory.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/prmichaelsen/remember-mcp.git"
|
|
20
|
+
},
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/prmichaelsen/remember-mcp/issues"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/prmichaelsen/remember-mcp#readme",
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "node esbuild.build.js",
|
|
27
|
+
"build:watch": "node esbuild.watch.js",
|
|
28
|
+
"clean": "rm -rf dist",
|
|
29
|
+
"dev": "tsx watch src/server.ts",
|
|
30
|
+
"start": "node dist/server.js",
|
|
31
|
+
"test": "jest",
|
|
32
|
+
"test:watch": "jest --watch",
|
|
33
|
+
"test:e2e": "jest --config jest.e2e.config.js",
|
|
34
|
+
"test:e2e:watch": "jest --config jest.e2e.config.js --watch",
|
|
35
|
+
"test:all": "npm test && npm run test:e2e",
|
|
36
|
+
"lint": "eslint src/**/*.ts",
|
|
37
|
+
"typecheck": "tsc --noEmit",
|
|
38
|
+
"prepublishOnly": "npm run clean && npm run build"
|
|
39
|
+
},
|
|
40
|
+
"keywords": [
|
|
41
|
+
"mcp",
|
|
42
|
+
"memory",
|
|
43
|
+
"vector-search",
|
|
44
|
+
"weaviate",
|
|
45
|
+
"firebase"
|
|
46
|
+
],
|
|
47
|
+
"author": "Patrick Michaelsen",
|
|
48
|
+
"license": "MIT",
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@modelcontextprotocol/sdk": "^1.0.4",
|
|
51
|
+
"@prmichaelsen/firebase-admin-sdk-v8": "^2.2.0",
|
|
52
|
+
"dotenv": "^16.4.5",
|
|
53
|
+
"weaviate-client": "^3.2.0"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@types/jest": "^29.5.12",
|
|
57
|
+
"@types/node": "^20.11.19",
|
|
58
|
+
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
|
59
|
+
"@typescript-eslint/parser": "^7.0.0",
|
|
60
|
+
"esbuild": "^0.20.0",
|
|
61
|
+
"eslint": "^8.56.0",
|
|
62
|
+
"jest": "^29.7.0",
|
|
63
|
+
"prettier": "^3.2.5",
|
|
64
|
+
"ts-jest": "^29.1.2",
|
|
65
|
+
"tsx": "^4.7.1",
|
|
66
|
+
"typescript": "^5.3.3"
|
|
67
|
+
}
|
|
68
|
+
}
|