mem0 Memory System

# ✨ mem0 MCP Server Integration Guide ✨ Made with ❤️ by Pink Pixel ## Overview This guide explains how to integrate the mem0 MCP server with applications that support the MCP (Machine Communication Protocol) standard, such as Cursor, Claude Desktop, or other AI assistants. The mem0 MCP server provides memory storage and retrieval capabilities that can enhance AI assistants with persistent memory. ## Table of Contents 1. [Prerequisites](#prerequisites) 2. [Starting the mem0 MCP Server](#starting-the-mem0-mcp-server) 3. [Configuring MCP in Your Application](#configuring-mcp-in-your-application) 4. [How It Works](#how-it-works) 5. [Example Workflows](#example-workflows) 6. [Troubleshooting](#troubleshooting) ## Prerequisites - Python 3.8+ installed - mem0ai package installed (`pip install mem0ai`) - Ollama or another supported LLM provider installed (optional, for non-mock mode) - An application that supports MCP (Machine Communication Protocol) ## Starting the mem0 MCP Server 1. **Clone or download the mem0-mcp-server repository** 2. **Install dependencies** ```bash cd mem0-mcp-server pip install -r requirements.txt ``` 3. **Start the server** ```bash python server.py ``` By default, the server runs on `http://0.0.0.0:8000`. You can customize the host and port in `server.py`. 4. **Verify the server is running** ```bash curl http://0.0.0.0:8000/health ``` You should see a response like: ```json {"success":true,"message":"mem0 MCP server is running"} ``` ## Configuring MCP in Your Application ### For Cursor 1. Open Cursor and go to Settings 2. Navigate to the "Plugins" or "Extensions" section 3. Look for "MCP Servers" or similar 4. Add a new MCP server with the following details: - Name: mem0 Memory - URL: http://0.0.0.0:8000 - Type: Memory 5. Save the configuration ### For Claude Desktop 1. Open Claude Desktop and go to Settings 2. Navigate to the "Integrations" section 3. Find "External Tools" or "MCP" 4. Add a new MCP server: - Name: mem0 Memory - URL: http://0.0.0.0:8000 - Category: Memory 5. Save the configuration ### For Other MCP-Compatible Applications Most applications that support MCP will have a similar configuration process: 1. Find the settings or preferences section 2. Look for MCP, plugins, extensions, or integrations 3. Add a new MCP server with the URL `http://0.0.0.0:8000` 4. Specify that it's a memory server 5. Save and restart the application if necessary ## How It Works When properly configured, the mem0 MCP server acts as a memory provider for your AI assistant. Here's the typical flow: 1. **Configuration**: The AI application connects to the mem0 MCP server and configures it with your preferred settings (provider, model, etc.) 2. **Memory Storage**: - When you interact with the AI, important information is automatically stored as memories - The AI can also be instructed to explicitly store specific information 3. **Memory Retrieval**: - When you ask a question, the AI automatically searches for relevant memories - The AI can use these memories to provide more contextual and personalized responses - The AI can also explicitly retrieve specific memories by ID 4. **Memory Management**: - Memories can be deleted when no longer needed - The memory store can be cleared completely if desired ## Example Workflows ### Example 1: Personal Knowledge Base 1. **Store information**: "Please remember that my dog's name is Max and he's a Golden Retriever." 2. **Retrieve later**: "What was my dog's name again?" 3. **The AI will respond**: "Your dog's name is Max, and he's a Golden Retriever." ### Example 2: Project Context 1. **Store project details**: "I'm working on a React project called TaskMaster that uses TypeScript and Tailwind CSS." 2. **Ask for help later**: "Can you help me with a component for my project?" 3. **The AI responds with context**: "I'd be happy to help with your React component for TaskMaster. Since you're using TypeScript and Tailwind CSS, I'll make sure to incorporate those in my solution." ### Example 3: Learning Preferences 1. **Express preference**: "I prefer explanations with code examples and diagrams." 2. **Ask for help later**: "Can you explain how Redux works?" 3. **The AI responds according to preferences**: "Here's how Redux works, with code examples as you prefer..." ## Troubleshooting ### Server Won't Start - Check if the port 8000 is already in use - Ensure you have all dependencies installed - Check the server logs for specific error messages ### MCP Connection Issues - Verify the server is running using the health endpoint - Check that the URL in your application configuration is correct - Ensure your firewall isn't blocking the connection ### Memory Not Being Stored - Check the server logs for errors - Verify that the memory provider is properly configured - Ensure you're using the correct API endpoints ### Memory Not Being Retrieved - Check that the search query is relevant to the stored memories - Verify that the memories were successfully stored - Check the server logs for any errors during retrieval ## Advanced Configuration For advanced users, you can customize the mem0 MCP server by: 1. **Modifying environment variables** in a `.env` file: ``` MEM0_PROVIDER=ollama MEM0_EMBEDDING_PROVIDER=ollama MEM0_DATA_DIR=./memory_data OLLAMA_BASE_URL=http://localhost:11434 ``` 2. **Changing the server configuration** in `server.py`: ```python # Customize host and port host = "127.0.0.1" # Only allow local connections port = 9000 # Use a different port ``` 3. **Implementing custom memory providers** by extending the `MemoryProvider` class. --- ## Need Help? If you encounter any issues or have questions, please: 1. Check the documentation 2. Look for error messages in the server logs 3. Visit our GitHub repository for more information Made with ❤️ by Pink Pixel | Dream it, Pixel it