mem0-mcp-glassBead
If you are the rightful owner of mem0-mcp-glassBead and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The MCP Server with Mem0 - Enhanced Edition is an advanced memory management server that integrates with MCP-compatible tools to efficiently manage coding preferences and memory operations.
MCP Server with Mem0 - Enhanced Edition
This is an enhanced fork of the original Mem0 MCP server that provides both a simple 3-tool mode for coding preferences and an extended 7-tool mode with 39 operations for comprehensive memory management.
This implementation demonstrates a structured approach for using an MCP server with mem0 to manage memories efficiently. The server can be used with Cursor, Claude Desktop, and other MCP-compatible tools.
Installation
- Clone this repository:
git clone https://github.com/glassBead-tc/mem0-mcp-glassBead.git
cd mem0-mcp-glassBead
- Initialize the
uv
environment:
uv venv
- Activate the virtual environment:
source .venv/bin/activate
- Install the dependencies using
uv
:
# Install in editable mode from pyproject.toml
uv pip install -e .
- Update
.env
file in the root directory with your mem0 API key:
MEM0_API_KEY=your_api_key_here
Usage
- Start the MCP server:
uv run main.py
- In Cursor, connect to the SSE endpoint, follow this doc for reference:
http://0.0.0.0:8080/sse
- Open the Composer in Cursor and switch to
Agent
mode.
Demo with Cursor
https://github.com/user-attachments/assets/56670550-fb11-4850-9905-692d3496231c
What's New in This Fork
Enhanced Mode with 7 Tools
- 39 total operations across 7 specialized tools
- Clean, simple implementation using FastMCP
- Same reliable architecture as classic mode
- No unnecessary complexity
Fixed Issues
- Resolved FastMCP parameter handling errors
- Removed complex Starlette/SSE implementations that caused event loop conflicts
- Simplified from broken plugin architecture to working direct implementation
Features
Classic Mode (Default)
The server provides three main tools for managing code preferences:
-
add_coding_preference
: Store code snippets, implementation details, and coding patterns with comprehensive context including:- Complete code with dependencies
- Language/framework versions
- Setup instructions
- Documentation and comments
- Example usage
- Best practices
-
get_all_coding_preferences
: Retrieve all stored coding preferences to analyze patterns, review implementations, and ensure no relevant information is missed. -
search_coding_preferences
: Semantically search through stored coding preferences to find relevant:- Code implementations
- Programming solutions
- Best practices
- Setup guides
- Technical documentation
Enhanced Mode (--enhanced flag)
Run with --enhanced
flag or set MEM0_MCP_ENHANCED=true
to access all 7 tools with 39 total operations:
# Using flag
uv run main.py --enhanced --port 8080
# Using environment variable
MEM0_MCP_ENHANCED=true uv run main.py --port 8080
Enhanced mode provides the following tools:
-
mem0_memory: Core memory operations
- Operations: add, get, get_all, search, update, delete, delete_all, history, batch_update, batch_delete, feedback
- Full CRUD operations with batch support
- Semantic search capabilities
- Memory history tracking
-
mem0_entity: Entity management (users, agents, apps)
- Operations: list_users, create_user, delete_user, migrate_user
- Manage different entity types
- Entity-specific memory operations
-
mem0_graph: Graph-based relationships between memories
- Operations: add_relation, get_relations, visualize, analyze, remove_relation
- Build knowledge graphs
- Analyze memory relationships
-
mem0_export: Import/export in various formats
- Operations: export, import, backup, restore
- Support for JSON format
- Bulk data operations
-
mem0_config: Configuration management
- Operations: get_config, update_config, reset_config, validate_config
- Manage custom instructions
- Validate configuration settings
-
mem0_webhook: Webhook management for events
- Operations: create, list, update, delete, test
- Configure event notifications
- Test webhook connections
-
mem0_advanced: Analytics and optimization features
- Operations: analyze_usage, optimize_storage, generate_insights
- Memory usage analytics
- Storage optimization recommendations
Why?
This implementation allows for a persistent coding preferences system that can be accessed via MCP. The SSE-based server can run as a process that agents connect to, use, and disconnect from whenever needed. This pattern fits well with "cloud-native" use cases where the server and clients can be decoupled processes on different nodes.
Server Details
Both classic and enhanced modes run on the same port with FastMCP's SSE transport:
# Classic mode (3 tools)
uv run main.py
# Enhanced mode (7 tools, 39 operations)
uv run main.py --enhanced
Note: FastMCP with SSE transport always runs on http://0.0.0.0:8000/sse
regardless of port arguments. The --port
flag is ignored by FastMCP's SSE implementation.
The server exposes an SSE endpoint at /sse
that MCP clients can connect to for accessing the memory management tools.
Configuration
The server uses environment variables for configuration:
# Required
MEM0_API_KEY=your_api_key_here
# Optional - Use enhanced mode by default
MEM0_MCP_ENHANCED=true
Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.
Acknowledgments
This project is a fork of the original mem0ai/mem0-mcp repository. Thanks to the Mem0 team for creating the initial implementation.
License
This project maintains the same license as the original repository.