
scanadi/mcp-ai-memory
Developer toolsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
Semanticメモリ管理用のModel Context Protocol (MCP)サーバー
概要
AIエージェントがセッション間でコンテキストナレッジを保存、取得、管理できるように、セマンティック・メモリ管理用のモデル・コンテクト・プロトコル(MCP)サーバーです。 : このメモリシステムを効果的に使用するためにAIモデルを指示する方法に関する包括的なガイドについては、システム PROMPT.mdを参照してください。 このプロンプトは、特にプロアクティブなメモリ検索のために、メモリツールを使用するタイミングと方法を理解することができます。 - - - 厳格なモードでフルタイプの安全 - - HNSWインデックス付きベクトル類似性検索 - タイプ安全SQLクエリ - トランスを使用して.js (API呼び出しなし) - - 応答から削除されたRedis +インメモリーフォールバック - ユーザーコンテキスト分離 - 応答から削除された埋め込み - - 豊富な関係タイプ(参照、矛盾、サポート、拡張、原因、優先順位など).
概要(AI 翻訳)
AIエージェントがセッション間でコンテキストナレッジを保存、取得、管理できるように、セマンティック・メモリ管理用のモデル・コンテクト・プロトコル(MCP)サーバーです。
** 利用可能なシステムプロンプト**:このメモリシステムを使用するAIモデルを効果的に指示する方法に関する包括的なガイドについては、システム PROMPT.mdを参照してください。 このプロンプトは、特にプロアクティブなメモリ検索のために、メモリツールを使用するタイミングと方法を理解することができます。
##特徴
コア機能
- TypeScript - 厳密なモードの完全なタイプ安全
- PostgreSQL + pgvector - HNSWインデックス付きベクトル類似性検索
- Kysely ORM - 安全なSQLクエリ -Local Embeddings - トランスを使ってください。js(API呼び出しなし)
- Intelligent Caching - 速い性能をblazingのためのRedis +メモリのフォールバック -マルチエージェントサポート - ユーザーコンテキストの分離
- トークン効率 - 応答から削除された埋め込み
高度なメモリ管理
-グラフの関係 - 豊富な関係タイプ(参照、矛盾、サポート、拡張、原因、優先順位など)
- グラフ トラバーサル - BFS/DFS の深さの限界およびろ過のアルゴリズム
このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。
README
以下は原文 README の抜粋です。原文を見る。
MCP AI Memory
A production-ready Model Context Protocol (MCP) server for semantic memory management that enables AI agents to store, retrieve, and manage contextual knowledge across sessions.
📖 System Prompt Available: See SYSTEM_PROMPT.md for a comprehensive guide on how to instruct AI models to use this memory system effectively. This prompt helps models understand when and how to use memory tools, especially for proactive memory retrieval.
Features
Core Capabilities
- TypeScript - Full type safety with strict mode
- PostgreSQL + pgvector - Vector similarity search with HNSW indexing
- Kysely ORM - Type-safe SQL queries
- Local Embeddings - Uses Transformers.js (no API calls)
- Intelligent Caching - Redis + in-memory fallback for blazing fast performance
- Multi-Agent Support - User context isolation
- Token Efficient - Embeddings removed from responses
Advanced Memory Management
- Graph Relationships - Rich relationship types (references, contradicts, supports, extends, causes, precedes, etc.)
- Graph Traversal - BFS/DFS algorithms with depth limits and filtering
- Memory Decay - Automatic lifecycle management with exponential decay
- Memory States - Active, dormant, archived, and expired states
- Preservation - Protect important memories from decay
- Soft Deletes - Data recovery with deleted_at timestamps
- Clustering - Automatic memory consolidation
- Compression - Automatic compression of archived memories
Prerequisites
- Node.js 18+ or Bun
- PostgreSQL with pgvector extension
- Redis (optional - falls back to in-memory cache if not available)
Installation
NPM Package (Recommended for Claude Desktop)
npm install -g mcp-ai-memory
From Source
- Install dependencies:
bun install
- Set up PostgreSQL with pgvector:
CREATE DATABASE mcp_ai_memory;
\c mcp_ai_memory
CREATE EXTENSION IF NOT EXISTS vector;
- Create environment file:
# Create .env with your database credentials
touch .env
- Run migrations:
bun run migrate
Usage
Development
bun run dev
Production
bun run build
bun run start
Troubleshooting
Embedding Dimension Mismatch Error
If you see an error like:
Failed to generate embedding: Error: Embedding dimension mismatch: Model produces 384-dimensional embeddings, but database expects 768
This occurs when the embedding model changes between sessions. To fix:
- Option 1: Reset and Re-embed (Recommended for new installations)
# Clear existing memories and start fresh psql -d your_database -c "TRUNCATE TABLE memories CASCADE;"
インストール
npx -y mcp-ai-memory設定
{
"mcpServers": {
"memory": {
"command": "npx",
"args": ["-y", "mcp-ai-memory"],
"env": {
"MEMORY_DB_URL": "postgresql://...",
"EMBEDDING_MODEL": "Xenova/all-mpnet-base-v2"
}
}
}
}