@oortmem/mcp 0.0.0-stage → 0.1.1

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,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,31 @@
1
- # Temporary Holding Version
1
+ # @oortmem/mcp
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Oort's MCP server, defined once: the seven memory tools (`recall`, `remember`, `forget`, `pin`,
4
+ `explain`, `list_recent`, `whoami`) with their input schemas and read, write and destructive
5
+ annotations, the server instructions, and a skill that tells an agent when to recall and when to
6
+ remember. It serves any memory backend: the local store behind `oort mcp` today, Oort Cloud
7
+ later.
8
+
9
+ ```sh
10
+ npm install @oortmem/mcp
11
+ ```
12
+
13
+ ```ts
14
+ import { createMcpServer, type MemoryBackend } from '@oortmem/mcp';
15
+ import { serveStdio } from '@modelcontextprotocol/server/stdio';
16
+
17
+ const backend: MemoryBackend = {/* recall, remember, forget, pin, explain, listRecent, whoami */};
18
+ serveStdio(() => createMcpServer({ backend }));
19
+ ```
20
+
21
+ Every method acts inside the scope the backend was built for; no tool argument can widen it.
22
+ Throw `MemoryToolError` for a refusal the user should read. Text in every result is scrubbed for
23
+ secrets once more before it reaches the host.
24
+
25
+ Also exported: `TOOLS`, `TOOL_NAMES`, `INSTRUCTIONS`, `inputSchemas` (zod), `toolJsonSchemas()`
26
+ (JSON Schema), `REMEMBER_MAX_FACTS` and `FACT_MAX_CHARS`. The skill is at
27
+ `@oortmem/mcp/skill/SKILL.md`.
28
+
29
+ Most people want the `oortmem` CLI instead: `oort mcp` runs this server over your local memory.
30
+
31
+ Part of [Oort](https://github.com/oortmem/oort), open-source memory for AI agents. Apache-2.0.
@@ -0,0 +1,2 @@
1
+ export { FACT_MAX_CHARS, INSTRUCTIONS, MEMORY_TYPES, REMEMBER_MAX_FACTS, TOOLS, TOOL_NAMES, inputSchemas, toolJsonSchemas, type ToolAnnotations, type ToolDefinition, type ToolInput, type ToolName, } from './tools.js';
2
+ export { MemoryToolError, createMcpServer, type CreateMcpServerOptions, type MemoryBackend, type RecallOutput, type RecalledFact, type RememberOutcome, } from './server.js';
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { FACT_MAX_CHARS, INSTRUCTIONS, MEMORY_TYPES, REMEMBER_MAX_FACTS, TOOLS, TOOL_NAMES, inputSchemas, toolJsonSchemas, } from './tools.js';
2
+ export { MemoryToolError, createMcpServer, } from './server.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,65 @@
1
+ import { McpServer } from '@modelcontextprotocol/server';
2
+ import { type ToolInput } from './tools.js';
3
+ /** One recalled fact, as `recall` returns it. */
4
+ export interface RecalledFact {
5
+ id: string;
6
+ text: string;
7
+ type: string;
8
+ tier: string;
9
+ valid_from: string;
10
+ /** Why it matched, e.g. `lexical #1, rerank 0.81`. */
11
+ why: string;
12
+ }
13
+ export interface RecallOutput {
14
+ memories: RecalledFact[];
15
+ /** True when candidates existed but none answers the question. */
16
+ abstained?: boolean;
17
+ /** A short, user-safe note (degraded recall, missing keys). */
18
+ note?: string;
19
+ }
20
+ export interface RememberOutcome {
21
+ fact: number;
22
+ outcome: 'added' | 'reinforced' | 'updated' | 'superseded' | 'skipped';
23
+ id?: string;
24
+ supersedes?: string;
25
+ reason?: string;
26
+ }
27
+ /**
28
+ * What the MCP tools need from a memory system. The local store (`oort mcp`) implements it
29
+ * today; the Oort Cloud API (CON-76) and the remote connector (CON-42) implement it later.
30
+ * Every method acts inside the scope the backend was built for: no argument can widen it.
31
+ * Throw `MemoryToolError` for a refusal the user should read; anything else is reported as
32
+ * `oort: <message>`.
33
+ */
34
+ export interface MemoryBackend {
35
+ recall(input: ToolInput<'recall'>): Promise<RecallOutput>;
36
+ remember(input: ToolInput<'remember'>): Promise<{
37
+ results: RememberOutcome[];
38
+ }>;
39
+ forget(input: ToolInput<'forget'>): Promise<{
40
+ forgotten: string;
41
+ }>;
42
+ pin(input: ToolInput<'pin'>): Promise<{
43
+ id: string;
44
+ pinned: boolean;
45
+ changed: boolean;
46
+ }>;
47
+ explain(input: ToolInput<'explain'>): Promise<Record<string, unknown>>;
48
+ listRecent(input: ToolInput<'list_recent'>): Promise<{
49
+ memories: Record<string, unknown>[];
50
+ }>;
51
+ whoami(input: ToolInput<'whoami'>): Promise<Record<string, unknown>>;
52
+ }
53
+ /** A refusal whose message is shown to the user as the tool error. */
54
+ export declare class MemoryToolError extends Error {
55
+ readonly name = "MemoryToolError";
56
+ }
57
+ export interface CreateMcpServerOptions {
58
+ backend: MemoryBackend;
59
+ /** Server version reported to hosts; defaults to @oortmem/core's VERSION. */
60
+ version?: string;
61
+ /** Extra error classes whose messages are user-facing refusals (e.g. the CLI's `Refusal`). */
62
+ isRefusal?: (e: unknown) => boolean;
63
+ }
64
+ /** A new server with the seven Oort tools over `backend`. Build one per connection. */
65
+ export declare function createMcpServer(opts: CreateMcpServerOptions): McpServer;
package/dist/server.js ADDED
@@ -0,0 +1,65 @@
1
+ import { McpServer } from '@modelcontextprotocol/server';
2
+ import { VERSION, scrub } from '@oortmem/core';
3
+ import { INSTRUCTIONS, TOOLS, inputSchemas } from './tools.js';
4
+ /** A refusal whose message is shown to the user as the tool error. */
5
+ export class MemoryToolError extends Error {
6
+ name = 'MemoryToolError';
7
+ }
8
+ const fail = (message) => ({
9
+ content: [{ type: 'text', text: message }],
10
+ isError: true,
11
+ });
12
+ /**
13
+ * Scrubs every `text` string in a tool result, however deep. Backends already return clean
14
+ * text; this is the last line before anything reaches the host.
15
+ */
16
+ function scrubTexts(value) {
17
+ if (Array.isArray(value))
18
+ return value.map(scrubTexts);
19
+ if (value !== null && typeof value === 'object') {
20
+ return Object.fromEntries(Object.entries(value).map(([k, v]) => [
21
+ k,
22
+ k === 'text' && typeof v === 'string' ? scrub(v).text : scrubTexts(v),
23
+ ]));
24
+ }
25
+ return value;
26
+ }
27
+ async function run(fn, isRefusal) {
28
+ try {
29
+ const data = scrubTexts(await fn());
30
+ return { content: [{ type: 'text', text: JSON.stringify(data) }] };
31
+ }
32
+ catch (e) {
33
+ if (e instanceof MemoryToolError || isRefusal(e)) {
34
+ return fail(e instanceof Error ? e.message : String(e));
35
+ }
36
+ const err = e instanceof Error ? e : new Error(String(e));
37
+ return fail(`oort: ${err.message}`);
38
+ }
39
+ }
40
+ /** A new server with the seven Oort tools over `backend`. Build one per connection. */
41
+ export function createMcpServer(opts) {
42
+ const b = opts.backend;
43
+ const isRefusal = opts.isRefusal ?? (() => false);
44
+ const server = new McpServer({ name: 'oort', title: 'Oort memory', version: opts.version ?? VERSION }, { capabilities: { tools: {} }, instructions: INSTRUCTIONS });
45
+ const handlers = {
46
+ recall: (i) => b.recall(i),
47
+ remember: (i) => b.remember({ ...i, facts: [...new Set(i.facts)] }),
48
+ forget: (i) => b.forget(i),
49
+ pin: (i) => b.pin(i),
50
+ explain: (i) => b.explain(i),
51
+ list_recent: (i) => b.listRecent(i),
52
+ whoami: (i) => b.whoami(i),
53
+ };
54
+ for (const t of TOOLS) {
55
+ const handler = handlers[t.name];
56
+ server.registerTool(t.name, {
57
+ title: t.title,
58
+ description: t.description,
59
+ inputSchema: inputSchemas[t.name],
60
+ annotations: t.annotations,
61
+ }, ((input) => run(() => handler(input), isRefusal)));
62
+ }
63
+ return server;
64
+ }
65
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1,63 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * The connectors note's D2 tool set, defined once. The local `oort mcp` server and the remote
4
+ * connector (CON-42) both serve these exact names, schemas and annotations.
5
+ */
6
+ export declare const TOOL_NAMES: readonly ['recall', 'remember', 'forget', 'pin', 'explain', 'list_recent', 'whoami'];
7
+ export type ToolName = (typeof TOOL_NAMES)[number];
8
+ /** `remember` takes at most this many facts per call: distilled facts, never a transcript. */
9
+ export declare const REMEMBER_MAX_FACTS = 5;
10
+ /** And each fact at most this many characters. */
11
+ export declare const FACT_MAX_CHARS = 500;
12
+ /** The first paragraph stands alone (hosts may keep only the first 512 characters). */
13
+ export declare const INSTRUCTIONS: string;
14
+ export declare const MEMORY_TYPES: readonly ['semantic', 'episodic', 'procedural', 'preference'];
15
+ export declare const inputSchemas: {
16
+ readonly recall: z.ZodObject<{
17
+ query: z.ZodString;
18
+ as_of: z.ZodOptional<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>>;
19
+ limit: z.ZodDefault<z.ZodNumber>;
20
+ }, z.core.$strip>;
21
+ readonly remember: z.ZodObject<{
22
+ facts: z.ZodArray<z.ZodString>;
23
+ type: z.ZodOptional<z.ZodEnum<{
24
+ episodic: "episodic";
25
+ preference: "preference";
26
+ procedural: "procedural";
27
+ semantic: "semantic";
28
+ }>>;
29
+ }, z.core.$strip>;
30
+ readonly forget: z.ZodObject<{
31
+ id: z.ZodString;
32
+ }, z.core.$strip>;
33
+ readonly pin: z.ZodObject<{
34
+ id: z.ZodString;
35
+ pinned: z.ZodBoolean;
36
+ }, z.core.$strip>;
37
+ readonly explain: z.ZodObject<{
38
+ id: z.ZodString;
39
+ }, z.core.$strip>;
40
+ readonly list_recent: z.ZodObject<{
41
+ since: z.ZodOptional<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodISODate]>>;
42
+ limit: z.ZodDefault<z.ZodNumber>;
43
+ }, z.core.$strip>;
44
+ readonly whoami: z.ZodObject<{}, z.core.$strip>;
45
+ };
46
+ export type ToolInput<N extends ToolName> = z.output<(typeof inputSchemas)[N]>;
47
+ export interface ToolAnnotations {
48
+ title: string;
49
+ readOnlyHint: boolean;
50
+ destructiveHint: boolean;
51
+ idempotentHint: boolean;
52
+ openWorldHint: boolean;
53
+ }
54
+ export interface ToolDefinition {
55
+ name: ToolName;
56
+ title: string;
57
+ description: string;
58
+ annotations: ToolAnnotations;
59
+ }
60
+ /** Name, title, description and annotations of every tool, in TOOL_NAMES order. */
61
+ export declare const TOOLS: readonly ToolDefinition[];
62
+ /** The JSON Schema of every tool's input, for hosts and docs that need it without zod. */
63
+ export declare function toolJsonSchemas(): Record<ToolName, Record<string, unknown>>;
package/dist/tools.js ADDED
@@ -0,0 +1,132 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * The connectors note's D2 tool set, defined once. The local `oort mcp` server and the remote
4
+ * connector (CON-42) both serve these exact names, schemas and annotations.
5
+ */
6
+ export const TOOL_NAMES = [
7
+ 'recall',
8
+ 'remember',
9
+ 'forget',
10
+ 'pin',
11
+ 'explain',
12
+ 'list_recent',
13
+ 'whoami',
14
+ ];
15
+ /** `remember` takes at most this many facts per call: distilled facts, never a transcript. */
16
+ export const REMEMBER_MAX_FACTS = 5;
17
+ /** And each fact at most this many characters. */
18
+ export const FACT_MAX_CHARS = 500;
19
+ /** The first paragraph stands alone (hosts may keep only the first 512 characters). */
20
+ export const INSTRUCTIONS = [
21
+ "Oort is the user's own long-term memory, which they connected on purpose. `recall` searches facts the user chose to keep from earlier sessions: decisions, preferences, project details. Use it when the user refers to earlier work, or when their past context would change the answer; skip it for self-contained questions. Use `remember` only for durable facts the user stated or confirmed, one standalone sentence each, never secrets or credentials. `forget` deletes permanently.",
22
+ 'Memories belong to the project directory this server was started in, plus global ones. `recall` returns only facts that are current; pass `as_of` to ask what was true at an earlier time. A newer fact can supersede an older one: the older one stays visible to `explain` but stops being recalled. Batch the facts of one decision into a single `remember` call. Ids from `recall` and `list_recent` feed `forget`, `pin` and `explain`.',
23
+ ].join('\n\n');
24
+ const Id = z.string().trim().min(1).max(64).describe('A memory id from recall or list_recent');
25
+ const IsoTime = z
26
+ .union([z.iso.datetime({ offset: true }), z.iso.date()])
27
+ .describe('An ISO 8601 date or date-time');
28
+ const Fact = z
29
+ .string()
30
+ .trim()
31
+ .min(1)
32
+ .max(FACT_MAX_CHARS)
33
+ .regex(/^[^\r\n]*$/, 'one line per fact')
34
+ .describe('One standalone claim, true without the conversation around it');
35
+ export const MEMORY_TYPES = ['semantic', 'episodic', 'procedural', 'preference'];
36
+ export const inputSchemas = {
37
+ recall: z.object({
38
+ query: z.string().trim().min(1).max(500).describe('What to look for, in plain words'),
39
+ as_of: IsoTime.optional().describe('Recall what was true at this time instead of now'),
40
+ limit: z.number().int().min(1).max(10).default(5),
41
+ }),
42
+ remember: z.object({
43
+ facts: z.array(Fact).min(1).max(REMEMBER_MAX_FACTS),
44
+ type: z
45
+ .enum(MEMORY_TYPES)
46
+ .optional()
47
+ .describe('A hint for the kind of fact; Oort decides the final type'),
48
+ }),
49
+ forget: z.object({ id: Id }),
50
+ pin: z.object({ id: Id, pinned: z.boolean() }),
51
+ explain: z.object({ id: Id }),
52
+ list_recent: z.object({
53
+ since: IsoTime.optional().describe('Only memories changed at or after this time'),
54
+ limit: z.number().int().min(1).max(50).default(20),
55
+ }),
56
+ whoami: z.object({}),
57
+ };
58
+ const read = (title) => ({
59
+ title,
60
+ readOnlyHint: true,
61
+ destructiveHint: false,
62
+ idempotentHint: true,
63
+ openWorldHint: false,
64
+ });
65
+ /** Name, title, description and annotations of every tool, in TOOL_NAMES order. */
66
+ export const TOOLS = [
67
+ {
68
+ name: 'recall',
69
+ title: 'Recall memories',
70
+ description: "Search the user's saved memories for facts relevant to a question. Returns up to 10 current facts with their date and why each matched.",
71
+ annotations: read('Recall memories'),
72
+ },
73
+ {
74
+ name: 'remember',
75
+ title: 'Remember facts',
76
+ description: 'Save one to five self-contained facts the user stated or confirmed. Oort skips secrets and dedupes, reinforces or supersedes older facts.',
77
+ annotations: {
78
+ title: 'Remember facts',
79
+ readOnlyHint: false,
80
+ destructiveHint: false,
81
+ idempotentHint: false,
82
+ openWorldHint: false,
83
+ },
84
+ },
85
+ {
86
+ name: 'forget',
87
+ title: 'Forget a memory',
88
+ description: 'Permanently delete one memory by id, everywhere it is stored.',
89
+ annotations: {
90
+ title: 'Forget a memory',
91
+ readOnlyHint: false,
92
+ destructiveHint: true,
93
+ idempotentHint: true,
94
+ openWorldHint: false,
95
+ },
96
+ },
97
+ {
98
+ name: 'pin',
99
+ title: 'Pin or unpin a memory',
100
+ description: 'Keep a memory always available (never moved to cold storage), or release it.',
101
+ annotations: {
102
+ title: 'Pin or unpin a memory',
103
+ readOnlyHint: false,
104
+ destructiveHint: false,
105
+ idempotentHint: true,
106
+ openWorldHint: false,
107
+ },
108
+ },
109
+ {
110
+ name: 'explain',
111
+ title: 'Explain a memory',
112
+ description: 'Show why a memory was stored: its source, the decisions behind it, and what it superseded.',
113
+ annotations: read('Explain a memory'),
114
+ },
115
+ {
116
+ name: 'list_recent',
117
+ title: 'Recent memories',
118
+ description: 'List memories saved or changed recently, newest first.',
119
+ annotations: read('Recent memories'),
120
+ },
121
+ {
122
+ name: 'whoami',
123
+ title: 'Oort account',
124
+ description: 'Describe this Oort connection: local or cloud mode, the scope, and which services are available.',
125
+ annotations: read('Oort account'),
126
+ },
127
+ ];
128
+ /** The JSON Schema of every tool's input, for hosts and docs that need it without zod. */
129
+ export function toolJsonSchemas() {
130
+ return Object.fromEntries(TOOL_NAMES.map((n) => [n, z.toJSONSchema(inputSchemas[n], { io: 'input' })]));
131
+ }
132
+ //# sourceMappingURL=tools.js.map
package/package.json CHANGED
@@ -1,6 +1,62 @@
1
1
  {
2
2
  "name": "@oortmem/mcp",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.1",
4
+ "description": "Oort's MCP server definition: the memory tools, their schemas and annotations, the server instructions and a skill, served over any memory backend.",
5
+ "keywords": [
6
+ "oort",
7
+ "agent-memory",
8
+ "ai-agents",
9
+ "llm-memory",
10
+ "mcp",
11
+ "model-context-protocol"
12
+ ],
13
+ "homepage": "https://oortcloud.dev",
14
+ "bugs": {
15
+ "url": "https://github.com/oortmem/oort/issues",
16
+ "email": "hello@oortcloud.dev"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/oortmem/oort.git",
21
+ "directory": "packages/mcp"
22
+ },
23
+ "license": "Apache-2.0",
24
+ "author": "Oort <hello@oortcloud.dev>",
25
+ "type": "module",
26
+ "engines": {
27
+ "node": ">=22.15.0"
28
+ },
29
+ "sideEffects": false,
30
+ "main": "./dist/index.js",
31
+ "types": "./dist/index.d.ts",
32
+ "exports": {
33
+ ".": {
34
+ "types": "./dist/index.d.ts",
35
+ "default": "./dist/index.js"
36
+ },
37
+ "./skill/SKILL.md": "./skill/oort-memory/SKILL.md"
38
+ },
39
+ "files": [
40
+ "dist",
41
+ "!dist/**/*.map",
42
+ "skill",
43
+ "README.md",
44
+ "LICENSE"
45
+ ],
46
+ "publishConfig": {
47
+ "access": "public"
48
+ },
49
+ "dependencies": {
50
+ "@modelcontextprotocol/server": "2.4.0",
51
+ "@oortmem/core": "0.1.1",
52
+ "zod": "4.6.7"
53
+ },
54
+ "devDependencies": {
55
+ "@modelcontextprotocol/client": "2.4.0",
56
+ "vitest": "^5.0.5"
57
+ },
58
+ "scripts": {
59
+ "build": "tsc -p tsconfig.json",
60
+ "typecheck": "tsc -p tsconfig.typecheck.json"
61
+ }
6
62
  }
@@ -0,0 +1,40 @@
1
+ ---
2
+ name: oort-memory
3
+ description: Use Oort, the user's long-term memory, well. Recall before answering about earlier work, decisions, preferences or project details; remember durable facts the user states or confirms; never store secrets.
4
+ ---
5
+
6
+ # Oort memory
7
+
8
+ Oort keeps facts the user chose to keep across sessions. It is connected as the `oort` MCP server
9
+ with seven tools: `recall`, `remember`, `forget`, `pin`, `explain`, `list_recent` and `whoami`.
10
+
11
+ ## When to recall
12
+
13
+ - The user refers to earlier work: "like last time", "the approach we picked", "my usual setup".
14
+ - Their past context would change the answer: a stack, a convention, a preference, a decision.
15
+ - Skip it for self-contained questions. A recall that finds nothing relevant returns
16
+ `abstained: true`; answer without memory then, and do not mention Oort.
17
+ - Use `as_of` for questions about the past ("what did we use in March").
18
+
19
+ ## When to remember
20
+
21
+ - Only durable facts the user stated or confirmed: decisions and why, preferences, project facts,
22
+ how something is done here.
23
+ - One standalone sentence per fact, true without the conversation around it. Name things fully:
24
+ "The billing service runs on port 8443", not "it uses that port".
25
+ - Batch the facts of one decision into a single `remember` call (at most five).
26
+ - Never secrets, keys, passwords or personal data the user did not ask you to keep. Oort scrubs
27
+ secrets, but do not send them.
28
+ - Do not remember your own suggestions unless the user accepted them.
29
+
30
+ ## Changing and removing
31
+
32
+ - A newer fact supersedes an older one on its own; you do not need to forget the old one first.
33
+ - `forget` deletes permanently. Use it when the user asks, and confirm which memory with
34
+ `list_recent` or `explain` first.
35
+ - `pin` keeps a memory always available. Use it only when the user asks.
36
+
37
+ ## Telling the user
38
+
39
+ Say briefly what you saved ("Saved: billing runs on port 8443."). When a recalled fact shaped
40
+ the answer, you can say so; `explain` shows why it was stored and what it replaced.