@mnemoverse/mcp-memory-server 0.11.0 → 0.12.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/README.md +26 -4
- package/dist/errors.d.ts +90 -7
- package/dist/errors.js +311 -51
- package/dist/errors.js.map +1 -1
- package/dist/names.d.ts +34 -4
- package/dist/names.js +50 -10
- package/dist/names.js.map +1 -1
- package/dist/render.d.ts +69 -7
- package/dist/render.js +97 -14
- package/dist/render.js.map +1 -1
- package/dist/requests.d.ts +34 -3
- package/dist/requests.js +12 -3
- package/dist/requests.js.map +1 -1
- package/dist/resources.js +5 -2
- package/dist/resources.js.map +1 -1
- package/dist/shared.d.ts +23 -2
- package/dist/shared.js +21 -1
- package/dist/shared.js.map +1 -1
- package/dist/tools.d.ts +64 -1
- package/dist/tools.js +638 -116
- package/dist/tools.js.map +1 -1
- package/package.json +1 -1
package/dist/shared.js
CHANGED
|
@@ -23,8 +23,28 @@
|
|
|
23
23
|
* `apiFetch` is the server's own way to reach the API (credential, base URL,
|
|
24
24
|
* transport). Its contract is on the `ApiFetch` type: reject with `ApiError`,
|
|
25
25
|
* `NetworkError` or `UnreadableBodyError`, because the tools branch on which.
|
|
26
|
+
*
|
|
27
|
+
* `MAX_RESULT_CHARS` and `capResult` are the tool-result size cap and the
|
|
28
|
+
* helper that applies it: 96,000 characters (24,000 tokens), the one bound
|
|
29
|
+
* both servers use for a tool result's text (`structuredContent` is not
|
|
30
|
+
* capped, OD-11). ADR-025 makes this the single source of truth for the
|
|
31
|
+
* number; the hosted connector still keeps its own 25,000-character literal
|
|
32
|
+
* (`src/constants.ts`) and adopts this export in its place at a later step,
|
|
33
|
+
* not yet done as of this release. `capResult` truncates on a code-point
|
|
34
|
+
* boundary (never inside a UTF-16 surrogate pair) and appends the truncation notice, so a consumer does
|
|
35
|
+
* not have to re-implement a `slice` that can cut a surrogate pair.
|
|
36
|
+
*
|
|
37
|
+
* `MemoryToolDeps.wording` and `.writeAuthor` (STEP4-2/3/5, owner
|
|
38
|
+
* 2026-09-24) are how a SECOND server registering these tools (the hosted
|
|
39
|
+
* connector is the first consumer) speaks in its own voice: `wording`
|
|
40
|
+
* swaps "this server" for "this connector" in the three descriptions that
|
|
41
|
+
* name it and, under `auth: "oauth"`, rewords every 401/403 explanation for
|
|
42
|
+
* a user who never sees an API key; `writeAuthor` lets a supplier vouch for
|
|
43
|
+
* the end user behind a write (core: `_get_provenance`, honoured only for a
|
|
44
|
+
* SERVICE/supplier caller). Both are optional, and absent, reproduce this
|
|
45
|
+
* package's existing behaviour exactly. Full contract: docs/shared.md.
|
|
26
46
|
*/
|
|
27
|
-
export { registerMemoryTools } from "./tools.js";
|
|
47
|
+
export { registerMemoryTools, MAX_RESULT_CHARS, capResult, } from "./tools.js";
|
|
28
48
|
export { registerMemoryPrompts } from "./prompts.js";
|
|
29
49
|
export { registerMemoryResources } from "./resources.js";
|
|
30
50
|
export { SERVER_INSTRUCTIONS } from "./teaching.js";
|
package/dist/shared.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,SAAS,GAGV,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,mBAAmB,GAKpB,MAAM,aAAa,CAAC"}
|
package/dist/tools.d.ts
CHANGED
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
* or the environment.
|
|
13
13
|
*/
|
|
14
14
|
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
15
|
+
import { type WriteAuthor } from "./requests.js";
|
|
16
|
+
import { type Wording } from "./errors.js";
|
|
15
17
|
/**
|
|
16
18
|
* How the tools reach the Mnemoverse API: send `path` (relative to the API base,
|
|
17
19
|
* e.g. "/memory/read") and resolve to the parsed JSON body.
|
|
@@ -24,10 +26,71 @@ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
24
26
|
* src/errors.ts. `options.signal` must be honoured.
|
|
25
27
|
*/
|
|
26
28
|
export type ApiFetch = <T = unknown>(path: string, options?: RequestInit) => Promise<T>;
|
|
27
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* `deps.apiFetch` with `deps.wording` applied to what it throws (STEP4-2):
|
|
31
|
+
* every rejection passes through {@link rewordFailure}, so an `ApiError`,
|
|
32
|
+
* `NetworkError` or `UnreadableBodyError` the consumer built with no
|
|
33
|
+
* `wording` (or with a different one) reaches the model explained under the
|
|
34
|
+
* wording this registration was given. Results and every other rejection
|
|
35
|
+
* pass through untouched. Installed only when `wording` is supplied at all:
|
|
36
|
+
* the stdio server supplies none, and its `apiFetch` is used exactly as
|
|
37
|
+
* before.
|
|
38
|
+
*/
|
|
39
|
+
export declare function wordedApiFetch(inner: ApiFetch, wording: Wording): ApiFetch;
|
|
40
|
+
/**
|
|
41
|
+
* What a server supplies when it registers the memory tools.
|
|
42
|
+
*
|
|
43
|
+
* `wording` and `writeAuthor` (STEP4-2/3/5, owner decisions 2026-09-24) are
|
|
44
|
+
* both optional, and both default to exactly this server's own behaviour: a
|
|
45
|
+
* consumer that supplies neither gets byte-identical descriptions, error
|
|
46
|
+
* text and write bodies to every release before this one. They exist for a
|
|
47
|
+
* SECOND server registering these same tools (the hosted connector,
|
|
48
|
+
* ADR-025) that needs to say "this connector" instead of "this server",
|
|
49
|
+
* speak to an OAuth user who never sees an API key, and vouch for the
|
|
50
|
+
* end user it is writing on behalf of.
|
|
51
|
+
*/
|
|
28
52
|
export interface MemoryToolDeps {
|
|
29
53
|
apiFetch: ApiFetch;
|
|
54
|
+
/** How this registration wants its own tool descriptions and error
|
|
55
|
+
* explanations worded. See {@link Wording} for each field. Read at
|
|
56
|
+
* registration time for the three descriptions that name the server,
|
|
57
|
+
* and applied to every `ApiError`/`NetworkError`/`UnreadableBodyError`
|
|
58
|
+
* the consumer's `apiFetch` rejects with (see {@link wordedApiFetch}),
|
|
59
|
+
* so the consumer states it once, here. Passing the same value to the
|
|
60
|
+
* error constructors inside `apiFetch` is allowed and changes nothing. */
|
|
61
|
+
wording?: Wording;
|
|
62
|
+
/**
|
|
63
|
+
* Supplier-vouched authorship for `memory_write` (STEP4-5). Called once
|
|
64
|
+
* per write, with no arguments; a returned value is sent as the request
|
|
65
|
+
* body's `author` field EXACTLY as returned (this package applies no
|
|
66
|
+
* normalisation beyond a `typeof` guard; core re-normalises server-side,
|
|
67
|
+
* see {@link WriteAuthor}). Returning `undefined`, or omitting this
|
|
68
|
+
* dependency entirely, sends the body this package has always sent: the
|
|
69
|
+
* stdio server's own requests are exactly this case, and do not change.
|
|
70
|
+
*
|
|
71
|
+
* Core honours `author` ONLY for a SERVICE/supplier caller and IGNORES it
|
|
72
|
+
* for an OIDC end-user (mnemoverse-core src/mnemo/api/routes.py:211-276,
|
|
73
|
+
* `_get_provenance`, verified 2026-09-24), so this dependency is useful
|
|
74
|
+
* only to a server that authenticates to core as a supplier vouching for
|
|
75
|
+
* someone else, not to an end-user's own key.
|
|
76
|
+
*/
|
|
77
|
+
writeAuthor?: () => WriteAuthor | undefined;
|
|
30
78
|
}
|
|
79
|
+
export declare const MAX_RESULT_CHARS: number;
|
|
80
|
+
/**
|
|
81
|
+
* Truncate a result string to MAX_RESULT_CHARS, appending a notice if truncated.
|
|
82
|
+
* Required by Claude Connectors Directory submission policy.
|
|
83
|
+
*
|
|
84
|
+
* Defensive against splitting UTF-16 surrogate pairs: if the character right
|
|
85
|
+
* before the cut point is a high surrogate (U+D800–U+DBFF), drop it so the
|
|
86
|
+
* result stays well-formed. Otherwise an emoji or non-BMP character at the
|
|
87
|
+
* boundary can produce a lone surrogate and corrupt downstream JSON encoding.
|
|
88
|
+
*
|
|
89
|
+
* Exported (re-exported from ./shared) so a consumer applying MAX_RESULT_CHARS
|
|
90
|
+
* to its own tool results does not have to re-implement this code-point-safe
|
|
91
|
+
* truncation as a plain `slice`, which can cut a surrogate pair.
|
|
92
|
+
*/
|
|
93
|
+
export declare function capResult(text: string, moreHint?: string): string;
|
|
31
94
|
/**
|
|
32
95
|
* The sentence behind {@link unreadableAnswerReply}, exported so the memory
|
|
33
96
|
* resource (src/resources.ts) says the same thing about an unreadable answer
|