MCP Memory Service
MCP Memory Service
An MCP server providing semantic memory and persistent storage capabilities for Claude Desktop using ChromaDB and sentence transformers. This service enables long-term memory storage with semantic search capabilities, making it ideal for maintaining context across conversations and instances. For personal use only. No user management is provided.
<a href="https://glama.ai/mcp/servers/bzvl3lz34o"><img width="380" height="200" src="https://glama.ai/mcp/servers/bzvl3lz34o/badge" alt="Memory Service MCP server" /></a>
Features
- Semantic search using sentence transformers
- Tag-based memory retrieval system
- Persistent storage using ChromaDB
- Automatic database backups
- Memory optimization tools
- Exact match retrieval
- Debug mode for similarity analysis
- Database health monitoring
- Duplicate detection and cleanup
- Customizable embedding model
Available Tools and Operations
The list covers all the core functionalities exposed through the MCP server's tools, organized by their primary purposes and use cases. Each category represents a different aspect of memory management and interaction available through the system.
Core Memory Operations
store_memory
- Store new information with optional tags
- Parameters:
- content: String (required)
- metadata: Object (optional)
- tags: Array or list of strings
- type: String
retrieve_memory
- Perform semantic search for relevant memories
- Parameters:
- query: String (required)
- n_results: Number (optional, default: 5)
search_by_tag
- Find memories using specific tags
- Parameters:
- tags: Array of strings (required)
Advanced Operations
exact_match_retrieve
- Find memories with exact content match
- Parameters:
- content: String (required)
debug_retrieve
- Retrieve memories with similarity scores
- Parameters:
- query: String (required)
- n_results: Number (optional)
- similarity_threshold: Number (optional)
Database Management
create_backup
- Create database backup
- Parameters: None
get_stats
- Get memory statistics
- Returns: Database size, memory count
optimize_db
- Optimize database performance
- Parameters: None
check_database_health
- Get database health metrics
- Returns: Health status and statistics
check_embedding_model
- Verify model status
- Parameters: None
Memory Management
delete_memory
- Delete specific memory by hash
- Parameters:
- content_hash: String (required)
delete_by_tag
- Delete all memories with specific tag
- Parameters:
- tag: String (required)
cleanup_duplicates
- Remove duplicate entries
- Parameters: None
Performance and Maintenance
- Default similarity threshold: 0.7
- Maximum recommended memories per query: 10
- Automatic optimization at 10,000 memories
- Daily automatic backups with 7-day retention
- Regular database health monitoring recommended
- Cloud storage sync must complete before access
- Debug mode available for troubleshooting
Installation
- Create Python virtual environment:
- Install dependencies:
Usage
- Start the server:(for testing purposes)
Isaolated test for methods
Claude MCP configuration
Add the following to your claude_desktop_config.json
file:
Storage Structure and Settings
Configure through environment variables:
Sample Use Cases
Semantic requests:
<img width="750" alt="grafik" src="https://github.com/user-attachments/assets/4bc854c6-721a-4abe-bcc5-7ef274628db7" /> <img width="1112" alt="grafik" src="https://github.com/user-attachments/assets/502477d2-ade6-4a5e-a756-b6302d9d6931" />Call by tool name: <img width="1112" alt="grafik" src="https://github.com/user-attachments/assets/23d161a8-f62c-41c6-bcd8-e9b16f369c95" />
Performance and Maintenance
- Default similarity threshold: 0.7
- Maximum recommended memories per query: 10
- Automatic optimization at 10,000 memories
- Daily automatic backups with 7-day retention
- Regular database health monitoring recommended
- Cloud storage sync must complete before access
- Debug mode available for troubleshooting
Testing
The project includes test suites for verifying the core functionality:
Test scripts are available in the tests/
directory:
test_memory_ops.py
: Tests core memory operations (store, retrieve, delete)test_semantic_search.py
: Tests semantic search functionality and similarity scoringtest_database.py
: Tests database operations (backup, health checks, optimization)
Each test file includes:
- Proper test fixtures for server setup and teardown
- Async test support using pytest-asyncio
- Comprehensive test cases for the related functionality
- Error case handling and validation
Project Structure
Additional Stuff for Development
Required Dependencies
Important Notes
- When storing in cloud, always ensure iCloud or other Cloud Drives sync is complete before accessing from another device
- Regular backups are crucial when testing new features
- Monitor ChromaDB storage size and optimize as needed
- The service includes automatic backup functionality that runs every 24 hours(tbd)
- Debug mode is available for troubleshooting semantic search results
- Memory optimization runs automatically when database size exceeds configured thresholds
Performance Considerations
- Default similarity threshold for semantic search: 0.7
- Maximum recommended memories per query: 10
- Automatic optimization triggers at 10,000 memories
- Backup retention policy: 7 days
Troubleshooting
- Check logs in
..\Claude\logs\mcp-server-memory.log
- Use
debug_retrieve
for search issues - Monitor database health with
check_database_health
- Use
exact_match_retrieve
for precise matching
Development Guidelines
- Follow PEP 8
- Use type hints
- Include docstrings for all functions and classes
- Add tests for new features
Pull Request Process
- Create a feature branch
- Add tests for new functionality
- Update documentation
- Submit PR with description of changes
License
MIT License - See LICENSE file for details
Acknowledgments
- ChromaDB team for the vector database
- Sentence Transformers project for embedding models
- MCP project for the protocol specification
Contact
Statement of Gratitude
A special thanks to God, my ultimate source of strength and guidance, and to my wife for her unwavering patience and support throughout this project. I'd also like to express my gratitude to Claude from Antrophic for his invaluable contributions and expertise. This project wouldn't have been possible without your collective support.
Provides semantic memory and persistent storage for Claude, leveraging ChromaDB and sentence transformers for enhanced search and retrieval capabilities.
- Features
- Available Tools and Operations
- Performance and Maintenance
- Installation
- Usage
- Claude MCP configuration
- Sample Use Cases
- Performance and Maintenance
- Testing
- Project Structure
- Additional Stuff for Development
- Required Dependencies
- Important Notes
- Performance Considerations
- Troubleshooting
- Development Guidelines
- License
- Acknowledgments
- Contact
- Statement of Gratitude