AI Long-Term Memory MCP Server
AI長期記憶MCPサーバー
AIエージェントに永続的な長期記憶を提供するModel Context Protocol (MCP) サーバーです。Claude Codeでの実用を想定して設計されており、AIシステムがセッションをまたいで記憶を保持できるようにします。
特徴
階層型メモリ構造: 3層システム(事実 → 経験 → 意思決定チェーン)
セマンティック検索: コサイン類似度を用いた埋め込みベースの検索
メモリ減衰: 活性化ベースの減衰 — 思い出された記憶は維持され、使われない記憶は薄れていく
感情認識: 感情の価数と強度を保存し、「フラッシュバルブ記憶(鮮明な記憶)」効果を実現
自動表面化: 会話コンテキストによってトリガーされるフックベースの自動メモリ検索
重複排除: 類似した記憶を自動的に統合(類似度80%以上のしきい値)
Related MCP server: Recall
アーキテクチャ
┌─────────────────────────────────────────┐
│ Claude Code │
│ (or any MCP client) │
├─────────────────────────────────────────┤
│ MCP Protocol │
├─────────────────────────────────────────┤
│ Memory MCP Server │
│ ┌───────────┐ ┌──────────────────┐ │
│ │ Write / │ │ Surface / │ │
│ │ Update / │ │ Search / │ │
│ │ Delete │ │ Read │ │
│ └─────┬─────┘ └────────┬─────────┘ │
│ │ │ │
│ ┌─────▼─────────────────▼─────────┐ │
│ │ SQLite Database │ │
│ │ memories + embeddings + decay │ │
│ └─────────────────────────────────┘ │
├─────────────────────────────────────────┤
│ Auto-Surface Hook │
│ (keyword matching on user input) │
└─────────────────────────────────────────┘メモリスキーマ
フィールド | 型 | 説明 |
| text | 短いタイトル |
| text | 全文 |
| text | 1行の要約 |
| text | 中程度の圧縮 |
| int | 1=事実, 2=経験, 3=意思決定チェーン |
| int | 1-5のスケール |
| real | 0-10, 高いほどフラッシュバルブ記憶 |
| real | -1から1, 負から正 |
| text | 気分の説明 |
| text | カンマ区切りのタグ |
| text | note/diary/feedback/project/user |
| text | JSON配列, 書き込み時に生成 |
| int | 思い出された回数 |
| text | 最後に思い出されたタイムスタンプ |
| text | active/decayed/expired |
MCPツール
ツール | 説明 |
| 自動埋め込みと重複排除を行い、記憶を作成または更新する |
| IDで特定の記憶を読み取る |
| 埋め込み類似度を使用したセマンティック検索 |
| 重要度と関連性に基づいて上位の記憶を表面化する |
| 既存のメモリフィールドを更新する |
| 記憶を論理削除する |
| 減衰サイクルを実行し、未使用の記憶を非アクティブ化する |
| 減衰した記憶を完全に削除する |
| メモリシステムの統計を取得する |
減衰メカニズム
記憶は created_at ではなく last_activated に基づいて減衰します。繰り返し思い出される記憶は無期限にアクティブなままです。減衰のしきい値:
低い重要度 (1-2) + 7日間アクティブ化なし → 減衰
中程度の重要度 (3) + 14日間アクティブ化なし → 減衰
高い重要度 (4-5) + 30日間アクティブ化なし → 減衰
ピン留めされた記憶は決して減衰しない
人間の記憶の統合に関する研究に触発されており、8つの論文に基づいています(設計ドキュメントを参照)。
自動表面化フック
auto_surface.cjs は Claude Code の UserPromptSubmit フックとして実行されます。ユーザーのメッセージごとに、以下の処理を行います:
メッセージからキーワードを抽出
メモリデータベースで一致するものを検索
関連する記憶を会話コンテキストに注入
これにより、明示的な検索コマンドなしで受動的な想起が可能になります。
セットアップ
npm installClaude Code MCP設定に追加:
{
"mcpServers": {
"memory": {
"command": "node",
"args": ["path/to/memory-mcp/index.js"]
}
}
}設計上の決定
ベクトルDBではなくSQLiteを採用: デプロイが簡単で、単一ファイルであり、1万件未満の記憶であれば十分な性能
時間ベースではなく活性化ベースの減衰: 人間の記憶を模倣 — 使用された記憶は強化され、未使用の記憶は薄れる
埋め込みによる重複排除: 類似したイベントの繰り返しによるメモリの肥大化を防ぐ
階層型アーキテクチャ: 事実(安定)、経験(コンテキスト依存)、意思決定(実行可能)を分離
研究参考文献
8つの論文の研究に基づいています:
Generative Agents (Stanford, 2023): メモリ・ストリーム、内省、計画/反応
MemGPT (2023): OSに触発されたページ管理を備えた階層型メモリ
LUFY (2024): 感情喚起の重み付けを伴う忘却メカニズム
MemoRAG (2024): 二重スコアリングを伴う記憶に触発された検索
Mem0 (2024): 自動抽出と重複排除を備えたグラフベースのメモリ
A-Mem (2024): 自己組織化エージェントメモリネットワーク
LoCoMo (2024): 長文脈会話メモリベンチマーク
Chloe/Noah (コミュニティ): 4次元コンパニオンAIメモリ
各論文の影響の詳細な分析については、docs/design.mdを参照してください。
ステータス
日常的にアクティブに使用中。17セッションで95以上の記憶を保持。実際の使用パターンに基づいて反復改善中。
ライセンス
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Persistent memory for AI agents. Search, store, and recall across sessions.
Memory system for AI agents with semantic search. Store and recall memories with ease.
Persistent memory and knowledge management for AI agents with semantic search and 50+ tools.
Persistent memory for AI agents. Semantic search, memory graph, W3C DID identity.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceProvides AI agents with persistent, searchable memory that survives across conversations using semantic search, temporal versioning, and smart organization. Enables long-term context retention and cross-session continuity for AI assistants.14-
- FlicenseAqualityNot gradedmaintenanceProvides long-term memory storage for AI assistants with semantic search, enabling persistent storage of preferences, decisions, and context with relationship tracking between memories.19-
- AlicenseNot gradedqualityCmaintenanceProvides persistent, semantic memory storage for LLMs across sessions using vector embeddings and FAISS search. Features bio-inspired memory consolidation, intelligent forgetting, and semantic retrieval without API costs.MIT

Memsolus MCP Serverofficial
AlicenseAqualityDmaintenanceProvides persistent long-term memory for AI agents through semantic search and automated knowledge graph extraction. It enables agents to store, recall, and reason over facts, preferences, and relationships across multiple conversations and sessions.148 npmMIT