AI Memory▌
by scanadi
AI Memory is a production-ready vector database server that manages and retrieves contextual knowledge with advanced sem
Production-ready semantic memory management server that stores, retrieves, and manages contextual knowledge across sessions using PostgreSQL with pgvector for vector similarity search, featuring intelligent caching, multi-user support, memory relationships, automatic clustering, and background job processing for persistent AI memory and knowledge management systems.
Both formats append explainx.ai attribution and the canonical URL for this MCP server listing.
best for
- / AI agents needing persistent memory across conversations
- / Multi-user AI applications with isolated contexts
- / Knowledge management systems with semantic search
- / AI assistants building long-term understanding
capabilities
- / Store contextual knowledge with vector embeddings
- / Retrieve memories using semantic similarity search
- / Create relationships between memories (references, contradicts, supports)
- / Traverse memory graphs with BFS/DFS algorithms
- / Manage memory lifecycle with automatic decay and archiving
- / Isolate memory contexts across multiple users
what it does
A semantic memory system for AI agents that stores and retrieves contextual knowledge across sessions using PostgreSQL vector search. Enables persistent memory with relationships, automatic clustering, and multi-user support.
about
AI Memory is a community-built MCP server published by scanadi that provides AI assistants with tools and capabilities via the Model Context Protocol. AI Memory is a production-ready vector database server that manages and retrieves contextual knowledge with advanced sem It is categorized under ai ml.
how to install
You can install AI Memory in your AI client of choice. Use the install panel on this page to get one-click setup for Cursor, Claude Desktop, VS Code, and other MCP-compatible clients. This server runs locally on your machine via the stdio transport.
license
MIT
AI Memory is released under the MIT license. This is a permissive open-source license, meaning you can freely use, modify, and distribute the software.
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;" -
Option 2: Specify a Consistent Model Add
EMBEDDING_MODELto your Claude Desktop config:{ "mcpServers": { "memory": { "command": "npx", "args": ["-y", "mcp-ai-memory"], "env": { "MEMORY_DB_URL": "postgresql://...", "EMBEDDING_MODEL": "Xenova/all-mpnet-base-v2" } } } }Common models:
Xenova/all-mpnet-base-v2(768 dimensions - default, best quality)Xenova/all-MiniLM-L6-v2(384 dimensions - smaller/faster)
-
Option 3: Run Migration for Flexible Dimensions If you're using the source version:
bun run migrateThis allows mixing different embedding dimensions in the same database.
Database Connection Issues
Ensure your PostgreSQL has the pgvector extension:
CREATE EXTENSION IF NOT EXISTS vector;
Claude Desktop Integration
💡 For Best Results: Include the SYSTEM_PROMPT.md content in your Claude Desktop system prompt or initial conversation to help Claude understand how to use the memory tools effectively.
Quick Setup (NPM)
Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"memory": {
"command": "npx",
"args": ["-y", "mcp-ai-memory"],
"env": {
"DATABASE_URL": "postgresql://username:password@localhost:5432/memory_db"
}
}
}
}
With Optional Redis Cache
{
"mcpServers": {
"memory": {
"command": "npx",
"args": ["-y", "mcp-ai-memory"],
"env": {
"DATABASE_URL": "postgresql://username:password@localhost:5432/memory_db",
"REDIS_URL": "redis://localhost:6379",
"EMBEDDING_MODEL": "Xenova/all-MiniLM-L6-v2",
"LOG_LEVEL": "info"
}
}
}
}
Environment Variables
| Variable | Description | Default |
|---|---|---|
DATABASE_URL | PostgreSQL connection string | Required |
REDIS_URL | Redis connection string (optional) | None - uses in-memory cache |
EMBEDDING_MODEL | Transformers.js model | Xenova/all-MiniLM-L6-v2 |
LOG_LEVEL | Logging level | info |
CACHE_TTL | Cache TTL in seconds | 3600 |
MAX_MEMORIES_PER_QUERY | Max results per search | 10 |
MIN_SIMILARITY_SCORE | Min similarity threshold | 0.5 |
Available Tools
💡 Token Efficiency: Default limits are set to 10 results to optimize token usage. Increase only when needed.
Core Operations (Most Important)
memory_search- SEARCH FIND RECALL - Search stored information using natural language (USE THIS FIRST! Default limit: 10)memory_list- LIST BROWSE SHOW - List all memories chronologically (fallback when search fails, default limit: 10)memory_store- STORE SAVE REMEMBER - Store new information after checking for duplicatesmemory_update- UPDATE MODIFY EDIT - Update existing memory metadatamemory_delete- DELETE REMOVE FORGET - Delete specific memories
Advanced Operations
memory_batch- BATCH BULK IMPORT - Store multiple memories efficientlymemory_batch_delete- Delete multiple memories at oncememory_graph_search- GRAPH RELATED - Search with relationship traversal (alias for memory_traverse)memory_consolidate- MERGE CLUSTER - Group similar memoriesmemory_stats- STATS INFO - Database statisticsmemory_relate- LINK CONNECT - Create memory relationshipsmemory_unrelate- UNLINK DISCONNECT - Remove relationshipsmemory_get_relations- Show all relationships for a memory
Graph & Decay Operations (New)
memory_traverse- TRAVERSE EXPLORE - Traverse memory graph with BFS/DFS algorithmsmemory_graph_analysis- ANALYZE CONNECTIONS - Analyze graph connectivity and relationship patternsmemory_decay_status- DECAY STATUS - Check decay status of a memorymemory_preserve- PRESERVE PROTECT - Preserve important memories from decay
Resources
memory://stats- Database statisticsmemory://types- Available memory typesmemory://tags- All unique tagsmemory://relationships- Memory relationshipsmemory://clusters- Memory clusters
Prompts
load-context- Load relevant context for a taskmemory-summary- Generate topic summariesconversation-context- Load conversation history
Architecture
src/
├── server.ts # MCP server implementation
├── types/ # TypeScript definitions
├── schemas/ # Zod validation schemas
├── services/ # Business logic
├── database/ # Kysely migrations and client
└── config/ # Configuration management
Environment Variables
# Required
MEMORY_DB_URL=postgresql://user:password@localhost:5432/mcp_ai_memory
# Optional - Caching (falls back to in-memory if Redis unavailable)
REDIS_URL=redis://localhost:6379
CACHE_TTL=3600 # 1 hour default cache
EMBEDDING_CACHE_TTL=86400 # 24 hours for embeddings
SEARCH_CACHE_TTL=3600 # 1 hour for search results
MEMORY_CACHE_TTL=7200 # 2 hours for individual memories
# Optional - Model & Performance
EMBEDDING_MODEL=Xenova/all-mpnet-base-v2
LOG_LEVEL=info
MAX_CONTENT_SIZE=1048576
DEFAULT_SEARCH_LIMIT=10 # Default 10 for token efficiency
DEFAULT_SIMILARITY_THRESHOLD=0.7
# Optional - Async Processing (requires Redis)
ENABLE_ASYNC_PROCESSING=true # Enable background job processing
BULL_CONCURRENCY=3 # Worker concurrency
ENABLE_REDIS_CACHE=true # Enable Redis caching
Caching Architecture
The server implements a two-tier caching strategy:
- Redis Cache (if available) - Distributed, persistent caching
- In-Memory Cache (fallback) - Local NodeCache for when Redis is unavailable
Async Job Processing
When Redis is available and ENABLE_ASYNC_PROCESSING=true, the server uses BullMQ for background job processing:
Features
- Async Embedding Generation: Offloads CPU-intensive embedding generation to background workers
- Batch Import: Processes large memory imports without blocking the main server
- Memory Consolidation: Runs clustering and merging operations in the background
- Automatic Retries: Failed jobs are retried with exponential backoff
- Dead Letter Queue: Permanently failed jobs are tracked for manual intervention
Running Workers
# Start all workers
bun run workers
# Or start individual workers
bun run worker:embedding # Embedding generation worker
bun run worker:batch # Batch import and consolidation worker
# Test async processing
bun run test:async
Queue Monitoring
The memory_stats tool includes queue statistics when async processing is enabled:
- Active, waiting, completed, and failed job counts
- Processing rates and performance metrics
- Worker health status
Cache Invalidation
- Memory updates/deletes automatically invalidate
FAQ
- What is the AI Memory MCP server?
- AI Memory is a Model Context Protocol (MCP) server profile on explainx.ai. MCP lets AI hosts (e.g. Claude Desktop, Cursor) call tools and resources through a standard interface; this page summarizes categories, install hints, and community ratings.
- How do MCP servers relate to agent skills?
- Skills are reusable instruction packages (often SKILL.md); MCP servers expose live capabilities. Teams frequently combine both—skills for workflows, MCP for APIs and data. See explainx.ai/skills and explainx.ai/mcp-servers for parallel directories.
- How are reviews shown for AI Memory?
- This profile displays 52 aggregated ratings (sample rows for discoverability plus signed-in user reviews). Average score is about 4.5 out of 5—verify behavior in your own environment before production use.
Use Cases▌
Extended AI Capabilities
Add new capabilities to Claude beyond text generation
Example
Access external data sources, execute code, interact with tools and services
Transform Claude from chatbot to action-taking agent
Context Enhancement
Provide Claude with access to relevant context and data
Example
Load project documentation, access knowledge bases, query databases
Get more accurate, context-aware responses
Workflow Automation
Automate multi-step workflows combining AI and external tools
Example
Research → Summarize → Create document → Send notification
Complete complex tasks end-to-end without manual steps
Implementation Guide▌
Prerequisites
- ›Claude Desktop 0.7.0+ or Cursor IDE with MCP support
- ›Basic understanding of MCP architecture and capabilities
- ›Access credentials for integrated services (if required)
- ›Willingness to experiment and iterate on configuration
Time Estimate
15-60 minutes depending on server complexity
Installation Steps
- 1.Install MCP server: npm install -g [package-name] or via GitHub
- 2.Add server configuration to ~/.claude/mcp.json
- 3.Provide required credentials and configuration
- 4.Restart Claude Desktop to load new server
- 5.Test basic functionality with simple prompts
- 6.Explore capabilities and experiment with use cases
- 7.Document successful patterns for reuse
Troubleshooting
- ⚠MCP server not loading: Check config syntax, verify installation
- ⚠Connection errors: Check network, firewall, credentials
- ⚠Feature not working: Read server docs, check required parameters
- ⚠Performance issues: Monitor resource usage, check for network latency
- ⚠Conflicts with other servers: Check port assignments, namespace collisions
Best Practices▌
✓ Do
- +Read server documentation thoroughly before setup
- +Start with simple use cases to validate functionality
- +Test in non-production environment first
- +Monitor resource usage and performance
- +Keep servers updated for bug fixes and new features
- +Document configuration for team members
- +Use environment variables for sensitive configuration
✗ Don't
- −Don't grant overly permissive access to MCP servers
- −Don't skip reading security considerations in docs
- −Don't expose sensitive data without proper controls
- −Don't run untrusted MCP servers without code review
- −Don't ignore error messages—investigate root cause
💡 Pro Tips
- ★Combine multiple MCP servers for powerful workflows
- ★Create custom MCP servers for your specific needs
- ★Share successful configurations with team
- ★Use MCP inspector for debugging
- ★Join MCP community for tips and troubleshooting
Technical Details▌
Architecture
Model Context Protocol standardizes how AI hosts (Claude, Cursor) communicate with external tools and data sources through server implementations.
Protocols
- Model Context Protocol (MCP)
- JSON-RPC 2.0
- stdio or HTTP transport
Compatibility
- Claude Desktop
- Cursor IDE
- Custom MCP clients
When to Use This▌
✓ Use When
Use when you need Claude to access external data, execute actions, or integrate with tools. Best for extending AI capabilities beyond conversation.
✗ Avoid When
Avoid when native integrations exist (use official APIs directly), for real-time critical systems, or when security/compliance requires zero external dependencies.
Integration▌
- →Tool composition: Chain multiple MCP tools in workflows
- →Context augmentation: Provide AI with relevant external data
- →Action delegation: Let AI execute tasks on external systems
- →Bidirectional sync: Keep AI context and external systems in sync
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
List & Promote Your MCP Server
Share your MCP server with the developer community
Ratings
4.5★★★★★52 reviews- ★★★★★Min Dixit· Dec 28, 2024
AI Memory has been reliable for tool-calling workflows; the MCP profile page is a good permalink for internal docs.
- ★★★★★Xiao Mehta· Dec 24, 2024
We evaluated AI Memory against two servers with overlapping tools; this profile had the clearer scope statement.
- ★★★★★Nikhil Sethi· Dec 4, 2024
I recommend AI Memory for teams standardizing on MCP; the explainx.ai page compares cleanly with sibling servers.
- ★★★★★Camila Reddy· Nov 27, 2024
According to our notes, AI Memory benefits from clear Model Context Protocol framing — fewer ambiguous “AI plugin” claims.
- ★★★★★Isabella Khan· Nov 23, 2024
We evaluated AI Memory against two servers with overlapping tools; this profile had the clearer scope statement.
- ★★★★★Valentina Brown· Nov 19, 2024
AI Memory has been reliable for tool-calling workflows; the MCP profile page is a good permalink for internal docs.
- ★★★★★Alexander Mensah· Nov 15, 2024
AI Memory is among the better-indexed MCP projects we tried; the explainx.ai summary tracks the official description.
- ★★★★★Isabella Taylor· Nov 15, 2024
I recommend AI Memory for teams standardizing on MCP; the explainx.ai page compares cleanly with sibling servers.
- ★★★★★Zaid Malhotra· Oct 18, 2024
AI Memory has been reliable for tool-calling workflows; the MCP profile page is a good permalink for internal docs.
- ★★★★★Aanya Zhang· Oct 14, 2024
AI Memory is among the better-indexed MCP projects we tried; the explainx.ai summary tracks the official description.
showing 1-10 of 52