@agentage/server-memory 0.0.2

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,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Agentage Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,45 @@
1
+ # @agentage/server-memory
2
+
3
+ The **MCP server** for agentage Memory exposes your local vaults
4
+ (`~/.agentage/vaults.json`, read through [`@agentage/memory-core`](https://github.com/agentage/memory-core))
5
+ as the frozen 6 `memory__*` tools over stdio. The open, cross-vendor counterpart to
6
+ `@modelcontextprotocol/server-memory`.
7
+
8
+ This package is intentionally **small** - it is just the MCP definition (the 6-tool Zod
9
+ schema + `.mcpc.json`, the text renderer, `createMemoryServer`, and a ~15-line stdio bin).
10
+ All memory logic (backends, git, search, routing) lives in `@agentage/memory-core`.
11
+
12
+ ## Use it
13
+
14
+ ```bash
15
+ # one-time, offline: scaffold ~/.agentage + a starter vault
16
+ # (memory-core's `init`, also surfaced by the agentage CLI)
17
+ npx @agentage/server-memory # serves ~/.agentage/vaults.json over stdio
18
+ ```
19
+
20
+ Point any stdio MCP client (Windsurf, Zed, Claude Desktop) at `npx @agentage/server-memory`.
21
+
22
+ ## Reused by the CLI daemon
23
+
24
+ The server builder is transport-agnostic, so the agentage CLI reuses the exact same
25
+ pieces and only swaps the transport:
26
+
27
+ ```ts
28
+ import { createMemoryServer, loadLocalServer } from '@agentage/server-memory';
29
+
30
+ // stdio bin: await (await loadLocalServer()).connect(new StdioServerTransport());
31
+ // CLI daemon: const server = createMemoryServer(registry, { scope: 'local' });
32
+ // await server.connect(new StreamableHTTPServerTransport(...));
33
+ ```
34
+
35
+ ## Develop
36
+
37
+ ```bash
38
+ npm install # links @agentage/memory-core via file:../memory-core
39
+ npm test # vitest: contract (tools/list = 6) + tools (in-memory) + e2e (init -> spawned bin -> round-trip)
40
+ npm run verify # type-check + lint + format:check + test + build
41
+ ```
42
+
43
+ `@agentage/memory-core` is a local `file:` link until both packages publish to npm; build
44
+ core before running here (the e2e does this automatically). The 6-tool schema and
45
+ `.mcpc.json` snapshot are the frozen MCP contract - keep them in sync if the contract changes.
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=server-memory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-memory.d.ts","sourceRoot":"","sources":["../../src/bin/server-memory.ts"],"names":[],"mappings":""}
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env node
2
+ // @agentage/server-memory - the stdio MCP keystone. `npx @agentage/server-memory`
3
+ // exposes the user's local vaults (~/.agentage/vaults.json, read via
4
+ // @agentage/memory-core) as the 6 memory__* tools over stdio, for stdio-only clients
5
+ // (Windsurf, Zed) and as the published npm artifact. Zero memory logic - it binds the
6
+ // memory-core server to a StdioServerTransport.
7
+ //
8
+ // stdout is the JSON-RPC wire; all diagnostics MUST go to stderr.
9
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
10
+ import { loadLocalServer } from '../server/local-server.js';
11
+ const main = async () => {
12
+ const server = await loadLocalServer();
13
+ await server.connect(new StdioServerTransport());
14
+ // The transport keeps the process alive until the client disconnects (stdin EOF).
15
+ };
16
+ main().catch((err) => {
17
+ const message = err instanceof Error ? err.message : String(err);
18
+ process.stderr.write(`[server-memory] fatal: ${message}\n`);
19
+ process.exit(1);
20
+ });
21
+ //# sourceMappingURL=server-memory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-memory.js","sourceRoot":"","sources":["../../src/bin/server-memory.ts"],"names":[],"mappings":";AACA,kFAAkF;AAClF,qEAAqE;AACrE,qFAAqF;AACrF,sFAAsF;AACtF,gDAAgD;AAChD,EAAE;AACF,kEAAkE;AAElE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,MAAM,IAAI,GAAG,KAAK,IAAmB,EAAE;IACrC,MAAM,MAAM,GAAG,MAAM,eAAe,EAAE,CAAC;IACvC,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,oBAAoB,EAAE,CAAC,CAAC;IACjD,kFAAkF;AACpF,CAAC,CAAC;AAEF,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;IAC5B,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACjE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,0BAA0B,OAAO,IAAI,CAAC,CAAC;IAC5D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { MEMORY_TOOLS, type MemoryToolDef } from './server/memory-tools.schema.js';
2
+ export { createMemoryServer, SERVER_NAME, SERVER_TITLE, SERVER_VERSION, type CreateServerOptions, } from './server/create-memory-server.js';
3
+ export { registerTools } from './server/register-tools.js';
4
+ export { loadLocalServer } from './server/local-server.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACnF,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,cAAc,EACd,KAAK,mBAAmB,GACzB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ // @agentage/server-memory public API - the MCP layer over @agentage/memory-core.
2
+ export { MEMORY_TOOLS } from './server/memory-tools.schema.js';
3
+ export { createMemoryServer, SERVER_NAME, SERVER_TITLE, SERVER_VERSION, } from './server/create-memory-server.js';
4
+ export { registerTools } from './server/register-tools.js';
5
+ export { loadLocalServer } from './server/local-server.js';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,OAAO,EAAE,YAAY,EAAsB,MAAM,iCAAiC,CAAC;AACnF,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,cAAc,GAEf,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import { type McpScope, type VaultRegistry } from '@agentage/memory-core';
3
+ export declare const SERVER_NAME = "agentage-memory";
4
+ export declare const SERVER_TITLE = "Agentage Memory";
5
+ export declare const SERVER_VERSION = "0.0.1";
6
+ export interface CreateServerOptions {
7
+ scope: McpScope;
8
+ version?: string;
9
+ readOnly?: boolean;
10
+ only?: string;
11
+ }
12
+ export declare const createMemoryServer: (reg: VaultRegistry, opts: CreateServerOptions) => McpServer;
13
+ //# sourceMappingURL=create-memory-server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-memory-server.d.ts","sourceRoot":"","sources":["../../src/server/create-memory-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAgB,KAAK,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGxF,eAAO,MAAM,WAAW,oBAAoB,CAAC;AAC7C,eAAO,MAAM,YAAY,oBAAoB,CAAC;AAC9C,eAAO,MAAM,cAAc,UAAU,CAAC;AAEtC,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,QAAQ,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAiBD,eAAO,MAAM,kBAAkB,GAAI,KAAK,aAAa,EAAE,MAAM,mBAAmB,KAAG,SAiBlF,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import { createRouter } from '@agentage/memory-core';
3
+ import { registerTools } from './register-tools.js';
4
+ export const SERVER_NAME = 'agentage-memory';
5
+ export const SERVER_TITLE = 'Agentage Memory';
6
+ export const SERVER_VERSION = '0.0.1';
7
+ const instructionsFor = (vaultIds) => {
8
+ const line = vaultIds.length > 1
9
+ ? `\nThis connection serves these vaults: ${vaultIds.join(', ')}. A path starting @<vault>/ addresses that vault (e.g. @${vaultIds[1]}/notes.md); every other path goes to the default vault. memory__list with no folder shows the vaults.`
10
+ : '';
11
+ return (`agentage Memory is the user's persistent memory, shared across every AI they use. Engage it proactively: check it when past context could help, and save decisions, preferences, and durable facts as you learn them.\n` +
12
+ `Memories are plain markdown files at POSIX paths (e.g. work/tasks/plan.md). Browse with memory__list, find by keyword with memory__search (single literal substring), read one with memory__read. Save with memory__write (new note or full rewrite) or memory__edit (in place: str_replace for small changes, append to add). Read a memory before editing it.` +
13
+ line);
14
+ };
15
+ // Build an MCP server exposing the frozen 6 tools over the registry's surfaced
16
+ // vaults (those whose mcp scope includes opts.scope). Transport-agnostic: connect
17
+ // it to a stdio or Streamable-HTTP transport. The vault router federates per-call.
18
+ export const createMemoryServer = (reg, opts) => {
19
+ const scoped = reg.surfaced(opts.scope);
20
+ const surfaced = opts.only ? scoped.filter((h) => h.id === opts.only) : scoped;
21
+ const fallbackDefault = reg.default();
22
+ const defaultHandle = surfaced.find((h) => h.id === fallbackDefault?.id) ?? surfaced[0];
23
+ const router = createRouter(surfaced, defaultHandle);
24
+ const server = new McpServer({
25
+ name: SERVER_NAME,
26
+ title: SERVER_TITLE,
27
+ version: opts.version ?? SERVER_VERSION,
28
+ websiteUrl: 'https://agentage.io',
29
+ }, { capabilities: { tools: {} }, instructions: instructionsFor(surfaced.map((h) => h.id)) });
30
+ registerTools(server, router, { readOnly: opts.readOnly });
31
+ return server;
32
+ };
33
+ //# sourceMappingURL=create-memory-server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-memory-server.js","sourceRoot":"","sources":["../../src/server/create-memory-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAqC,MAAM,uBAAuB,CAAC;AACxF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,CAAC,MAAM,WAAW,GAAG,iBAAiB,CAAC;AAC7C,MAAM,CAAC,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AU,EAAE,qBAAqB;KAClC,EACD,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,YAAY,EAAE,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAC1F,CAAC;IACF,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC3D,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ export interface LocalServerOptions {
3
+ configDir?: string;
4
+ }
5
+ export declare const loadLocalServer: (opts?: LocalServerOptions) => Promise<McpServer>;
6
+ //# sourceMappingURL=local-server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-server.d.ts","sourceRoot":"","sources":["../../src/server/local-server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AASzE,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAgBD,eAAO,MAAM,eAAe,GAAU,OAAM,kBAAuB,KAAG,OAAO,CAAC,SAAS,CAStF,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { createRegistry, loadConfig, } from '@agentage/memory-core';
2
+ import { createMemoryServer } from './create-memory-server.js';
3
+ const truthy = (v) => v === '1' || v === 'true' || v === 'yes';
4
+ // Resolve config from the environment first (so `npx` works with no file):
5
+ // AGENTAGE_VAULTS_DIR -> autodiscover every subfolder of that dir as a vault;
6
+ // otherwise -> read ~/.agentage/vaults.json (or the zero-config default).
7
+ const resolveConfig = async (configDir) => {
8
+ const vaultsDir = process.env.AGENTAGE_VAULTS_DIR;
9
+ if (vaultsDir)
10
+ return { version: 1, vaultsDir, autodiscover: true, autoInit: true };
11
+ return loadConfig({ configDir });
12
+ };
13
+ // The whole local stack in one call: resolve config -> registry (memory-core) -> an
14
+ // MCP server over the surfaced vaults. Honors env knobs: AGENTAGE_VAULTS_DIR,
15
+ // AGENTAGE_VAULT (one vault), AGENTAGE_SCOPE (local|remote), AGENTAGE_READONLY.
16
+ export const loadLocalServer = async (opts = {}) => {
17
+ const config = await resolveConfig(opts.configDir);
18
+ const registry = await createRegistry(config);
19
+ const scope = process.env.AGENTAGE_SCOPE || 'local';
20
+ return createMemoryServer(registry, {
21
+ scope,
22
+ readOnly: truthy(process.env.AGENTAGE_READONLY),
23
+ only: process.env.AGENTAGE_VAULT || undefined,
24
+ });
25
+ };
26
+ //# sourceMappingURL=local-server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-server.js","sourceRoot":"","sources":["../../src/server/local-server.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,UAAU,GAGX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAM/D,MAAM,MAAM,GAAG,CAAC,CAAqB,EAAW,EAAE,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,MAAM,IAAI,CAAC,KAAK,KAAK,CAAC;AAE5F,2EAA2E;AAC3E,gFAAgF;AAChF,sFAAsF;AACtF,MAAM,aAAa,GAAG,KAAK,EAAE,SAAkB,EAAyB,EAAE;IACxE,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC;IAClD,IAAI,SAAS;QAAE,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACpF,OAAO,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;AACnC,CAAC,CAAC;AAEF,oFAAoF;AACpF,8EAA8E;AAC9E,gFAAgF;AAChF,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAAE,OAA2B,EAAE,EAAsB,EAAE;IACzF,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACnD,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,MAAM,CAAC,CAAC;IAC9C,MAAM,KAAK,GAAI,OAAO,CAAC,GAAG,CAAC,cAA2B,IAAI,OAAO,CAAC;IAClE,OAAO,kBAAkB,CAAC,QAAQ,EAAE;QAClC,KAAK;QACL,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;QAC/C,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,SAAS;KAC9C,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ export interface MemoryToolDef {
3
+ name: string;
4
+ title: string;
5
+ description: string;
6
+ annotations: {
7
+ readOnlyHint: boolean;
8
+ destructiveHint: boolean;
9
+ openWorldHint: boolean;
10
+ idempotentHint?: boolean;
11
+ };
12
+ input: z.ZodRawShape;
13
+ output: z.ZodRawShape;
14
+ }
15
+ export declare const MEMORY_TOOLS: readonly MemoryToolDef[];
16
+ //# sourceMappingURL=memory-tools.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-tools.schema.d.ts","sourceRoot":"","sources":["../../src/server/memory-tools.schema.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAkLxB,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE;QACX,YAAY,EAAE,OAAO,CAAC;QACtB,eAAe,EAAE,OAAO,CAAC;QACzB,aAAa,EAAE,OAAO,CAAC;QACvB,cAAc,CAAC,EAAE,OAAO,CAAC;KAC1B,CAAC;IACF,KAAK,EAAE,CAAC,CAAC,WAAW,CAAC;IACrB,MAAM,EAAE,CAAC,CAAC,WAAW,CAAC;CACvB;AAED,eAAO,MAAM,YAAY,EAAE,SAAS,aAAa,EAsEvC,CAAC"}
@@ -0,0 +1,205 @@
1
+ // The frozen 6-tool surface. Changing any tool name or shape is a breaking change to
2
+ // the MCP contract, guarded by the .mcpc.json snapshot test. Descriptions are
3
+ // multi-sentence and cross-model-tuned; input param keys stay snake_case.
4
+ import { z } from 'zod';
5
+ const pathField = z
6
+ .string()
7
+ .trim()
8
+ .min(1)
9
+ .max(1024)
10
+ .describe('Exact POSIX .md address - not a title or search query. Case-sensitive, no leading slash. e.g. work/tasks/foo.md');
11
+ const limitField = z
12
+ .number()
13
+ .int()
14
+ .min(1)
15
+ .max(50)
16
+ .describe('Optional. Max results in this page; defaults to 20, capped at 50.')
17
+ .optional();
18
+ const cursorField = z
19
+ .string()
20
+ .min(1)
21
+ .describe("Opaque pagination token - pass the previous response's nextCursor here verbatim for the next page. Omit for the first page; never construct or edit it.")
22
+ .optional();
23
+ const folderField = z
24
+ .string()
25
+ .trim()
26
+ .max(1024)
27
+ .describe('Folder, POSIX, no leading slash (trailing slash optional), e.g. work/tasks. Matches that folder only - not a string prefix. Omit = whole memory')
28
+ .optional();
29
+ const tagsField = z
30
+ .array(z.string().trim().min(1).max(128))
31
+ .max(50)
32
+ .describe('Tags to filter by (frontmatter tags: or inline #tag), AND-matched (all must be present), case-sensitive, bare without #. e.g. [project, active]. Omit = no tag filter')
33
+ .optional();
34
+ const frontmatterField = z
35
+ .record(z.string(), z.unknown())
36
+ .describe('YAML metadata as a key->value map (no --- fences), e.g. {"type":"task","status":"active","tags":["project"]}. write replaces the whole map; edit shallow-merges top-level keys (nested values replaced wholesale; a key cannot be removed via edit - use write to fully replace)')
37
+ .optional();
38
+ const searchInput = {
39
+ query: z
40
+ .string()
41
+ .trim()
42
+ .min(1)
43
+ .describe('Literal text to find (case-insensitive). Matched as ONE exact substring across titles/bodies/tags - not semantic, not split into words - so a multi-word query matches only that exact phrase; search a SINGLE distinctive keyword. e.g. pkce'),
44
+ folder: folderField,
45
+ tags: tagsField,
46
+ limit: limitField,
47
+ cursor: cursorField,
48
+ };
49
+ const searchOutput = {
50
+ results: z.array(z.object({
51
+ path: z.string(),
52
+ title: z.string(),
53
+ snippet: z.string(),
54
+ score: z.number(),
55
+ updated: z.string(),
56
+ })),
57
+ nextCursor: z.string().optional(),
58
+ };
59
+ const readInput = { path: pathField };
60
+ const readOutput = {
61
+ path: z.string(),
62
+ title: z.string(),
63
+ frontmatter: z.record(z.string(), z.unknown()),
64
+ body: z.string(),
65
+ tags: z.array(z.string()),
66
+ updated: z.string(),
67
+ deleted: z.boolean(),
68
+ };
69
+ const listInput = {
70
+ folder: folderField,
71
+ depth: z
72
+ .number()
73
+ .int()
74
+ .min(1)
75
+ .max(2)
76
+ .describe('Optional. 1 = direct children of the folder only; 2 (default) = also expand each subfolder one more level.')
77
+ .optional(),
78
+ tags: tagsField,
79
+ };
80
+ const treeFileSchema = z.object({
81
+ type: z.literal('file'),
82
+ path: z.string(),
83
+ title: z.string(),
84
+ updated: z.string(),
85
+ });
86
+ const treeSubfolderSchema = z.object({
87
+ type: z.literal('folder'),
88
+ path: z.string(),
89
+ files: z.number().describe('Recursive file count inside this folder'),
90
+ truncated: z
91
+ .boolean()
92
+ .describe('True = this folder was NOT expanded (over the per-folder entry limit or the response budget); call memory__list with this folder path to see inside')
93
+ .optional(),
94
+ });
95
+ const treeFolderSchema = treeSubfolderSchema.extend({
96
+ entries: z
97
+ .array(z.discriminatedUnion('type', [treeFileSchema, treeSubfolderSchema]))
98
+ .describe('Direct children, present when this folder is expanded (within depth and limits)')
99
+ .optional(),
100
+ });
101
+ const listOutput = {
102
+ folder: z.string().describe('The browsed folder, normalized; empty = memory root'),
103
+ entries: z.array(z.discriminatedUnion('type', [treeFileSchema, treeFolderSchema])),
104
+ truncated: z
105
+ .boolean()
106
+ .describe('True = something was omitted anywhere in this response (a folder over the per-folder limit, or the response budget); narrow with a subfolder or memory__search'),
107
+ files: z.number().describe('Total files under the browsed folder (after the tags filter)'),
108
+ };
109
+ const writeInput = {
110
+ path: pathField,
111
+ body: z
112
+ .string()
113
+ .describe('The complete Markdown body, excluding frontmatter (no --- fences). write overwrites the entire existing body.'),
114
+ frontmatter: frontmatterField,
115
+ };
116
+ const writeOutput = { path: z.string(), updated: z.string() };
117
+ const editInput = {
118
+ path: pathField,
119
+ body: z
120
+ .string()
121
+ .describe('Markdown body, excluding frontmatter (no --- fences). With mode=replace it becomes the new body; with mode=append it is added to the end. Not used with mode=str_replace. Omit to change only frontmatter.')
122
+ .optional(),
123
+ frontmatter: frontmatterField,
124
+ mode: z
125
+ .enum(['replace', 'append', 'str_replace'])
126
+ .describe('Optional. "str_replace" swaps old_str for new_str in place; "append" adds body to the end; omit or "replace" overwrites the whole body. Frontmatter always shallow-merges regardless.')
127
+ .optional(),
128
+ old_str: z
129
+ .string()
130
+ .min(1)
131
+ .describe('mode=str_replace only. The exact existing body text to replace - must match verbatim (including whitespace) and appear exactly once. Read the memory first to copy it.')
132
+ .optional(),
133
+ new_str: z
134
+ .string()
135
+ .describe('mode=str_replace only. The replacement text. Omit to delete old_str.')
136
+ .optional(),
137
+ };
138
+ const deleteInput = { path: pathField };
139
+ const deleteOutput = { path: z.string(), deleted: z.literal(true) };
140
+ export const MEMORY_TOOLS = [
141
+ {
142
+ name: 'memory__search',
143
+ title: 'Search memory',
144
+ description: 'Find memories by literal text, ranked by match count. Matches the query as ONE case-insensitive substring (not semantic, not tokenized) across titles/bodies/tags - so search a SINGLE keyword, not a phrase. Returns path+snippet+score (score = number of matches, not a relevance %), never full bodies. Use when you have a keyword to rank by; to browse the folder tree instead, use memory__list. Zero hits? try a synonym.',
145
+ annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false },
146
+ input: searchInput,
147
+ output: searchOutput,
148
+ },
149
+ {
150
+ name: 'memory__read',
151
+ title: 'Read memory',
152
+ description: 'Read ONE memory by its exact path: returns full frontmatter + body. Use a path you got from memory__search/list, a prior write/edit, or the user - do not invent or guess one from a title. No known path? use memory__search first.',
153
+ annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false },
154
+ input: readInput,
155
+ output: readOutput,
156
+ },
157
+ {
158
+ name: 'memory__list',
159
+ title: 'Browse memory',
160
+ description: 'Browse the memory as a folder tree: the files and subfolders under a folder, 2 levels deep by default, with per-folder file counts - no bodies, no ranking. Use to see what exists and how it is organized, or to list every note carrying a tag (tags filter); have a keyword to rank by instead? use memory__search. A folder shown without its own entries has more inside: call memory__list again with that folder. Folders over the per-folder entry limit are flagged truncated and not expanded - browse them directly or narrow with memory__search.',
161
+ annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false },
162
+ input: listInput,
163
+ output: listOutput,
164
+ },
165
+ {
166
+ name: 'memory__write',
167
+ title: 'Write memory',
168
+ description: 'Create a NEW memory or fully OVERWRITE an existing one at path - replaces the entire body and frontmatter (idempotent; the saved memory persists for every AI). Use when you have the complete final content. To change only part of an existing memory, use memory__edit. Store durable knowledge and notes only - never secrets, passwords, API keys, one-time codes, or payment/government identifiers (these are refused).',
169
+ annotations: {
170
+ readOnlyHint: false,
171
+ destructiveHint: false,
172
+ idempotentHint: true,
173
+ openWorldHint: false,
174
+ },
175
+ input: writeInput,
176
+ output: writeOutput,
177
+ },
178
+ {
179
+ name: 'memory__edit',
180
+ title: 'Edit memory',
181
+ description: 'Amend an EXISTING memory in place: mode=str_replace swaps one exact text match (old_str -> new_str) without resending the note - the default choice for small changes; append adds to the end; replace overwrites the whole body; frontmatter shallow-merges. Fails with not-found if the path does not exist - use memory__write to create. Do not introduce secrets, passwords, API keys, one-time codes, or payment/government identifiers (these are refused).',
182
+ annotations: {
183
+ readOnlyHint: false,
184
+ destructiveHint: false,
185
+ idempotentHint: false,
186
+ openWorldHint: false,
187
+ },
188
+ input: editInput,
189
+ output: writeOutput,
190
+ },
191
+ {
192
+ name: 'memory__delete',
193
+ title: 'Delete memory',
194
+ description: 'Soft-delete (forget) a memory by path; recoverable from git history. Returns not-found if the path does not exist. To remove only part of a memory, use memory__edit.',
195
+ annotations: {
196
+ readOnlyHint: false,
197
+ destructiveHint: true,
198
+ idempotentHint: false,
199
+ openWorldHint: false,
200
+ },
201
+ input: deleteInput,
202
+ output: deleteOutput,
203
+ },
204
+ ];
205
+ //# sourceMappingURL=memory-tools.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-tools.schema.js","sourceRoot":"","sources":["../../src/server/memory-tools.schema.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,8EAA8E;AAC9E,0EAA0E;AAE1E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,SAAS,GAAG,CAAC;KAChB,MAAM,EAAE;KACR,IAAI,EAAE;KACN,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,IAAI,CAAC;KACT,QAAQ,CACP,iHAAiH,CAClH,CAAC;AACJ,MAAM,UAAU,GAAG,CAAC;KACjB,MAAM,EAAE;KACR,GAAG,EAAE;KACL,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,EAAE,CAAC;KACP,QAAQ,CAAC,mEAAmE,CAAC;KAC7E,QAAQ,EAAE,CAAC;AACd,MAAM,WAAW,GAAG,CAAC;KAClB,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,QAAQ,CACP,yJAAyJ,CAC1J;KACA,QAAQ,EAAE,CAAC;AACd,MAAM,WAAW,GAAG,CAAC;KAClB,MAAM,EAAE;KACR,IAAI,EAAE;KACN,GAAG,CAAC,IAAI,CAAC;KACT,QAAQ,CACP,iJAAiJ,CAClJ;KACA,QAAQ,EAAE,CAAC;AACd,MAAM,SAAS,GAAG,CAAC;KAChB,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;KACxC,GAAG,CAAC,EAAE,CAAC;KAC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Ac,EAAE,KAAK;YACrB,aAAa,EAAE,KAAK;SACrB;QACD,KAAK,EAAE,SAAS;QAChB,MAAM,EAAE,WAAW;KACpB;IACD;QACE,IAAI,EAAE,gBAAgB;QACtB,KAAK,EAAE,eAAe;QACtB,WAAW,EACT,uKAAuK;QACzK,WAAW,EAAE;YACX,YAAY,EAAE,KAAK;YACnB,eAAe,EAAE,IAAI;YACrB,cAAc,EAAE,KAAK;YACrB,aAAa,EAAE,KAAK;SACrB;QACD,KAAK,EAAE,WAAW;QAClB,MAAM,EAAE,YAAY;KACrB;CACO,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import { type Router } from '@agentage/memory-core';
3
+ export interface RegisterOptions {
4
+ readOnly?: boolean;
5
+ }
6
+ export declare const registerTools: (server: McpServer, router: Router, opts?: RegisterOptions) => void;
7
+ //# sourceMappingURL=register-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-tools.d.ts","sourceRoot":"","sources":["../../src/server/register-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,EAIL,KAAK,MAAM,EAGZ,MAAM,uBAAuB,CAAC;AA+C/B,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAKD,eAAO,MAAM,aAAa,GACxB,QAAQ,SAAS,EACjB,QAAQ,MAAM,EACd,OAAM,eAAoB,KACzB,IAqEF,CAAC"}
@@ -0,0 +1,90 @@
1
+ import { UnknownVaultError, } from '@agentage/memory-core';
2
+ import { MEMORY_TOOLS } from './memory-tools.schema.js';
3
+ import { renderDelete, renderEdit, renderList, renderRead, renderSearch, renderWrite, } from './render-markdown.js';
4
+ const byName = new Map(MEMORY_TOOLS.map((t) => [t.name, t]));
5
+ const toolConfig = (name) => {
6
+ const def = byName.get(name);
7
+ if (!def)
8
+ throw new Error(`unknown tool: ${name}`);
9
+ return {
10
+ title: def.title,
11
+ description: def.description,
12
+ inputSchema: def.input,
13
+ outputSchema: def.output,
14
+ annotations: def.annotations,
15
+ };
16
+ };
17
+ const ok = (data, text) => ({
18
+ content: [{ type: 'text', text }],
19
+ structuredContent: data,
20
+ });
21
+ const isError = (text) => ({
22
+ content: [{ type: 'text', text }],
23
+ isError: true,
24
+ });
25
+ const notFound = (path, hint = 'Use memory__search to find the right path, or memory__list to browse.') => isError(`No memory at path "${path}". ${hint}`);
26
+ // Map an UnknownVaultError to a tool error; let other throws propagate to the SDK.
27
+ const guard = async (fn) => {
28
+ try {
29
+ return await fn();
30
+ }
31
+ catch (e) {
32
+ if (e instanceof UnknownVaultError)
33
+ return isError(e.message);
34
+ throw e;
35
+ }
36
+ };
37
+ // Register the frozen 6-tool surface onto the federated router. write/edit return
38
+ // {path,updated} (the commit SHA is internal, stripped); errors surface as isError.
39
+ // With readOnly, only search/read/list are registered.
40
+ export const registerTools = (server, router, opts = {}) => {
41
+ server.registerTool('memory__search', toolConfig('memory__search'), (args) => guard(async () => {
42
+ const query = args;
43
+ const result = await router.search(query);
44
+ return ok(result, renderSearch(query, result));
45
+ }));
46
+ server.registerTool('memory__read', toolConfig('memory__read'), (args) => guard(async () => {
47
+ const { path } = args;
48
+ const view = await router.read(path);
49
+ return view ? ok(view, renderRead(view)) : notFound(path);
50
+ }));
51
+ server.registerTool('memory__list', toolConfig('memory__list'), (args) => guard(async () => {
52
+ const query = args;
53
+ const result = await router.list(query);
54
+ return ok(result, renderList(query, result));
55
+ }));
56
+ if (opts.readOnly)
57
+ return;
58
+ server.registerTool('memory__write', toolConfig('memory__write'), (args) => guard(async () => {
59
+ const input = args;
60
+ const r = await router.write(input);
61
+ const view = { path: r.path, updated: r.updated };
62
+ return ok(view, renderWrite(view));
63
+ }));
64
+ server.registerTool('memory__edit', toolConfig('memory__edit'), (args) => guard(async () => {
65
+ const input = args;
66
+ if (input.mode === 'str_replace') {
67
+ if (!input.old_str)
68
+ return isError('mode=str_replace needs old_str: the exact body text to replace. Add new_str for the replacement, or omit it to delete old_str.');
69
+ if (input.body !== undefined)
70
+ return isError('mode=str_replace edits in place via old_str/new_str - do not send body. Use mode=replace to overwrite the whole body.');
71
+ }
72
+ else if (input.old_str !== undefined || input.new_str !== undefined) {
73
+ return isError('old_str/new_str work only with mode="str_replace".');
74
+ }
75
+ else if (input.body === undefined && input.frontmatter === undefined) {
76
+ return isError('memory__edit needs a change: provide body (with mode) and/or frontmatter. To create a new memory, use memory__write.');
77
+ }
78
+ const r = await router.edit({ ...input, mode: input.mode ?? 'replace' });
79
+ if (!r)
80
+ return notFound(input.path, 'Use memory__write to create it.');
81
+ const view = { path: r.path, updated: r.updated };
82
+ return ok(view, renderEdit(view));
83
+ }));
84
+ server.registerTool('memory__delete', toolConfig('memory__delete'), (args) => guard(async () => {
85
+ const { path } = args;
86
+ const deleted = await router.delete(path);
87
+ return deleted ? ok({ path, deleted: true }, renderDelete(path)) : notFound(path);
88
+ }));
89
+ };
90
+ //# sourceMappingURL=register-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-tools.js","sourceRoot":"","sources":["../../src/server/register-tools.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,iBAAiB,GAMlB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EACL,YAAY,EACZ,UAAU,EACV,UAAU,EACV,UAAU,EACV,YAAY,EACZ,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAE9B,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7D,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,EAAE;IAClC,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAA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AI,IAAI,SAAS,EAAE,CAAC,CAAC;QACzE,IAAI,CAAC,CAAC;YAAE,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,iCAAiC,CAAC,CAAC;QACvE,MAAM,IAAI,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;QAClD,OAAO,EAAE,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;IACpC,CAAC,CAAC,CACH,CAAC;IAEF,MAAM,CAAC,YAAY,CAAC,gBAAgB,EAAE,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAC3E,KAAK,CAAC,KAAK,IAAI,EAAE;QACf,MAAM,EAAE,IAAI,EAAE,GAAG,IAAwB,CAAC;QAC1C,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC1C,OAAO,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACpF,CAAC,CAAC,CACH,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { type ListQuery, type ListResult, type MemoryView, type SearchQuery, type SearchResult, type WriteResult } from '@agentage/memory-core';
2
+ export declare const renderSearch: (q: SearchQuery, result: SearchResult) => string;
3
+ export declare const renderList: (q: ListQuery, result: ListResult) => string;
4
+ export declare const renderRead: (view: MemoryView) => string;
5
+ export declare const renderWrite: (r: Pick<WriteResult, "path" | "updated">) => string;
6
+ export declare const renderEdit: (r: Pick<WriteResult, "path" | "updated">) => string;
7
+ export declare const renderDelete: (path: string) => string;
8
+ //# sourceMappingURL=render-markdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-markdown.d.ts","sourceRoot":"","sources":["../../src/server/render-markdown.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,YAAY,EAGjB,KAAK,WAAW,EACjB,MAAM,uBAAuB,CAAC;AAmB/B,eAAO,MAAM,YAAY,GAAI,GAAG,WAAW,EAAE,QAAQ,YAAY,KAAG,MAOnE,CAAC;AAIF,eAAO,MAAM,UAAU,GAAI,GAAG,SAAS,EAAE,QAAQ,UAAU,KAAG,MAqC7D,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,MAAM,UAAU,KAAG,MAGzC,CAAC;AAEN,eAAO,MAAM,WAAW,GAAI,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC,KAAG,MACgC,CAAC;AAExG,eAAO,MAAM,UAAU,GAAI,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC,KAAG,MACtB,CAAC;AAEjD,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,KAAG,MAC2D,CAAC"}
@@ -0,0 +1,56 @@
1
+ // The model reads content[].text; we render lean per-tool markdown there (never a
2
+ // JSON dump) while structuredContent carries the typed object.
3
+ import { serializeDoc, } from '@agentage/memory-core';
4
+ const UNSAFE_RANGES = [
5
+ [0x200b, 0x200d],
6
+ [0xfeff, 0xfeff],
7
+ [0x202a, 0x202e],
8
+ [0x2066, 0x2069],
9
+ ];
10
+ const hex = (n) => `\\u${n.toString(16).padStart(4, '0')}`;
11
+ const UNSAFE_CHARS = new RegExp(`[${UNSAFE_RANGES.map(([a, b]) => `${hex(a)}-${hex(b)}`).join('')}]`, 'g');
12
+ const sanitize = (s) => s.replace(/<!--[\s\S]*?-->/g, '').replace(UNSAFE_CHARS, '');
13
+ const moreLine = (tool, cursor) => cursor ? `\n\nMore: call ${tool} again with cursor \`${cursor}\`` : '';
14
+ export const renderSearch = (q, result) => {
15
+ if (!result.results.length)
16
+ return `No memories matched "${sanitize(q.query)}".`;
17
+ const rows = result.results.map((h, i) => `${i + 1}. **${sanitize(h.title)}** — \`${h.path}\` · score ${h.score} · updated ${h.updated}\n ${sanitize(h.snippet)}`);
18
+ return `Found ${result.results.length} memories for "${sanitize(q.query)}":\n\n${rows.join('\n')}${moreLine('memory__search', result.nextCursor)}`;
19
+ };
20
+ const count = (n, one, many) => `${n} ${n === 1 ? one : many}`;
21
+ export const renderList = (q, result) => {
22
+ const scope = [
23
+ q.tags?.length ? ` tagged \`${q.tags.join(', ')}\`` : '',
24
+ q.folder ? ` under \`${q.folder}\`` : '',
25
+ ].join('');
26
+ if (!result.entries.length)
27
+ return `No memories${scope || ' in this memory'}.`;
28
+ const name = (path) => path.slice(path.lastIndexOf('/') + 1);
29
+ const fileLine = (f) => `- ${name(f.path)} · ${f.updated.slice(0, 10)}`;
30
+ const stubLine = (f) => `- ${name(f.path)}/ · ${count(f.files, 'file', 'files')} (${f.truncated ? 'too many entries to expand' : 'not expanded'} - list \`${f.path}\`)`;
31
+ const loose = [];
32
+ const sections = [];
33
+ for (const e of result.entries) {
34
+ if (e.type === 'file')
35
+ loose.push(fileLine(e));
36
+ else if (!e.entries)
37
+ loose.push(stubLine(e));
38
+ else
39
+ sections.push([
40
+ `**${e.path}/** · ${count(e.files, 'file', 'files')}`,
41
+ ...e.entries.map((c) => (c.type === 'file' ? fileLine(c) : stubLine(c))),
42
+ ].join('\n'));
43
+ }
44
+ const folders = result.entries.filter((e) => e.type === 'folder').length;
45
+ const head = `${count(result.files, 'memory', 'memories')}${scope}${folders ? ` · ${count(folders, 'folder', 'folders')}` : ''}`;
46
+ const blocks = [loose.join('\n'), ...sections].filter(Boolean);
47
+ const note = result.truncated
48
+ ? '\n\nSome entries were omitted (per-folder limit): list a subfolder directly or use memory__search.'
49
+ : '';
50
+ return `${head}\n\n${blocks.join('\n\n')}${note}`;
51
+ };
52
+ export const renderRead = (view) => `${view.deleted ? '(soft-deleted - recoverable)\n\n' : ''}${sanitize(serializeDoc(view.frontmatter, view.body))}`;
53
+ export const renderWrite = (r) => `Wrote \`${r.path}\` (updated ${r.updated}). To change part of it, call memory__edit with this path.`;
54
+ export const renderEdit = (r) => `Edited \`${r.path}\` (updated ${r.updated}).`;
55
+ export const renderDelete = (path) => `Deleted \`${path}\` (soft-delete, recoverable). Recreate with memory__write if this was unintended.`;
56
+ //# sourceMappingURL=render-markdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-markdown.js","sourceRoot":"","sources":["../../src/server/render-markdown.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,+DAA+D;AAE/D,OAAO,EACL,YAAY,GASb,MAAM,uBAAuB,CAAC;AAE/B,MAAM,aAAa,GAAoC;IACrD,CAAC,MAAM,EAAE,MAAM,CAAC;IAChB,CAAC,MAAM,EAAE,MAAM,CAAC;IAChB,CAAC,MAAM,EAAE,MAAM,CAAC;IAChB,CAAC,MAAM,EAAE,MAAM,CAAC;CACjB,CAAC;AACF,MAAM,GAAG,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;AAC3E,MAAM,YAAY,GAAG,IAAI,MAAM,CAC7B,IAAI,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,EACpE,GAAG,CACJ,CAAC;AAEF,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAEpG,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,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QAAQ,CAClE,YAAY,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,CAC1C,EAAE,CAAC;AAEN,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAwC,EAAU,EAAE,CAC9E,WAAW,CAAC,CAAC,IAAI,eAAe,CAAC,CAAC,OAAO,4DAA4D,CAAC;AAExG,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAwC,EAAU,EAAE,CAC7E,YAAY,CAAC,CAAC,IAAI,eAAe,CAAC,CAAC,OAAO,IAAI,CAAC;AAEjD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAY,EAAU,EAAE,CACnD,aAAa,IAAI,oFAAoF,CAAC"}
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "@agentage/server-memory",
3
+ "version": "0.0.2",
4
+ "description": "The agentage Memory MCP server: exposes your local vaults as the frozen 6 memory__* tools over stdio. The open, cross-vendor counterpart to @modelcontextprotocol/server-memory.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/agentage/server-memory.git"
10
+ },
11
+ "main": "dist/index.js",
12
+ "types": "dist/index.d.ts",
13
+ "exports": {
14
+ ".": "./dist/index.js"
15
+ },
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "bin": {
20
+ "agentage-server-memory": "dist/bin/server-memory.js"
21
+ },
22
+ "files": [
23
+ "dist"
24
+ ],
25
+ "engines": {
26
+ "node": ">=22.0.0",
27
+ "npm": ">=10.0.0"
28
+ },
29
+ "scripts": {
30
+ "build": "tsc -p tsconfig.build.json",
31
+ "type-check": "tsc --noEmit",
32
+ "lint": "eslint src test",
33
+ "lint:fix": "eslint src test --fix",
34
+ "format": "prettier --write \"{src,test}/**/*.ts\"",
35
+ "format:check": "prettier --check \"{src,test}/**/*.ts\"",
36
+ "test": "vitest run",
37
+ "test:watch": "vitest",
38
+ "test:coverage": "vitest run --coverage",
39
+ "clean": "rm -rf dist *.tsbuildinfo coverage",
40
+ "verify": "npm run type-check && npm run lint && npm run format:check && npm run test && npm run build",
41
+ "prepublishOnly": "npm run verify"
42
+ },
43
+ "dependencies": {
44
+ "@agentage/memory-core": "^0.1.0",
45
+ "@modelcontextprotocol/sdk": "^1.29.0",
46
+ "zod": "^4.4.3"
47
+ },
48
+ "devDependencies": {
49
+ "@types/node": "^22.10.0",
50
+ "@typescript-eslint/eslint-plugin": "^8.18.0",
51
+ "@typescript-eslint/parser": "^8.18.0",
52
+ "@vitest/coverage-v8": "^2.1.8",
53
+ "eslint": "^9.17.0",
54
+ "eslint-config-prettier": "^9.1.0",
55
+ "eslint-plugin-prettier": "^5.2.1",
56
+ "prettier": "^3.4.2",
57
+ "typescript": "^5.7.2",
58
+ "vitest": "^2.1.8"
59
+ }
60
+ }