mcp-memory
Smart memory for AI agents. Solves the Karpathy problem: memories decay, topics are frequency-weighted, one-time questions don't become obsessions. 7 tools. Zero deps.
README
mcp-memory
Smart memory for AI agents. Memories decay, topics are frequency-weighted, one-time questions don't become obsessions.
Solves the Karpathy problem: "A single question from 2 months ago keeps coming up as a deep interest with undue mentions in perpetuity."
In Action
Day 1: User asks 5 questions (Rust, dark mode, Python, job title, Haskell)
#1 [ACTIVE] rel=1.000 cat=preference "User prefers dark mode in all editors"
#2 [ACTIVE] rel=0.900 cat=fact "User works as a senior software engineer"
#3 [FADING] rel=0.500 cat=question "User is building a Python web scraper"
#4 [FADING] rel=0.300 cat=one-time "User asked about Rust programming"
#5 [FADING] rel=0.300 cat=one-time "User asked what Haskell monads are"
Day 2-5: User mentions Python 4 more times → auto-upgraded to "interest"
#1 [ACTIVE] rel=2.658 mentions=5 cat=interest "Python web scraper"
#2 [ACTIVE] rel=1.000 mentions=1 cat=preference "dark mode"
#3 [ACTIVE] rel=0.900 mentions=1 cat=fact "senior software engineer"
#4 [FADING] rel=0.300 mentions=1 cat=one-time "Rust" ← FADING, won't obsess
#5 [FADING] rel=0.300 mentions=1 cat=one-time "Haskell" ← FADING, won't obsess
After 60 days:
Rust: 0.3 × 0.5^(60/7) = 0.0008 → DEAD (gone, as it should be)
Python: 0.8 × 0.5^(60/60) × 3.32 = 1.329 → STILL ACTIVE (real interest)
How It Fixes This
| Current LLM Memory | mcp-memory |
|---|---|
| Ask about Rust once → mentioned forever | Ask once → fades in 7 days |
| All memories equal weight | Categories: one-time (7d), question (14d), interest (60d), preference (180d) |
| No decay | Exponential decay — old memories naturally fade |
| No frequency tracking | Mentioned 5+ times → auto-upgrades from "question" to "interest" |
| Keyword matching | Relevance scoring: decay × frequency × match quality |
Install
"mcpServers": {
"memory": {
"command": "npx",
"args": ["-y", "mcp-memory"]
}
}
Tools
| Tool | What it does |
|---|---|
remember |
Store a memory with category. Auto-detects duplicates and reinforces. |
recall |
Retrieve memories ranked by smart relevance, not just keyword match. |
forget |
Explicitly delete a memory. |
reinforce |
User mentioned topic again — boost relevance, reset decay clock. |
inspect |
Debug view: all memories with decay status and scores. |
prune |
Auto-remove memories below relevance threshold. |
stats |
Health overview: active, fading, dead memories. |
Memory Categories
| Category | Decay Half-life | Use For |
|---|---|---|
one-time |
7 days | Casual question, unlikely to matter again |
question |
14 days | Regular question, might come back |
interest |
60 days | Recurring topic (auto-promoted after 5 mentions) |
context |
30 days | Situational context, project-specific |
preference |
180 days | User stated preference ("I prefer X") |
correction |
365 days | User corrected the agent ("No, I meant X") |
fact |
365 days | Factual info about the user (role, location) |
Examples
User asks about Rust once:
remember(content: "User asked about Rust programming", category: "one-time")
→ Stored. Decays to 50% in 7 days. Gone in a month.
User keeps mentioning Python (5th time):
remember(content: "User asked about Python")
→ Reinforced (mention #5). Auto-upgraded from "question" to "interest". Now persists 60 days.
Recall with smart ranking:
recall(query: "programming")
→ Python (relevance: 0.92, 5 mentions, ACTIVE)
→ Rust (relevance: 0.08, 1 mention, FADING)
Python ranks first because it's been mentioned 5x. Rust ranks last because it was asked once and is fading. This is what Karpathy wants.
The Math
relevance = base_weight × decay × frequency_boost
where:
base_weight = category-specific (0.3 for one-time, 1.0 for preference)
decay = 0.5 ^ (age_days / halflife_days)
freq_boost = 1 + log2(mention_count)
A one-time question from 2 months ago:
0.3 × 0.5^(60/7) × 1.0 = 0.0003 → effectively zero. Won't surface.
A preference mentioned 8 times, last week:
1.0 × 0.5^(7/180) × 4.0 = 3.89 → top of every recall.
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 模型以安全和受控的方式获取实时的网络信息。