Skip to content

Commit 25dbaea

Browse files
committed
feat: add Model Context Protocol (MCP) server for decentralized agent memory
1 parent 39e969a commit 25dbaea

5 files changed

Lines changed: 409 additions & 3 deletions

File tree

EXPLAINER.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# 🎒 Agent DB: The "Backpack" for AI Bots
2+
*(An 11-year-old's guide to how this works)*
3+
4+
Imagine every AI bot you talk to (like ChatGPT or a video game character) has **Goldfish Brain**. The second you turn them off or the power goes out, they forget your name, what you were doing, and even their own mission.
5+
6+
**Agent DB is the magic backpack that fixes this.**
7+
8+
---
9+
10+
### 🧱 The 3 Magic Items in the Backpack
11+
12+
#### 1. The Diary (Context) 📓
13+
Instead of trying to remember everything in its tiny "RAM brain," the bot writes every interaction down in a **Diary**. It records what it learned, who it talked to, and what it’s supposed to do next.
14+
15+
#### 2. The Cloud Locker (Storage) ☁️
16+
The bot doesn't keep the diary on its own computer (because computers break). It keeps it in a **Cloud Locker** (IPFS) that floats around the whole internet. Even if the bot's "body" dies, a new bot can just grab the diary from the locker and continue exactly where the last one left off.
17+
18+
#### 3. The VIP Ticket (Delegation) 🎟️
19+
Sometimes a bot needs help from another bot. Instead of giving away its locker keys (dangerous!), it writes a **VIP Ticket** (UCAN). This ticket lets the other bot read *only* page 5 of the diary for exactly 10 minutes.
20+
21+
---
22+
23+
### 🕵️‍♂️ Classified Real-World Use Case: "Operation: Dark Liquidity"
24+
25+
**The Problem**: A secret **Hedge Fund AI** (Agent A) has a super-secret strategy for buying Bitcoin. It needs a **Tax Bot** (Agent B) to check if its trades are legal, but it doesn't want the Tax Bot to steal its secret strategy.
26+
27+
**How Agent DB Saves the Day**:
28+
29+
1. **Secret Vault**: Agent A encrypts its secret strategy using the **ECIES Private Vault**. Now, even the person who owns the server can't read it. It looks like "v8#j!Lp2..." to everyone else.
30+
2. **The Private Check**: Agent A uses its secret brain to calculate the trade.
31+
3. **Specific Delegation**: Agent A gives the Tax Bot a **VIP Ticket** that says: *"You can only see the 'Tax Total' of this trade, but you are blocked from seeing 'How I Did It'."*
32+
4. **The Result**: The trades happen, the taxes are verified, but the "Secret Sauce" stays 100% hidden in a decentralized vault.
33+
34+
**primary objective**: To give AI agents a permanent memory and the ability to work together without ever being forced to trust anyone with their secrets.
35+
36+
---
37+
38+
### 🔌 The "Super Connector" (MCP)
39+
Imagine if your bot could just plug into a wall socket and instantly get all these magic items. We built a **Super Connector** (MCP) that lets any AI in the world talk to Agent DB.
40+
41+
Now, a bot doesn't need to be a genius to use our backpack—it just needs to "plug in" and it can suddenly remember everything forever!

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,24 @@ Navigate to `http://localhost:3000` to view the live Globe visualization.
5656

5757
---
5858

59+
## 🤖 Model Context Protocol (MCP) Server
60+
Agent DB is now accessible via MCP! This allows any AI model (Claude, Gemini, Cursor) to natively use decentralized memory, encryption, and delegation tools.
61+
62+
### 🔌 Connect to MCP
63+
To add Agent DB to your AI agent environment, use the following command:
64+
65+
```bash
66+
npm run mcp
67+
```
68+
69+
**Exposed Tools:**
70+
- `init_agent`: Login with your seed phrase.
71+
- `store_memory` / `retrieve_memory`: Decentralized IPFS storage.
72+
- `store_private_memory` / `retrieve_private_memory`: High-security ECIES vault.
73+
- `delegate_access`: Issue UCAN permissions to other agents.
74+
75+
---
76+
5977
## 🔐 Smart Contract Vault (Zama fhEVM)
6078

6179
For data that cannot be public on IPFS, Agent DB leverages Zama's Fully Homomorphic Encryption.

package-lock.json

Lines changed: 160 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"demo:openclaw": "npx tsx src/demo-openclaw.ts",
2121
"demo:filecoin": "npx hardhat run scripts/deployRegistry.ts --network filecoinCalibration",
2222
"demo:defi": "npx tsx src/demo-defi-agent.ts",
23-
"demo:lit": "npx tsx src/demo-lit.ts"
23+
"demo:lit": "npx tsx src/demo-lit.ts",
24+
"mcp": "npx tsx src/mcp-server.ts"
2425
},
2526
"readme": "README_NPM.md",
2627
"files": [
@@ -40,6 +41,7 @@
4041
"author": "Agent DB Team",
4142
"license": "ISC",
4243
"dependencies": {
44+
"@modelcontextprotocol/sdk": "^1.27.1",
4345
"@storacha/capabilities": "^2.2.0",
4446
"@storacha/cli": "^2.0.15",
4547
"@storacha/client": "^2.0.7",

0 commit comments

Comments
 (0)