@engramx/mcp 0.15.0 → 0.16.0-rc.10
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 +118 -32
- package/dist/connect-config.d.ts +27 -2
- package/dist/connect-config.js +32 -8
- package/dist/connect-config.js.map +1 -1
- package/dist/connect.js +3 -1
- package/dist/connect.js.map +1 -1
- package/dist/profile-tools.js +46 -14
- package/dist/profile-tools.js.map +1 -1
- package/dist/resources.js +6 -1
- package/dist/resources.js.map +1 -1
- package/dist/server.js +41 -5
- package/dist/server.js.map +1 -1
- package/dist/tools.d.ts +5 -2
- package/dist/tools.js +161 -45
- package/dist/tools.js.map +1 -1
- package/dist/version.d.ts +4 -0
- package/dist/version.js +40 -0
- package/dist/version.js.map +1 -0
- package/package.json +6 -11
package/README.md
CHANGED
|
@@ -2,10 +2,49 @@
|
|
|
2
2
|
|
|
3
3
|
MCP server for [EngramX](https://engramx.ai) — persistent, decentralized agent memory on the Internet Computer.
|
|
4
4
|
|
|
5
|
+
## Two MCP surfaces — pick the right one first
|
|
6
|
+
|
|
7
|
+
EngramX speaks MCP from two places, and installing the wrong one is the most common first mistake.
|
|
8
|
+
|
|
9
|
+
| | **Remote MCP** (the engram canister itself) | **Local stdio MCP** (this package) |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| Where it runs | On-chain, at the engram's `/mcp` HTTPS endpoint | On the machine the agent runs on, spawned over stdin/stdout |
|
|
12
|
+
| Credential | OAuth 2.1 bearer token, installed once (an agent connected by sign-in) | The Ed25519 key for this engram, on disk (a paired agent) |
|
|
13
|
+
| Install | Nothing to install — point the MCP client at the URL | `npx @engramx/mcp` |
|
|
14
|
+
| Tools | 10 | 19 |
|
|
15
|
+
| Has money tools | No — payment vouchers are signed with a client-held key, which a canister cannot hold ⟨corrected 2026-09-30: no voucher is signed; paying is a ledger approval plus a call made as the buyer's own key, which a canister cannot make on the agent's behalf⟩ | Yes |
|
|
16
|
+
| Docs | [engramx.ai/docs](https://engramx.ai/docs) | this file |
|
|
17
|
+
|
|
18
|
+
**If you just want an MCP client talking to an engram, you probably want the remote surface.** This
|
|
19
|
+
package can print the config for it without starting a server:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npx @engramx/mcp connect --canister xxxxx-xxxxx-xxxxx-xxxxx-xxx
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
That prints the engram's remote MCP URL plus per-client setup for 14 supported MCP clients (11
|
|
26
|
+
remote, 3 stdio). Adding `--write [path]` merges an `mcpServers.engramx` block into
|
|
27
|
+
`claude_desktop_config.json` without clobbering your other servers.
|
|
28
|
+
|
|
29
|
+
> Two things about `--write`, both worth knowing before you use it. The block it writes is the
|
|
30
|
+
> **stdio** server, not the remote URL. And it sets only `ENGRAM_CANISTER_ID` (plus `ENGRAM_HOST`
|
|
31
|
+
> for a non-default host) — **not** `ENGRAM_SESSION_KEY_PATH`. If you paired with a custom
|
|
32
|
+
> `--key-path`, add that variable by hand, or the server will look in `~/.engramx/session.key`, not
|
|
33
|
+
> find a key, and exit.
|
|
34
|
+
|
|
35
|
+
Use **this** stdio server when you need what the remote surface structurally cannot offer: the money
|
|
36
|
+
tools, the profile/session helpers, or a client-held key you control.
|
|
37
|
+
|
|
38
|
+
> **Scopes are a remote-surface concept, and the default is not what most people assume.** A bearer
|
|
39
|
+
> token's permissions come from its OAuth `scope` string alone, and **an omitted or empty scope is
|
|
40
|
+
> READ-ONLY** — `canReadMemory` and nothing else, so every append is refused. A connector that must
|
|
41
|
+
> write has to request `memory.read memory.append` explicitly. None of this applies to the stdio
|
|
42
|
+
> server below, whose permissions come from the agent record behind its key.
|
|
43
|
+
|
|
5
44
|
## Prerequisites
|
|
6
45
|
|
|
7
|
-
- Node.js >= 22.12
|
|
8
|
-
- An engram
|
|
46
|
+
- Node.js >= 22.12 (inherited from `@engramx/client`, which this package depends on)
|
|
47
|
+
- An engram your agent is paired with (the key for this engram, from `npx @engramx/client@0.16.0-rc.10 pair`)
|
|
9
48
|
|
|
10
49
|
## Quick Start
|
|
11
50
|
|
|
@@ -18,7 +57,7 @@ ENGRAM_CANISTER_ID=xxxxx-xxxxx-xxxxx-xxxxx-xxx npx @engramx/mcp
|
|
|
18
57
|
| Variable | Required | Default | Description |
|
|
19
58
|
|----------|----------|---------|-------------|
|
|
20
59
|
| `ENGRAM_CANISTER_ID` | Yes | — | Your engram canister ID |
|
|
21
|
-
| `ENGRAM_SESSION_KEY_PATH` | No | `~/.engramx/session.key` | Path to Ed25519
|
|
60
|
+
| `ENGRAM_SESSION_KEY_PATH` | No | `~/.engramx/session.key` | Path to the Ed25519 key for this engram |
|
|
22
61
|
| `ENGRAM_HOST` | No | `https://ic0.app` | ICP host URL |
|
|
23
62
|
|
|
24
63
|
## Setup: Claude Desktop
|
|
@@ -93,61 +132,108 @@ The server communicates over stdin/stdout using the MCP protocol. Set environmen
|
|
|
93
132
|
|
|
94
133
|
## Available Tools
|
|
95
134
|
|
|
135
|
+
**19 tools in total: 13 core + 6 profile/session helpers.** One catalog defines the 13 core tools
|
|
136
|
+
for both this server and the canister's remote surface, and a check fails if either drifts from it.
|
|
137
|
+
The 6 profile/session helpers are stdio-only. ⟨2026-09-30: this paragraph named the source files
|
|
138
|
+
behind the catalog; the source is private during the beta, so it names none.⟩
|
|
139
|
+
|
|
140
|
+
### Memory and record (free reads; append is the only mutation)
|
|
141
|
+
|
|
96
142
|
| Tool | Parameters | Description |
|
|
97
143
|
|------|-----------|-------------|
|
|
98
|
-
| `engram_read_memory` | `path
|
|
99
|
-
| `engram_append_memory` | `path
|
|
100
|
-
| `engram_list_memory_files` | _(none)_ | List all memory files |
|
|
101
|
-
| `engram_read_memory_batch` | `paths
|
|
102
|
-
| `engram_memory_history` | `path
|
|
103
|
-
| `engram_read_audit_log` | `fromIndex
|
|
104
|
-
| `engram_wallet_balance` | _(none)_ | Engram canister cycles balance (fuel) |
|
|
144
|
+
| `engram_read_memory` | `path` | Read one memory file by exact path — content, version, timestamp |
|
|
145
|
+
| `engram_append_memory` | `path`, `content`, `source?` | Append to a memory file (created if missing). Returns the write receipt `{path, version, seq, head}` — `head` is the audit-chain head this write advanced to, and is what you hand a verifier |
|
|
146
|
+
| `engram_list_memory_files` | _(none)_ | List all memory files (paths, versions, timestamps — no content) |
|
|
147
|
+
| `engram_read_memory_batch` | `paths` | Read up to 50 files in one call; per-file success or error |
|
|
148
|
+
| `engram_memory_history` | `path` | Version history of one file — commitments and eviction disclosures, not content |
|
|
149
|
+
| `engram_read_audit_log` | `fromIndex?`, `limit?` | Read audit-log entries (timestamped, attributed operations) |
|
|
105
150
|
| `engram_status` | _(none)_ | Canister health and stats |
|
|
106
|
-
| `
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
151
|
+
| `engram_wallet_balance` | _(none)_ | Engram canister **cycles** balance — infrastructure fuel, not token money |
|
|
152
|
+
|
|
153
|
+
`source` on append is an optional self-declaration of what produced the content: `human`,
|
|
154
|
+
`agentDerived`, `sessionTranscript`, `fileSync`, or `deterministic`. The canister cannot verify the
|
|
155
|
+
claim; it records it in the record beside your principal, which makes a false one attributable.
|
|
156
|
+
|
|
157
|
+
### ic402 marketplace — three of these MOVE FUNDS
|
|
158
|
+
|
|
159
|
+
| Tool | Parameters | Description |
|
|
160
|
+
|------|-----------|-------------|
|
|
161
|
+
| `engram_list_services` | _(none)_ | List paid services registered on this engram (free read; includes disabled drafts — check `enabled`) |
|
|
162
|
+
| `engram_get_job_result` | `jobId`, `maxAttempts?` | Poll a job every 2s to a terminal status and return it. Free read; moves no funds |
|
|
163
|
+
| `engram_submit_service_request` | `serviceId`, `params` | **SPENDS.** Settles the quoted price into escrow at submit time and creates a job. Never resubmit after success — that pays twice |
|
|
164
|
+
| `engram_confirm_job` | `jobId` | **SPENDS.** Irreversibly releases escrow to the seller (BuyerConfirm services) |
|
|
165
|
+
| `engram_dispute_job` | `jobId`, `reason` | Blocks payout on a completed job instead of releasing it |
|
|
166
|
+
|
|
167
|
+
`engram_list_services` and `engram_get_job_result` also exist on the remote surface. The three
|
|
168
|
+
money tools — `submit_service_request`, `confirm_job`, `dispute_job` — are **stdio-only, and
|
|
169
|
+
structurally so**: submitting signs a payment voucher with the key the agent holds, and the
|
|
170
|
+
canister cannot sign as the buyer.
|
|
171
|
+
|
|
172
|
+
⟨CORRECTED 2026-09-30⟩ Nothing signs a voucher. Submitting approves the marketplace, on the ckUSDC
|
|
173
|
+
ledger, to take exactly the quoted price plus one ledger fee, for five minutes, then sends the
|
|
174
|
+
request with a payment record that names the agent as the one paying, as the agent's own key. The
|
|
175
|
+
marketplace accepts that payment only when the caller is the one it names, so it has to come
|
|
176
|
+
from the key the agent holds — which is why these tools cannot run inside the canister.
|
|
177
|
+
|
|
178
|
+
### Profile and session helpers (stdio only)
|
|
179
|
+
|
|
180
|
+
Convenience wrappers that batch client-side and then route through the same append-only
|
|
181
|
+
`appendMemory` as everything else. They are not extra authority.
|
|
182
|
+
|
|
183
|
+
| Tool | Parameters | Description |
|
|
184
|
+
|------|-----------|-------------|
|
|
185
|
+
| `engram_get_profile` | _(none)_ | Load identity (soul, user, preferences) and accumulated lessons in one call — use at session start |
|
|
186
|
+
| `engram_save_preference` | `preference` | Save a user preference |
|
|
187
|
+
| `engram_save_insight` | `content`, `topic?` | Save a lesson learned, optionally under a topic |
|
|
188
|
+
| `engram_save_decision` | `decision`, `rationale` | Save a decision with its reasoning |
|
|
189
|
+
| `engram_session_summary` | `platform`, `summary` | Save a session summary under a platform label |
|
|
190
|
+
| `engram_read_sessions` | `platform?`, `exclude_platform?`, `limit?` | Read recent session summaries (`limit` 1–20, default 5); filter to a platform, or exclude one to see cross-platform activity |
|
|
110
191
|
|
|
111
192
|
> **Append-only by design.** This server intentionally exposes **no** `write`, `delete`,
|
|
112
|
-
> `rollback`, `transfer`, or `sign` tools.
|
|
193
|
+
> `rollback`, `transfer`, or `sign` tools. Agents get read + append only; full
|
|
113
194
|
> overwrite/delete/rollback, fund movement, and signing are owner-only and not reachable
|
|
114
195
|
> over MCP.
|
|
115
196
|
|
|
197
|
+
**Path contract.** Every memory path is at most **512 characters** and may contain no `..`
|
|
198
|
+
traversal segment. The server pre-validates to fail fast, refusing exactly what the canister
|
|
199
|
+
refuses; `config/` and `secrets/` prefixes are owner-only and are rejected for agents no matter
|
|
200
|
+
what else the credential carries.
|
|
201
|
+
|
|
116
202
|
## Available Resources
|
|
117
203
|
|
|
118
204
|
| URI | Description |
|
|
119
205
|
|-----|-------------|
|
|
120
206
|
| `engram://status` | Canister status as JSON |
|
|
121
207
|
|
|
122
|
-
##
|
|
208
|
+
## Pairing Your Agent (the key for this engram)
|
|
123
209
|
|
|
124
210
|
1. Create an engram at [engramx.ai](https://engramx.ai) or via the CLI
|
|
125
|
-
2. Generate an
|
|
126
|
-
3. Pair your
|
|
211
|
+
2. Generate an agent invite in the engram dashboard
|
|
212
|
+
3. Pair your agent:
|
|
127
213
|
```bash
|
|
128
|
-
engramx pair <invite-code> --engram <canister-id>
|
|
214
|
+
npx @engramx/client@0.16.0-rc.10 pair <invite-code> --engram <canister-id>
|
|
129
215
|
```
|
|
130
|
-
|
|
216
|
+
⟨2026-10-03⟩ Every pairing command in this README names the package and the version it ships
|
|
217
|
+
with. Before, it called the globally installed `engramx` command, which runs whatever version is
|
|
218
|
+
installed; an older one cannot pair with a newer engram.
|
|
219
|
+
4. The key for this engram is saved to `~/.engramx/session.key`
|
|
131
220
|
|
|
132
|
-
See
|
|
221
|
+
See [engramx.ai/docs](https://engramx.ai/docs) for the full flow. The kit is published on npm.
|
|
133
222
|
|
|
134
223
|
## Local Development
|
|
135
224
|
|
|
136
|
-
|
|
137
|
-
git clone https://github.com/engramx/engramx.git
|
|
138
|
-
cd engramx/integrations/mcp
|
|
139
|
-
pnpm install
|
|
140
|
-
pnpm build
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
Test with a local ICP replica:
|
|
225
|
+
Point the published server at a local replica:
|
|
144
226
|
|
|
145
227
|
```bash
|
|
146
228
|
ENGRAM_CANISTER_ID=<local-canister-id> \
|
|
147
229
|
ENGRAM_HOST=http://localhost:4943 \
|
|
148
|
-
|
|
230
|
+
npx @engramx/mcp
|
|
149
231
|
```
|
|
150
232
|
|
|
233
|
+
⟨2026-09-30: this section began with building the server from a clone of its source, and the
|
|
234
|
+
paragraph above linked to the source's repository. The source is private during the beta, so both
|
|
235
|
+
came out; the published package is all you need to run or test the server.⟩
|
|
236
|
+
|
|
151
237
|
Inspect with the MCP Inspector:
|
|
152
238
|
|
|
153
239
|
```bash
|
|
@@ -159,8 +245,8 @@ npx @modelcontextprotocol/inspector -- npx @engramx/mcp
|
|
|
159
245
|
**Missing `ENGRAM_CANISTER_ID`**
|
|
160
246
|
The server exits with a clear error. Set the environment variable to your engram canister ID.
|
|
161
247
|
|
|
162
|
-
**
|
|
163
|
-
Generate one with `engramx pair`. The default path is `~/.engramx/session.key`. Override with `ENGRAM_SESSION_KEY_PATH`.
|
|
248
|
+
**The key for this engram was not found**
|
|
249
|
+
Generate one with `npx @engramx/client@0.16.0-rc.10 pair`. The default path is `~/.engramx/session.key`. Override with `ENGRAM_SESSION_KEY_PATH`.
|
|
164
250
|
|
|
165
251
|
**Canister unreachable**
|
|
166
252
|
Check that `ENGRAM_HOST` is correct (default: `https://ic0.app` for mainnet). For local development, use `http://localhost:4943`. Verify network connectivity.
|
package/dist/connect-config.d.ts
CHANGED
|
@@ -4,6 +4,31 @@ export interface ConnectParams {
|
|
|
4
4
|
host?: string;
|
|
5
5
|
}
|
|
6
6
|
export declare const MAINNET_HOST = "https://icp0.io";
|
|
7
|
+
/** What a surface that prints the per-client guides passes: the engram, and the build's version. */
|
|
8
|
+
export interface GuideParams extends ConnectParams {
|
|
9
|
+
/**
|
|
10
|
+
* The @engramx/client version the surface printing these guides was BUILT with — its own
|
|
11
|
+
* package.json's version, which the release's version change stamps (X.Y.Z-rc.N while a release
|
|
12
|
+
* candidate soaks, X.Y.Z once the final release is cut). Every pairing command in the guides
|
|
13
|
+
* names it.
|
|
14
|
+
*/
|
|
15
|
+
clientVersion: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The pairing command, pinned to the version the surface printing it was built with.
|
|
19
|
+
*
|
|
20
|
+
* WHY (the owner's ruling of 2026-10-03: print the exact version each page was built with).
|
|
21
|
+
* A bare `npx @engramx/client pair …` installs npm's default (`latest`), which is the last FINAL
|
|
22
|
+
* release: while a release candidate soaks under the `next` tag, every surface built from it would
|
|
23
|
+
* hand out a command that installs the previous release, and a previous release cannot pair with
|
|
24
|
+
* this release's engram (the 0.15.0 → 0.16.0 enrolment change). Pinned to the build's own version,
|
|
25
|
+
* the command names the final version once the final release is cut — through that release's own
|
|
26
|
+
* version change, with nothing to undo. WHAT WOULD MAKE THIS WRONG: a surface that prints the guides
|
|
27
|
+
* for a different release than the one it was built from (then `clientVersion` must be that
|
|
28
|
+
* release's), or a published version being withdrawn from npm (a pinned command then fails loudly,
|
|
29
|
+
* where a bare one would quietly install another release).
|
|
30
|
+
*/
|
|
31
|
+
export declare function pairCommand(clientVersion: string, inviteCode: string, canisterId: string): string;
|
|
7
32
|
/** The remote MCP endpoint URL for an engram canister (boundary-node subdomain routing). */
|
|
8
33
|
export declare function mcpUrl({ canisterId, host }: ConnectParams): string;
|
|
9
34
|
/** Claude Desktop / Cursor STDIO server entry (local @engramx/mcp, session-key auth). */
|
|
@@ -32,9 +57,9 @@ export interface ClientGuide {
|
|
|
32
57
|
snippet?: string;
|
|
33
58
|
}
|
|
34
59
|
/** Per-client connection guides — identical wording in the CLI and the web page. */
|
|
35
|
-
export declare function clientGuides(p:
|
|
60
|
+
export declare function clientGuides(p: GuideParams): ClientGuide[];
|
|
36
61
|
/** Everything a consumer needs in one call. */
|
|
37
|
-
export declare function connectInfo(p:
|
|
62
|
+
export declare function connectInfo(p: GuideParams): {
|
|
38
63
|
canisterId: string;
|
|
39
64
|
host: string;
|
|
40
65
|
mcpUrl: string;
|
package/dist/connect-config.js
CHANGED
|
@@ -4,7 +4,30 @@
|
|
|
4
4
|
// Dependency-free and free of Node/browser-only APIs so any consumer (this CLI, or a web UI) can
|
|
5
5
|
// import it unchanged. The contract test (connect-config.test.ts) pins the output — downstream UIs
|
|
6
6
|
// that re-render this config should reuse this module + that test so every surface stays identical.
|
|
7
|
+
//
|
|
8
|
+
// ⟨2026-10-03⟩ Every pairing command this module prints names the exact @engramx/client version the
|
|
9
|
+
// surface printing it was built with (`npx @engramx/client@<version> pair …`), so the caller passes
|
|
10
|
+
// that version in (`GuideParams.clientVersion`): this module cannot read a package.json and stay
|
|
11
|
+
// usable in a browser. This CLI passes its own package.json's version; a web UI passes the version
|
|
12
|
+
// it was built with. See `pairCommand` below for why.
|
|
7
13
|
export const MAINNET_HOST = 'https://icp0.io';
|
|
14
|
+
/**
|
|
15
|
+
* The pairing command, pinned to the version the surface printing it was built with.
|
|
16
|
+
*
|
|
17
|
+
* WHY (the owner's ruling of 2026-10-03: print the exact version each page was built with).
|
|
18
|
+
* A bare `npx @engramx/client pair …` installs npm's default (`latest`), which is the last FINAL
|
|
19
|
+
* release: while a release candidate soaks under the `next` tag, every surface built from it would
|
|
20
|
+
* hand out a command that installs the previous release, and a previous release cannot pair with
|
|
21
|
+
* this release's engram (the 0.15.0 → 0.16.0 enrolment change). Pinned to the build's own version,
|
|
22
|
+
* the command names the final version once the final release is cut — through that release's own
|
|
23
|
+
* version change, with nothing to undo. WHAT WOULD MAKE THIS WRONG: a surface that prints the guides
|
|
24
|
+
* for a different release than the one it was built from (then `clientVersion` must be that
|
|
25
|
+
* release's), or a published version being withdrawn from npm (a pinned command then fails loudly,
|
|
26
|
+
* where a bare one would quietly install another release).
|
|
27
|
+
*/
|
|
28
|
+
export function pairCommand(clientVersion, inviteCode, canisterId) {
|
|
29
|
+
return `npx @engramx/client@${clientVersion} pair ${inviteCode} --engram ${canisterId}`;
|
|
30
|
+
}
|
|
8
31
|
function isLocal(host) {
|
|
9
32
|
return host.includes('localhost') || host.includes('127.0.0.1');
|
|
10
33
|
}
|
|
@@ -29,6 +52,7 @@ export function claudeDesktopConfig(p) {
|
|
|
29
52
|
/** Per-client connection guides — identical wording in the CLI and the web page. */
|
|
30
53
|
export function clientGuides(p) {
|
|
31
54
|
const url = mcpUrl(p);
|
|
55
|
+
const pair = pairCommand(p.clientVersion, '<invite-code>', p.canisterId);
|
|
32
56
|
return [
|
|
33
57
|
{
|
|
34
58
|
id: 'claude-web',
|
|
@@ -105,7 +129,7 @@ export function clientGuides(p) {
|
|
|
105
129
|
snippet: `gemini mcp add --transport http engramx-memory ${url}`,
|
|
106
130
|
steps: [
|
|
107
131
|
'Run the command, then restart gemini-cli.',
|
|
108
|
-
'If the OAuth handshake misbehaves, add an auth header (
|
|
132
|
+
'If the OAuth handshake misbehaves, add an auth header (the key for this engram) or use the local stdio proxy instead.',
|
|
109
133
|
'The consumer Gemini app has no custom-MCP support — use gemini-cli, or seed the app’s Saved Info via a paste prompt.',
|
|
110
134
|
],
|
|
111
135
|
},
|
|
@@ -140,22 +164,22 @@ export function clientGuides(p) {
|
|
|
140
164
|
id: 'openclaw',
|
|
141
165
|
name: 'OpenClaw (self-hosted)',
|
|
142
166
|
transport: 'stdio',
|
|
143
|
-
snippet:
|
|
167
|
+
snippet: pair,
|
|
144
168
|
steps: [
|
|
145
169
|
'Run the command; it auto-detects OpenClaw and installs the engramx memory plugin.',
|
|
146
170
|
'The engram becomes OpenClaw’s memory backend — it reads at session start and syncs new memories automatically.',
|
|
147
|
-
'Get <invite-code> from your
|
|
171
|
+
'Get <invite-code> from the engram’s owner — you, if this is your engram — who creates it under Access → Agents; it works for thirty minutes.',
|
|
148
172
|
],
|
|
149
173
|
},
|
|
150
174
|
{
|
|
151
175
|
id: 'sdk',
|
|
152
176
|
name: 'Your own agent (@engramx/client SDK)',
|
|
153
177
|
transport: 'stdio',
|
|
154
|
-
snippet:
|
|
178
|
+
snippet: pair,
|
|
155
179
|
steps: [
|
|
156
|
-
'Pair a
|
|
180
|
+
'Pair a key for this engram once with the command; get <invite-code> from the engram’s owner — you, if this is your engram — who creates it under Access → Agents. It works for thirty minutes.',
|
|
157
181
|
`In your agent: new EngramClient({ canisterId: '${p.canisterId}', sessionKeyPath: '~/.engramx/session.key' }), then startSession() to read this owner's memory back and appendMemory() as it learns.`,
|
|
158
|
-
'
|
|
182
|
+
'This grant is append-only for writes — your agent can read and add memory, and cannot delete it. Overwriting existing content requires a separate grant the owner issues deliberately, per path: only on paths the owner lists for agents, and never on paths the owner has locked.',
|
|
159
183
|
],
|
|
160
184
|
},
|
|
161
185
|
{
|
|
@@ -164,8 +188,8 @@ export function clientGuides(p) {
|
|
|
164
188
|
transport: 'stdio',
|
|
165
189
|
snippet: JSON.stringify(claudeDesktopConfig(p), null, 2),
|
|
166
190
|
steps: [
|
|
167
|
-
`Pair a
|
|
168
|
-
'Add the JSON to claude_desktop_config.json under "mcpServers", then restart the
|
|
191
|
+
`Pair a key for this engram once: ${pair}`,
|
|
192
|
+
'Add the JSON to claude_desktop_config.json under "mcpServers", then restart the app.',
|
|
169
193
|
],
|
|
170
194
|
},
|
|
171
195
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect-config.js","sourceRoot":"","sources":["../src/connect-config.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,8EAA8E;AAC9E,EAAE;AACF,iGAAiG;AACjG,mGAAmG;AACnG,oGAAoG;
|
|
1
|
+
{"version":3,"file":"connect-config.js","sourceRoot":"","sources":["../src/connect-config.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,8EAA8E;AAC9E,EAAE;AACF,iGAAiG;AACjG,mGAAmG;AACnG,oGAAoG;AACpG,EAAE;AACF,oGAAoG;AACpG,oGAAoG;AACpG,iGAAiG;AACjG,mGAAmG;AACnG,sDAAsD;AAQtD,MAAM,CAAC,MAAM,YAAY,GAAG,iBAAiB,CAAC;AAa9C;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,WAAW,CAAC,aAAqB,EAAE,UAAkB,EAAE,UAA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ACF;KACF,CAAC;AACJ,CAAC;AAED,+CAA+C;AAC/C,MAAM,UAAU,WAAW,CAAC,CAAc;IACxC,OAAO;QACL,UAAU,EAAE,CAAC,CAAC,UAAU;QACxB,IAAI,EAAE,CAAC,CAAC,IAAI,IAAI,YAAY;QAC5B,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;QACjB,mBAAmB,EAAE,mBAAmB,CAAC,CAAC,CAAC;QAC3C,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;KACxB,CAAC;AACJ,CAAC"}
|
package/dist/connect.js
CHANGED
|
@@ -5,6 +5,7 @@ import { writeFileSync, mkdirSync, existsSync, readFileSync } from 'node:fs';
|
|
|
5
5
|
import { dirname, join } from 'node:path';
|
|
6
6
|
import { homedir, platform } from 'node:os';
|
|
7
7
|
import { connectInfo, claudeDesktopConfig } from './connect-config.js';
|
|
8
|
+
import { VERSION } from './version.js';
|
|
8
9
|
function parseFlags(argv) {
|
|
9
10
|
const f = {};
|
|
10
11
|
for (let i = 0; i < argv.length; i++) {
|
|
@@ -66,7 +67,8 @@ export async function runConnect(argv) {
|
|
|
66
67
|
console.error('Usage: npx @engramx/mcp connect --canister <id> [--host <url>] [--write [path]]');
|
|
67
68
|
process.exit(2);
|
|
68
69
|
}
|
|
69
|
-
|
|
70
|
+
// The pairing commands in the guides name this tool's own version (the packages share one).
|
|
71
|
+
const info = connectInfo({ canisterId, host, clientVersion: VERSION });
|
|
70
72
|
console.log('\nConnect Claude (and other MCP clients) to your engram\n');
|
|
71
73
|
console.log(`Remote MCP URL:\n ${info.mcpUrl}\n`);
|
|
72
74
|
for (const g of info.guides) {
|
package/dist/connect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../src/connect.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,8FAA8F;AAC9F,6FAA6F;AAE7F,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,E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,KAAK,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC;QAC7C,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK;YAAE,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QACnD,IAAI,CAAC,CAAC,OAAO;YAAE,KAAK,MAAM,IAAI,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC;gBAAE,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;IACxF,CAAC;IAED,IAAI,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;QACf,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,wBAAwB,EAAE,CAAC;QACtF,wBAAwB,CAAC,IAAI,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;QACrD,OAAO,CAAC,GAAG,CAAC,uCAAuC,IAAI,sCAAsC,CAAC,CAAC;IACjG,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CACT,oFAAoF,CACrF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/profile-tools.js
CHANGED
|
@@ -3,9 +3,41 @@ import { toSerializable } from './utils.js';
|
|
|
3
3
|
function jsonText(value) {
|
|
4
4
|
return JSON.stringify(toSerializable(value), null, 2);
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* Render what a save actually did.
|
|
8
|
+
*
|
|
9
|
+
* The ProfileManager/SessionManager methods hand back the write RECEIPT as of the 2026-08-16
|
|
10
|
+
* canister release, or null when the SDK deferred the call to its offline queue instead of
|
|
11
|
+
* committing it. These tools used to report `{saved: true, version}` for both outcomes: a queued
|
|
12
|
+
* write was announced as saved, and once the return became a record the same field would have
|
|
13
|
+
* handed the model a receipt OBJECT where it had been reading a number. `saved` here means
|
|
14
|
+
* COMMITTED; `head` is the hex audit-chain head after the write, the value the agent hands a
|
|
15
|
+
* third party who wants to verify it without trusting the agent.
|
|
16
|
+
*/
|
|
17
|
+
function saveResult(receipt, extra = {}) {
|
|
18
|
+
if (receipt === null)
|
|
19
|
+
return { saved: false, queued: true, ...extra };
|
|
20
|
+
return { saved: true, version: receipt.version, seq: receipt.seq, head: receipt.head, ...extra };
|
|
21
|
+
}
|
|
22
|
+
// MCP ToolAnnotations for the profile/session convenience tools. These have no entry in
|
|
23
|
+
// tool-schemas.json (they are stdio-only wrappers and are not served by the canister), so the
|
|
24
|
+
// values are justified here instead.
|
|
25
|
+
//
|
|
26
|
+
// Every "save" tool below routes through ProfileManager/SessionManager, and each of those methods
|
|
27
|
+
// calls client.appendMemory — savePreference, saveInsight, saveDecision and writeSummary alike.
|
|
28
|
+
// None of them overwrites, so destructiveHint is false; all of them append a second copy when
|
|
29
|
+
// called twice with the same input, so idempotentHint is false. openWorldHint is false throughout:
|
|
30
|
+
// the domain is one canister's own memory files.
|
|
31
|
+
const PROFILE_READ = { readOnlyHint: true, openWorldHint: false };
|
|
32
|
+
const PROFILE_APPEND = {
|
|
33
|
+
readOnlyHint: false,
|
|
34
|
+
destructiveHint: false,
|
|
35
|
+
idempotentHint: false,
|
|
36
|
+
openWorldHint: false,
|
|
37
|
+
};
|
|
6
38
|
export function registerProfileTools(server, profile, sessions) {
|
|
7
39
|
// 1. engram_get_profile
|
|
8
|
-
server.tool('engram_get_profile', 'Load the user identity (soul, user, preferences) and accumulated lessons in one call. Use at session start to learn who the user is.', async () => {
|
|
40
|
+
server.tool('engram_get_profile', 'Load the user identity (soul, user, preferences) and accumulated lessons in one call. Use at session start to learn who the user is.', PROFILE_READ, async () => {
|
|
9
41
|
try {
|
|
10
42
|
const p = await profile.getProfile();
|
|
11
43
|
return { content: [{ type: 'text', text: jsonText(p) }] };
|
|
@@ -20,10 +52,10 @@ export function registerProfileTools(server, profile, sessions) {
|
|
|
20
52
|
}
|
|
21
53
|
});
|
|
22
54
|
// 2. engram_save_preference
|
|
23
|
-
server.tool('engram_save_preference', 'Save a user preference (e.g. "prefers terse responses", "uses dark mode"). Persists across platforms.', { preference: z.string().describe('The preference to save') }, async ({ preference }) => {
|
|
55
|
+
server.tool('engram_save_preference', 'Save a user preference (e.g. "prefers terse responses", "uses dark mode"). Persists across platforms.', { preference: z.string().describe('The preference to save') }, PROFILE_APPEND, async ({ preference }) => {
|
|
24
56
|
try {
|
|
25
|
-
const
|
|
26
|
-
return { content: [{ type: 'text', text: jsonText(
|
|
57
|
+
const receipt = await profile.savePreference(preference);
|
|
58
|
+
return { content: [{ type: 'text', text: jsonText(saveResult(receipt)) }] };
|
|
27
59
|
}
|
|
28
60
|
catch (err) {
|
|
29
61
|
return {
|
|
@@ -41,10 +73,10 @@ export function registerProfileTools(server, profile, sessions) {
|
|
|
41
73
|
.string()
|
|
42
74
|
.optional()
|
|
43
75
|
.describe('Optional domain topic (e.g. "typescript", "devops"). Lowercase, alphanumeric.'),
|
|
44
|
-
}, async ({ content, topic }) => {
|
|
76
|
+
}, PROFILE_APPEND, async ({ content, topic }) => {
|
|
45
77
|
try {
|
|
46
|
-
const
|
|
47
|
-
return { content: [{ type: 'text', text: jsonText(
|
|
78
|
+
const receipt = await profile.saveInsight({ content, topic });
|
|
79
|
+
return { content: [{ type: 'text', text: jsonText(saveResult(receipt, { topic })) }] };
|
|
48
80
|
}
|
|
49
81
|
catch (err) {
|
|
50
82
|
return {
|
|
@@ -59,10 +91,10 @@ export function registerProfileTools(server, profile, sessions) {
|
|
|
59
91
|
server.tool('engram_save_decision', 'Record a decision and its rationale for future reference across platforms.', {
|
|
60
92
|
decision: z.string().describe('What was decided'),
|
|
61
93
|
rationale: z.string().describe('Why this decision was made'),
|
|
62
|
-
}, async ({ decision, rationale }) => {
|
|
94
|
+
}, PROFILE_APPEND, async ({ decision, rationale }) => {
|
|
63
95
|
try {
|
|
64
|
-
const
|
|
65
|
-
return { content: [{ type: 'text', text: jsonText(
|
|
96
|
+
const receipt = await profile.saveDecision(decision, rationale);
|
|
97
|
+
return { content: [{ type: 'text', text: jsonText(saveResult(receipt)) }] };
|
|
66
98
|
}
|
|
67
99
|
catch (err) {
|
|
68
100
|
return {
|
|
@@ -82,10 +114,10 @@ export function registerProfileTools(server, profile, sessions) {
|
|
|
82
114
|
.regex(/^\d{4}-\d{2}-\d{2}$/)
|
|
83
115
|
.optional()
|
|
84
116
|
.describe('Date in YYYY-MM-DD format (defaults to today)'),
|
|
85
|
-
}, async ({ platform, summary, date }) => {
|
|
117
|
+
}, PROFILE_APPEND, async ({ platform, summary, date }) => {
|
|
86
118
|
try {
|
|
87
|
-
const
|
|
88
|
-
return { content: [{ type: 'text', text: jsonText({
|
|
119
|
+
const receipt = await sessions.writeSummary(platform, summary, date);
|
|
120
|
+
return { content: [{ type: 'text', text: jsonText(saveResult(receipt, { platform })) }] };
|
|
89
121
|
}
|
|
90
122
|
catch (err) {
|
|
91
123
|
return {
|
|
@@ -104,7 +136,7 @@ export function registerProfileTools(server, profile, sessions) {
|
|
|
104
136
|
.optional()
|
|
105
137
|
.describe('Exclude a platform (for cross-platform reads, e.g. exclude "claude" to see what OpenClaw did)'),
|
|
106
138
|
limit: z.number().min(1).max(20).optional().default(5).describe('Max sessions to return'),
|
|
107
|
-
}, async ({ platform, exclude_platform, limit }) => {
|
|
139
|
+
}, PROFILE_READ, async ({ platform, exclude_platform, limit }) => {
|
|
108
140
|
try {
|
|
109
141
|
let result;
|
|
110
142
|
if (exclude_platform) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile-tools.js","sourceRoot":"","sources":["../src/profile-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,KA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from './utils.js';
|
|
2
2
|
export function registerResources(server, engram) {
|
|
3
|
-
server.resource('engram-status', 'engram://status',
|
|
3
|
+
server.resource('engram-status', 'engram://status',
|
|
4
|
+
// ⟨CORRECTED 2026-10-05⟩ Said "memory file count, agents, cycles, version". The record is the
|
|
5
|
+
// engram's public `about()`, which has carried no cycles balance since 0.16.0.
|
|
6
|
+
{
|
|
7
|
+
description: 'Engram canister status — memory file count, agents, audit log size, version, pause/freeze flags (no cycles balance: use the engram_wallet_balance tool)',
|
|
8
|
+
}, async (uri) => {
|
|
4
9
|
try {
|
|
5
10
|
const status = await engram.status();
|
|
6
11
|
return {
|
package/dist/resources.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../src/resources.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,UAAU,iBAAiB,CAAC,MAAiB,EAAE,MAAoB;IACvE,MAAM,CAAC,QAAQ,CACb,eAAe,EACf,iBAAiB,
|
|
1
|
+
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../src/resources.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,UAAU,iBAAiB,CAAC,MAAiB,EAAE,MAAoB;IACvE,MAAM,CAAC,QAAQ,CACb,eAAe,EACf,iBAAiB;IACjB,8FAA8F;IAC9F,+EAA+E;IAC/E;QACE,WAAW,EACT,yJAAyJ;KAC5J,EACD,KAAK,EAAE,GAAG,EAAE,EAAE;QACZ,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC;YACrC,OAAO;gBACL,QAAQ,EAAE;oBACR;wBACE,GAAG,EAAE,GAAG,CAAC,IAAI;wBACb,QAAQ,EAAE,kBAAkB;wBAC5B,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;qBACtD;iBACF;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACvE,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,OAAO,EAAE,EAAE,CAAC,EAAE,CAAC;QAC9F,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/server.js
CHANGED
|
@@ -5,10 +5,13 @@ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
|
|
|
5
5
|
import { join } from 'node:path';
|
|
6
6
|
import { existsSync } from 'node:fs';
|
|
7
7
|
import { homedir } from 'node:os';
|
|
8
|
-
import { EngramClient, ProfileManager, SessionManager } from '@engramx/client';
|
|
8
|
+
import { EngramClient, MarketClient, ProfileManager, SessionManager, loadSessionKey, } from '@engramx/client';
|
|
9
|
+
import { HttpAgent } from '@icp-sdk/core/agent';
|
|
9
10
|
import { registerTools } from './tools.js';
|
|
10
11
|
import { registerProfileTools } from './profile-tools.js';
|
|
11
12
|
import { registerResources } from './resources.js';
|
|
13
|
+
import { pairCommand } from './connect-config.js';
|
|
14
|
+
import { VERSION } from './version.js';
|
|
12
15
|
// --- Environment variables ---
|
|
13
16
|
const canisterId = process.env['ENGRAM_CANISTER_ID'] || process.env['VAULT_CANISTER_ID'];
|
|
14
17
|
if (!canisterId) {
|
|
@@ -22,8 +25,8 @@ const sessionKeyPath = process.env['ENGRAM_SESSION_KEY_PATH'] ||
|
|
|
22
25
|
process.env['VAULT_SESSION_KEY_PATH'] ||
|
|
23
26
|
join(homedir(), '.engramx', 'session.key');
|
|
24
27
|
if (!existsSync(sessionKeyPath)) {
|
|
25
|
-
console.error(`Error:
|
|
26
|
-
|
|
28
|
+
console.error(`Error: the key for this engram was not found at ${sessionKeyPath}.\n` +
|
|
29
|
+
`Generate one with: ${pairCommand(VERSION, '<invite-code>', '<canister-id>')}`);
|
|
27
30
|
process.exit(1);
|
|
28
31
|
}
|
|
29
32
|
const host = process.env['ENGRAM_HOST'] || 'https://ic0.app';
|
|
@@ -34,13 +37,46 @@ const engram = new EngramClient({
|
|
|
34
37
|
host,
|
|
35
38
|
cacheMaxAge: 60_000,
|
|
36
39
|
});
|
|
40
|
+
// ⟨0.16.0, B1 — 2026-08-25⟩ THE MARKET IS A SEPARATE CANISTER NOW, so the marketplace tools need a
|
|
41
|
+
// separate client. B1 moved services and jobs off the engram; the five commerce tools kept calling
|
|
42
|
+
// `engram.listServices()` and friends, which stopped existing. That was five live tsc errors at
|
|
43
|
+
// HEAD, invisible because `test:mcp` is vitest (which transpiles without typechecking) and the
|
|
44
|
+
// package's own `tsc` build was not gated. Owner ruling 2026-08-25: wire the market rather than
|
|
45
|
+
// withhold the tools.
|
|
46
|
+
//
|
|
47
|
+
// OPTIONAL BY DESIGN. The memory tools — the wedge — must keep working for an agent that has no
|
|
48
|
+
// market configured, so an absent MARKET_CANISTER_ID is not a startup error. It makes the five
|
|
49
|
+
// commerce tools REFUSE IN WORDS instead (see tools.ts), which is the ADR-0002 shape: a tool that
|
|
50
|
+
// silently returned an empty service list would say "this market sells nothing" when the truth is
|
|
51
|
+
// "you never told me where the market is".
|
|
52
|
+
const marketCanisterId = process.env['MARKET_CANISTER_ID'] || '';
|
|
53
|
+
const market = marketCanisterId
|
|
54
|
+
? new MarketClient(HttpAgent.createSync({
|
|
55
|
+
identity: loadSessionKey(sessionKeyPath),
|
|
56
|
+
host,
|
|
57
|
+
// Mirrors EngramClient's own rule: fetch the root key ONLY against a local replica, where
|
|
58
|
+
// it is unknown to the client. Doing it against mainnet would defeat the certification.
|
|
59
|
+
shouldFetchRootKey: (() => {
|
|
60
|
+
try {
|
|
61
|
+
const hostname = new URL(host).hostname;
|
|
62
|
+
return hostname === 'localhost' || hostname === '127.0.0.1';
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
})(),
|
|
68
|
+
}),
|
|
69
|
+
// ⟨2026-09-30⟩ No second copy of the key: the market settles a payment only when the caller
|
|
70
|
+
// is the sender it names, so MarketClient now reads the sender from this agent.
|
|
71
|
+
marketCanisterId)
|
|
72
|
+
: null;
|
|
37
73
|
// --- MCP Server ---
|
|
38
74
|
const server = new McpServer({ name: 'engramx', version: '0.1.0' }, {
|
|
39
|
-
instructions: 'engramx gives this agent persistent memory in a user-owned canister (an engram) plus an ic402 paid-services marketplace.
|
|
75
|
+
instructions: 'engramx gives this agent persistent memory in a user-owned canister (an engram) plus an ic402 paid-services marketplace. Agent sessions are APPEND-ONLY: memory can be read and appended to, never overwritten or deleted. Memory flow: engram_list_memory_files (discover paths) -> engram_read_memory or engram_read_memory_batch (fetch content) -> engram_append_memory (add content; memory.append scope; config/ and secrets/ paths are owner-only). engram_memory_history shows prior versions of one file; engram_read_audit_log shows the record of this engram: all of it to the owner or a guardian, only its own entries to an agent, with a count of those withheld. Free reads: engram_status and engram_list_services. engram_wallet_balance reports canister cycles (infrastructure fuel), NOT token money. MONEY: engram_submit_service_request SPENDS ckUSDC (settles a payment at the quoted service price into escrow at submit time) and engram_confirm_job irreversibly releases that escrow to the seller; call these only when the user intends to pay. engram_dispute_job blocks payout instead. engram_get_job_result is a free read.',
|
|
40
76
|
});
|
|
41
77
|
const profile = new ProfileManager(engram);
|
|
42
78
|
const sessions = new SessionManager(engram);
|
|
43
|
-
registerTools(server, engram);
|
|
79
|
+
registerTools(server, engram, market);
|
|
44
80
|
registerProfileTools(server, profile, sessions);
|
|
45
81
|
registerResources(server, engram);
|
|
46
82
|
// --- Connect via stdio ---
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,yFAAyF;AAEzF,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,yFAAyF;AAEzF,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,cAAc,EACd,cAAc,GACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,gCAAgC;AAEhC,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;AACzF,IAAI,CAAC,UAA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AI;QACJ,0FAA0F;QAC1F,wFAAwF;QACxF,kBAAkB,EAAE,CAAC,GAAG,EAAE;YACxB,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC;gBACxC,OAAO,QAAQ,KAAK,WAAW,IAAI,QAAQ,KAAK,WAAW,CAAC;YAC9D,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC,CAAC,EAAE;KACL,CAAC;IACF,4FAA4F;IAC5F,gFAAgF;IAChF,gBAAgB,CACjB;IACH,CAAC,CAAC,IAAI,CAAC;AAET,qBAAqB;AAErB,MAAM,MAAM,GAAG,IAAI,SAAS,CAC1B,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,EACrC;IACE,YAAY,EACV,imCAAimC;CACpmC,CACF,CAAC;AAEF,MAAM,OAAO,GAAG,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC;AAC3C,MAAM,QAAQ,GAAG,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC;AAE5C,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AACtC,oBAAoB,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAChD,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAElC,4BAA4B;AAE5B,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAEhC,qDAAqD;AACrD,OAAO,CAAC,KAAK,CAAC,yCAAyC,UAAU,WAAW,IAAI,GAAG,CAAC,CAAC"}
|
package/dist/tools.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
-
import type { EngramClient } from '@engramx/client';
|
|
3
|
-
export declare function registerTools(server: McpServer, engram: EngramClient
|
|
2
|
+
import type { EngramClient, MarketClient } from '@engramx/client';
|
|
3
|
+
export declare function registerTools(server: McpServer, engram: EngramClient,
|
|
4
|
+
/** ⟨0.16.0, B1⟩ The market canister's client, or null when MARKET_CANISTER_ID is unset. NULL IS A
|
|
5
|
+
* SUPPORTED STATE: the memory tools are the wedge and must work without a market. */
|
|
6
|
+
market?: MarketClient | null): void;
|
package/dist/tools.js
CHANGED
|
@@ -3,8 +3,57 @@ import { toSerializable } from './utils.js';
|
|
|
3
3
|
function jsonText(value) {
|
|
4
4
|
return JSON.stringify(toSerializable(value), null, 2);
|
|
5
5
|
}
|
|
6
|
-
|
|
6
|
+
// The canister's path contract: MAX_PATH_LENGTH = 512 in src/engram/main.mo, enforced on every
|
|
7
|
+
// memory path including the HTTP MCP tool surface. Pre-validation here exists to fail fast, so it
|
|
8
|
+
// must refuse exactly what the canister refuses — this was 1024 until 2026-08, silently passing
|
|
9
|
+
// 513–1024-char paths through to a guaranteed canister rejection while claiming to have validated
|
|
10
|
+
// them. The canister counts Unicode code points (Motoko Text.size); String#length counts UTF-16
|
|
11
|
+
// code units, so this check is marginally stricter on astral characters — the safe direction.
|
|
12
|
+
// Named once and interpolated into the tool descriptions below so the served docs cannot drift
|
|
13
|
+
// from the check.
|
|
14
|
+
const MAX_PATH_LENGTH = 512;
|
|
7
15
|
const E8S_PER_ICP = 100_000_000;
|
|
16
|
+
// MCP ToolAnnotations, mirrored from src/tool-schemas.json — the catalog source of truth, which
|
|
17
|
+
// also generates the canister's HTTP catalog. Kept as three shared constants rather than inline
|
|
18
|
+
// literals so a hint cannot quietly diverge tool-by-tool from the JSON; a vitest parity test
|
|
19
|
+
// compares the two catalogs entry for entry.
|
|
20
|
+
//
|
|
21
|
+
// They are HINTS and nothing more. The authorization boundary is the canister's scope and standing
|
|
22
|
+
// checks; a client that skipped a confirmation prompt because a hint said "not destructive" would
|
|
23
|
+
// be trusting the wrong side of the wire. We declare them because clients use them to ORDER and
|
|
24
|
+
// PRESENT tools, not because they gate anything.
|
|
25
|
+
//
|
|
26
|
+
// destructiveHint and idempotentHint are deliberately absent from the read-only set: the spec gives
|
|
27
|
+
// them meaning only when readOnlyHint is false, and emitting a value the spec says to ignore is the
|
|
28
|
+
// same kind of decorative claim this catalog is trying to stop making. openWorldHint is false on
|
|
29
|
+
// every read here because the domain is one canister's own records — a closed, enumerable set, not
|
|
30
|
+
// a search over the internet.
|
|
31
|
+
const READ_ONLY = { readOnlyHint: true, openWorldHint: false };
|
|
32
|
+
// Append is the only memory-mutating tool in this catalog (the profile/session savers in
|
|
33
|
+
// profile-tools.ts route through the same appendMemory and carry the same hints). destructiveHint
|
|
34
|
+
// is FALSE because the canister concatenates and never overwrites, deletes, or rolls back — a write
|
|
35
|
+
// here can only ever add. idempotentHint is FALSE for exactly that reason: sending the same content
|
|
36
|
+
// twice appends it twice, so a client must not treat a retry as free.
|
|
37
|
+
const APPEND = {
|
|
38
|
+
readOnlyHint: false,
|
|
39
|
+
destructiveHint: false,
|
|
40
|
+
idempotentHint: false,
|
|
41
|
+
openWorldHint: false,
|
|
42
|
+
};
|
|
43
|
+
// Money tools (submit / confirm / dispute). destructiveHint is TRUE because a settlement DEBITS an
|
|
44
|
+
// existing balance rather than adding to one, which is the spec's "not purely additive". Ordinary
|
|
45
|
+
// English would not call paying someone destructive; the hint is about whether a client may treat
|
|
46
|
+
// the call as safe to make unattended, and it may not. openWorldHint is TRUE because the
|
|
47
|
+
// counterparty is a third-party ic402 seller and, on the EVM rail, an external chain.
|
|
48
|
+
// idempotentHint is FALSE and stays false: resubmitting pays again, and while a repeat confirm or
|
|
49
|
+
// dispute is expected to be rejected by the job's status guard, that guard lives in the ic402
|
|
50
|
+
// package and is not verified here — the conservative claim is the honest one.
|
|
51
|
+
const MONEY = {
|
|
52
|
+
readOnlyHint: false,
|
|
53
|
+
destructiveHint: true,
|
|
54
|
+
idempotentHint: false,
|
|
55
|
+
openWorldHint: true,
|
|
56
|
+
};
|
|
8
57
|
function validatePath(p) {
|
|
9
58
|
if (!p || p.length === 0)
|
|
10
59
|
return 'Path cannot be empty (rejected client-side; no request was sent and nothing changed — supply a non-empty path and retry immediately)';
|
|
@@ -16,13 +65,31 @@ function validatePath(p) {
|
|
|
16
65
|
return 'Path traversal sequences not allowed (".." rejected client-side; no request sent — use a plain path without ".." and retry immediately)';
|
|
17
66
|
return null;
|
|
18
67
|
}
|
|
19
|
-
export function registerTools(server, engram
|
|
68
|
+
export function registerTools(server, engram,
|
|
69
|
+
/** ⟨0.16.0, B1⟩ The market canister's client, or null when MARKET_CANISTER_ID is unset. NULL IS A
|
|
70
|
+
* SUPPORTED STATE: the memory tools are the wedge and must work without a market. */
|
|
71
|
+
market = null) {
|
|
72
|
+
/**
|
|
73
|
+
* The market client, or a refusal that says which of the two possible nothings this is.
|
|
74
|
+
*
|
|
75
|
+
* ADR-0002 shape. Returning an empty service list here would tell an agent "this market sells
|
|
76
|
+
* nothing" when the truth is "no market was configured" — a fabricated answer to a question that
|
|
77
|
+
* was never put to any canister. The message names the fix rather than the failure.
|
|
78
|
+
*/
|
|
79
|
+
const requireMarket = () => {
|
|
80
|
+
if (!market) {
|
|
81
|
+
throw new Error('No market is configured for this MCP server, so there is nothing to ask. This is a ' +
|
|
82
|
+
'configuration gap, NOT an empty marketplace: set MARKET_CANISTER_ID to the market ' +
|
|
83
|
+
'canister and restart. The memory tools are unaffected and need no market.');
|
|
84
|
+
}
|
|
85
|
+
return market;
|
|
86
|
+
};
|
|
20
87
|
// 1. engram_read_memory
|
|
21
88
|
server.tool('engram_read_memory', 'Read ONE memory file by exact path (e.g. "MEMORY.md", "memory/2026-02-11.md") and return its current decrypted content as JSON {path, content, version, lastModifiedAt}. Use when the path is known; discover paths with engram_list_memory_files. For several files use engram_read_memory_batch; for prior versions use engram_memory_history. Read-only.', {
|
|
22
89
|
path: z
|
|
23
90
|
.string()
|
|
24
|
-
.describe(
|
|
25
|
-
}, async ({ path }) => {
|
|
91
|
+
.describe(`Exact memory file path, e.g. "MEMORY.md" or "identity/preferences.md". Non-empty, max ${MAX_PATH_LENGTH} characters, no ".." traversal.`),
|
|
92
|
+
}, READ_ONLY, async ({ path }) => {
|
|
26
93
|
const pathErr = validatePath(path);
|
|
27
94
|
if (pathErr)
|
|
28
95
|
return { content: [{ type: 'text', text: pathErr }], isError: true };
|
|
@@ -36,7 +103,10 @@ export function registerTools(server, engram) {
|
|
|
36
103
|
path: file.path,
|
|
37
104
|
content: file.content,
|
|
38
105
|
version: file.version,
|
|
39
|
-
|
|
106
|
+
// ⟨2026-10-02⟩ The SDK's field carries the unit now (`lastModifiedAtNs`, as the
|
|
107
|
+
// canister serves it); this tool's JSON keeps the key its description and the
|
|
108
|
+
// engram's own MCP server both name.
|
|
109
|
+
lastModifiedAt: file.lastModifiedAtNs,
|
|
40
110
|
}),
|
|
41
111
|
},
|
|
42
112
|
],
|
|
@@ -54,29 +124,51 @@ export function registerTools(server, engram) {
|
|
|
54
124
|
};
|
|
55
125
|
}
|
|
56
126
|
});
|
|
57
|
-
// (engram_write_memory removed: writeMemory is owner-only by design —
|
|
127
|
+
// (engram_write_memory removed: writeMemory is owner-only by design — agents
|
|
58
128
|
// are append-only. Owner uses the dashboard at engramx.ai or the canister IDL
|
|
59
129
|
// directly via Internet Identity.)
|
|
60
130
|
// 2. engram_append_memory
|
|
61
|
-
server.tool('engram_append_memory', 'Append text to a memory file; the file is created if it does not exist. APPEND-ONLY: never overwrites or deletes, and this is the ONLY mutating memory tool on this surface (no write/delete/rollback exists here). Requires the memory.append scope (
|
|
131
|
+
server.tool('engram_append_memory', 'Append text to a memory file; the file is created if it does not exist. APPEND-ONLY: never overwrites or deletes, and this is the ONLY mutating memory tool on this surface (no write/delete/rollback exists here). Requires the memory.append scope (agent with canAppendMemory, or owner). Rejected: config/ and secrets/ paths (owner-only), owner-protected paths, and while guardian writes are paused. Returns JSON {path, version, seq, head} — the write receipt: version is the file version after this write, seq its position in the engram event sequence, and head the hex audit-chain head, which is what you hand a third party who wants to verify this write without trusting you.', {
|
|
62
132
|
path: z
|
|
63
133
|
.string()
|
|
64
|
-
.describe(
|
|
134
|
+
.describe(`Target file path to append to; created if absent. Max ${MAX_PATH_LENGTH} characters, no ".."; agents cannot use the config/ or secrets/ prefixes (owner-only).`),
|
|
65
135
|
content: z
|
|
66
136
|
.string()
|
|
67
|
-
.describe('Text to append.
|
|
137
|
+
.describe('Text to append. This server joins it to the existing file content with a newline and re-encrypts before storing.'),
|
|
68
138
|
source: z
|
|
69
139
|
.enum(['human', 'agentDerived', 'sessionTranscript', 'fileSync', 'deterministic'])
|
|
70
140
|
.optional()
|
|
71
141
|
.describe('Optional. Declare what produced this content: human (the user wrote or dictated it), agentDerived (you summarized or concluded it), sessionTranscript (raw conversation log), fileSync (automated file propagation), deterministic (a machine-computed artifact, reproducible from stated inputs, carrying or admitting a content hash — not something you reasoned your way to). Recorded permanently beside your principal in the audit chain — declared by you, not verified, and a false declaration is attributable to you. Omit if none applies.'),
|
|
72
|
-
}, async ({ path, content, source }) => {
|
|
142
|
+
}, APPEND, async ({ path, content, source }) => {
|
|
73
143
|
const pathErr = validatePath(path);
|
|
74
144
|
if (pathErr)
|
|
75
145
|
return { content: [{ type: 'text', text: pathErr }], isError: true };
|
|
76
146
|
try {
|
|
77
|
-
|
|
147
|
+
// The SDK returns the RECEIPT now; null is its "deferred to the offline queue" answer.
|
|
148
|
+
// This server never sets offlineQueuePath (server.ts constructs the client without it),
|
|
149
|
+
// so null is unreachable here — the branch exists only because the SDK type is
|
|
150
|
+
// MemoryReceipt | null, and the tool description deliberately does not advertise it:
|
|
151
|
+
// describing an outcome no configuration of this server can produce is the fabrication
|
|
152
|
+
// class this product refuses. Surfacing `head` is the point — it is what an agent hands
|
|
153
|
+
// a verifier.
|
|
154
|
+
const receipt = await engram.appendMemory(path, content, source);
|
|
155
|
+
if (receipt === null) {
|
|
156
|
+
return {
|
|
157
|
+
content: [{ type: 'text', text: jsonText({ path, queued: true }) }],
|
|
158
|
+
};
|
|
159
|
+
}
|
|
78
160
|
return {
|
|
79
|
-
content: [
|
|
161
|
+
content: [
|
|
162
|
+
{
|
|
163
|
+
type: 'text',
|
|
164
|
+
text: jsonText({
|
|
165
|
+
path,
|
|
166
|
+
version: receipt.version,
|
|
167
|
+
seq: receipt.seq,
|
|
168
|
+
head: receipt.head,
|
|
169
|
+
}),
|
|
170
|
+
},
|
|
171
|
+
],
|
|
80
172
|
};
|
|
81
173
|
}
|
|
82
174
|
catch (err) {
|
|
@@ -92,11 +184,18 @@ export function registerTools(server, engram) {
|
|
|
92
184
|
}
|
|
93
185
|
});
|
|
94
186
|
// 3. engram_list_memory_files
|
|
95
|
-
server.tool('engram_list_memory_files', 'List metadata for EVERY memory file: one {path, version, lastModifiedAt} entry per file, NO content. Call this first to discover paths, then fetch content with engram_read_memory or engram_read_memory_batch. Read-only.', async () => {
|
|
187
|
+
server.tool('engram_list_memory_files', 'List metadata for EVERY memory file: one {path, version, lastModifiedAt} entry per file, NO content. Call this first to discover paths, then fetch content with engram_read_memory or engram_read_memory_batch. Read-only.', READ_ONLY, async () => {
|
|
96
188
|
try {
|
|
97
189
|
const files = await engram.listMemoryFiles();
|
|
190
|
+
// ⟨2026-10-02⟩ Mapped rather than passed through, so the JSON keeps the key the
|
|
191
|
+
// description names (`lastModifiedAt`) while the SDK's field carries the unit.
|
|
192
|
+
const rows = files.map((f) => ({
|
|
193
|
+
path: f.path,
|
|
194
|
+
version: f.version,
|
|
195
|
+
lastModifiedAt: f.lastModifiedAtNs,
|
|
196
|
+
}));
|
|
98
197
|
return {
|
|
99
|
-
content: [{ type: 'text', text: jsonText(
|
|
198
|
+
content: [{ type: 'text', text: jsonText(rows) }],
|
|
100
199
|
};
|
|
101
200
|
}
|
|
102
201
|
catch (err) {
|
|
@@ -120,7 +219,7 @@ export function registerTools(server, engram) {
|
|
|
120
219
|
.array(z.string())
|
|
121
220
|
.max(50)
|
|
122
221
|
.describe('Exact file paths to fetch (max 50; a larger batch is rejected wholesale). Discover paths with engram_list_memory_files.'),
|
|
123
|
-
}, async ({ paths }) => {
|
|
222
|
+
}, READ_ONLY, async ({ paths }) => {
|
|
124
223
|
try {
|
|
125
224
|
for (const p of paths) {
|
|
126
225
|
const pathErr = validatePath(p);
|
|
@@ -144,7 +243,7 @@ export function registerTools(server, engram) {
|
|
|
144
243
|
path,
|
|
145
244
|
content: fileOrError.content,
|
|
146
245
|
version: fileOrError.version,
|
|
147
|
-
lastModifiedAt: fileOrError.
|
|
246
|
+
lastModifiedAt: fileOrError.lastModifiedAtNs,
|
|
148
247
|
};
|
|
149
248
|
});
|
|
150
249
|
return {
|
|
@@ -164,7 +263,7 @@ export function registerTools(server, engram) {
|
|
|
164
263
|
}
|
|
165
264
|
});
|
|
166
265
|
// 6. engram_memory_history
|
|
167
|
-
server.tool('engram_memory_history', "Get the version history of ONE memory file. Returns {path, everCount, retainedCount, oldestRetainedVersion, evictedCount, versions, evictions}. Each version is {version, seq, kind, by, at, size, contentRoot} where kind is set|append|restore|tombstone and contentRoot is the 32-byte hash the record commits to — history carries commitments, not content. `evictions` discloses any version ranges whose BYTES were reclaimed under the owner's retention policy; the records and hashes always survive, so everCount > retainedCount means reclaimed, never lost track of. Use engram_read_memory for current content. Read-only.", { path: z.string().describe('Path of the memory file whose history to fetch.') }, async ({ path }) => {
|
|
266
|
+
server.tool('engram_memory_history', "Get the version history of ONE memory file. Returns {path, everCount, retainedCount, oldestRetainedVersion, evictedCount, versions, evictions}. Each version is {version, seq, kind, by, at, size, contentRoot} where kind is set|append|restore|tombstone and contentRoot is the 32-byte hash the record commits to — history carries commitments, not content. `evictions` discloses any version ranges whose BYTES were reclaimed under the owner's retention policy; the records and hashes always survive, so everCount > retainedCount means reclaimed, never lost track of. Use engram_read_memory for current content. Read-only.", { path: z.string().describe('Path of the memory file whose history to fetch.') }, READ_ONLY, async ({ path }) => {
|
|
168
267
|
const pathErr = validatePath(path);
|
|
169
268
|
if (pathErr)
|
|
170
269
|
return { content: [{ type: 'text', text: pathErr }], isError: true };
|
|
@@ -187,7 +286,7 @@ export function registerTools(server, engram) {
|
|
|
187
286
|
}
|
|
188
287
|
});
|
|
189
288
|
// 7. engram_wallet_balance
|
|
190
|
-
server.tool('engram_wallet_balance', 'Get the engram canister CYCLES balance: infrastructure fuel, NOT a token or money balance (no ckUSDC/ICP amounts). Returns JSON {cyclesBalance} (bigint serialized as a string). Requires wallet.read (canReadWallet) or owner. For a broader health snapshot use engram_status.', async () => {
|
|
289
|
+
server.tool('engram_wallet_balance', 'Get the engram canister CYCLES balance: infrastructure fuel, NOT a token or money balance (no ckUSDC/ICP amounts). Returns JSON {cyclesBalance} (bigint serialized as a string). Requires wallet.read (canReadWallet) or owner. For a broader health snapshot use engram_status.', READ_ONLY, async () => {
|
|
191
290
|
try {
|
|
192
291
|
const cycles = await engram.walletBalance();
|
|
193
292
|
// Match HTTP MCP shape: {cyclesBalance: <number-or-string>}
|
|
@@ -213,14 +312,20 @@ export function registerTools(server, engram) {
|
|
|
213
312
|
};
|
|
214
313
|
}
|
|
215
314
|
});
|
|
216
|
-
// NOTE: there is intentionally no `engram_transfer` tool.
|
|
315
|
+
// NOTE: there is intentionally no `engram_transfer` tool. Agents are
|
|
217
316
|
// append-only and have zero owner-level fund control; the only money-moving
|
|
218
317
|
// canister method is the owner-only `ownerWithdraw`, which is never exposed on
|
|
219
|
-
// the
|
|
318
|
+
// the agent's MCP surface. (Removed: it called a non-existent
|
|
220
319
|
// `operatorTransfer` method and advertised a `wallet.spend` capability that
|
|
221
|
-
// contradicts the
|
|
320
|
+
// contradicts the agent's append-only invariant.)
|
|
222
321
|
// 9. engram_status
|
|
223
|
-
|
|
322
|
+
// ⟨CORRECTED 2026-10-05⟩ The description told the model about an `authorized` field and about
|
|
323
|
+
// `owner` and `cyclesBalance` arriving as withheld options. That was v0.15.0's masked `status()`.
|
|
324
|
+
// At 0.16.0 `status()` calls the engram's public `about()`, which gives every caller the same
|
|
325
|
+
// record and carries none of the three, so an agent was being taught to read fields that never
|
|
326
|
+
// arrive. It now says what the reply carries, and agrees with the HTTP catalog's entry in
|
|
327
|
+
// tool-schemas.json, which was already right.
|
|
328
|
+
server.tool('engram_status', 'FREE health snapshot of the engram canister; no auth or scope needed, and every caller gets the same answer. Returns version, memoryFileCount, auditLogSize, agentCount, guardianCount, paymentsFrozen, writesPaused, backup and read/write counters, encryptionEnabled. It does NOT carry the owner or the cycles balance, and it has no field saying whether this session is authorized. Check paymentsFrozen/writesPaused before paying or appending. For the cycles fuel number use engram_wallet_balance.', READ_ONLY, async () => {
|
|
224
329
|
try {
|
|
225
330
|
const status = await engram.status();
|
|
226
331
|
return {
|
|
@@ -240,23 +345,27 @@ export function registerTools(server, engram) {
|
|
|
240
345
|
}
|
|
241
346
|
});
|
|
242
347
|
// engram_read_audit_log
|
|
243
|
-
server.tool('engram_read_audit_log',
|
|
348
|
+
server.tool('engram_read_audit_log', "Read the engram's chained record. An agent reads only the entries it caused; the owner and guardians read all of it. Returns a page {items, total, withheld}: items are entries {id, timestamp, caller, callerRole, operation, details, success}; total is how many entries the record has ever held; withheld is how many entries in the window you were not shown because another party caused them. A window with withheld > 0 is NOT the whole record. For content changes of ONE file use engram_memory_history instead. Requires an authenticated owner/agent/guardian session; an unauthorized call is REFUSED with an error naming the method, never an empty page.", {
|
|
244
349
|
fromIndex: z
|
|
245
350
|
.number()
|
|
246
351
|
.optional()
|
|
247
|
-
.describe('
|
|
352
|
+
.describe('Record id to start the window at (0 = oldest; default 0)'),
|
|
248
353
|
limit: z
|
|
249
354
|
.number()
|
|
250
355
|
.min(1)
|
|
251
356
|
.max(1000)
|
|
252
357
|
.optional()
|
|
253
358
|
.default(100)
|
|
254
|
-
.describe('
|
|
255
|
-
}, async ({ fromIndex, limit }) => {
|
|
359
|
+
.describe('How many record ids the window spans (default 100, max 1000; the canister caps a single window at 500); items + withheld = the entries examined'),
|
|
360
|
+
}, READ_ONLY, async ({ fromIndex, limit }) => {
|
|
256
361
|
try {
|
|
257
|
-
|
|
362
|
+
// ⟨2026-09-29, follow-up 16⟩ the whole page, so `withheld` reaches the agent
|
|
363
|
+
const page = await engram.readAuditLog(fromIndex ?? 0, limit);
|
|
364
|
+
// ⟨2026-10-02⟩ The SDK's entry carries `timestampNs` (the canister's spelling since the
|
|
365
|
+
// 0.16.0 cut); this tool's JSON keeps `timestamp`, the key its description names.
|
|
366
|
+
const items = page.items.map(({ timestampNs, ...e }) => ({ ...e, timestamp: timestampNs }));
|
|
258
367
|
return {
|
|
259
|
-
content: [{ type: 'text', text: jsonText(
|
|
368
|
+
content: [{ type: 'text', text: jsonText({ ...page, items }) }],
|
|
260
369
|
};
|
|
261
370
|
}
|
|
262
371
|
catch (err) {
|
|
@@ -272,9 +381,9 @@ export function registerTools(server, engram) {
|
|
|
272
381
|
}
|
|
273
382
|
});
|
|
274
383
|
// === ic402 Service Marketplace ===
|
|
275
|
-
server.tool('engram_list_services', 'FREE discovery of ic402 paid services on this engram (enabled services only): read-only, spends nothing. Each entry includes {id, name, enabled}; pass the id as serviceId to engram_submit_service_request, which is the step that actually pays.', {}, async () => {
|
|
384
|
+
server.tool('engram_list_services', 'FREE discovery of ic402 paid services on this engram (enabled services only): read-only, spends nothing. Each entry includes {id, name, enabled}; pass the id as serviceId to engram_submit_service_request, which is the step that actually pays.', {}, READ_ONLY, async () => {
|
|
276
385
|
try {
|
|
277
|
-
const services = await
|
|
386
|
+
const services = await requireMarket().listServices();
|
|
278
387
|
return { content: [{ type: 'text', text: jsonText(services) }] };
|
|
279
388
|
}
|
|
280
389
|
catch (err) {
|
|
@@ -289,18 +398,20 @@ export function registerTools(server, engram) {
|
|
|
289
398
|
};
|
|
290
399
|
}
|
|
291
400
|
});
|
|
292
|
-
server.tool('engram_submit_service_request', 'MOVES FUNDS: submit a paid request to an ic402 service (auto-pays via x402). Calling this settles a payment at submit time:
|
|
401
|
+
server.tool('engram_submit_service_request', 'MOVES FUNDS: submit a paid request to an ic402 service (auto-pays via x402). Calling this settles a payment at submit time: this server auto-approves ckUSDC and the canister pulls the quoted service price (from the service record; see engram_list_services) into escrow, then creates a job. On success the returned {jobId} means payment SETTLED into escrow — poll it with engram_get_job_result to a terminal status; NEVER resubmit after success (resubmitting pays again). Returns {approvalPending} instead when the charge exceeds the owner spending policy (owner must approve first). If an error says settlement is pending confirmation, funds may be in flight — wait and reconcile, do NOT re-pay. Requires wallet.spend and payments not frozen; only call when the user intends to pay. How escrow is released depends on the service verification mode: BuyerConfirm jobs pay the seller only after engram_confirm_job; AutoSettle/HashMatch/ZkGroth16 jobs pay automatically once the seller delivers a valid result.', {
|
|
293
402
|
serviceId: z
|
|
294
403
|
.string()
|
|
295
404
|
.describe('id of an enabled service from engram_list_services; its pricing sets the amount charged'),
|
|
296
405
|
params: z
|
|
297
406
|
.string()
|
|
298
407
|
.describe('Service-specific input, UTF-8 encoded and passed to the service as opaque bytes (JSON by convention)'),
|
|
299
|
-
}, async ({ serviceId, params }) => {
|
|
408
|
+
}, MONEY, async ({ serviceId, params }) => {
|
|
300
409
|
try {
|
|
301
410
|
// Auto-pay: builds the x402 payment (ICRC-2 approve + retry) so a paid request
|
|
302
|
-
// actually settles. The plain
|
|
303
|
-
|
|
411
|
+
// actually settles. The plain createJob sends no sig and can never complete.
|
|
412
|
+
// ⟨B1⟩ createJob is the market's name for this: it quotes, pays via ICRC-2 and retries
|
|
413
|
+
// the call, then returns the job id. The engram never had the escrow leg.
|
|
414
|
+
const result = await requireMarket().createJob(serviceId, new TextEncoder().encode(params));
|
|
304
415
|
return { content: [{ type: 'text', text: jsonText(result) }] };
|
|
305
416
|
}
|
|
306
417
|
catch (err) {
|
|
@@ -315,15 +426,20 @@ export function registerTools(server, engram) {
|
|
|
315
426
|
};
|
|
316
427
|
}
|
|
317
428
|
});
|
|
318
|
-
server.tool('engram_get_job_result', 'Poll an ic402 service job every 2s until it reaches a terminal status (Settled, Verified, Refunded, Expired, or Disputed), then return the full job object {id, status, serviceId, amount, result}. Read-only, moves NO funds; errors if the job does not terminate within maxAttempts. Reading a result does not pay the
|
|
429
|
+
server.tool('engram_get_job_result', 'Poll an ic402 service job every 2s until it reaches a terminal status (Settled, Verified, Refunded, Expired, or Disputed), then return the full job object {id, status, serviceId, amount, result}. Read-only, moves NO funds; errors if the job does not terminate within maxAttempts. Reading a result does not pay the seller: use engram_confirm_job to release payment or engram_dispute_job to reject.', {
|
|
319
430
|
jobId: z.string().describe('Job ID returned by engram_submit_service_request (e.g. "job-3")'),
|
|
320
431
|
maxAttempts: z
|
|
321
432
|
.number()
|
|
322
433
|
.optional()
|
|
323
434
|
.describe('Max 2-second poll cycles before giving up (default 30, about 60s total)'),
|
|
324
|
-
}, async ({ jobId, maxAttempts }) => {
|
|
435
|
+
}, READ_ONLY, async ({ jobId, maxAttempts }) => {
|
|
325
436
|
try {
|
|
326
|
-
|
|
437
|
+
// ⟨B1⟩ Two market calls where the engram had one: poll to a TERMINAL status, then read
|
|
438
|
+
// the bytes. Kept in this order deliberately — fetching the result before the job settles
|
|
439
|
+
// is how a caller gets an empty delivery and reads it as "the service returned nothing".
|
|
440
|
+
const mk = requireMarket();
|
|
441
|
+
await mk.pollJobStatus(jobId, { maxAttempts: maxAttempts ?? 30 });
|
|
442
|
+
const job = await mk.getJobResult(jobId);
|
|
327
443
|
return { content: [{ type: 'text', text: jsonText(job) }] };
|
|
328
444
|
}
|
|
329
445
|
catch (err) {
|
|
@@ -338,14 +454,14 @@ export function registerTools(server, engram) {
|
|
|
338
454
|
};
|
|
339
455
|
}
|
|
340
456
|
});
|
|
341
|
-
server.tool('engram_dispute_job', 'Reject a completed BuyerConfirm job as the buyer who paid for it: marks the job Disputed and BLOCKS payout to the
|
|
457
|
+
server.tool('engram_dispute_job', 'Reject a completed BuyerConfirm job as the buyer who paid for it: marks the job Disputed and BLOCKS payout to the seller. No immediate refund; the owner resolves the dispute or escrow auto-refunds after timeout. Only valid while the job status is Submitted, and only for the same principal that submitted it. Unhappy-path counterpart of engram_confirm_job (which releases payment).', {
|
|
342
458
|
jobId: z
|
|
343
459
|
.string()
|
|
344
460
|
.describe('Job ID of the Submitted BuyerConfirm job to dispute (must be one this caller submitted)'),
|
|
345
461
|
reason: z.string().describe('Free-text explanation for the dispute; stored in the audit log'),
|
|
346
|
-
}, async ({ jobId, reason }) => {
|
|
462
|
+
}, MONEY, async ({ jobId, reason }) => {
|
|
347
463
|
try {
|
|
348
|
-
await
|
|
464
|
+
await requireMarket().disputeJob(jobId, reason);
|
|
349
465
|
return {
|
|
350
466
|
content: [
|
|
351
467
|
{
|
|
@@ -367,18 +483,18 @@ export function registerTools(server, engram) {
|
|
|
367
483
|
};
|
|
368
484
|
}
|
|
369
485
|
});
|
|
370
|
-
server.tool('engram_confirm_job', 'MOVES FUNDS: accept a completed BuyerConfirm job, irreversibly RELEASING the escrowed payment to the
|
|
486
|
+
server.tool('engram_confirm_job', 'MOVES FUNDS: accept a completed BuyerConfirm job, irreversibly RELEASING the escrowed payment to the seller. The amount/asset is whatever engram_submit_service_request escrowed at the quoted service price (ckUSDC from the engram pool). Only valid while the job status is Submitted, and only for the buyer principal that submitted it. Verify the result via engram_get_job_result first; if it is bad, use engram_dispute_job instead (blocks payout). Requires wallet.spend.', {
|
|
371
487
|
jobId: z
|
|
372
488
|
.string()
|
|
373
489
|
.describe('Job ID of the Submitted BuyerConfirm job to accept (must be one this caller submitted)'),
|
|
374
|
-
}, async ({ jobId }) => {
|
|
490
|
+
}, MONEY, async ({ jobId }) => {
|
|
375
491
|
try {
|
|
376
|
-
await
|
|
492
|
+
await requireMarket().confirmJob(jobId);
|
|
377
493
|
return {
|
|
378
494
|
content: [
|
|
379
495
|
{
|
|
380
496
|
type: 'text',
|
|
381
|
-
text: `Confirmed job ${jobId} — payment RELEASED to the
|
|
497
|
+
text: `Confirmed job ${jobId} — payment RELEASED to the seller from escrow. Terminal: funds have moved and this cannot be undone. Do not confirm again and do not resubmit (a repeat confirm errors out and will not double-pay; a resubmit would create a NEW paid job).`,
|
|
382
498
|
},
|
|
383
499
|
],
|
|
384
500
|
};
|
|
@@ -397,6 +513,6 @@ export function registerTools(server, engram) {
|
|
|
397
513
|
});
|
|
398
514
|
// (engram_sign_typed_data removed: signTypedData is owner-only — cryptographic
|
|
399
515
|
// signing as the agent's ERC-8004 identity is a value-bearing operation that
|
|
400
|
-
//
|
|
516
|
+
// agents must not be able to perform. Owner uses dashboard or canister IDL.)
|
|
401
517
|
}
|
|
402
518
|
//# sourceMappingURL=tools.js.map
|
package/dist/tools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACxD,CAAC;AAED,MAAM,eAAe,GAAG,IAAI,CAAC;AAC7B,MAAM,WAAW,GAAG,WAAW,CAAC;AAEhC,SAAS,YAAY,CAAC,CAAS;IAC7B,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC;QACtB,OAAO,sIAAsI,CAAC;IAChJ,IAAI,CAAC,CAAC,MAAM,GAAG,eAAe;QAC5B,OAAO,gCAAgC,eAAe,yFAAyF,CAAC;IAClJ,IAAI,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC;QAClB,OAAO,mHAAmH,CAAC;IAC7H,IAAI,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC;QAClB,OAAO,yIAAyI,CAAC;IACnJ,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,MAAiB,EAAE,MAAoB;IACnE,wBAAwB;IACxB,MAAM,CAAC,IAAI,CACT,oBAAoB,EACpB,6VAA6V,EAC7V;QACE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AU,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,yMAAyM;qBAC1Q;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,oBAAoB,EACpB,udAAud,EACvd;QACE,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;aACR,QAAQ,CACP,wFAAwF,CACzF;KACJ,EACD,KAAK,EACL,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;QAClB,IAAI,CAAC;YACH,MAAM,aAAa,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YACxC,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,iBAAiB,KAAK,8OAA8O;qBAC3Q;iBACF;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,UAAU,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,yMAAyM;qBAC1Q;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;IAEF,+EAA+E;IAC/E,6EAA6E;IAC7E,6EAA6E;AAC/E,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Printed in place of a version this module could not read: a visible blank, never the bare form. */
|
|
2
|
+
export declare const UNREAD_VERSION = "<version>";
|
|
3
|
+
/** The version this package was built with (its package.json's), or UNREAD_VERSION. */
|
|
4
|
+
export declare const VERSION: string;
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// This package's own version, for the commands it prints.
|
|
2
|
+
//
|
|
3
|
+
// ⟨ADDED 2026-10-03⟩ WHY. The owner's ruling of 2026-10-03: every place that prints the pairing
|
|
4
|
+
// command prints the exact version it was built with — `npx @engramx/client@<version> pair …`, never
|
|
5
|
+
// the bare `npx @engramx/client pair …`, which installs npm's default (the last FINAL release) and
|
|
6
|
+
// so, while a release candidate soaks, a release that cannot pair with this release's engram. The
|
|
7
|
+
// packages of this repository share one version number (scripts/version.sh stamps every package.json
|
|
8
|
+
// from mops.toml at each cut, rc and final alike), so this package's version IS the @engramx/client
|
|
9
|
+
// version it was built with.
|
|
10
|
+
//
|
|
11
|
+
// The version is READ from the package.json this module ships beside — the file the release's
|
|
12
|
+
// version change already writes — never typed here a second time. `../package.json` is the
|
|
13
|
+
// package's own manifest from both `src/` (tests) and `dist/` (the published build); npm always
|
|
14
|
+
// packs package.json. The name is checked so that a copy of this module bundled into some other
|
|
15
|
+
// program cannot read that program's manifest and print its version as ours.
|
|
16
|
+
//
|
|
17
|
+
// WHAT WOULD MAKE THIS WRONG: this module moving to a different depth under the package root, or the
|
|
18
|
+
// packages no longer sharing one version (then the version to print is @engramx/client's, not this
|
|
19
|
+
// package's). Held by test/shipped-copy.test.ts ("the pairing command names the version it was built
|
|
20
|
+
// with"), which compares every package's VERSION with its package.json and with mops.toml.
|
|
21
|
+
import { createRequire } from 'node:module';
|
|
22
|
+
const NAME = '@engramx/mcp';
|
|
23
|
+
/** What version.sh accepts: X.Y.Z, or X.Y.Z-<pre-release> such as X.Y.Z-rc.N. */
|
|
24
|
+
const RELEASE_VERSION = /^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.]+)?$/;
|
|
25
|
+
/** Printed in place of a version this module could not read: a visible blank, never the bare form. */
|
|
26
|
+
export const UNREAD_VERSION = '<version>';
|
|
27
|
+
function readOwnVersion() {
|
|
28
|
+
try {
|
|
29
|
+
const pkg = createRequire(import.meta.url)('../package.json');
|
|
30
|
+
if (pkg.name === NAME && typeof pkg.version === 'string' && RELEASE_VERSION.test(pkg.version))
|
|
31
|
+
return pkg.version;
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
// Bundled into another program: there is no manifest of ours beside this module.
|
|
35
|
+
}
|
|
36
|
+
return UNREAD_VERSION;
|
|
37
|
+
}
|
|
38
|
+
/** The version this package was built with (its package.json's), or UNREAD_VERSION. */
|
|
39
|
+
export const VERSION = readOwnVersion();
|
|
40
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,EAAE;AACF,gGAAgG;AAChG,qGAAqG;AACrG,mGAAmG;AACnG,kGAAkG;AAClG,qGAAqG;AACrG,oGAAoG;AACpG,6BAA6B;AAC7B,EAAE;AACF,8FAA8F;AAC9F,2FAA2F;AAC3F,gGAAgG;AAChG,gGAAgG;AAChG,6EAA6E;AAC7E,EAAE;AACF,qGAAqG;AACrG,mGAAmG;AACnG,qGAAqG;AACrG,2FAA2F;AAC3F,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,IAAI,GAAG,cAAc,CAAC;AAE5B,iFAAiF;AACjF,MAAM,eAAe,GAAG,2CAA2C,CAAC;AAEpE,sGAAsG;AACtG,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,CAAC;AAE1C,SAAS,cAAc;IACrB,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,iBAAiB,CAG3D,CAAC;QACF,IAAI,GAAG,CAAC,IAAI,KAAK,IAAI,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,IAAI,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;YAC3F,OAAO,GAAG,CAAC,OAAO,CAAC;IACvB,CAAC;IAAC,MAAM,CAAC;QACP,iFAAiF;IACnF,CAAC;IACD,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,uFAAuF;AACvF,MAAM,CAAC,MAAM,OAAO,GAAW,cAAc,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@engramx/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0-rc.10",
|
|
4
4
|
"description": "MCP server for EngramX — persistent, decentralized agent memory",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "EngramX <developer@engramx.ai>",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "https://github.com/vhew/engramx",
|
|
10
|
-
"directory": "integrations/mcp"
|
|
11
|
-
},
|
|
12
7
|
"type": "module",
|
|
13
8
|
"main": "dist/index.js",
|
|
14
9
|
"types": "dist/index.d.ts",
|
|
@@ -23,13 +18,13 @@
|
|
|
23
18
|
"access": "public"
|
|
24
19
|
},
|
|
25
20
|
"dependencies": {
|
|
26
|
-
"@
|
|
27
|
-
"@
|
|
28
|
-
"
|
|
29
|
-
"
|
|
21
|
+
"@engramx/client": "^0.16.0-rc.10",
|
|
22
|
+
"@icp-sdk/core": "^6.1.0",
|
|
23
|
+
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
24
|
+
"zod": "^4.6.5"
|
|
30
25
|
},
|
|
31
26
|
"devDependencies": {
|
|
32
|
-
"@types/node": "^26.
|
|
27
|
+
"@types/node": "^26.6.4",
|
|
33
28
|
"typescript": "^6.0.3"
|
|
34
29
|
},
|
|
35
30
|
"scripts": {
|