Claude Memory MCP Server
An MCP (Model Context Protocol) server implementation that provides persistent memory capabilities for Large Language Models, specifically designed to integrate with the Claude desktop application.
Overview
This project implements optimal memory techniques based on comprehensive research of current approaches in the field. It provides a standardized way for Claude to maintain persistent memory across conversations and sessions.
Features
- Tiered Memory Architecture: Short-term, long-term, and archival memory tiers
- Multiple Memory Types: Support for conversations, knowledge, entities, and reflections
- Semantic Search: Retrieve memories based on semantic similarity
- Memory Consolidation: Automatic consolidation of short-term memories into long-term memory
- Memory Management: Importance-based memory retention and forgetting
- Claude Integration: Ready-to-use integration with Claude desktop application
- MCP Protocol Support: Compatible with the Model Context Protocol
Architecture
The MCP server follows a functional domain-based architecture with the following components:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Claude Desktop β
βββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββ
β MCP Interface β
β βββββββββββββββββββ βββββββββββββββββββ ββββββββββββ β
β β Tool Definitionsβ β Request Handler β β Security β β
β βββββββββββββββββββ βββββββββββββββββββ ββββββββββββ β
βββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββ
β Memory Domain Manager β
βββββββββββββββββββ¬ββββββββββββββββββ¬βββββββββββββββββββββ€
β Episodic Domainβ Semantic Domainβ Temporal Domain β
βββββββββββββββββββ΄ββββββββββββββββββ΄βββββββββββββββββββββ€
β Persistence Domain β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Functional Domains
- Episodic Domain: Manages session-based interactions and contextual memory
- Semantic Domain: Handles knowledge organization and retrieval
- Temporal Domain: Controls time-aware processing of memories
- Persistence Domain: Manages storage optimization and retrieval
Installation
Prerequisites
- Python 3.8 or higher
- pip package manager
Installation Steps
Clone the repository:
git clone https://github.com/WhenMoon-afk/claude-memory-mcp.git cd claude-memory-mcpInstall dependencies:
pip install -e .Run the setup script:
chmod +x setup.sh ./setup.sh
Claude Desktop Integration
To integrate with the Claude desktop application, add the following to your Claude configuration file:
{
"mcpServers": {
"memory": {
"command": "python",
"args": ["-m", "memory_mcp"],
"env": {
"MEMORY_FILE_PATH": "/path/to/your/memory.json"
}
}
}
}
Memory File Structure
The memory system uses a JSON-based file structure with the following components:
{
"metadata": {
"version": "1.0",
"created_at": "ISO-8601 timestamp",
"updated_at": "ISO-8601 timestamp"
},
"memory_index": {
// Vector index for fast semantic search
},
"short_term_memory": [
// Recent and frequently accessed memories
],
"long_term_memory": [
// Older or less frequently accessed memories
],
"archived_memory": [
// Rarely accessed but potentially valuable memories
],
"memory_schema": {
// Schema definitions for memory entries
},
"config": {
// Configuration settings for memory management
}
}
Usage
Starting the Server
python -m memory_mcp
Available Tools
store_memory: Store new information in memoryretrieve_memory: Retrieve relevant memories based on querylist_memories: List available memories with filtering optionsupdate_memory: Update existing memory entriesdelete_memory: Remove specific memoriesmemory_stats: Get statistics about the memory store
Development
Project Structure
memory_mcp/
βββ memory/
β βββ models.py # Memory data models
β βββ storage.py # Memory storage operations
β βββ retrieval.py # Memory retrieval operations
β βββ consolidation.py # Memory consolidation operations
βββ domains/
β βββ episodic.py # Episodic memory domain
β βββ semantic.py # Semantic knowledge domain
β βββ temporal.py # Temporal processing domain
β βββ persistence.py # Storage and retrieval domain
βββ mcp/
β βββ server.py # MCP server implementation
β βββ tools.py # MCP tool definitions
β βββ handler.py # Request handling
βββ security/
β βββ validation.py # Input validation
βββ utils/
βββ embeddings.py # Vector embedding utilities
βββ schema.py # Schema validation
Running Tests
pytest
Research Background
This implementation is based on comprehensive research of current LLM persistent memory techniques:
- OS-Inspired Memory Management: Tiered memory architecture similar to MemGPT
- Biological-Inspired Episodic Memory: Context-sensitive memory retrieval
- Vector Embeddings: Semantic search inspired by vector database approaches
- Self-Reflection: Memory consolidation through periodic review
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgements
- Based on research of optimal memory techniques for LLMs
- Implements the Model Context Protocol for integration with Claude
Memory Server
Project Details
- WhenMoon-afk/claude-memory-mcp
- MIT License
- Last Updated: 4/11/2025
Recomended MCP Servers
A Model Context Protocol server for interacting with the Solana blockchain, powered by the [Solana Agent Kit](https://github.com/sendaifun/solana-agent-kit)
A Model Context Protocol (MCP) server that provides secure, read-only access to BigQuery datasets. Enables Large Language Models...
A MCP server for Google Analytics Data API
π Enable AI assistants to search, access, and analyze PubMed articles through a simple MCP interface.
Run AI Agent in your browser.
MCP server providing a knowledge graph implementation with semantic search capabilities powered by Qdrant vector database





