traqr-memory-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.
@@ -0,0 +1,62 @@
1
+ # TraqrDB Memory Instructions for CLAUDE.md
2
+
3
+ > Copy this section into your project's CLAUDE.md to enable automatic memory behavior.
4
+ > Without these instructions, Claude has the tools but won't use them proactively.
5
+
6
+ ---
7
+
8
+ ## Memory System
9
+
10
+ TraqrDB memory via MCP tools. Persistent vector database that remembers across sessions.
11
+ Only `content` is required for any store — domain, category, summary, topic, tags are all
12
+ auto-derived from content.
13
+
14
+ ### Reading
15
+ - `memory_search` — search by meaning, returns summaries (~30 tokens/result)
16
+ - `memory_read` — expand one memory by ID (full content + version history)
17
+ - `memory_browse` — navigate by domain/category facets (no embedding cost)
18
+ - `memory_context` — load assembled task context (principles, preferences, gotchas)
19
+
20
+ ### Writing
21
+ - `memory_store` — store a memory (just pass content, rest auto-derived)
22
+ - `memory_enhance` — deepen existing understanding with new context
23
+ - `memory_pulse` — batch capture 2+ learnings at once
24
+
25
+ ### Managing
26
+ - `memory_audit` — system health, stats, quality metrics
27
+ - `memory_archive` — archive stale content (was correct, now outdated)
28
+ - `memory_forget` — forget incorrect or harmful content permanently
29
+
30
+ ### Capture Triggers — Fire Automatically, Don't Ask
31
+
32
+ **Immediate captures** (call `memory_store` right after these happen):
33
+ 1. **Bug root cause found** — "X broke because Y in file Z"
34
+ 2. **User states a preference** — "I prefer/hate/want/always/never..." — capture exactly
35
+ 3. **API behaves unexpectedly** — document the gotcha with specifics
36
+ 4. **Architecture decision made** — what was decided AND why
37
+ 5. **Something fails silently** — the most dangerous kind, always capture
38
+
39
+ **Use `memory_enhance`** when deepening existing understanding:
40
+ 6. **User reacts to your output** — what does this reveal about how they work?
41
+ 7. **User corrects your approach** — store the correction AND the reasoning
42
+ 8. **New detail about user's style** — compounds into existing personality memories
43
+
44
+ **Session checkpoints:**
45
+ 9. **After completing a subtask** — "Did I learn anything non-obvious?"
46
+ 10. **Before ending a session** — memory_pulse with session learnings
47
+
48
+ **Do NOT capture:**
49
+ - Generic advice any developer would know
50
+ - Observations about code that are obvious from reading it
51
+ - Anything already documented in CLAUDE.md or project docs
52
+
53
+ ### Search Before You Start
54
+
55
+ At the beginning of significant tasks, search memory for relevant context:
56
+ ```
57
+ memory_search("topic of the current task")
58
+ memory_context({ taskDescription: "what you're about to do" })
59
+ ```
60
+
61
+ This surfaces gotchas, preferences, and patterns from prior sessions that
62
+ inform your approach before you write a single line of code.
package/README.md ADDED
@@ -0,0 +1,135 @@
1
+ # TraqrDB — Memory-as-a-Service for AI Agents
2
+
3
+ A schema + intelligence layer on top of Postgres + pgvector. Store memories, search by meaning, track entity relationships, manage memory lifecycle — all via 10 MCP tools.
4
+
5
+ ## Quick Start (10 minutes)
6
+
7
+ ### 1. Set Up Your Database
8
+
9
+ **Option A: Supabase (easiest, free tier)**
10
+ 1. Create a project at [supabase.com](https://supabase.com)
11
+ 2. Go to SQL Editor, paste contents of `setup.sql`, run
12
+ 3. Copy your project URL + service role key from Settings > API
13
+
14
+ **Option B: AWS RDS / Aurora**
15
+ 1. Create RDS Postgres 15+ instance
16
+ 2. Enable pgvector: `CREATE EXTENSION vector;`
17
+ 3. Run setup.sql via psql: `psql $DATABASE_URL -f setup.sql`
18
+
19
+ **Option C: Docker (local dev)**
20
+ ```bash
21
+ docker run -d --name traqrdb \
22
+ -e POSTGRES_PASSWORD=postgres \
23
+ -p 5432:5432 \
24
+ pgvector/pgvector:pg16
25
+ psql postgresql://postgres:postgres@localhost:5432/postgres -f setup.sql
26
+ ```
27
+
28
+ ### 2. Configure Environment
29
+
30
+ ```bash
31
+ # Required: Postgres connection
32
+ export DATABASE_URL="postgresql://user:pass@host:5432/dbname"
33
+ # OR for Supabase:
34
+ export SUPABASE_URL="https://xxx.supabase.co"
35
+ export SUPABASE_SERVICE_ROLE_KEY="eyJ..."
36
+
37
+ # Embedding provider (choose one)
38
+ export OPENAI_API_KEY="sk-..." # OpenAI ($0.02/1M tokens)
39
+ export GOOGLE_API_KEY="AIza..." # Gemini Embedding 2 (free tier)
40
+ # OR neither — entities use name matching, no semantic search
41
+
42
+ # Optional
43
+ export COHERE_API_KEY="..." # Cohere Rerank v3.5
44
+ ```
45
+
46
+ ### 3. Connect to Your AI Agent
47
+
48
+ Add to your MCP client config (Claude Code, Cursor, etc.):
49
+ ```json
50
+ {
51
+ "traqr-memory": {
52
+ "command": "npx",
53
+ "args": ["traqr-memory-mcp"],
54
+ "env": {
55
+ "DATABASE_URL": "postgresql://...",
56
+ "OPENAI_API_KEY": "sk-..."
57
+ }
58
+ }
59
+ }
60
+ ```
61
+
62
+ ### 4. Verify
63
+
64
+ Use `memory_audit` to check health, then `memory_store` to create your first memory.
65
+
66
+ ---
67
+
68
+ ## 10 MCP Tools
69
+
70
+ | Tool | Description |
71
+ |------|-------------|
72
+ | `memory_store` | Remember something. Only content required — everything else auto-derived. |
73
+ | `memory_search` | Search memories by meaning. Returns summaries. |
74
+ | `memory_read` | Expand a memory by ID. Full content + version history. |
75
+ | `memory_enhance` | Deepen understanding. Creates connected memories via triage pipeline. |
76
+ | `memory_browse` | Navigate by facet. Domain > category > summaries. Zero embedding cost. |
77
+ | `memory_context` | Load task-relevant context — principles, preferences, gotchas. |
78
+ | `memory_pulse` | Batch: capture multiple learnings + search + update in one call. |
79
+ | `memory_audit` | System health, stats, quality metrics. |
80
+ | `memory_archive` | Archive stale content that was once correct. |
81
+ | `memory_forget` | Forget incorrect or harmful content permanently. |
82
+
83
+ ## What's Inside
84
+
85
+ **Schema** (created by `setup.sql`):
86
+ - `traqr_memories` — content, embeddings, lifecycle, dual tsvectors
87
+ - `memory_relationships` — graph edges between memories
88
+ - `memory_entities` — extracted entities with embeddings
89
+ - `memory_entity_links` — memory-to-entity junction table
90
+ - 12+ indexes including partial HNSW, BM25 GIN, lifecycle
91
+ - 10+ RPC functions for search, BM25, temporal, graph, confidence decay
92
+
93
+ **Intelligence** (in the TypeScript package):
94
+ - Multi-strategy retrieval: semantic + BM25 > RRF fusion > optional Cohere rerank
95
+ - 3-zone cosine triage: NOOP (>=0.90), ADD (<0.60), borderline (GPT-4o-mini decision)
96
+ - Type-aware lifecycle: facts invalidate, preferences supersede, patterns coexist
97
+ - Entity extraction: multi-signal canonicalization (name > ILIKE > embedding)
98
+ - Quality gate: 3-layer ingestion filter prevents noise
99
+
100
+ ## Graceful Degradation
101
+
102
+ | Missing | Behavior |
103
+ |---------|----------|
104
+ | No embedding API key | Entities use name matching. BM25 keyword search works. No vector search. |
105
+ | No COHERE_API_KEY | Search uses RRF scores instead of Cohere rerank. |
106
+
107
+ ## TypeScript Library API
108
+
109
+ ```typescript
110
+ import { storeMemory, searchMemories, triageAndStore } from '@traqr/memory'
111
+
112
+ // Store a memory
113
+ await storeMemory({ content: 'Always use bun', sourceType: 'manual' })
114
+
115
+ // Search by meaning
116
+ const results = await searchMemories('package manager', { limit: 5 })
117
+
118
+ // Store with triage (dedup + edges + LLM borderline)
119
+ const result = await triageAndStore({ content: '...', sourceType: 'session' })
120
+ // result.zone: 'noop' | 'add' | 'borderline'
121
+ ```
122
+
123
+ ## Environment Variables
124
+
125
+ | Variable | Required | Description |
126
+ |----------|----------|-------------|
127
+ | `DATABASE_URL` or `SUPABASE_URL` | Yes | Postgres connection |
128
+ | `SUPABASE_SERVICE_ROLE_KEY` | Supabase only | Service role key |
129
+ | `OPENAI_API_KEY` | Recommended | OpenAI embeddings |
130
+ | `GOOGLE_API_KEY` | Alternative | Gemini Embedding 2 (free) |
131
+ | `COHERE_API_KEY` | No | Cohere Rerank (quality boost) |
132
+
133
+ ## License
134
+
135
+ Apache-2.0
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * TraqrDB Memory MCP Server
4
+ *
5
+ * Standalone MCP server for AI agents. 10 memory tools powered by
6
+ * Postgres + pgvector. Multi-strategy retrieval (semantic + BM25 + RRF),
7
+ * cosine triage, LLM borderline decisions, entity extraction.
8
+ *
9
+ * Usage:
10
+ * SUPABASE_URL=... SUPABASE_SERVICE_ROLE_KEY=... npx traqr-memory-mcp
11
+ */
12
+ export {};
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;GASG"}
package/dist/index.js ADDED
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * TraqrDB Memory MCP Server
4
+ *
5
+ * Standalone MCP server for AI agents. 10 memory tools powered by
6
+ * Postgres + pgvector. Multi-strategy retrieval (semantic + BM25 + RRF),
7
+ * cosine triage, LLM borderline decisions, entity extraction.
8
+ *
9
+ * Usage:
10
+ * SUPABASE_URL=... SUPABASE_SERVICE_ROLE_KEY=... npx traqr-memory-mcp
11
+ */
12
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
13
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
14
+ import { configureMemory } from '@traqr/memory';
15
+ import { registerTools } from './tools.js';
16
+ // Configure database from environment
17
+ const supabaseUrl = process.env.SUPABASE_URL || process.env.DATABASE_URL;
18
+ const supabaseKey = process.env.SUPABASE_SERVICE_ROLE_KEY || 'service_role';
19
+ if (!supabaseUrl) {
20
+ console.error('Error: SUPABASE_URL or DATABASE_URL environment variable required.');
21
+ console.error('See README.md for setup instructions.');
22
+ process.exit(1);
23
+ }
24
+ configureMemory({
25
+ supabaseUrl,
26
+ supabaseKey,
27
+ userId: process.env.TRAQR_USER_ID,
28
+ projectId: process.env.TRAQR_PROJECT_ID,
29
+ });
30
+ // Create and start MCP server
31
+ const server = new McpServer({
32
+ name: 'traqr-memory',
33
+ version: '1.0.0',
34
+ });
35
+ registerTools(server);
36
+ async function main() {
37
+ const transport = new StdioServerTransport();
38
+ await server.connect(transport);
39
+ }
40
+ main().catch((err) => {
41
+ console.error('TraqrDB Memory MCP server failed to start:', err);
42
+ process.exit(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AE;IACnB,OAAO,CAAC,KAAK,CAAC,4CAA4C,EAAE,GAAG,CAAC,CAAA;IAChE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * MCP Tool Handlers
3
+ *
4
+ * 10 memory tools calling @traqr/memory library functions directly.
5
+ * No HTTP layer, no apiCall(), no localhost server needed.
6
+ */
7
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
8
+ export declare function registerTools(server: McpServer): void;
9
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AA8CxE,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,QA6S9C"}
package/dist/tools.js ADDED
@@ -0,0 +1,301 @@
1
+ /**
2
+ * MCP Tool Handlers
3
+ *
4
+ * 10 memory tools calling @traqr/memory library functions directly.
5
+ * No HTTP layer, no apiCall(), no localhost server needed.
6
+ */
7
+ import { z } from 'zod';
8
+ import { storeMemory, searchMemoriesV2, getMemory, archiveMemory, triageAndStore, getSystemHealth, getDetailedStats, assembleSessionContext, deriveAll, getMemoryClient, } from '@traqr/memory';
9
+ // ---------------------------------------------------------------------------
10
+ // Shared schemas
11
+ // ---------------------------------------------------------------------------
12
+ const categoryEnum = z.enum(['gotcha', 'pattern', 'fix', 'insight', 'question', 'preference', 'convention']);
13
+ const controlledTagEnum = z.enum(['critical', 'important', 'nice-to-know', 'evergreen', 'active', 'stale-risk', 'from-incident', 'from-decision', 'from-observation']);
14
+ // ---------------------------------------------------------------------------
15
+ // Helpers
16
+ // ---------------------------------------------------------------------------
17
+ function errorResult(err) {
18
+ const msg = err instanceof Error ? err.message : String(err);
19
+ return { content: [{ type: 'text', text: `Error: ${msg}` }] };
20
+ }
21
+ function toSummaryResult(r) {
22
+ return {
23
+ id: r.id,
24
+ summary: r.summary || (r.content ? r.content.slice(0, 120) + '...' : ''),
25
+ domain: r.domain,
26
+ category: r.category,
27
+ topic: r.topic,
28
+ score: Math.round((r.relevanceScore || r.similarity || 0) * 1000) / 1000,
29
+ };
30
+ }
31
+ // ---------------------------------------------------------------------------
32
+ // Tool Registration
33
+ // ---------------------------------------------------------------------------
34
+ export function registerTools(server) {
35
+ // --- memory_store ---
36
+ server.tool('memory_store', 'Remember something. Only content required — domain, category, summary, topic, tags are all auto-derived. ' +
37
+ 'Use when you learn a fact, preference, or pattern worth keeping. Override any field if auto-detection is wrong.', {
38
+ content: z.string().describe('What you learned — be specific. Include WHAT, WHY, WHERE.'),
39
+ summary: z.string().max(120).optional().describe('Override auto-summary'),
40
+ category: categoryEnum.optional().describe('Override auto-category'),
41
+ topic: z.string().optional().describe('Override auto-topic'),
42
+ tags: z.array(controlledTagEnum).optional().describe('Override auto-tags'),
43
+ confidence: z.number().min(0).max(1).default(0.8),
44
+ }, async ({ content, summary, category, topic, tags, confidence }) => {
45
+ try {
46
+ const derived = deriveAll(content, { summary, category, topic, tags, sourceTool: 'mcp-store' });
47
+ const input = {
48
+ content,
49
+ summary: derived.summary,
50
+ category: derived.category,
51
+ tags: derived.tags,
52
+ sourceType: 'session',
53
+ sourceProject: 'default',
54
+ confidence,
55
+ domain: derived.domain,
56
+ topic: derived.topic,
57
+ memoryType: derived.memoryType,
58
+ sourceTool: 'mcp-store',
59
+ };
60
+ const memory = await storeMemory(input);
61
+ return {
62
+ content: [{ type: 'text', text: `Stored [${derived.domain}/${derived.category}] ${derived.summary}` }],
63
+ };
64
+ }
65
+ catch (err) {
66
+ return errorResult(err);
67
+ }
68
+ });
69
+ // --- memory_search ---
70
+ server.tool('memory_search', 'Search memories by meaning. Returns summaries (~30 tokens each). Use memory_read to expand a specific result.', {
71
+ query: z.string().describe('Natural language search query'),
72
+ limit: z.number().min(1).max(50).default(10),
73
+ category: categoryEnum.optional(),
74
+ memoryType: z.enum(['fact', 'preference', 'pattern']).optional(),
75
+ threshold: z.number().min(0).max(1).optional(),
76
+ }, async ({ query, limit, category, memoryType, threshold }) => {
77
+ try {
78
+ const options = {
79
+ limit,
80
+ category,
81
+ memoryType: memoryType,
82
+ similarityThreshold: threshold,
83
+ };
84
+ const results = await searchMemoriesV2(query, options);
85
+ const summaries = results.map(toSummaryResult);
86
+ return {
87
+ content: [{ type: 'text', text: JSON.stringify({
88
+ query, total: summaries.length, showing: summaries.length, results: summaries,
89
+ }, null, 2) }],
90
+ };
91
+ }
92
+ catch (err) {
93
+ return errorResult(err);
94
+ }
95
+ });
96
+ // --- memory_read ---
97
+ server.tool('memory_read', 'Expand a memory by ID. Shows full content, metadata, version history, and related memories.', { memoryId: z.string().describe('UUID of the memory') }, async ({ memoryId }) => {
98
+ try {
99
+ const memory = await getMemory(memoryId);
100
+ if (!memory)
101
+ return { content: [{ type: 'text', text: `Memory ${memoryId} not found` }] };
102
+ return { content: [{ type: 'text', text: JSON.stringify(memory, null, 2) }] };
103
+ }
104
+ catch (err) {
105
+ return errorResult(err);
106
+ }
107
+ });
108
+ // --- memory_enhance ---
109
+ server.tool('memory_enhance', 'Deepen understanding of a topic. Stores a new connected memory that extends existing knowledge. ' +
110
+ 'Use when you learn something that adds to what you already know.', {
111
+ content: z.string().describe('New observation or detail to add'),
112
+ context: z.string().optional().describe('Why this matters or when it applies'),
113
+ }, async ({ content, context }) => {
114
+ try {
115
+ const fullContent = context ? `${content}\n\nContext: ${context}` : content;
116
+ const derived = deriveAll(fullContent, { sourceTool: 'mcp-enhance' });
117
+ const input = {
118
+ content: fullContent,
119
+ summary: derived.summary,
120
+ category: derived.category,
121
+ tags: derived.tags,
122
+ sourceType: 'session',
123
+ sourceProject: 'default',
124
+ confidence: 0.85,
125
+ domain: derived.domain,
126
+ topic: derived.topic,
127
+ memoryType: derived.memoryType,
128
+ sourceTool: 'mcp-enhance',
129
+ };
130
+ const result = await triageAndStore(input);
131
+ return {
132
+ content: [{ type: 'text', text: `Enhanced [${derived.domain}/${derived.category}]: ${derived.summary} (zone: ${result.zone})` }],
133
+ };
134
+ }
135
+ catch (err) {
136
+ return errorResult(err);
137
+ }
138
+ });
139
+ // --- memory_browse ---
140
+ server.tool('memory_browse', 'Navigate memories by facet. No args = domain counts. +domain = categories. +category = summaries. Zero embedding cost.', {
141
+ domain: z.string().optional(),
142
+ category: categoryEnum.optional(),
143
+ }, async ({ domain, category }) => {
144
+ try {
145
+ // Direct query via client — browse doesn't need the full search pipeline
146
+ const client = getMemoryClient();
147
+ let query = client.from('traqr_memories')
148
+ .select('domain, category, content, summary, id')
149
+ .eq('is_archived', false)
150
+ .eq('is_forgotten', false);
151
+ if (domain)
152
+ query = query.eq('domain', domain);
153
+ if (category)
154
+ query = query.eq('category', category);
155
+ query = query.limit(20).order('created_at', { ascending: false });
156
+ const { data, error } = await query;
157
+ if (error)
158
+ throw new Error(error.message);
159
+ if (!domain && !category) {
160
+ // Return domain counts
161
+ const counts = {};
162
+ for (const row of data || []) {
163
+ const d = row.domain || 'unknown';
164
+ counts[d] = (counts[d] || 0) + 1;
165
+ }
166
+ return { content: [{ type: 'text', text: JSON.stringify({ domains: counts }, null, 2) }] };
167
+ }
168
+ const summaries = (data || []).map((r) => ({
169
+ id: r.id,
170
+ summary: r.summary || r.content?.slice(0, 100),
171
+ domain: r.domain,
172
+ category: r.category,
173
+ }));
174
+ return { content: [{ type: 'text', text: JSON.stringify(summaries, null, 2) }] };
175
+ }
176
+ catch (err) {
177
+ return errorResult(err);
178
+ }
179
+ });
180
+ // --- memory_context ---
181
+ server.tool('memory_context', 'Load task-relevant context — principles, preferences, gotchas for the current work.', {
182
+ taskDescription: z.string().optional(),
183
+ }, async ({ taskDescription }) => {
184
+ try {
185
+ const result = await assembleSessionContext({
186
+ slotName: 'standalone',
187
+ taskDescription,
188
+ });
189
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
190
+ }
191
+ catch (err) {
192
+ return errorResult(err);
193
+ }
194
+ });
195
+ // --- memory_pulse ---
196
+ server.tool('memory_pulse', 'Batch operation: capture multiple learnings + search + update in one call. Each capture only needs content.', {
197
+ search: z.string().optional(),
198
+ searchLimit: z.number().min(1).max(5).default(3),
199
+ captures: z.array(z.object({
200
+ content: z.string().describe('What you learned (min 20 chars)'),
201
+ category: categoryEnum.optional(),
202
+ tags: z.array(controlledTagEnum).optional(),
203
+ })).default([]),
204
+ }, async ({ search, searchLimit, captures }) => {
205
+ try {
206
+ // Run captures through triage
207
+ const captureResults = await Promise.all(captures
208
+ .filter((c) => c.content.trim().length >= 20)
209
+ .slice(0, 5)
210
+ .map((cap) => {
211
+ const derived = deriveAll(cap.content, {
212
+ category: cap.category, tags: cap.tags, sourceTool: 'mcp-pulse',
213
+ });
214
+ const input = {
215
+ content: cap.content.trim(),
216
+ summary: derived.summary,
217
+ category: derived.category,
218
+ tags: [...(derived.tags || []), 'pulse'],
219
+ sourceType: 'session',
220
+ sourceProject: 'default',
221
+ confidence: 0.8,
222
+ domain: derived.domain,
223
+ topic: derived.topic,
224
+ memoryType: derived.memoryType,
225
+ sourceTool: 'mcp-pulse',
226
+ };
227
+ return triageAndStore(input).catch(() => null);
228
+ }));
229
+ // Run search if requested
230
+ let searchResults = [];
231
+ if (search) {
232
+ const results = await searchMemoriesV2(search, { limit: searchLimit }).catch(() => []);
233
+ searchResults = results.map(toSummaryResult);
234
+ }
235
+ const successful = captureResults.filter(Boolean);
236
+ const zones = {
237
+ noop: successful.filter((r) => r?.zone === 'noop').length,
238
+ add: successful.filter((r) => r?.zone === 'add').length,
239
+ borderline: successful.filter((r) => r?.zone === 'borderline').length,
240
+ };
241
+ const summary = `Captured ${successful.filter((r) => !r?.deduplicated).length}, merged ${successful.filter((r) => r?.merged).length} | Zones: ${zones.noop} noop, ${zones.add} new, ${zones.borderline} borderline`;
242
+ const text = searchResults.length > 0
243
+ ? `${summary}\n\nSearch: ${searchResults.length} results\n${JSON.stringify(searchResults, null, 2)}`
244
+ : summary;
245
+ return { content: [{ type: 'text', text }] };
246
+ }
247
+ catch (err) {
248
+ return errorResult(err);
249
+ }
250
+ });
251
+ // --- memory_audit ---
252
+ server.tool('memory_audit', 'Memory system health, stats, and quality metrics.', {}, async () => {
253
+ try {
254
+ const [health, stats] = await Promise.all([
255
+ getSystemHealth(),
256
+ getDetailedStats(),
257
+ ]);
258
+ return { content: [{ type: 'text', text: JSON.stringify({ health, stats }, null, 2) }] };
259
+ }
260
+ catch (err) {
261
+ return errorResult(err);
262
+ }
263
+ });
264
+ // --- memory_archive ---
265
+ server.tool('memory_archive', 'Archive a memory. Use for stale or outdated content that was once correct.', {
266
+ memoryId: z.string(),
267
+ reason: z.string().describe('Why: stale, incorrect, duplicate, noise'),
268
+ }, async ({ memoryId, reason }) => {
269
+ try {
270
+ await archiveMemory(memoryId, reason);
271
+ return { content: [{ type: 'text', text: `Archived ${memoryId}: ${reason}` }] };
272
+ }
273
+ catch (err) {
274
+ return errorResult(err);
275
+ }
276
+ });
277
+ // --- memory_forget ---
278
+ server.tool('memory_forget', 'Forget a memory. Use for incorrect, irrelevant, or harmful content that should never surface again. ' +
279
+ 'Different from archive: archive = once correct but now stale, forget = should not exist.', {
280
+ memoryId: z.string().describe('UUID of the memory to forget'),
281
+ reason: z.string().optional().describe('Why this memory should be forgotten'),
282
+ }, async ({ memoryId, reason }) => {
283
+ try {
284
+ const client = getMemoryClient();
285
+ const { error } = await client.from('traqr_memories')
286
+ .update({
287
+ is_forgotten: true,
288
+ forgotten_at: new Date().toISOString(),
289
+ updated_at: new Date().toISOString(),
290
+ })
291
+ .eq('id', memoryId);
292
+ if (error)
293
+ throw new Error(error.message);
294
+ return { content: [{ type: 'text', text: `Forgotten ${memoryId}${reason ? `: ${reason}` : ''}` }] };
295
+ }
296
+ catch (err) {
297
+ return errorResult(err);
298
+ }
299
+ });
300
+ }
301
+ //# sourceMappingURL=tools.js.map
@@ -0,0 +1 @@
1
+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CAAC;YAAC,OAAO,WAAW,CAAC,GAAG,CAAC,CAAA;QAAC,CAAC;IAC3C,CAAC,CACF,CAAA;AACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "traqr-memory-mcp",
3
+ "version": "0.1.0",
4
+ "description": "Memory-as-a-service MCP server for AI agents. 10 tools, Postgres + pgvector, multi-strategy retrieval. Works with Claude Code, Cursor, Codex, and any MCP client.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "bin": {
8
+ "traqr-memory-mcp": "./dist/index.js"
9
+ },
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "setup.sql",
19
+ "README.md",
20
+ "MEMORY_INSTRUCTIONS.md"
21
+ ],
22
+ "scripts": {
23
+ "build": "tsc",
24
+ "start": "node dist/index.js"
25
+ },
26
+ "dependencies": {
27
+ "@traqr/memory": "^0.1.0",
28
+ "@modelcontextprotocol/sdk": "^1.12.1",
29
+ "zod": "^3.24.2"
30
+ },
31
+ "keywords": [
32
+ "mcp",
33
+ "memory",
34
+ "ai",
35
+ "agent",
36
+ "postgres",
37
+ "pgvector",
38
+ "embedding",
39
+ "rag",
40
+ "claude-code",
41
+ "cursor",
42
+ "codex"
43
+ ],
44
+ "license": "Apache-2.0",
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "https://github.com/jiggycapital/traqr-oss"
48
+ }
49
+ }