bmdpat-agent-memory
v1.0.0
Published
MCP server for the bmdpat.com Agent Memory API — persistent key-value memory for AI agents, powered by x402 USDC micropayments on Base.
Downloads
131
Maintainers
Readme
@bmdpat/agent-memory-mcp
MCP server for the bmdpat.com Agent Memory API — persistent key-value memory for AI agents, paid per-call with USDC micropayments on Base via x402.
What it does
Exposes four tools that let any MCP-compatible AI agent (Claude, Cursor, etc.) read and write persistent memories:
| Tool | Description | Cost |
|------|-------------|------|
| memory_store | Store a key-value memory in a namespace | ~$0.001 |
| memory_recall | Retrieve a specific memory or list all in a namespace | ~$0.001 |
| memory_forget | Delete a memory by namespace + key | ~$0.0005 |
| memory_stats | Get total count and list of all namespaces | ~$0.0001 |
Payments are handled automatically — the server intercepts 402 responses and signs the USDC transfer for you.
Requirements
- Node.js 18+
- An EVM wallet private key (
EVM_PRIVATE_KEY) - USDC on Base (chain ID 8453) in that wallet — even a few cents covers thousands of calls
Setup
1. Get USDC on Base
Bridge USDC to Base at bridge.base.org or buy directly on Coinbase. Even $1 covers ~1,000 memory operations.
2. Install
npm install -g @bmdpat/agent-memory-mcpOr run without installing:
npx @bmdpat/agent-memory-mcp3. Configure your MCP client
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"agent-memory": {
"command": "npx",
"args": ["@bmdpat/agent-memory-mcp"],
"env": {
"EVM_PRIVATE_KEY": "0xYOUR_PRIVATE_KEY_HERE"
}
}
}
}Cursor
Add to .cursor/mcp.json in your project root or ~/.cursor/mcp.json globally:
{
"mcpServers": {
"agent-memory": {
"command": "npx",
"args": ["@bmdpat/agent-memory-mcp"],
"env": {
"EVM_PRIVATE_KEY": "0xYOUR_PRIVATE_KEY_HERE"
}
}
}
}Other MCP clients
Any client that supports stdio MCP servers works. Point it to npx @bmdpat/agent-memory-mcp with EVM_PRIVATE_KEY in the environment.
Environment variables
| Variable | Required | Default | Description |
|----------|----------|---------|-------------|
| EVM_PRIVATE_KEY | Yes | — | EVM private key (32-byte hex, 0x-prefixed or not). Must have USDC on Base. |
| MEMORY_API_URL | No | https://bmdpat.com | Override the API base URL (for local dev/testing). |
Security: Use a dedicated wallet with only the USDC you need. Never use a wallet that holds large amounts or controls other assets.
Usage examples
Once configured, ask your AI agent to:
Store the current task context in memory namespace "my-project", key "current-task"
Recall all memories in namespace "my-project"
What namespaces do I have stored in memory?
Forget the memory at namespace "my-project", key "old-context"Namespacing strategy
Use namespaces to organize memories by scope:
session-{id}— per-session contextuser-{id}— user-specific preferencesproject-{name}— project-level shared contextglobal— cross-session persistent facts
How x402 payments work
When the MCP server calls the API:
- The API returns HTTP 402 with payment requirements (amount, asset, payTo address on Base)
- The server signs an EIP-3009
TransferWithAuthorizationover USDC using your private key - The signed payment is attached as an
X-PAYMENTheader and the request is retried - The API verifies the payment on-chain and processes the request
No pre-authorization or account registration needed — just a wallet with USDC.
Building from source
git clone https://github.com/bmdhodl/bmdpat
cd bmdpat/mcp-server
npm install
npm run build
node dist/index.jsAPI reference
The underlying API is documented at the endpoints below. All require x402 payment:
POST /api/memory/store— store a key-value memoryPOST /api/memory/recall— retrieve by key, or list all in namespaceDELETE /api/memory/forget— delete a specific memoryGET /api/memory/stats— total count and namespace list
License
MIT
