Long-Term Memory for Claude with RAG (Retrieval-Augmented Generation) using Weaviate.
This Model Context Protocol (MCP) server provides Claude with long-term memory capabilities by integrating with a Weaviate-based RAG system. It allows Claude to remember conversations across sessions and retrieve relevant information from past interactions.
- Memory Types: Supports different memory types (procedural, semantic, episodic)
- Configurable Memory Settings:
- Importance threshold for what to remember
- Retention period for automatic forgetting
- Memory strength boosting for frequently accessed information
- Memory Operations:
- Save conversations to long-term memory
- Search across all memories semantically
- Retrieve memories by type
- Forget old or specific memories
- Source Types:
- File sources (individual files)
- Directory sources (folders with multiple files)
- Web sources (URLs to web pages)
- Source Management:
- Add, update, and remove knowledge sources
- Enable/disable sources
- Index sources into the memory system
store_message- Stores individual chat messages in temporary memorysave_chat- Saves the current chat to a file and optionally imports it into the RAG systemsearch_rag- Searches the RAG system for relevant informationget_memory_by_type- Retrieves memories of a specific type (procedural, semantic, episodic)get_entity_info- Gets information about a specific entity from the memory systemget_memory_settings- Retrieves current memory configuration settingsupdate_memory_settings- Updates memory configuration (thresholds, retention, etc.)forget_old_memories- Forgets memories older than the retention periodforget_memories- Forgets specific memories by IDlist_knowledge_sources- Lists all configured external knowledge sourcesadd_knowledge_source- Adds a new external knowledge sourceupdate_knowledge_source- Updates an existing knowledge sourcedelete_knowledge_source- Removes a knowledge sourceindex_knowledge_source- Indexes a knowledge source into the memory system
default- Default prompt that introduces the long-term memory capabilityresearcher- Researcher assistant with memory integrationknowledge-explorer- Specialized prompt for exploring external knowledge sources
- Node.js (v18 or higher)
- Python 3.8+ with the Weaviate-Chat-RAG system installed
- Docker for running Weaviate
-
Clone the repository:
git clone [repository_url] /Users/lorenzo/_pythonScripts/LTM-RAG cd /Users/lorenzo/_pythonScripts/LTM-RAG -
Install dependencies:
npm install
-
Build the server:
npm run build
-
Create a symlink to the Claude MCP directory:
mkdir -p ~/Library/Application\ Support/Claude/MCP/ ln -s /Users/lorenzo/_pythonScripts/LTM-RAG ~/Library/Application\ Support/Claude/MCP/LTM-RAG
-
Configure Claude Desktop to use the MCP server by editing:
~/Library/Application Support/Claude/claude_desktop_config.jsonAdd the following configuration:
{ "mcpServers": { "ltm-rag": { "command": "node", "args": [ "/Users/lorenzo/Library/Application Support/Claude/MCP/LTM-RAG/dist/index.js" ], "env": {} } } } -
Or use the provided installation script:
./install.sh
- Start Claude Desktop
- Click the paperclip icon, then the plug icon
- Select "default", "researcher", or "knowledge-explorer" under "ltm-rag"
- Chat with Claude normally
- "Save this conversation to your long-term memory" - Saves the current chat
- "Search your memory for [query]" - Searches the RAG system
- "What do you know about [entity]?" - Retrieves entity information
- "What [memory type] memories do you have?" - Retrieves memories by type
- "Show me your memory settings" - Displays current configuration
- "Update your memory settings" - Changes memory configuration
- "Forget memories older than your retention period" - Removes old memories
- "List your knowledge sources" - Shows configured external sources
- "Add a new knowledge source" - Sets up a new source
- "Index knowledge source [name]" - Imports external content into memory
The system supports integrating with various external knowledge sources:
-
Files:
- PDF documents, text files, markdown files, etc.
- Example: "Add a new knowledge source for my research paper at /path/to/paper.pdf"
-
Directories:
- Folders containing multiple related documents
- Example: "Add a new knowledge source for my project documentation at /path/to/docs/"
-
Web Pages:
- URLs to web content that can be scraped and indexed
- Example: "Add a new knowledge source for the website https://example.com/knowledge-base"
The integration works by:
- Registering the source in the LTM-RAG configuration
- When indexed, the content is processed:
- Extracted and broken into manageable chunks
- Embedded using the same embedding model as chat memories
- Stored in the Weaviate vector database with appropriate metadata
- Made available for retrieval alongside conversation memories
Knowledge sources can be enabled/disabled and managed over time.
The following enhancements are being considered for future development:
-
Scheduled Indexing:
- Automatic re-indexing of sources on a schedule
- Support for sources that change or update frequently
-
Specialized Source Types:
- GitHub repositories integration (code, documentation, issues)
- Notion workspaces or other note-taking systems
- SQL databases for structured data access
- Email archives
- Calendar data integration
-
Authentication and Access Control:
- Support for authenticated sources (API keys, OAuth)
- Permissions and access controls for sensitive information
-
Knowledge Source Processing Plugins:
- Specialized processors for different file types
- Custom extractors for domain-specific information
- Custom classifiers for domain-specific memory types
-
Active Learning for Source Relevance:
- Track which sources provide useful information
- Adjust source importance based on user feedback
- Prioritize sources that consistently provide valuable information
-
Knowledge Graph Building:
- Automatically extract entities and relationships from sources
- Build a knowledge graph connecting information across sources
- Enable more sophisticated reasoning over the combined knowledge
For development with auto-rebuild:
npm run watchSince MCP servers communicate over stdio, debugging can be challenging. You can add console.log statements that will appear in the Claude Desktop logs.
The LTM-RAG system uses configuration files stored in ~/.ltm-rag/:
memory_settings.json- Contains memory configuration parametersknowledge_sources.json- Lists configured external knowledge sources
MIT