openzoo 0.34.11 → 0.35.0
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/lib/mcp.js +45 -0
- package/package.json +1 -1
package/lib/mcp.js
CHANGED
|
@@ -7,6 +7,7 @@ import { PayClient, QuoteTooHighError, UnderfundedError } from './pay.js';
|
|
|
7
7
|
import { tokenBalance } from './x402.js';
|
|
8
8
|
import { askWithContext, contextCacheDisabled, BIND_MIN_CHARS } from './hrr.js';
|
|
9
9
|
import { listContexts } from './contexts.js';
|
|
10
|
+
import { withNamespace } from './namespace.js';
|
|
10
11
|
|
|
11
12
|
const pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
|
|
12
13
|
// The model zoo_ask uses when the caller does not name one. Opus 5 by default:
|
|
@@ -301,6 +302,50 @@ export function buildMcpServer() {
|
|
|
301
302
|
})),
|
|
302
303
|
}));
|
|
303
304
|
|
|
305
|
+
// OUROBOROS — the model's durable external memory, managed server-side by
|
|
306
|
+
// leCore (docs/ZOO.md §7-8). memory_write stores a fact into a per-wallet
|
|
307
|
+
// partition; memory_search recalls ranked, best first, across sessions. The
|
|
308
|
+
// namespace header keys the partition to THIS wallet. Free (infrastructure),
|
|
309
|
+
// and every response carries a deterministic lecore.receipt.
|
|
310
|
+
const memHeaders = () => withNamespace({ 'content-type': 'application/json' });
|
|
311
|
+
|
|
312
|
+
server.registerTool('zoo_remember', {
|
|
313
|
+
description: 'OUROBOROS: store a fact/decision into your durable external memory (leCore, server-side). Findable later by zoo_recall across sessions — you HAVE persistent memory; write to it instead of losing context.',
|
|
314
|
+
inputSchema: {
|
|
315
|
+
text: z.string().describe('the fact, decision, or note to remember'),
|
|
316
|
+
tags: z.array(z.string()).optional().describe('optional tags to group/filter later'),
|
|
317
|
+
},
|
|
318
|
+
}, async ({ text: t, tags }) => {
|
|
319
|
+
try {
|
|
320
|
+
const r = await fetch(`${config.apiBase}/v1/memory/write`, {
|
|
321
|
+
method: 'POST', headers: memHeaders(),
|
|
322
|
+
body: JSON.stringify({ text: t, tags: tags || [] }),
|
|
323
|
+
});
|
|
324
|
+
const d = await r.json();
|
|
325
|
+
if (!r.ok) return text({ error: d?.error || `memory_write HTTP ${r.status}` });
|
|
326
|
+
return text({ stored: d.stored, id: d.id, total_memories: d.entries, receipt: d._meta?.['lecore.receipt']?.output_sha256?.slice(0, 16) });
|
|
327
|
+
} catch (e) { return text({ error: `zoo_remember failed: ${e.message}` }); }
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
server.registerTool('zoo_recall', {
|
|
331
|
+
description: 'OUROBOROS: recall from your durable external memory — ranked results, best first, across all past sessions. Check here BEFORE claiming you do not remember something.',
|
|
332
|
+
inputSchema: {
|
|
333
|
+
query: z.string().describe('what to recall'),
|
|
334
|
+
top: z.number().int().min(1).max(50).optional().describe('how many results (default 4)'),
|
|
335
|
+
tags: z.array(z.string()).optional().describe('restrict to these tags'),
|
|
336
|
+
},
|
|
337
|
+
}, async ({ query, top, tags }) => {
|
|
338
|
+
try {
|
|
339
|
+
const r = await fetch(`${config.apiBase}/v1/memory/search`, {
|
|
340
|
+
method: 'POST', headers: memHeaders(),
|
|
341
|
+
body: JSON.stringify({ query, top: top || 4, ...(tags ? { tags } : {}) }),
|
|
342
|
+
});
|
|
343
|
+
const d = await r.json();
|
|
344
|
+
if (!r.ok) return text({ error: d?.error || `memory_search HTTP ${r.status}` });
|
|
345
|
+
return text({ hits: (d.hits || []).map((h) => ({ id: h.id, text: h.text, tags: h.tags, score: h.score })), searched: d.searched });
|
|
346
|
+
} catch (e) { return text({ error: `zoo_recall failed: ${e.message}` }); }
|
|
347
|
+
});
|
|
348
|
+
|
|
304
349
|
return { server, client };
|
|
305
350
|
}
|
|
306
351
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openzoo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.0",
|
|
4
4
|
"description": "Local x402-paying proxy + MCP server for openzoo.fun — point any OpenAI-compatible harness (Cursor, Claude Code, aider, SDKs) at localhost and it pays per call from a local burner wallet. Solana and Base rails live; Robinhood experimental.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|