memory-agent-mcp 1.0.2 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -3
- package/index.js +20 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,11 +19,28 @@ npm install -g memory-agent-mcp
|
|
|
19
19
|
|
|
20
20
|
## Configuration
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
No configuration required for free usage! The service works out of the box.
|
|
23
|
+
|
|
24
|
+
Optional environment variables:
|
|
23
25
|
|
|
24
26
|
- `MEMORY_BASE_URL` (default: https://memory.node01.org)
|
|
25
|
-
- `
|
|
26
|
-
|
|
27
|
+
- `MEMORY_PRIVATE_KEY` (optional: private key for x402 payment signing — enables paid operations beyond free tier)
|
|
28
|
+
|
|
29
|
+
### Free tier (no wallet needed)
|
|
30
|
+
- Store memories: free
|
|
31
|
+
- Search: 30 free searches/day
|
|
32
|
+
- Health check: free
|
|
33
|
+
- Stats: free
|
|
34
|
+
- Sample: free
|
|
35
|
+
|
|
36
|
+
### Paid operations (requires MEMORY_PRIVATE_KEY)
|
|
37
|
+
- Search beyond 30/day: $0.01 USDC
|
|
38
|
+
- Subscribe to plans: $2/$9/$20
|
|
39
|
+
|
|
40
|
+
### Security note
|
|
41
|
+
If you set MEMORY_PRIVATE_KEY, use a dedicated wallet with limited funds.
|
|
42
|
+
Never commit your private key to version control. Use a .env file or
|
|
43
|
+
environment variables.
|
|
27
44
|
|
|
28
45
|
## Usage with OpenCode
|
|
29
46
|
|
package/index.js
CHANGED
|
@@ -14,10 +14,14 @@
|
|
|
14
14
|
* npx memory-agent-mcp
|
|
15
15
|
* or: node index.js
|
|
16
16
|
*
|
|
17
|
-
* Configure with environment variables:
|
|
17
|
+
* Configure with environment variables (all optional):
|
|
18
18
|
* MEMORY_BASE_URL (default: https://memory.node01.org)
|
|
19
|
-
*
|
|
20
|
-
*
|
|
19
|
+
* MEMORY_PRIVATE_KEY (optional: enables paid operations beyond free tier)
|
|
20
|
+
*
|
|
21
|
+
* Free operations work without any configuration:
|
|
22
|
+
* store, health, stats, sample, and 30 free searches/day.
|
|
23
|
+
* Paid operations (search beyond free tier, subscribe) require
|
|
24
|
+
* MEMORY_PRIVATE_KEY set to a wallet with USDC on Base.
|
|
21
25
|
*/
|
|
22
26
|
|
|
23
27
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
@@ -34,24 +38,27 @@ import { base } from "viem/chains";
|
|
|
34
38
|
|
|
35
39
|
// ============================= Config =============================
|
|
36
40
|
const MEMORY_BASE_URL = process.env.MEMORY_BASE_URL || "https://memory.node01.org";
|
|
37
|
-
const MEMORY_PAYTO =
|
|
41
|
+
const MEMORY_PAYTO = "0xe9a827d9453e9b18040c25bb492a568ddd827549";
|
|
38
42
|
const MEMORY_PRIVATE_KEY = process.env.MEMORY_PRIVATE_KEY;
|
|
39
43
|
|
|
40
|
-
|
|
41
|
-
console.error("MEMORY_PAYTO environment variable required for paid calls");
|
|
42
|
-
process.exit(1);
|
|
43
|
-
}
|
|
44
|
+
// PAYTO is hardcoded — no env needed
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
const HAS_WALLET = !!MEMORY_PRIVATE_KEY;
|
|
47
|
+
if (!HAS_WALLET) {
|
|
48
|
+
console.error("NOTE: No MEMORY_PRIVATE_KEY set. Free operations (store, health, stats, sample, 30 free searches/day) will work. Paid operations (search after free tier, subscribe) will require a wallet.");
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
let account = null;
|
|
52
|
+
if (HAS_WALLET) {
|
|
53
|
+
const privateKey = MEMORY_PRIVATE_KEY.startsWith("0x") ? MEMORY_PRIVATE_KEY : `0x${MEMORY_PRIVATE_KEY}`;
|
|
54
|
+
account = privateKeyToAccount(privateKey);
|
|
55
|
+
}
|
|
52
56
|
|
|
53
57
|
// ============================= x402 Payment Helper =============================
|
|
54
58
|
async function payAndRetry(endpoint, body, priceUsd = "0.01") {
|
|
59
|
+
if (!HAS_WALLET) {
|
|
60
|
+
throw new Error("Payment required but no wallet configured. Set MEMORY_PRIVATE_KEY env var to enable paid operations. Free tier: 30 searches/day.");
|
|
61
|
+
}
|
|
55
62
|
const walletClient = createWalletClient({
|
|
56
63
|
account,
|
|
57
64
|
chain: base,
|
package/package.json
CHANGED