@lore-co/mcp 0.1.19

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 ADDED
@@ -0,0 +1,110 @@
1
+ # Functional Source License, Version 1.1
2
+
3
+ ## Abbreviation
4
+
5
+ FSL-1.1-MIT
6
+
7
+ ## Notice
8
+
9
+ Copyright (c) 2026 Treadie, Inc
10
+
11
+ ## Terms and Conditions
12
+
13
+ ### Licensor ("We")
14
+
15
+ The party offering the Software under these Terms and Conditions.
16
+
17
+ ### The Software
18
+
19
+ The "Software" is each version of the software that we make available under
20
+ these Terms and Conditions, as indicated by our inclusion of these Terms and
21
+ Conditions with the Software.
22
+
23
+ ### License Grant
24
+
25
+ Subject to your compliance with this License Grant and the Patents,
26
+ Redistribution and Trademark clauses below, we hereby grant you the right to
27
+ use, copy, modify, create derivative works, publicly perform, publicly display
28
+ and redistribute the Software for any Permitted Purpose identified below.
29
+
30
+ ### Permitted Purpose
31
+
32
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
33
+ means making the Software available to others in a commercial product or
34
+ service that:
35
+
36
+ 1. substitutes for the Software;
37
+
38
+ 2. substitutes for any other product or service we offer using the Software
39
+ that exists as of the date we make the Software available; or
40
+
41
+ 3. offers the same or substantially similar functionality as the Software.
42
+
43
+ Permitted Purposes specifically include using the Software:
44
+
45
+ 1. for your internal use and access;
46
+
47
+ 2. for non-commercial education;
48
+
49
+ 3. for non-commercial research; and
50
+
51
+ 4. in connection with professional services that you provide to a licensee
52
+ using the Software in accordance with these Terms and Conditions.
53
+
54
+ ### Patents
55
+
56
+ To the extent your use for a Permitted Purpose would necessarily infringe our
57
+ patents, the license grant above includes a license under our patents. If you
58
+ make a claim against any party that the Software infringes or contributes to
59
+ the infringement of any patent, then your patent license to the Software ends
60
+ immediately.
61
+
62
+ ### Redistribution
63
+
64
+ The Terms and Conditions apply to all copies, modifications and derivatives of
65
+ the Software.
66
+
67
+ If you redistribute any copies, modifications or derivatives of the Software,
68
+ you must include a copy of or a link to these Terms and Conditions and not
69
+ remove any copyright notices provided in or with the Software.
70
+
71
+ ### Disclaimer
72
+
73
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
74
+ IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
75
+ PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
76
+
77
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
78
+ SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
79
+ EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
80
+
81
+ ### Trademarks
82
+
83
+ Except for displaying the License Details and identifying us as the origin of
84
+ the Software, you have no right under these Terms and Conditions to use our
85
+ trademarks, trade names, service marks or product names.
86
+
87
+ ## Grant of Future License
88
+
89
+ We hereby irrevocably grant you an additional license to use the Software under
90
+ the MIT license that is effective on the second anniversary of the date we make
91
+ the Software available. On or after that date, you may use the Software under
92
+ the MIT license, in which case the following will apply:
93
+
94
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
95
+ this software and associated documentation files (the "Software"), to deal in
96
+ the Software without restriction, including without limitation the rights to
97
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
98
+ of the Software, and to permit persons to whom the Software is furnished to do
99
+ so, subject to the following conditions:
100
+
101
+ The above copyright notice and this permission notice shall be included in all
102
+ copies or substantial portions of the Software.
103
+
104
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
105
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
106
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
107
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
108
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
109
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
110
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,63 @@
1
+ # @lore-co/mcp
2
+
3
+ Local stdio MCP server for querying Lore shared knowledge and prior agent
4
+ sessions.
5
+
6
+ ## Configure
7
+
8
+ For Cowork and other local hosts on the same machine, connect once with the
9
+ Lore CLI:
10
+
11
+ ```sh
12
+ lore connect --login --agent cowork
13
+ ```
14
+
15
+ The MCP server then reads the API URL and credential from the CLI's mode-0600
16
+ `~/.lore/config.json`. It rejects symlinks, oversized files, files owned by
17
+ another user, and group/world-accessible permissions.
18
+
19
+ Hosts that do not use the Lore CLI can configure the connection explicitly:
20
+
21
+ ```json
22
+ {
23
+ "mcpServers": {
24
+ "lore": {
25
+ "command": "npx",
26
+ "args": ["-y", "@lore-co/mcp@0.1.19"],
27
+ "env": {
28
+ "LORE_API_URL": "https://your-lore.example.com",
29
+ "LORE_WORKSPACE_TOKEN": "YOUR_WORKSPACE_TOKEN"
30
+ }
31
+ }
32
+ }
33
+ }
34
+ ```
35
+
36
+ Node.js 22 or newer is required. Use a separate, revocable workspace token for
37
+ each host. Never commit the token.
38
+
39
+ Explicit constructor options take precedence over environment variables, which
40
+ take precedence over the stored CLI config. Overriding the API URL also
41
+ requires an explicit token or header; the server will not send the stored token
42
+ to a different endpoint.
43
+
44
+ The default tool set is read-only:
45
+
46
+ - `ask_lore`
47
+ - `search_learnings`
48
+ - `get_learning`
49
+
50
+ To register `remember_learning`, `correct_learning`, and `forget_learning`, set
51
+ `LORE_MCP_WRITE_TOOLS=true`. Host instructions should still require explicit
52
+ user intent before every shared-knowledge mutation.
53
+
54
+ ## Capability boundary
55
+
56
+ MCP gives a host explicit Lore tools. It does not provide ambient transcript
57
+ capture, automatic prompt injection, or Context Guard unless the host itself
58
+ implements those boundaries. The server returns static, sanitized tool errors
59
+ and does not expose upstream URLs, response bodies, stack traces, or
60
+ credentials.
61
+
62
+ See the [Copilot templates](https://github.com/treadiehq/lore/tree/main/integrations/copilot)
63
+ and [Claude Cowork plugin](https://github.com/treadiehq/lore/tree/main/integrations/claude-cowork).
@@ -0,0 +1,95 @@
1
+ #!/usr/bin/env node
2
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ import { LoreClient, type SharedMemoryClientOptions } from "@lore-co/sdk";
4
+ import { z } from "zod";
5
+ export { MCP_RELIABILITY_INTEGRATION, type ReliabilityIntegrationManifest, } from "@lore-co/core/integration-contract";
6
+ export declare const MemorySearchInputSchema: z.ZodObject<{
7
+ diff: z.ZodOptional<z.ZodString>;
8
+ files: z.ZodOptional<z.ZodArray<z.ZodString>>;
9
+ components: z.ZodOptional<z.ZodArray<z.ZodString>>;
10
+ symbols: z.ZodOptional<z.ZodArray<z.ZodString>>;
11
+ limit: z.ZodOptional<z.ZodNumber>;
12
+ organization: z.ZodOptional<z.ZodString>;
13
+ project: z.ZodOptional<z.ZodString>;
14
+ repo: z.ZodOptional<z.ZodString>;
15
+ path: z.ZodOptional<z.ZodString>;
16
+ component: z.ZodOptional<z.ZodString>;
17
+ agent: z.ZodDefault<z.ZodString>;
18
+ task: z.ZodString;
19
+ scope: z.ZodOptional<z.ZodObject<{
20
+ organization: z.ZodOptional<z.ZodString>;
21
+ project: z.ZodOptional<z.ZodString>;
22
+ repo: z.ZodOptional<z.ZodString>;
23
+ path: z.ZodOptional<z.ZodString>;
24
+ component: z.ZodOptional<z.ZodString>;
25
+ }, z.core.$strict>>;
26
+ }, z.core.$strict>;
27
+ export declare const MemoryGetInputSchema: z.ZodObject<{
28
+ id: z.ZodUUID;
29
+ }, z.core.$strict>;
30
+ export declare const AskLoreInputSchema: z.ZodObject<{
31
+ question: z.ZodString;
32
+ repo: z.ZodOptional<z.ZodString>;
33
+ project: z.ZodOptional<z.ZodString>;
34
+ sessionId: z.ZodOptional<z.ZodString>;
35
+ limit: z.ZodOptional<z.ZodNumber>;
36
+ sessionLimit: z.ZodOptional<z.ZodNumber>;
37
+ }, z.core.$strict>;
38
+ export declare const MemoryRememberInputSchema: z.ZodObject<{
39
+ category: z.ZodOptional<z.ZodEnum<{
40
+ architecture: "architecture";
41
+ convention: "convention";
42
+ correction: "correction";
43
+ gotcha: "gotcha";
44
+ known_gotcha: "known_gotcha";
45
+ deprecated: "deprecated";
46
+ behavior: "behavior";
47
+ review_feedback: "review_feedback";
48
+ other: "other";
49
+ }>>;
50
+ agent: z.ZodDefault<z.ZodString>;
51
+ sessionId: z.ZodOptional<z.ZodString>;
52
+ organization: z.ZodOptional<z.ZodString>;
53
+ project: z.ZodOptional<z.ZodString>;
54
+ repo: z.ZodOptional<z.ZodString>;
55
+ path: z.ZodOptional<z.ZodString>;
56
+ component: z.ZodOptional<z.ZodString>;
57
+ content: z.ZodString;
58
+ scope: z.ZodOptional<z.ZodObject<{
59
+ organization: z.ZodOptional<z.ZodString>;
60
+ project: z.ZodOptional<z.ZodString>;
61
+ repo: z.ZodOptional<z.ZodString>;
62
+ path: z.ZodOptional<z.ZodString>;
63
+ component: z.ZodOptional<z.ZodString>;
64
+ }, z.core.$strict>>;
65
+ }, z.core.$strict>;
66
+ export declare const MemoryCorrectInputSchema: z.ZodObject<{
67
+ id: z.ZodUUID;
68
+ content: z.ZodString;
69
+ category: z.ZodOptional<z.ZodEnum<{
70
+ architecture: "architecture";
71
+ convention: "convention";
72
+ correction: "correction";
73
+ gotcha: "gotcha";
74
+ known_gotcha: "known_gotcha";
75
+ deprecated: "deprecated";
76
+ behavior: "behavior";
77
+ review_feedback: "review_feedback";
78
+ other: "other";
79
+ }>>;
80
+ agent: z.ZodDefault<z.ZodString>;
81
+ sessionId: z.ZodOptional<z.ZodString>;
82
+ }, z.core.$strict>;
83
+ export declare const MemoryForgetInputSchema: z.ZodObject<{
84
+ id: z.ZodUUID;
85
+ }, z.core.$strict>;
86
+ export interface CreateMcpServerOptions {
87
+ client?: LoreClient;
88
+ baseUrl?: string;
89
+ fetch?: SharedMemoryClientOptions["fetch"];
90
+ headers?: SharedMemoryClientOptions["headers"];
91
+ writeTools?: boolean;
92
+ }
93
+ export declare function createMcpServer(options?: CreateMcpServerOptions): McpServer;
94
+ export declare function runStdioServer(): Promise<void>;
95
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAaA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAEL,UAAU,EACV,KAAK,yBAAyB,EAC/B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,2BAA2B,EAC3B,KAAK,8BAA8B,GACpC,MAAM,oCAAoC,CAAC;AAmF5C,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;kBAYzB,CAAC;AAEZ,eAAO,MAAM,oBAAoB;;kBAItB,CAAC;AAEZ,eAAO,MAAM,kBAAkB;;;;;;;kBAsBpB,CAAC;AAEZ,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAS3B,CAAC;AAEZ,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;kBAQ1B,CAAC;AAEZ,eAAO,MAAM,uBAAuB;;kBAAuB,CAAC;AAiD5D,MAAM,WAAW,sBAAsB;IACrC,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,yBAAyB,CAAC,OAAO,CAAC,CAAC;IAC3C,OAAO,CAAC,EAAE,yBAAyB,CAAC,SAAS,CAAC,CAAC;IAC/C,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,eAAe,CAC7B,OAAO,GAAE,sBAA2B,GACnC,SAAS,CA2PX;AAED,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAGpD"}
package/dist/index.js ADDED
@@ -0,0 +1,387 @@
1
+ #!/usr/bin/env node
2
+ import { closeSync, constants as fsConstants, fstatSync, openSync, readFileSync, realpathSync, } from "node:fs";
3
+ import { homedir } from "node:os";
4
+ import { resolve } from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
7
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
8
+ import { SharedMemoryApiError, LoreClient, } from "@lore-co/sdk";
9
+ import { z } from "zod";
10
+ export { MCP_RELIABILITY_INTEGRATION, } from "@lore-co/core/integration-contract";
11
+ const scopeShape = {
12
+ organization: z.string().trim().min(1).optional(),
13
+ project: z.string().trim().min(1).optional(),
14
+ repo: z.string().trim().min(1).optional(),
15
+ path: z.string().trim().min(1).optional(),
16
+ component: z.string().trim().min(1).optional(),
17
+ };
18
+ const scopeSchema = z.object(scopeShape).strict();
19
+ const categorySchema = z.enum([
20
+ "architecture",
21
+ "convention",
22
+ "correction",
23
+ "gotcha",
24
+ "known_gotcha",
25
+ "deprecated",
26
+ "behavior",
27
+ "review_feedback",
28
+ "other",
29
+ ]);
30
+ const StoredConnectorConfigSchema = z
31
+ .object({
32
+ apiUrl: z.url(),
33
+ token: z.string().trim().min(1),
34
+ })
35
+ .passthrough();
36
+ function environmentValue(environment, name) {
37
+ const value = environment[name]?.trim();
38
+ return value === undefined || value === "" ? undefined : value;
39
+ }
40
+ function readStoredConnectorConfig(environment) {
41
+ const home = resolve(environmentValue(environment, "LORE_HOME") ??
42
+ environmentValue(environment, "HOME") ??
43
+ homedir());
44
+ const path = resolve(home, ".lore", "config.json");
45
+ let descriptor;
46
+ try {
47
+ descriptor = openSync(path, fsConstants.O_RDONLY | fsConstants.O_NOFOLLOW);
48
+ const metadata = fstatSync(descriptor);
49
+ if (!metadata.isFile() ||
50
+ metadata.size > 64 * 1024 ||
51
+ (process.platform !== "win32" && (metadata.mode & 0o077) !== 0) ||
52
+ (typeof process.getuid === "function" &&
53
+ metadata.uid !== process.getuid())) {
54
+ return null;
55
+ }
56
+ const parsed = StoredConnectorConfigSchema.safeParse(JSON.parse(readFileSync(descriptor, "utf8")));
57
+ return parsed.success
58
+ ? { apiUrl: parsed.data.apiUrl, token: parsed.data.token }
59
+ : null;
60
+ }
61
+ catch {
62
+ return null;
63
+ }
64
+ finally {
65
+ if (descriptor !== undefined) {
66
+ closeSync(descriptor);
67
+ }
68
+ }
69
+ }
70
+ export const MemorySearchInputSchema = z
71
+ .object({
72
+ agent: z.string().trim().min(1).default("mcp"),
73
+ task: z.string().trim().min(1).describe("Task or question to search for"),
74
+ scope: scopeSchema.optional(),
75
+ ...scopeShape,
76
+ diff: z.string().optional().describe("Relevant code diff"),
77
+ files: z.array(z.string().trim().min(1)).optional(),
78
+ components: z.array(z.string().trim().min(1)).optional(),
79
+ symbols: z.array(z.string().trim().min(1)).optional(),
80
+ limit: z.number().int().positive().max(20).optional(),
81
+ })
82
+ .strict();
83
+ export const MemoryGetInputSchema = z
84
+ .object({
85
+ id: z.uuid().describe("Memory UUID"),
86
+ })
87
+ .strict();
88
+ export const AskLoreInputSchema = z
89
+ .object({
90
+ question: z
91
+ .string()
92
+ .trim()
93
+ .min(1)
94
+ .describe('Natural question, e.g. "What did the previous session already try?"'),
95
+ repo: z.string().trim().min(1).optional(),
96
+ project: z.string().trim().min(1).optional(),
97
+ sessionId: z
98
+ .string()
99
+ .trim()
100
+ .min(1)
101
+ .optional()
102
+ .describe("Your current session id; boosts the sessions this work continues"),
103
+ limit: z.number().int().positive().max(20).optional(),
104
+ sessionLimit: z.number().int().positive().max(10).optional(),
105
+ })
106
+ .strict();
107
+ export const MemoryRememberInputSchema = z
108
+ .object({
109
+ content: z.string().trim().min(1).describe("Durable knowledge to save"),
110
+ scope: scopeSchema.optional(),
111
+ ...scopeShape,
112
+ category: categorySchema.optional(),
113
+ agent: z.string().trim().min(1).default("mcp"),
114
+ sessionId: z.string().trim().min(1).optional(),
115
+ })
116
+ .strict();
117
+ export const MemoryCorrectInputSchema = z
118
+ .object({
119
+ id: z.uuid().describe("Active memory UUID to correct"),
120
+ content: z.string().trim().min(1).describe("Correct replacement content"),
121
+ category: categorySchema.optional(),
122
+ agent: z.string().trim().min(1).default("mcp"),
123
+ sessionId: z.string().trim().min(1).optional(),
124
+ })
125
+ .strict();
126
+ export const MemoryForgetInputSchema = MemoryGetInputSchema;
127
+ function serializableObject(value) {
128
+ const serialized = JSON.parse(JSON.stringify(value));
129
+ if (typeof serialized !== "object" ||
130
+ serialized === null ||
131
+ Array.isArray(serialized)) {
132
+ return { value: serialized };
133
+ }
134
+ return serialized;
135
+ }
136
+ function toolResult(value, text) {
137
+ const structuredContent = serializableObject(value);
138
+ return {
139
+ content: [
140
+ {
141
+ type: "text",
142
+ text: text ?? JSON.stringify(structuredContent, null, 2),
143
+ },
144
+ ],
145
+ structuredContent,
146
+ };
147
+ }
148
+ function toolError(error) {
149
+ const details = error instanceof SharedMemoryApiError
150
+ ? {
151
+ error: "Lore request failed",
152
+ status: error.status,
153
+ }
154
+ : {
155
+ error: "Lore tool failed",
156
+ };
157
+ return {
158
+ ...toolResult(details),
159
+ isError: true,
160
+ };
161
+ }
162
+ export function createMcpServer(options = {}) {
163
+ const writeToolsEnabled = options.writeTools ?? process.env.LORE_MCP_WRITE_TOOLS === "true";
164
+ const environmentApiUrl = environmentValue(process.env, "LORE_API_URL");
165
+ const environmentToken = environmentValue(process.env, "LORE_WORKSPACE_TOKEN");
166
+ const storedConfig = options.client === undefined &&
167
+ (options.baseUrl === undefined || options.headers === undefined) &&
168
+ (environmentApiUrl === undefined || environmentToken === undefined)
169
+ ? readStoredConnectorConfig(process.env)
170
+ : null;
171
+ const storedToken = options.baseUrl === undefined && environmentApiUrl === undefined
172
+ ? storedConfig?.token
173
+ : undefined;
174
+ const client = options.client ??
175
+ new LoreClient({
176
+ baseUrl: options.baseUrl ??
177
+ environmentApiUrl ??
178
+ storedConfig?.apiUrl ??
179
+ "http://localhost:3004",
180
+ ...(options.fetch === undefined ? {} : { fetch: options.fetch }),
181
+ ...(options.headers !== undefined
182
+ ? { headers: options.headers }
183
+ : environmentToken ?? storedToken
184
+ ? {
185
+ headers: {
186
+ authorization: `Bearer ${environmentToken ?? storedToken}`,
187
+ },
188
+ }
189
+ : {}),
190
+ });
191
+ const server = new McpServer({
192
+ name: "lore",
193
+ version: "0.1.19",
194
+ });
195
+ server.registerTool("search_learnings", {
196
+ title: "Search shared learnings",
197
+ description: "Find shared engineering learnings relevant to a task and return formatted context.",
198
+ inputSchema: MemorySearchInputSchema,
199
+ annotations: {
200
+ readOnlyHint: true,
201
+ openWorldHint: true,
202
+ },
203
+ }, async (input) => {
204
+ try {
205
+ const result = await client.getContext(input);
206
+ return toolResult(result, result.context || "No relevant shared learnings found.");
207
+ }
208
+ catch (error) {
209
+ return toolError(error);
210
+ }
211
+ });
212
+ server.registerTool("ask_lore", {
213
+ title: "Ask Lore",
214
+ description: "Query shared context: durable knowledge plus prior work sessions " +
215
+ "(what previous agents tried, errors hit, decisions made). Answers " +
216
+ "include provenance. Pass sessionId to prioritize the sessions your " +
217
+ "current work continues.",
218
+ inputSchema: AskLoreInputSchema,
219
+ annotations: {
220
+ readOnlyHint: true,
221
+ openWorldHint: true,
222
+ },
223
+ }, async (input) => {
224
+ try {
225
+ const result = await client.ask({
226
+ question: input.question,
227
+ agent: "mcp",
228
+ ...(input.repo === undefined ? {} : { repo: input.repo }),
229
+ ...(input.project === undefined ? {} : { project: input.project }),
230
+ ...(input.sessionId === undefined
231
+ ? {}
232
+ : { sessionId: input.sessionId }),
233
+ ...(input.limit === undefined ? {} : { limit: input.limit }),
234
+ ...(input.sessionLimit === undefined
235
+ ? {}
236
+ : { sessionLimit: input.sessionLimit }),
237
+ });
238
+ const lines = [];
239
+ if (result.context !== "") {
240
+ lines.push(result.context);
241
+ }
242
+ for (const match of result.sessions) {
243
+ const where = match.session.repo ?? match.session.project ?? "";
244
+ lines.push(`Prior ${match.session.agent} session${where === "" ? "" : ` in ${where}`} (last active ${match.session.lastActivityAt}):`);
245
+ for (const excerpt of match.excerpts) {
246
+ lines.push(`- ${excerpt.text}`);
247
+ }
248
+ }
249
+ return toolResult(result, lines.length === 0
250
+ ? "No relevant shared context found."
251
+ : lines.join("\n"));
252
+ }
253
+ catch (error) {
254
+ return toolError(error);
255
+ }
256
+ });
257
+ server.registerTool("get_learning", {
258
+ title: "Get shared learning",
259
+ description: "Get one shared engineering learning by UUID.",
260
+ inputSchema: MemoryGetInputSchema,
261
+ annotations: {
262
+ readOnlyHint: true,
263
+ openWorldHint: true,
264
+ },
265
+ }, async ({ id }) => {
266
+ try {
267
+ return toolResult(await client.getLearning(id));
268
+ }
269
+ catch (error) {
270
+ return toolError(error);
271
+ }
272
+ });
273
+ if (writeToolsEnabled) {
274
+ server.registerTool("remember_learning", {
275
+ title: "Remember engineering knowledge",
276
+ description: "Store a durable engineering fact, convention, correction, or decision.",
277
+ inputSchema: MemoryRememberInputSchema,
278
+ annotations: {
279
+ readOnlyHint: false,
280
+ destructiveHint: false,
281
+ idempotentHint: true,
282
+ openWorldHint: true,
283
+ },
284
+ }, async (input) => {
285
+ try {
286
+ return toolResult(await client.createLearning({
287
+ content: input.content,
288
+ ...(input.scope === undefined ? {} : { scope: input.scope }),
289
+ ...(input.organization === undefined
290
+ ? {}
291
+ : { organization: input.organization }),
292
+ ...(input.project === undefined
293
+ ? {}
294
+ : { project: input.project }),
295
+ ...(input.repo === undefined ? {} : { repo: input.repo }),
296
+ ...(input.path === undefined ? {} : { path: input.path }),
297
+ ...(input.component === undefined
298
+ ? {}
299
+ : { component: input.component }),
300
+ ...(input.category === undefined
301
+ ? {}
302
+ : { category: input.category }),
303
+ source: {
304
+ agent: input.agent,
305
+ ...(input.sessionId === undefined
306
+ ? {}
307
+ : { sessionId: input.sessionId }),
308
+ },
309
+ }));
310
+ }
311
+ catch (error) {
312
+ return toolError(error);
313
+ }
314
+ });
315
+ server.registerTool("correct_learning", {
316
+ title: "Correct shared learning",
317
+ description: "Supersede an active learning with corrected replacement content.",
318
+ inputSchema: MemoryCorrectInputSchema,
319
+ annotations: {
320
+ readOnlyHint: false,
321
+ destructiveHint: true,
322
+ idempotentHint: true,
323
+ openWorldHint: true,
324
+ },
325
+ }, async (input) => {
326
+ try {
327
+ return toolResult(await client.correctLearning(input.id, {
328
+ content: input.content,
329
+ ...(input.category === undefined
330
+ ? {}
331
+ : { category: input.category }),
332
+ source: {
333
+ agent: input.agent,
334
+ ...(input.sessionId === undefined
335
+ ? {}
336
+ : { sessionId: input.sessionId }),
337
+ },
338
+ }));
339
+ }
340
+ catch (error) {
341
+ return toolError(error);
342
+ }
343
+ });
344
+ server.registerTool("forget_learning", {
345
+ title: "Forget shared learning",
346
+ description: "Soft-delete a shared engineering learning by UUID.",
347
+ inputSchema: MemoryForgetInputSchema,
348
+ annotations: {
349
+ readOnlyHint: false,
350
+ destructiveHint: true,
351
+ idempotentHint: true,
352
+ openWorldHint: true,
353
+ },
354
+ }, async ({ id }) => {
355
+ try {
356
+ return toolResult(await client.forgetLearning(id));
357
+ }
358
+ catch (error) {
359
+ return toolError(error);
360
+ }
361
+ });
362
+ }
363
+ return server;
364
+ }
365
+ export async function runStdioServer() {
366
+ const server = createMcpServer();
367
+ await server.connect(new StdioServerTransport());
368
+ }
369
+ function isMainModule() {
370
+ const entry = process.argv[1];
371
+ if (entry === undefined) {
372
+ return false;
373
+ }
374
+ try {
375
+ return (realpathSync(entry) === realpathSync(fileURLToPath(import.meta.url)));
376
+ }
377
+ catch {
378
+ return false;
379
+ }
380
+ }
381
+ if (isMainModule()) {
382
+ void runStdioServer().catch(() => {
383
+ console.error("Failed to start Lore MCP server");
384
+ process.exitCode = 1;
385
+ });
386
+ }
387
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/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,aAAa,EAAE,IAAI;aACpB;SACF,EACD,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;YACf,IAAI,CAAC;gBACH,OAAO,UAAU,CAAC,MAAM,MAAM,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC;YACrD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,SAAS,CAAC,KAAK,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC,CACA,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc;IAClC,MAAM,MAAM,GAAG,eAAe,EAAE,CAAC;IACjC,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,oBAAoB,EAAE,CAAC,CAAC;AACnD,CAAC;AAED,SAAS,YAAY;IACnB,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC9B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,CAAC;QACH,OAAO,CACL,YAAY,CAAC,KAAK,CAAC,KAAK,YAAY,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CACrE,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,IAAI,YAAY,EAAE,EAAE,CAAC;IACnB,KAAK,cAAc,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE;QAC/B,OAAO,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACjD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;AACL,CAAC"}
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@lore-co/mcp",
3
+ "version": "0.1.19",
4
+ "description": "Lore MCP server for shared engineering knowledge and prior agent sessions",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "bin": {
9
+ "lore-mcp": "./dist/index.js"
10
+ },
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/index.js"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "README.md"
20
+ ],
21
+ "engines": {
22
+ "node": ">=22.0.0"
23
+ },
24
+ "publishConfig": {
25
+ "access": "public"
26
+ },
27
+ "keywords": [
28
+ "lore",
29
+ "mcp",
30
+ "ai",
31
+ "memory"
32
+ ],
33
+ "license": "FSL-1.1-MIT",
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "git+https://github.com/treadiehq/lore.git",
37
+ "directory": "packages/mcp"
38
+ },
39
+ "dependencies": {
40
+ "@modelcontextprotocol/sdk": "^1.30.0",
41
+ "zod": "^4.4.3",
42
+ "@lore-co/sdk": "0.1.19",
43
+ "@lore-co/core": "0.1.19"
44
+ },
45
+ "scripts": {
46
+ "dev": "tsx watch src/index.ts",
47
+ "build": "tsc -p tsconfig.json",
48
+ "start": "node dist/index.js",
49
+ "typecheck": "tsc --noEmit -p tsconfig.json",
50
+ "test": "vitest run --passWithNoTests"
51
+ }
52
+ }