indra_db_mcp
用于人工智能推理和决策的持久记忆。
一个MCP服务器,为AI代理提供跨会话持久的内存。建立在 indra_db --一个类似git的版本化思想数据库。
问题
AI代理每次会话都会重新开始。昨天的见解消失了。重新做出决定。推理链消失了。
indra_db_mcp 通过赋予代理人以下改变:
- 🧠 持久内存 --在会话边界中幸存下来的记录推理
- 🔍 语义搜索 --按含义而非关键字查找过去的决定
- 🌿 分支 --在不失去主线的情况下探索替代方案
- 📜 历史 --了解理解是如何随着时间的推移而演变的
快速开始
安装
# Requires Bun (https://bun.sh)
bun add -g indra_db_mcp配置您的代理
克劳德代码 --添加到您的项目 CLAUDE.md:
@import node_modules/indra_db_mcp/INDRA_INSTRUCTIONS.md克劳德桌面 --添加到 claude_desktop_config.json:
{
"mcpServers": {
"indra": {
"command": "bunx",
"args": ["-y", "indra_db_mcp"]
}
}
}开源代码 --添加到 opencode.json:
{
"mcpServers": {
"indra": {
"command": ["bunx", "-y", "indra_db_mcp"],
"type": "local"
}
},
"instructions": ["node_modules/indra_db_mcp/INDRA_INSTRUCTIONS.md"]
}通用MCP客户端:
{
"mcpServers": {
"indra": {
"command": "bunx",
"args": ["-y", "indra_db_mcp"],
"env": {
"INDRA_DB_PATH": "./.indra"
}
}
}
}工具
| 工具 | 目的 |
|---|---|
indra_remember | 记录推理、决策和见解 |
indra_search | 通过意义找到过去的推理(或 "*" 为所有人) |
indra_status | 检查当前分支和条目计数 |
indra_branch | 创建、切换或列出分支 |
indra_experiment | 用于探索替代方案的快速沙盒 |
indra_history | 看看推理是如何进化的 |
indra_diff | 比较历史上的两点 |
示例用法
代理人可能会这样使用Indra:
User: Should I use PostgreSQL or MongoDB for my e-commerce app?
Agent thinking:
→ indra_search({ query: "database recommendations" })
→ Found: Previously recommended PostgreSQL for relational data with transactions
→ Making recommendation based on past reasoning + current context
→ indra_remember({
content: "Recommended PostgreSQL for e-commerce app. User has relational product
catalog, needs transactions for orders. Consistent with past guidance.",
id: "ecommerce-db-decision"
})稍后:
User: Why did you recommend PostgreSQL?
Agent:
→ indra_search({ query: "ecommerce database" })
→ Found the reasoning from the previous session
→ Can explain the decision with full context勘探分支
Agent: Let me explore an alternative approach...
→ indra_experiment({ name: "try-nosql-approach" })
[Explores MongoDB path, records reasoning]
→ indra_diff({ from: "main" }) // Compare with main reasoning
→ indra_branch({ action: "switch", name: "main" }) // Back to main环境变量
| 变量 | 描述 | 默认值 |
|---|---|---|
INDRA_DB_PATH | 数据库文件的路径 | ./.indra |
INDRA_API_URL | 用于同步的API(可选) | https://api.indradb.net |
运作原理
- 内容定址存储器 --每个条目都经过哈希处理。身份来自内容。
- 本地嵌入 --用途
sentence-transformers/all-MiniLM-L6-v2用于语义搜索。 - 类似Git的版本控制 --提交创建快照。分支允许并行探索。
- 单个文件 --一切尽在一
.indra文件。易于备份和共享。
建筑
┌─────────────────────────────────────────────────────────┐
│ MCP Client (Claude) │
└─────────────────────────┬───────────────────────────────┘
│ MCP Protocol (stdio)
┌─────────────────────────▼───────────────────────────────┐
│ indra_db_mcp (Bun) │
│ ┌─────────────┐ ┌──────────────┐ ┌───────────────┐ │
│ │ MCP SDK │ │ IndraClient │ │ Auto-sync │ │
│ └─────────────┘ └──────┬───────┘ └───────────────┘ │
└──────────────────────────┼──────────────────────────────┘
│ CLI subprocess (JSON)
┌──────────────────────────▼──────────────────────────────┐
│ indra CLI (Rust) │
│ ┌─────────────┐ ┌──────────────┐ ┌───────────────┐ │
│ │ Graph Store │ │ Embeddings │ │ Git-like VCS │ │
│ └─────────────┘ └──────────────┘ └───────────────┘ │
└─────────────────────────────────────────────────────────┘在IndraDB上可视化
推至 IndraDB 用于3D可视化和分析:
indra login
indra remote add origin username/my-memory
indra push origin许可证
麻省理工学院
