Agent Memory MCP
A self-improving memory server that captures, organizes, and shares memories across workspaces, builds a personal knowledge graph, learns preferences, and recommends tools to limit token usage.
README
Agent Memory MCP
A self-improving agent memory server implementing the Model Context Protocol (MCP). It captures, organizes, and shares memories across all your workspaces and repositories, builds a personal knowledge graph, learns your preferences, and recommends the right tools to limit token usage.
Features
- Cross-workspace memory sharing — memories stored in
~/.agent-memory-mcp/are available to every workspace/repo. - Semantic + keyword recall — SQLite FTS5 full-text search plus lightweight vector similarity.
- Knowledge graph — auto-extracts entities and relations from memories, like a personal CodeGraph.
- Continuous correction — corrections are linked to memories and used to update confidence and generate preferences.
- Preference learning — learns style, formatting, workflow, and tool-selection preferences from interactions.
- Tool recommender — logs tool outcomes and recommends the best tool given a task description.
- Self-improvement —
reflectanalyzes patterns, merges duplicates, surfaces insights, and updates preferences.
Quick start
npm install
npm run build
node dist/index.js
📖 Full usage guide: https://jthiruveedula.github.io/agent-memory-mcp/
Platform Setup
VS Code (GitHub Copilot)
The .vscode/mcp.json is pre-configured for this workspace. Copilot will automatically discover it.
Claude Code CLI
Add the following to .claude/settings.json (already included in this repo):
{
"mcpServers": {
"agent-memory": {
"command": "node",
"args": ["${workspaceFolder}/dist/index.js"]
}
}
}
Claude Desktop
Open ~/Library/Application Support/Claude/settings.json and add:
{
"mcpServers": {
"agent-memory": {
"command": "node",
"args": ["/ABSOLUTE/PATH/TO/agent-memory-mcp/dist/index.js"]
}
}
}
Replace the path with the actual absolute path to this project.
Cursor
The .cursor/mcp.json is pre-configured for this workspace. Cursor will discover it automatically.
OpenCode
The opencode.json is pre-configured for this workspace. OpenCode will discover it automatically.
Environment variables
| Variable | Description |
|---|---|
AGENT_MEMORY_DIR |
Storage directory (default: ~/.agent-memory-mcp) |
AGENT_MEMORY_LOG_LEVEL |
debug, info, warn, error (default: info) |
OPENAI_API_KEY |
Optional: enables OpenAI text-embedding-3-small embeddings |
ANTHROPIC_API_KEY |
Optional: enables Anthropic API-based reflections |
Available tools
remember— store a memory, correction, preference, or tool outcome.recall— search memories semantically and by keyword.recall_recent— list the most recently accessed or created memories.remember_correction— store a correction tied to an existing memory.remember_tool_outcome— log success/failure, tokens, duration for a tool call.get_preferences— retrieve learned preferences, optionally filtered by key prefix.set_preference— manually set a preference.get_tool_recommendations— get ranked tool recommendations for a task.get_knowledge_graph— explore entities and relations around a topic.reflect— run self-improvement analysis.update_memory_confidence— reinforce or penalize a memory.
Example workflow
After connecting the server to your MCP client, it will start learning as you work:
-
Store a preference
{ "tool": "remember", "content": "I prefer flat error handling over throwing." } -
Log a tool outcome
{ "tool": "remember_tool_outcome", "arguments": { "tool_name": "grep_search", "task_summary": "Find helper usages", "success": true, "duration_ms": 120, "tokens_used": 200 } } -
Recall when needed
{ "tool": "recall", "arguments": { "query": "error handling preference", "limit": 5 } } -
Run reflection periodically
{ "tool": "reflect" }
The server also exposes a memory-context prompt and three resources (memory://preferences, memory://recent, memory://stats) that MCP clients can pull into context.
Architecture
src/
├── index.ts # Entry point: starts MCP stdio server
├── server.ts # MCP Server wiring (tools, resources, prompts)
├── config.ts # Configuration and paths
├── types.ts # Shared types and Zod schemas
├── db/
│ ├── schema.ts # SQLite schema with versioned migrations
│ ├── embeddings.ts # Local hash-based or OpenAI embeddings
│ └── memory-store.ts # CRUD, search, embeddings, graph persistence
├── graph/
│ └── knowledge-graph.ts # Entity/relation extraction and graph queries
├── learning/
│ ├── preference-learner.ts # Preference extraction and updates
│ ├── tool-recommender.ts # Tool outcome learning
│ └── self-improver.ts # Reflection and consolidation
└── tools/
└── memory-tools.ts # MCP tool handlers
Development
npm run dev # run with tsx
npm run build # compile TypeScript
npm run inspector # test with MCP inspector
Testing
npm test # runs full-test + stress-test + platform-check
# Individual suites
bash scripts/smoke-test.sh
bash scripts/full-test.sh
bash scripts/stress-test.sh
bash scripts/platform-check.sh
A GitHub Actions CI workflow is included under .github/workflows/ci.yml. Last updated: July 14, 2026.
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 模型以安全和受控的方式获取实时的网络信息。