@joseairosa/recall 1.8.2 → 1.9.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,59 @@
1
+ # Adding MCP Tools
2
+
3
+ Pattern for adding new tools to the Recall MCP server.
4
+
5
+ ## Steps
6
+
7
+ 1. **Add Zod schema** to `src/types.ts`
8
+ 2. **Add method** to `MemoryStore` in `src/persistence/memory-store.ts`
9
+ 3. **Add tool handler** to `src/tools/index.ts` or a new file (e.g., `src/tools/my-tools.ts`)
10
+ 4. **Register in HTTP handler** at `src/http/mcp-handler.ts` (for SaaS transport)
11
+
12
+ ## Tool File Pattern
13
+
14
+ For a new tool group, use the module-level setter pattern:
15
+
16
+ ```typescript
17
+ // src/tools/my-tools.ts
18
+ import { MemoryStore } from '../persistence/memory-store.js';
19
+
20
+ let memoryStore: MemoryStore | null = null;
21
+
22
+ export function setMyMemoryStore(store: MemoryStore) {
23
+ memoryStore = store;
24
+ }
25
+
26
+ export const myTools = [
27
+ {
28
+ name: 'my_tool',
29
+ description: '...',
30
+ inputSchema: { type: 'object', properties: { ... } },
31
+ }
32
+ ];
33
+
34
+ export async function handleMyTool(args: unknown) {
35
+ if (!memoryStore) throw new McpError(ErrorCode.InternalError, 'Store not initialized');
36
+ // ...
37
+ }
38
+ ```
39
+
40
+ Then register in `src/tools/index.ts`:
41
+ ```typescript
42
+ import { myTools, setMyMemoryStore } from './my-tools.js';
43
+ // Add to tools array and setMemoryStore function
44
+ ```
45
+
46
+ ## Error Handling
47
+
48
+ Always use MCP error codes:
49
+ ```typescript
50
+ import { McpError, ErrorCode } from '@modelcontextprotocol/sdk/types.js';
51
+ throw new McpError(ErrorCode.InvalidRequest, 'message');
52
+ throw new McpError(ErrorCode.InternalError, 'message');
53
+ ```
54
+
55
+ ## Testing
56
+
57
+ - Place tests as `src/tools/my-tools.test.ts`
58
+ - Use `MockMemoryStore` from `src/__mocks__/memory-store.mock.ts`
59
+ - For service logic: create `src/services/my.service.ts` + `my.service.test.ts`
@@ -0,0 +1,64 @@
1
+ # Project: Recall MCP Server
2
+
3
+ **Last Updated:** 2026-02-17
4
+
5
+ ## Overview
6
+
7
+ Redis/Valkey-powered MCP (Model Context Protocol) server providing long-term memory for Claude conversations. Stores context with semantic search via embeddings. Deployed as both stdio (self-hosted) and HTTP (SaaS at recallmcp.com).
8
+
9
+ ## Technology Stack
10
+
11
+ - **Language:** TypeScript (strict, ESM)
12
+ - **Runtime:** Node.js ≥18
13
+ - **Build Tool:** tsup (ESM output)
14
+ - **Testing:** Vitest
15
+ - **Package Manager:** npm
16
+ - **Storage:** Redis (ioredis) or Valkey (@valkey/valkey-glide)
17
+ - **MCP SDK:** @modelcontextprotocol/sdk
18
+ - **HTTP Framework:** Express 5
19
+ - **Auth:** Firebase Admin (SaaS), API keys
20
+ - **Billing:** Stripe
21
+ - **IDs:** ULID (never auto-increment)
22
+
23
+ ## Directory Structure
24
+
25
+ ```
26
+ src/
27
+ ├── index.ts # MCP stdio entry point
28
+ ├── server-http.ts # HTTP/SaaS entry point
29
+ ├── types.ts # Zod schemas, all shared types
30
+ ├── persistence/ # Storage layer (Redis/Valkey adapters)
31
+ ├── embeddings/ # Multi-provider embedding system
32
+ ├── services/ # Business logic (rlm.service.ts)
33
+ ├── tools/ # MCP tool handlers
34
+ ├── resources/ # MCP resource handlers
35
+ ├── prompts/ # MCP prompt handlers
36
+ ├── analysis/ # Claude-powered conversation analysis
37
+ └── http/ # HTTP/SaaS infrastructure
38
+ ```
39
+
40
+ ## Development Commands
41
+
42
+ - **Build:** `npm run build`
43
+ - **Dev (watch):** `npm run dev`
44
+ - **Start (stdio):** `npm run start`
45
+ - **Start (HTTP):** `npm run start:http`
46
+ - **Test:** `npm test`
47
+ - **Test (watch):** `npm run test:watch`
48
+ - **Coverage:** `npm run test:coverage`
49
+
50
+ ## Architecture Notes
51
+
52
+ - **Two transports:** stdio (single-tenant, self-hosted) vs HTTP (multi-tenant SaaS)
53
+ - **Storage abstraction:** `StorageClient` interface with Redis and Valkey adapters
54
+ - **Embedding auto-detection:** Factory picks provider from available API keys (Voyage > Cohere > OpenAI > Anthropic fallback)
55
+ - **Workspace isolation:** Memories scoped by workspace path; global memories cross workspaces
56
+ - **Redis key patterns are immutable** — changing them requires migration
57
+
58
+ ## Critical Constraints
59
+
60
+ - **Never remove context types** from `ContextType` enum in `types.ts` (breaks existing memories)
61
+ - **Redis key patterns** are immutable; document migration path if changing
62
+ - **Backward compatibility** on all public MCP tool interfaces
63
+ - **Always use ULID** for new IDs (`ulid()` from the `ulid` package)
64
+ - **ESM imports** must use `.js` extensions (even for `.ts` source files)
@@ -37,7 +37,9 @@
37
37
  "Bash(gh run list:*)",
38
38
  "Bash(xargs -I {} git push origin --delete {})",
39
39
  "Read(//Users/joseairosa/Development/mcp/mem/**)",
40
- "Bash(find:*)"
40
+ "Bash(find:*)",
41
+ "mcp__recall-remote__store_memory",
42
+ "mcp__recall-remote__set_workspace"
41
43
  ],
42
44
  "deny": [],
43
45
  "ask": [],
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ 22