@seanhogg/builderforce-memory-mcp 2026.6.18

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.
Files changed (53) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +133 -0
  3. package/dist/backend.d.ts +60 -0
  4. package/dist/backend.d.ts.map +1 -0
  5. package/dist/backend.js +11 -0
  6. package/dist/backend.js.map +1 -0
  7. package/dist/backends/memory-store.d.ts +73 -0
  8. package/dist/backends/memory-store.d.ts.map +1 -0
  9. package/dist/backends/memory-store.js +152 -0
  10. package/dist/backends/memory-store.js.map +1 -0
  11. package/dist/bin/http.d.ts +14 -0
  12. package/dist/bin/http.d.ts.map +1 -0
  13. package/dist/bin/http.js +33 -0
  14. package/dist/bin/http.js.map +1 -0
  15. package/dist/bin/stdio.d.ts +18 -0
  16. package/dist/bin/stdio.d.ts.map +1 -0
  17. package/dist/bin/stdio.js +24 -0
  18. package/dist/bin/stdio.js.map +1 -0
  19. package/dist/index.d.ts +21 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +18 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/tools.d.ts +47 -0
  24. package/dist/tools.d.ts.map +1 -0
  25. package/dist/tools.js +186 -0
  26. package/dist/tools.js.map +1 -0
  27. package/dist/transports/http.d.ts +30 -0
  28. package/dist/transports/http.d.ts.map +1 -0
  29. package/dist/transports/http.js +45 -0
  30. package/dist/transports/http.js.map +1 -0
  31. package/dist/transports/mcp-server.d.ts +17 -0
  32. package/dist/transports/mcp-server.d.ts.map +1 -0
  33. package/dist/transports/mcp-server.js +26 -0
  34. package/dist/transports/mcp-server.js.map +1 -0
  35. package/dist/transports/sdk.d.ts +45 -0
  36. package/dist/transports/sdk.d.ts.map +1 -0
  37. package/dist/transports/sdk.js +44 -0
  38. package/dist/transports/sdk.js.map +1 -0
  39. package/dist/transports/stdio.d.ts +14 -0
  40. package/dist/transports/stdio.d.ts.map +1 -0
  41. package/dist/transports/stdio.js +17 -0
  42. package/dist/transports/stdio.js.map +1 -0
  43. package/package.json +86 -0
  44. package/src/backend.ts +66 -0
  45. package/src/backends/memory-store.ts +217 -0
  46. package/src/bin/http.ts +36 -0
  47. package/src/bin/stdio.ts +26 -0
  48. package/src/index.ts +31 -0
  49. package/src/tools.ts +214 -0
  50. package/src/transports/http.ts +64 -0
  51. package/src/transports/mcp-server.ts +40 -0
  52. package/src/transports/sdk.ts +75 -0
  53. package/src/transports/stdio.ts +19 -0
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Framework-agnostic MCP tool definitions over a MemoryBackend.
3
+ *
4
+ * Defined once here, then registered into whichever server framework a
5
+ * transport uses — the Claude Agent SDK's `tool()` (in-process) or the MCP
6
+ * SDK's `registerTool()` (stdio/HTTP). Both accept the same (name, description,
7
+ * zod raw shape, handler→CallToolResult) shape, so the handlers below are the
8
+ * single source of truth.
9
+ *
10
+ * Token-saving is enforced HERE, server-side, regardless of what the model
11
+ * asks for: recall is top-K (capped), each entry's content is truncated, and
12
+ * there is deliberately no "return everything" tool. Moving memory out of the
13
+ * prompt only saves tokens if recall is selective — a tool that dumps the whole
14
+ * store back into context is more expensive than inlining it.
15
+ */
16
+ import { z } from "zod";
17
+ import type { MemoryBackend } from "./backend.js";
18
+ /** The MCP CallToolResult shape both server frameworks expect. */
19
+ export interface ToolResult {
20
+ content: Array<{
21
+ type: "text";
22
+ text: string;
23
+ }>;
24
+ isError?: boolean;
25
+ }
26
+ /** A framework-neutral tool: maps 1:1 onto Agent-SDK `tool()` and MCP `registerTool()`. */
27
+ export interface MemoryTool {
28
+ name: string;
29
+ description: string;
30
+ /** Zod *raw shape* (e.g. `{ query: z.string() }`), not a ZodObject. */
31
+ inputSchema: z.ZodRawShape;
32
+ handler: (args: Record<string, unknown>) => Promise<ToolResult>;
33
+ }
34
+ export interface MemoryToolsOptions {
35
+ /** Hard cap on entries any recall tool returns to the model. Default 5. */
36
+ maxResults?: number;
37
+ /** Max characters of each entry's content surfaced to the model. Default 500. */
38
+ maxContentChars?: number;
39
+ /** Expose write tools (remember/forget). Default true; forced false if the backend is read-only. */
40
+ writable?: boolean;
41
+ }
42
+ /**
43
+ * Builds the memory tool set bound to `backend`. Write tools are included only
44
+ * when `writable` is not false AND the backend actually implements them.
45
+ */
46
+ export declare function buildMemoryTools(backend: MemoryBackend, opts?: MemoryToolsOptions): MemoryTool[];
47
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,aAAa,EAAa,MAAM,cAAc,CAAC;AAE7D,kEAAkE;AAClE,MAAM,WAAW,UAAU;IACvB,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,2FAA2F;AAC3F,MAAM,WAAW,UAAU;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,uEAAuE;IACvE,WAAW,EAAE,CAAC,CAAC,WAAW,CAAC;IAC3B,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;CACnE;AAED,MAAM,WAAW,kBAAkB;IAC/B,2EAA2E;IAC3E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iFAAiF;IACjF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oGAAoG;IACpG,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AA4BD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,aAAa,EAAE,IAAI,GAAE,kBAAuB,GAAG,UAAU,EAAE,CA4IpG"}
package/dist/tools.js ADDED
@@ -0,0 +1,186 @@
1
+ /**
2
+ * Framework-agnostic MCP tool definitions over a MemoryBackend.
3
+ *
4
+ * Defined once here, then registered into whichever server framework a
5
+ * transport uses — the Claude Agent SDK's `tool()` (in-process) or the MCP
6
+ * SDK's `registerTool()` (stdio/HTTP). Both accept the same (name, description,
7
+ * zod raw shape, handler→CallToolResult) shape, so the handlers below are the
8
+ * single source of truth.
9
+ *
10
+ * Token-saving is enforced HERE, server-side, regardless of what the model
11
+ * asks for: recall is top-K (capped), each entry's content is truncated, and
12
+ * there is deliberately no "return everything" tool. Moving memory out of the
13
+ * prompt only saves tokens if recall is selective — a tool that dumps the whole
14
+ * store back into context is more expensive than inlining it.
15
+ */
16
+ import { z } from "zod";
17
+ const DEFAULT_MAX_RESULTS = 5;
18
+ const DEFAULT_MAX_CONTENT = 500;
19
+ function clip(s, n) {
20
+ return s.length <= n ? s : `${s.slice(0, n)}…`;
21
+ }
22
+ function ok(text) {
23
+ return { content: [{ type: "text", text }] };
24
+ }
25
+ function fail(text) {
26
+ return { content: [{ type: "text", text }], isError: true };
27
+ }
28
+ function renderHits(hits, maxChars) {
29
+ if (hits.length === 0)
30
+ return "No matching memories.";
31
+ return hits
32
+ .map((h) => {
33
+ const tags = h.tags?.length ? ` tags=[${h.tags.join(", ")}]` : "";
34
+ const score = h.score != null ? ` score=${h.score.toFixed(3)}` : "";
35
+ return `• ${h.key}${score}${tags}\n ${clip(h.content, maxChars)}`;
36
+ })
37
+ .join("\n");
38
+ }
39
+ /**
40
+ * Builds the memory tool set bound to `backend`. Write tools are included only
41
+ * when `writable` is not false AND the backend actually implements them.
42
+ */
43
+ export function buildMemoryTools(backend, opts = {}) {
44
+ const maxResults = Math.max(1, opts.maxResults ?? DEFAULT_MAX_RESULTS);
45
+ const maxContent = Math.max(80, opts.maxContentChars ?? DEFAULT_MAX_CONTENT);
46
+ const writable = opts.writable !== false;
47
+ const tools = [
48
+ {
49
+ name: "memory_recall",
50
+ description: "Semantically recall the most relevant stored memories for a query. " +
51
+ "Call this BEFORE answering whenever the task may depend on prior context, user " +
52
+ "preferences, project decisions, or facts learned in earlier sessions — instead of " +
53
+ "assuming that context is already in your prompt. Returns a small ranked set, not the " +
54
+ "whole store.",
55
+ inputSchema: {
56
+ query: z.string().describe("What to look for — a question, topic, or keywords."),
57
+ topK: z
58
+ .number()
59
+ .int()
60
+ .min(1)
61
+ .max(maxResults)
62
+ .optional()
63
+ .describe(`How many memories to return (max ${maxResults}).`),
64
+ },
65
+ handler: async (args) => {
66
+ try {
67
+ const query = String(args["query"] ?? "");
68
+ if (!query.trim())
69
+ return fail("query is required.");
70
+ const k = Math.min(maxResults, Number(args["topK"] ?? maxResults));
71
+ const hits = await backend.recall(query, k);
72
+ return ok(renderHits(hits.slice(0, maxResults), maxContent));
73
+ }
74
+ catch (err) {
75
+ return fail(`recall failed: ${String(err)}`);
76
+ }
77
+ },
78
+ },
79
+ {
80
+ name: "memory_get",
81
+ description: "Fetch a single memory by its exact key. Use when you already know the key " +
82
+ "(e.g. one surfaced by memory_recall) and want its full, untruncated value.",
83
+ inputSchema: {
84
+ key: z.string().describe("The exact memory key."),
85
+ },
86
+ handler: async (args) => {
87
+ try {
88
+ const key = String(args["key"] ?? "");
89
+ if (!key)
90
+ return fail("key is required.");
91
+ const hit = await backend.get(key);
92
+ return hit ? ok(`• ${hit.key}\n ${hit.content}`) : ok(`No memory found for key "${key}".`);
93
+ }
94
+ catch (err) {
95
+ return fail(`get failed: ${String(err)}`);
96
+ }
97
+ },
98
+ },
99
+ {
100
+ name: "memory_recall_by_tag",
101
+ description: "List memories carrying a given tag (e.g. 'user', 'project', 'decision'). " +
102
+ "Use to pull a known category of context rather than searching semantically.",
103
+ inputSchema: {
104
+ tag: z.string().describe("The tag to filter by."),
105
+ limit: z
106
+ .number()
107
+ .int()
108
+ .min(1)
109
+ .max(maxResults)
110
+ .optional()
111
+ .describe(`Max entries to return (max ${maxResults}).`),
112
+ },
113
+ handler: async (args) => {
114
+ try {
115
+ const tag = String(args["tag"] ?? "");
116
+ if (!tag)
117
+ return fail("tag is required.");
118
+ const limit = Math.min(maxResults, Number(args["limit"] ?? maxResults));
119
+ const hits = await backend.recallByTag(tag, limit);
120
+ return ok(renderHits(hits, maxContent));
121
+ }
122
+ catch (err) {
123
+ return fail(`recall_by_tag failed: ${String(err)}`);
124
+ }
125
+ },
126
+ },
127
+ ];
128
+ if (writable && backend.remember) {
129
+ tools.push({
130
+ name: "memory_remember",
131
+ description: "Persist a fact for future sessions. Call when you learn something durable and reusable: " +
132
+ "a user preference, a project constraint, a decision and its rationale. Keep keys stable " +
133
+ "and descriptive (e.g. 'user.preferred-language') so the same fact overwrites rather than " +
134
+ "duplicating.",
135
+ inputSchema: {
136
+ key: z.string().describe("Stable, descriptive identifier; reusing a key overwrites it."),
137
+ content: z.string().describe("The fact to store."),
138
+ tags: z.array(z.string()).optional().describe("Optional grouping tags."),
139
+ importance: z.number().min(0).max(1).optional().describe("Importance 0–1 (default 0.5)."),
140
+ ttlMs: z.number().int().positive().optional().describe("Optional time-to-live in ms."),
141
+ },
142
+ handler: async (args) => {
143
+ try {
144
+ const key = String(args["key"] ?? "");
145
+ const content = String(args["content"] ?? "");
146
+ if (!key || !content)
147
+ return fail("key and content are required.");
148
+ await backend.remember({
149
+ key,
150
+ content,
151
+ tags: args["tags"],
152
+ importance: args["importance"],
153
+ ttlMs: args["ttlMs"],
154
+ });
155
+ return ok(`Remembered "${key}".`);
156
+ }
157
+ catch (err) {
158
+ return fail(`remember failed: ${String(err)}`);
159
+ }
160
+ },
161
+ });
162
+ }
163
+ if (writable && backend.forget) {
164
+ tools.push({
165
+ name: "memory_forget",
166
+ description: "Delete a memory by key. Use to remove a fact that is now wrong or obsolete.",
167
+ inputSchema: {
168
+ key: z.string().describe("The exact memory key to delete."),
169
+ },
170
+ handler: async (args) => {
171
+ try {
172
+ const key = String(args["key"] ?? "");
173
+ if (!key)
174
+ return fail("key is required.");
175
+ await backend.forget(key);
176
+ return ok(`Forgot "${key}".`);
177
+ }
178
+ catch (err) {
179
+ return fail(`forget failed: ${String(err)}`);
180
+ }
181
+ },
182
+ });
183
+ }
184
+ return tools;
185
+ }
186
+ //# sourceMappingURL=tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA2BxB,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAC9B,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEhC,SAAS,IAAI,CAAC,CAAS,EAAE,CAAS;IAC9B,OAAO,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC;AACnD,CAAC;AAED,SAAS,EAAE,CAAC,IAAY;IACpB,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;AACjD,CAAC;AAED,SAAS,IAAI,CAAC,IAAY;IACtB,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAChE,CAAC;AAED,SAAS,UAAU,CAAC,IAAiB,EAAE,QAAgB;IACnD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,uBAAuB,CAAC;IACtD,OAAO,IAAI;SACN,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACP,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EA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B;wBACpD,KAAK,EAAE,IAAI,CAAC,OAAO,CAAuB;qBAC7C,CAAC,CAAC;oBACH,OAAO,EAAE,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;gBACtC,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACX,OAAO,IAAI,CAAC,oBAAoB,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBACnD,CAAC;YACL,CAAC;SACJ,CAAC,CAAC;IACP,CAAC;IAED,IAAI,QAAQ,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QAC7B,KAAK,CAAC,IAAI,CAAC;YACP,IAAI,EAAE,eAAe;YACrB,WAAW,EAAE,6EAA6E;YAC1F,WAAW,EAAE;gBACT,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;aAC9D;YACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;gBACpB,IAAI,CAAC;oBACD,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;oBACtC,IAAI,CAAC,GAAG;wBAAE,OAAO,IAAI,CAAC,kBAAkB,CAAC,CAAC;oBAC1C,MAAM,OAAO,CAAC,MAAO,CAAC,GAAG,CAAC,CAAC;oBAC3B,OAAO,EAAE,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;gBAClC,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACX,OAAO,IAAI,CAAC,kBAAkB,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBACjD,CAAC;YACL,CAAC;SACJ,CAAC,CAAC;IACP,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * HTTP transport — the multi-tenant / networked path (builderforce.ai hosting,
3
+ * remote claws). Stateless Streamable HTTP: one short-lived McpServer +
4
+ * transport per request, so it scales horizontally with no sticky sessions.
5
+ * Bearer-token auth gates every request.
6
+ *
7
+ * Consumed from the Claude Agent SDK as:
8
+ * mcpServers: {
9
+ * builderforce_memory: { type: "http", url: "https://mcp.builderforce.ai/memory",
10
+ * headers: { Authorization: `Bearer ${KEY}` } }
11
+ * }
12
+ */
13
+ import type { IncomingMessage, ServerResponse } from "node:http";
14
+ import type { MemoryBackend } from "../backend.js";
15
+ import { type McpServerOptions } from "./mcp-server.js";
16
+ export interface HttpHandlerOptions extends McpServerOptions {
17
+ /**
18
+ * Shared secret required in `Authorization: Bearer <token>`. When set, every
19
+ * request without a matching token is rejected 401. Omit only behind a trusted
20
+ * gateway that has already authenticated the caller.
21
+ */
22
+ authToken?: string;
23
+ }
24
+ /**
25
+ * Returns a `(req, res) => Promise<void>` handler you mount on any Node HTTP
26
+ * server (or Express). Per request it spins up a stateless MCP server bound to
27
+ * `backend`, handles the MCP exchange, and tears down on response close.
28
+ */
29
+ export declare function createMemoryHttpHandler(backend: MemoryBackend, opts?: HttpHandlerOptions): (req: IncomingMessage, res: ServerResponse) => Promise<void>;
30
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/transports/http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAkB,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExE,MAAM,WAAW,kBAAmB,SAAQ,gBAAgB;IACxD;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAOD;;;;GAIG;AACH,wBAAgB,uBAAuB,CACnC,OAAO,EAAE,aAAa,EACtB,IAAI,GAAE,kBAAuB,GAC9B,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,CAuB9D"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * HTTP transport — the multi-tenant / networked path (builderforce.ai hosting,
3
+ * remote claws). Stateless Streamable HTTP: one short-lived McpServer +
4
+ * transport per request, so it scales horizontally with no sticky sessions.
5
+ * Bearer-token auth gates every request.
6
+ *
7
+ * Consumed from the Claude Agent SDK as:
8
+ * mcpServers: {
9
+ * builderforce_memory: { type: "http", url: "https://mcp.builderforce.ai/memory",
10
+ * headers: { Authorization: `Bearer ${KEY}` } }
11
+ * }
12
+ */
13
+ import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
14
+ import { buildMcpServer } from "./mcp-server.js";
15
+ function unauthorized(res) {
16
+ res.writeHead(401, { "content-type": "application/json" });
17
+ res.end(JSON.stringify({ error: "unauthorized" }));
18
+ }
19
+ /**
20
+ * Returns a `(req, res) => Promise<void>` handler you mount on any Node HTTP
21
+ * server (or Express). Per request it spins up a stateless MCP server bound to
22
+ * `backend`, handles the MCP exchange, and tears down on response close.
23
+ */
24
+ export function createMemoryHttpHandler(backend, opts = {}) {
25
+ return async (req, res) => {
26
+ if (opts.authToken) {
27
+ const header = req.headers["authorization"];
28
+ if (header !== `Bearer ${opts.authToken}`) {
29
+ unauthorized(res);
30
+ return;
31
+ }
32
+ }
33
+ const server = buildMcpServer(backend, opts);
34
+ // Stateless: no session id generator → a fresh transport per request.
35
+ const transport = new StreamableHTTPServerTransport({ sessionIdGenerator: undefined });
36
+ res.on("close", () => {
37
+ void transport.close();
38
+ void server.close();
39
+ });
40
+ await server.connect(transport);
41
+ // Pass undefined body — the transport reads/parses the request stream itself.
42
+ await transport.handleRequest(req, res);
43
+ };
44
+ }
45
+ //# sourceMappingURL=http.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/transports/http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD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+ HTTP).
3
+ *
4
+ * Both use the standard @modelcontextprotocol/sdk `McpServer`; only the
5
+ * transport binding differs. The tools come from the same buildMemoryTools()
6
+ * the in-process Agent SDK transport uses, so all three stay in lockstep.
7
+ */
8
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
9
+ import type { MemoryBackend } from "../backend.js";
10
+ import { type MemoryToolsOptions } from "../tools.js";
11
+ export interface McpServerOptions extends MemoryToolsOptions {
12
+ name?: string;
13
+ version?: string;
14
+ }
15
+ /** Constructs an McpServer with the memory tools registered. */
16
+ export declare function buildMcpServer(backend: MemoryBackend, opts?: McpServerOptions): McpServer;
17
+ //# sourceMappingURL=mcp-server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../../src/transports/mcp-server.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAoB,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAExE,MAAM,WAAW,gBAAiB,SAAQ,kBAAkB;IACxD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,gEAAgE;AAChE,wBAAgB,cAAc,CAAC,OAAO,EAAE,aAAa,EAAE,IAAI,GAAE,gBAAqB,GAAG,SAAS,CAqB7F"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Shared MCP server builder for the out-of-process transports (stdio + HTTP).
3
+ *
4
+ * Both use the standard @modelcontextprotocol/sdk `McpServer`; only the
5
+ * transport binding differs. The tools come from the same buildMemoryTools()
6
+ * the in-process Agent SDK transport uses, so all three stay in lockstep.
7
+ */
8
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
9
+ import { buildMemoryTools } from "../tools.js";
10
+ /** Constructs an McpServer with the memory tools registered. */
11
+ export function buildMcpServer(backend, opts = {}) {
12
+ const server = new McpServer({
13
+ name: opts.name ?? "builderforce-memory",
14
+ version: opts.version ?? "2026.5.31",
15
+ });
16
+ // The generic registerTool() over a zod raw shape trips TS2589 (excessively
17
+ // deep instantiation); the tool surface is identical across our transports,
18
+ // so register through a loose signature. Runtime behaviour is unchanged —
19
+ // both frameworks consume (name, {description, inputSchema}, handler).
20
+ const register = server.registerTool.bind(server);
21
+ for (const t of buildMemoryTools(backend, opts)) {
22
+ register(t.name, { description: t.description, inputSchema: t.inputSchema }, t.handler);
23
+ }
24
+ return server;
25
+ }
26
+ //# sourceMappingURL=mcp-server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-server.js","sourceRoot":"","sources":["../../src/transports/mcp-server.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,gBAAgB,EAA2B,MAAM,aAAa,CAAC;AAOxE,gEAAgE;AAChE,MAAM,UAAU,cAAc,CAAC,OAAsB,EAAE,OAAyB,EAAE;IAC9E,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QACzB,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,qBAAqB;QACxC,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,WAAW;KACvC,CAAC,CAAC;IAEH,4EAA4E;IAC5E,4EAA4E;IAC5E,0EAA0E;IAC1E,uEAAuE;IACvE,MAAM,QAAQ,GAAG,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAIvC,CAAC;IAEV,KAAK,MAAM,CAAC,IAAI,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC;QAC9C,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC,WAAW,EAAE,WAAW,EAAE,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;IAC5F,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * In-process transport for the Claude Agent SDK.
3
+ *
4
+ * Returns the `type: "sdk"` MCP server config you drop straight into
5
+ * `query({ options: { mcpServers: { builderforce_memory: <this> } } })`.
6
+ * No subprocess, no socket — the tools run in your product's process, calling
7
+ * the MemoryBackend directly. Lowest latency; the consuming product pulls in
8
+ * @anthropic-ai/claude-agent-sdk (and, for the local backend, @seanhogg/builderforce-memory).
9
+ *
10
+ * The Agent SDK is imported indirectly so this package builds and so the stdio
11
+ * and HTTP transports don't drag the SDK in.
12
+ */
13
+ import type { MemoryBackend } from "../backend.js";
14
+ import { type MemoryToolsOptions } from "../tools.js";
15
+ export interface SdkServerOptions extends MemoryToolsOptions {
16
+ /** MCP server name; becomes the middle segment of `mcp__<name>__<tool>`. Default 'builderforce_memory'. */
17
+ name?: string;
18
+ version?: string;
19
+ }
20
+ /** The shape of `createSdkMcpServer`'s return — re-declared to avoid a hard type dep on the SDK. */
21
+ export interface SdkMcpServerConfig {
22
+ type: "sdk";
23
+ name: string;
24
+ instance: unknown;
25
+ }
26
+ /**
27
+ * Wraps the memory tools as an in-process Claude Agent SDK MCP server.
28
+ *
29
+ * @example
30
+ * import { query } from "@anthropic-ai/claude-agent-sdk";
31
+ * import { createMemoryMcpServer, createLocalMemoryStoreBackend } from "@seanhogg/builderforce-memory-mcp";
32
+ *
33
+ * const backend = await createLocalMemoryStoreBackend();
34
+ * const memory = await createMemoryMcpServer(backend);
35
+ *
36
+ * for await (const msg of query({
37
+ * prompt: "...",
38
+ * options: {
39
+ * mcpServers: { builderforce_memory: memory },
40
+ * allowedTools: ["mcp__builderforce_memory__*"],
41
+ * },
42
+ * })) { /* ... *\/ }
43
+ */
44
+ export declare function createMemoryMcpServer(backend: MemoryBackend, opts?: SdkServerOptions): Promise<SdkMcpServerConfig>;
45
+ //# sourceMappingURL=sdk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/transports/sdk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAoB,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAExE,MAAM,WAAW,gBAAiB,SAAQ,kBAAkB;IACxD,2GAA2G;IAC3G,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,oGAAoG;AACpG,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,KAAK,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,qBAAqB,CACvC,OAAO,EAAE,aAAa,EACtB,IAAI,GAAE,gBAAqB,GAC5B,OAAO,CAAC,kBAAkB,CAAC,CAwB7B"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * In-process transport for the Claude Agent SDK.
3
+ *
4
+ * Returns the `type: "sdk"` MCP server config you drop straight into
5
+ * `query({ options: { mcpServers: { builderforce_memory: <this> } } })`.
6
+ * No subprocess, no socket — the tools run in your product's process, calling
7
+ * the MemoryBackend directly. Lowest latency; the consuming product pulls in
8
+ * @anthropic-ai/claude-agent-sdk (and, for the local backend, @seanhogg/builderforce-memory).
9
+ *
10
+ * The Agent SDK is imported indirectly so this package builds and so the stdio
11
+ * and HTTP transports don't drag the SDK in.
12
+ */
13
+ import { buildMemoryTools } from "../tools.js";
14
+ /**
15
+ * Wraps the memory tools as an in-process Claude Agent SDK MCP server.
16
+ *
17
+ * @example
18
+ * import { query } from "@anthropic-ai/claude-agent-sdk";
19
+ * import { createMemoryMcpServer, createLocalMemoryStoreBackend } from "@seanhogg/builderforce-memory-mcp";
20
+ *
21
+ * const backend = await createLocalMemoryStoreBackend();
22
+ * const memory = await createMemoryMcpServer(backend);
23
+ *
24
+ * for await (const msg of query({
25
+ * prompt: "...",
26
+ * options: {
27
+ * mcpServers: { builderforce_memory: memory },
28
+ * allowedTools: ["mcp__builderforce_memory__*"],
29
+ * },
30
+ * })) { /* ... *\/ }
31
+ */
32
+ export async function createMemoryMcpServer(backend, opts = {}) {
33
+ const _import = (m) =>
34
+ // eslint-disable-next-line @typescript-eslint/no-implied-eval, no-new-func
35
+ new Function("m", "return import(m)")(m);
36
+ const sdk = (await _import("@anthropic-ai/claude-agent-sdk"));
37
+ const tools = buildMemoryTools(backend, opts).map((t) => sdk.tool(t.name, t.description, t.inputSchema, t.handler));
38
+ return sdk.createSdkMcpServer({
39
+ name: opts.name ?? "builderforce_memory",
40
+ version: opts.version ?? "2026.5.31",
41
+ tools,
42
+ });
43
+ }
44
+ //# sourceMappingURL=sdk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/transports/sdk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,gBAAgB,EAA2B,MAAM,aAAa,CAAC;AAexE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACvC,OAAsB,EACtB,OAAyB,EAAE;IAE3B,MAAM,OAAO,GAAG,CAAC,CAAS,EAAoB,EAAE;IAC5C,2EAA2E;IAC3E,IAAI,QAAQ,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAqB,CAAC;IAEjE,MAAM,GAAG,GAAG,CAAC,MAAM,OAAO,CAAC,gCAAgC,CAAC,CAQ3D,CAAC;IAEF,MAAM,KAAK,GAAG,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACpD,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,OAA2D,CAAC,CAChH,CAAC;IAEF,OAAO,GAAG,CAAC,kBAAkB,CAAC;QAC1B,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,qBAAqB;QACxC,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,WAAW;QACpC,KAAK;KACR,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * stdio transport — the portable path. Any MCP client in any language launches
3
+ * this as a subprocess and speaks MCP over stdin/stdout. Consumed from the
4
+ * Claude Agent SDK as:
5
+ * mcpServers: {
6
+ * builderforce_memory: { type: "stdio", command: "npx",
7
+ * args: ["-y", "@seanhogg/builderforce-memory-mcp"] }
8
+ * }
9
+ */
10
+ import type { MemoryBackend } from "../backend.js";
11
+ import { type McpServerOptions } from "./mcp-server.js";
12
+ /** Serves `backend` over stdio. Resolves when the transport closes. */
13
+ export declare function runStdio(backend: MemoryBackend, opts?: McpServerOptions): Promise<void>;
14
+ //# sourceMappingURL=stdio.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../../src/transports/stdio.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAkB,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExE,uEAAuE;AACvE,wBAAsB,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE,IAAI,GAAE,gBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAGjG"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * stdio transport — the portable path. Any MCP client in any language launches
3
+ * this as a subprocess and speaks MCP over stdin/stdout. Consumed from the
4
+ * Claude Agent SDK as:
5
+ * mcpServers: {
6
+ * builderforce_memory: { type: "stdio", command: "npx",
7
+ * args: ["-y", "@seanhogg/builderforce-memory-mcp"] }
8
+ * }
9
+ */
10
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
11
+ import { buildMcpServer } from "./mcp-server.js";
12
+ /** Serves `backend` over stdio. Resolves when the transport closes. */
13
+ export async function runStdio(backend, opts = {}) {
14
+ const server = buildMcpServer(backend, opts);
15
+ await server.connect(new StdioServerTransport());
16
+ }
17
+ //# sourceMappingURL=stdio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stdio.js","sourceRoot":"","sources":["../../src/transports/stdio.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAAE,cAAc,EAAyB,MAAM,iBAAiB,CAAC;AAExE,uEAAuE;AACvE,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,OAAsB,EAAE,OAAyB,EAAE;IAC9E,MAAM,MAAM,GAAG,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,oBAAoB,EAAE,CAAC,CAAC;AACrD,CAAC"}
package/package.json ADDED
@@ -0,0 +1,86 @@
1
+ {
2
+ "name": "@seanhogg/builderforce-memory-mcp",
3
+ "version": "2026.6.18",
4
+ "description": "BuilderForce Agent Memory — MCP transport. Exposes @seanhogg/builderforce-memory to any MCP client (Claude Agent SDK in-process, stdio, or HTTP) over a pluggable MemoryBackend, with token-saving fetch-on-demand recall.",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "module": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "bin": {
16
+ "builderforce-memory-mcp": "dist/bin/stdio.js",
17
+ "builderforce-memory-mcp-http": "dist/bin/http.js"
18
+ },
19
+ "files": [
20
+ "dist",
21
+ "src",
22
+ "README.md",
23
+ "LICENSE"
24
+ ],
25
+ "keywords": [
26
+ "mcp",
27
+ "model-context-protocol",
28
+ "claude-agent-sdk",
29
+ "agent-memory",
30
+ "ssm",
31
+ "builderforce",
32
+ "typescript"
33
+ ],
34
+ "author": {
35
+ "name": "Sean Hogg",
36
+ "email": "seanhogg@gmail.com",
37
+ "url": "https://builderforce.ai"
38
+ },
39
+ "license": "MIT",
40
+ "repository": {
41
+ "type": "git",
42
+ "url": "https://github.com/SeanHogg/builderforce-memory.git",
43
+ "directory": "packages/memory-mcp"
44
+ },
45
+ "homepage": "https://github.com/SeanHogg/builderforce-memory/tree/main/packages/memory-mcp#readme",
46
+ "dependencies": {
47
+ "@modelcontextprotocol/sdk": "^1.12.0",
48
+ "zod": "^3.23.0"
49
+ },
50
+ "peerDependencies": {
51
+ "@anthropic-ai/claude-agent-sdk": ">=0.1.0",
52
+ "@seanhogg/builderforce-memory": "^2026.6.18",
53
+ "fake-indexeddb": "^6.0.0"
54
+ },
55
+ "peerDependenciesMeta": {
56
+ "@anthropic-ai/claude-agent-sdk": {
57
+ "optional": true
58
+ },
59
+ "@seanhogg/builderforce-memory": {
60
+ "optional": true
61
+ },
62
+ "fake-indexeddb": {
63
+ "optional": true
64
+ }
65
+ },
66
+ "devDependencies": {
67
+ "@anthropic-ai/claude-agent-sdk": ">=0.1.0",
68
+ "@types/node": "^20.0.0",
69
+ "@typescript-eslint/eslint-plugin": "^7.0.0",
70
+ "@typescript-eslint/parser": "^7.0.0",
71
+ "eslint": "^8.57.0",
72
+ "fake-indexeddb": "^6.0.0",
73
+ "typescript": "^5.0.0",
74
+ "@seanhogg/builderforce-memory": "2026.6.18"
75
+ },
76
+ "engines": {
77
+ "node": ">=18.0.0"
78
+ },
79
+ "publishConfig": {
80
+ "access": "public"
81
+ },
82
+ "scripts": {
83
+ "build": "tsc",
84
+ "lint": "eslint src/"
85
+ }
86
+ }