--- title: Long Term Memory MCP Server emoji: 🧠 colorFrom: blue colorTo: purple sdk: gradio sdk_version: "4.0.0" app_file: app.py pinned: false license: mit tags: - mcp-server-track - mcp - memory - rag - llm - conversation short_description: MCP Server providing long-term memory for LLM conversations --- # 🧠 Long Term Memory MCP Server **Tags**: mcp-server-track A Model Context Protocol (MCP) server that provides long-term memory capabilities for LLM conversations. This allows users to save important insights, conclusions, and context from conversations and retrieve them in future interactions. ## 🎯 Problem Solved Current LLM interactions are stateless - they don't remember previous conversations or insights you've shared. This MCP server solves that by providing: - **Persistent Memory**: Save important insights and context from conversations - **Semantic Search**: Find relevant memories using natural language queries - **Context Continuity**: Build upon previous conversations and learnings - **Knowledge Accumulation**: Build a personal knowledge base over time ## 🚀 Features ### MCP Server Tools - `save_memory` - Save insights, conclusions, or context to long-term memory - `search_memory` - Search through memories using semantic similarity - `list_memories` - Browse all stored memories - `delete_memory` - Remove specific memories ### Gradio Demo Interface - Interactive web interface for testing all MCP tools - Real-time memory statistics - Semantic search with adjustable similarity thresholds - Memory browsing and management ## 🛠️ Technical Architecture - **MCP Protocol**: Standards-compliant MCP server - **Vector Storage**: ChromaDB for efficient semantic search - **Embeddings**: SentenceTransformers (all-MiniLM-L6-v2) for semantic understanding - **Interface**: Gradio web app for demonstration and testing - **Storage**: Persistent local database ## 📦 Installation & Usage ### Local Development ```bash # Clone and install dependencies pip install -r requirements.txt # Run the application python app.py ``` ### Hugging Face Spaces This Space runs both the MCP server and Gradio demo simultaneously. ## 🎮 Demo Video - ## 💡 Use Cases ### Example Scenario 1. **Initial Conversation**: You discuss quantum consciousness theories with an LLM 2. **Save Insight**: Use `save_memory` to store key conclusions 3. **Future Conversation**: LLM can `search_memory` to find relevant context 4. **Continuity**: Build upon previous insights in new discussions ### Sample Usage with Claude Desktop **Saving a memory:** ``` User: "Save this insight to memory: 'Consciousness might emerge from quantum processes in microtubules, as proposed by Penrose-Hameroff theory. This could explain the hard problem of consciousness.' Title: 'Quantum Consciousness Theory', Tags: 'consciousness, quantum, penrose, microtubules'" LLM: *Uses save_memory tool* ✅ Memory saved successfully! ID: abc123... ``` **Searching memories:** ``` User: "What did we previously discuss about consciousness and quantum physics?" LLM: *Uses search_memory tool* 🔍 Found relevant memory: "Quantum Consciousness Theory" - discusses how consciousness might emerge from quantum processes in microtubules... ``` ## 🔧 MCP Client Configuration ### Claude Desktop Add to your `claude_desktop_config.json`: ```json { "mcpServers": { "long-term-memory": { "command": "python", "args": ["path/to/mcp_server.py"], "env": {} } } } ``` ### Cursor IDE Configure in your MCP settings to connect to the server. ## 📊 Memory Statistics The system tracks: - Total memories stored - Content length statistics - Tag usage patterns - Timestamp-based organization ## 🔐 Privacy & Data - All data stored locally in ChromaDB - No external API calls for embeddings (uses local SentenceTransformers) - Full control over your memory data - Easy export/import capabilities ## 🚧 Future Enhancements - [ ] Memory categorization and hierarchical organization - [ ] Conversation threading and context linking - [ ] Export/import functionality - [ ] Advanced search filters (date, tags, content type) - [ ] Memory summarization and consolidation - [ ] Integration with external knowledge bases ## 🤝 Contributing This project was created for the [Hugging Face MCP Hackathon](https://huggingface.co/Agents-MCP-Hackathon). Contributions welcome! ## 📝 License MIT License - Feel free to use and modify! ## Author - [Andrei Zagrebin] (@cheeeaaat) --- *Built with ❤️ for the Hugging Face MCP Hackathon - Track 1: MCP Server/Tool*