AgentDB
MCP server providing agent memory management with layered awakening, per-agent SQLite storage, and a dashboard for monitoring and administration.
README
AgentDB
MCP-based agent memory management system with layered awakening.
Each agent gets its own SQLite database. An MCP server exposes tools for managing context (system prompts, todos, memories, skills, buffers, tool calls). A Flask dashboard provides a web UI and REST API for monitoring and administration.
Architecture
Worker Agent ──► MCP Server (agent_id scoped tools)
│
▼
SQLite per agent ◄── Dashboard (read-only views + admin API)
(WAL mode)
Key design decisions:
- Layered awakening — loads ~5K tokens instead of 50K+ by selecting top priorities, top memories, skill metadata only, and buffer titles only
- Per-agent isolation — each agent has its own
.dbfile; no cross-agent data leakage - WAL mode — concurrent readers never block writers
- Auto-logging —
AutoLoggingMCPproxy records every tool call with timing, input/output summaries, without blocking tool execution
Project Structure
agent-db/
├── agentdb_server/ # MCP server
│ ├── server.py # Entry point, tool registration
│ ├── db.py # DatabaseManager (connections, migrations)
│ ├── schema.sql # SQLite schema (7 tables)
│ ├── tool_logger.py # AutoLoggingMCP proxy
│ └── tools/
│ ├── awaken.py # Layered awakening (6 layers)
│ ├── todo.py # Todo CRUD
│ ├── memory.py # Memory store & search
│ ├── skill.py # Skill catalog
│ ├── buffer.py # Long document storage
│ └── tool_call.py # Tool call logging & stats
├── dashboard/ # Flask web app
│ ├── app.py # Routes (index, agent detail, admin)
│ ├── api.py # REST API blueprint (/api)
│ ├── models.py # SQLAlchemy ORM models
│ └── templates/
│ ├── base.html # Dark theme base layout
│ ├── index.html # Agent list
│ ├── agent_detail.html # Agent overview
│ ├── awakening_detail.html
│ └── admin.html # Cross-agent admin overview
├── tests/
│ ├── test_core.py # DB layer + schema tests
│ └── test_api.py # REST API endpoint tests
└── pyproject.toml
Quick Start
Install
pip install -e ".[dashboard,dev]"
Run MCP Server
# Default agents directory: ./agents
agentdb-server
# Custom directory
AGENTDB_AGENTS_DIR=/path/to/agents agentdb-server
Run Dashboard
agentdb-dashboard
# Serves at http://localhost:5000
Run Tests
pytest tests/ -v
MCP Tools
Awakening
| Tool | Description |
|---|---|
awaken(agent_id, include_tool_history?) |
Load 6-layer context (~5K tokens) |
update_system_prompt(agent_id, content) |
Create new prompt version |
get_system_prompt(agent_id) |
Get active system prompt |
Awakening layers:
| Layer | Content | Budget |
|---|---|---|
| 1 | Active system prompt | ~500 tokens |
| 2 | Top 5 pending todos by priority | ~200 tokens |
| 3 | Skills catalog (metadata only) | ~1000 tokens |
| 4 | Top 10 memories by importance | ~3000 tokens |
| 5 | Buffer references (titles only) | minimal |
| 6 | Recent 20 tool calls (optional) | ~300 tokens |
Todos
| Tool | Description |
|---|---|
add_todo(agent_id, content, priority?) |
Add todo (priority 1-10) |
list_todos(agent_id, status?) |
List todos, filter by status |
complete_todo(agent_id, todo_id) |
Mark todo as done |
Memories
| Tool | Description |
|---|---|
remember(agent_id, title, content, importance?, mem_type?) |
Store memory (importance 0.0-1.0, type: fact/experience/insight) |
search_memories(agent_id, query, limit?) |
Keyword search, ordered by importance |
get_memory(agent_id, memory_id) |
Get single memory |
Skills
| Tool | Description |
|---|---|
add_skill(agent_id, category, name, description, full_doc?) |
Add to catalog |
get_skill_catalog(agent_id) |
Metadata by category (no full_doc) |
load_skill(agent_id, skill_id) |
Load full documentation |
Buffers
| Tool | Description |
|---|---|
store_buffer(agent_id, title, content) |
Store long document |
load_buffer(agent_id, buffer_id) |
Load full content |
list_buffers(agent_id) |
List titles only |
Tool Calls
| Tool | Description |
|---|---|
log_tool_call(agent_id, tool_name, status?, ...) |
Manually log external tool usage |
list_tool_calls(agent_id, tool_name?, limit?) |
Query call history |
get_tool_stats(agent_id) |
Per-tool stats: count, success/error rate, avg duration |
Dashboard REST API
Base URL: http://localhost:5000/api
Agents
GET /api/agents # List all agents with stats
Per-Agent Resources
Each resource supports full CRUD at /api/agents/{id}/{resource}:
GET /api/agents/{id}/memories # List
GET /api/agents/{id}/memories/{mid} # Detail
POST /api/agents/{id}/memories # Create
PUT /api/agents/{id}/memories/{mid} # Update
DELETE /api/agents/{id}/memories/{mid} # Delete
Same pattern applies to: todos, skills, buffers, system_prompts.
Tool Calls & Awakenings (read-only)
GET /api/agents/{id}/tool_calls?tool_name=&limit= # Call history
GET /api/agents/{id}/tool_calls/stats # Aggregated stats
GET /api/agents/{id}/awakenings # Awakening history
GET /api/agents/{id}/awakenings/{aid} # Awakening detail
Examples
# List agents
curl http://localhost:5000/api/agents
# Create a memory
curl -X POST http://localhost:5000/api/agents/my-agent/memories \
-H 'Content-Type: application/json' \
-d '{"title": "API pattern", "content": "Use REST conventions", "importance": 0.8}'
# Get tool call stats
curl http://localhost:5000/api/agents/my-agent/tool_calls/stats
Database Schema
Each agent's SQLite database contains 7 tables:
| Table | Purpose |
|---|---|
system_prompts |
Versioned behavioral guidelines |
todos |
Task items with priority (1-10) and status |
memories |
Knowledge notes with importance (0.0-1.0) and type |
skills |
Skill catalog with metadata + full documentation |
buffers |
Long document storage |
tool_calls |
Tool invocation history with timing and status |
awakenings |
Snapshots of what was loaded during each awakening |
Auto-Logging
The AutoLoggingMCP proxy wraps tool registration so that every tool call is automatically recorded:
- Timing — duration in milliseconds
- Input summary — JSON with large fields truncated to 200 chars
- Output summary — truncated to 500 chars
- Silent failure — logging errors never block tool execution
- Exclusions —
log_tool_call,list_tool_calls,get_tool_statsare excluded to prevent recursion
Claude Code Integration
Add to your Claude Code MCP config:
{
"mcpServers": {
"agentdb": {
"command": "agentdb-server",
"env": {
"AGENTDB_AGENTS_DIR": "/path/to/agents"
}
}
}
}
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。