repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources16d ago| #1 | --- |
| #2 | title: MCP Integration |
| #3 | description: "Connect any AI client to Mem0 using Model Context Protocol for universal memory access" |
| #4 | --- |
| #5 | |
| #6 | > Model Context Protocol (MCP) provides a standardized way for AI agents to manage their own memory through Mem0, without manual API calls. |
| #7 | |
| #8 | ## Why use MCP |
| #9 | |
| #10 | When building AI applications, memory management often requires manual integration. MCP eliminates this complexity by: |
| #11 | |
| #12 | - **Universal compatibility**: Works with any MCP-compatible client (Claude Desktop, Cursor, custom agents) |
| #13 | - **Agent autonomy**: AI agents decide when to save, search, or update memories |
| #14 | - **Zero infrastructure**: No servers to maintain - Mem0 handles everything |
| #15 | - **Standardized protocol**: One integration works across all your AI tools |
| #16 | |
| #17 | ## Available tools |
| #18 | |
| #19 | The MCP server exposes 9 memory tools to your AI client: |
| #20 | |
| #21 | | Tool | Purpose | |
| #22 | |------|---------| |
| #23 | | `add_memory` | Store conversations or facts | |
| #24 | | `search_memories` | Find relevant memories with filters | |
| #25 | | `get_memories` | List memories with pagination | |
| #26 | | `update_memory` | Modify existing memory content | |
| #27 | | `delete_memory` | Remove specific memories | |
| #28 | | `delete_all_memories` | Bulk delete memories | |
| #29 | | `delete_entities` | Remove user/agent/app entities | |
| #30 | | `get_memory` | Retrieve single memory by ID | |
| #31 | | `list_entities` | View stored entities | |
| #32 | |
| #33 | ## Deployment options |
| #34 | |
| #35 | Choose the deployment method that fits your workflow: |
| #36 | |
| #37 | <AccordionGroup> |
| #38 | <Accordion title="Python package (recommended)"> |
| #39 | Install and run locally with uvx: |
| #40 | |
| #41 | ```bash |
| #42 | uv pip install mem0-mcp-server |
| #43 | ``` |
| #44 | |
| #45 | Configure your client: |
| #46 | ```json |
| #47 | { |
| #48 | "mcpServers": { |
| #49 | "mem0": { |
| #50 | "command": "uvx", |
| #51 | "args": ["mem0-mcp-server"], |
| #52 | "env": { |
| #53 | "MEM0_API_KEY": "m0-...", |
| #54 | "MEM0_DEFAULT_USER_ID": "your-handle" |
| #55 | } |
| #56 | } |
| #57 | } |
| #58 | } |
| #59 | ``` |
| #60 | </Accordion> |
| #61 | |
| #62 | <Accordion title="Docker container"> |
| #63 | Containerized deployment with HTTP endpoint: |
| #64 | |
| #65 | ```bash |
| #66 | docker build -t mem0-mcp-server https://github.com/mem0ai/mem0-mcp.git |
| #67 | docker run --rm -d -e MEM0_API_KEY="m0-..." -p 8080:8081 mem0-mcp-server |
| #68 | ``` |
| #69 | |
| #70 | Configure for HTTP: |
| #71 | ```json |
| #72 | { |
| #73 | "mcpServers": { |
| #74 | "mem0-docker": { |
| #75 | "command": "curl", |
| #76 | "args": ["-X", "POST", "http://localhost:8080/mcp", "--data-binary", "@"], |
| #77 | "env": { |
| #78 | "MEM0_API_KEY": "m0-..." |
| #79 | } |
| #80 | } |
| #81 | } |
| #82 | } |
| #83 | ``` |
| #84 | </Accordion> |
| #85 | |
| #86 | <Accordion title="Smithery"> |
| #87 | One-click setup with managed service: |
| #88 | |
| #89 | Visit [smithery.ai/server/@mem0ai/mem0-memory-mcp](https://smithery.ai/server/@mem0ai/mem0-memory-mcp) and: |
| #90 | |
| #91 | 1. Select your AI client (Cursor, Claude Desktop, etc.) |
| #92 | 2. Configure your Mem0 API key |
| #93 | 3. Set your default user ID |
| #94 | 4. Enable graph memory (optional) |
| #95 | 5. Copy the generated configuration |
| #96 | |
| #97 | Your client connects automatically - no installation required. |
| #98 | </Accordion> |
| #99 | </AccordionGroup> |
| #100 | |
| #101 | ## Configuration |
| #102 | |
| #103 | ### Required environment variables |
| #104 | ```bash |
| #105 | MEM0_API_KEY="m0-..." # Your Mem0 API key |
| #106 | MEM0_DEFAULT_USER_ID="your-handle" # Default user ID |
| #107 | ``` |
| #108 | |
| #109 | ### Optional variables |
| #110 | ```bash |
| #111 | MEM0_ENABLE_GRAPH_DEFAULT="true" # Enable graph memories |
| #112 | MEM0_MCP_AGENT_MODEL="gpt-4o-mini" # LLM for bundled examples |
| #113 | ``` |
| #114 | |
| #115 | <AccordionGroup> |
| #116 | <Accordion title="Test your setup with the Python agent"> |
| #117 | The included Pydantic AI agent provides an interactive REPL to test memory operations: |
| #118 | |
| #119 | ```bash |
| #120 | # Install the package |
| #121 | pip install mem0-mcp-server |
| #122 | |
| #123 | # Set your API keys |
| #124 | export MEM0_API_KEY="m0-..." |
| #125 | export OPENAI_API_KEY="sk-openai-..." |
| #126 | |
| #127 | # Clone and test with the agent |
| #128 | git clone https://github.com/mem0ai/mem0-mcp.git |
| #129 | cd mem0-mcp-server |
| #130 | python example/pydantic_ai_repl.py |
| #131 | ``` |
| #132 | |
| #133 | **Testing different server configurations:** |
| #134 | |
| #135 | - **Local server** (default): `python example/pydantic_ai_repl.py` |
| #136 | |
| #137 | - **Docker container**: |
| #138 | ```bash |
| #139 | export MEM0_MCP_CONFIG_PATH=example/docker-config.json |
| #140 | export MEM0_MCP_CONFIG_SERVER=mem0-docker |
| #141 | python example/pydantic_ai_repl.py |
| #142 | ``` |
| #143 | |
| #144 | - **Smithery remote**: |
| #145 | ```bash |
| #146 | export MEM0_MCP_CONFIG_PATH=example/config-smithery.json |
| #147 | export MEM0_MCP_CONFIG_SERVER=mem0-memory-mcp |
| #148 | python example/pydantic_ai_repl.py |
| #149 | ``` |
| #150 | |
| #151 | Try these test prompts: |
| #152 | - "Remember that I love tiramisu" |
| #153 | - "Search for my food preferences" |
| #154 | - "Update my project: the mobile app is now 80% complete" |
| #155 | - "Show me all memories about project Phoenix" |
| #156 | - "Delete memories from 2023" |
| #157 | </Accordion> |
| #158 | </AccordionGroup> |
| #159 | |
| #160 | ## How the testing works |
| #161 | |
| #162 | 1. **Configuration loads** - Reads from `example/config.json` by default |
| #163 | 2. **Server starts** - Launches or connects to the Mem0 MCP server |
| #164 | 3. **Agent connects** - Pydantic AI agent (Mem0Guide) attaches to the server |
| #165 | 4. **Interactive REPL** - You get a chat interface to test all memory operations |
| #166 | |
| #167 | ## Example interactions |
| #168 | |
| #169 | Once connected, your AI agent can: |
| #170 | |
| #171 | ``` |
| #172 | User: Remember that I'm allergic to peanuts |
| #173 | Agent: [calls add_memory] Got it! I've saved your peanut allergy. |
| #174 | |
| #175 | User: What dietary restrictions do I know about? |
| #176 | Agent: [calls search_memories] You have a peanut allergy. |
| #177 | ``` |
| #178 | |
| #179 | The agent automatically decides when to use memory tools based on context. |
| #180 | |
| #181 | ## Try these prompts |
| #182 | |
| #183 | ```python |
| #184 | # Multi-task operations |
| #185 | "Generate 5 user personas for our e-commerce app with different demographics, store them all, then search for existing personas" |
| #186 | |
| #187 | # Natural context retrieval |
| #188 | "Anything about my work preferences I should remember?" |
| #189 | |
| #190 | # Complex information updates |
| #191 | "Update my current project: the mobile app is now 80% complete, we've fixed the login issues, and the launch date is March 15" |
| #192 | |
| #193 | # Time-based queries |
| #194 | "What meetings did I have last week about Project Phoenix?" |
| #195 | |
| #196 | # Memory cleanup |
| #197 | "Delete all test data and temporary memories from our development phase" |
| #198 | |
| #199 | # Personal preferences |
| #200 | "I drink oat milk cappuccino with one sugar every morning, and I prefer standing desks" |
| #201 | |
| #202 | # Health and wellness tracking |
| #203 | "I'm allergic to peanuts and shellfish, and I go for 5km runs on weekday mornings" |
| #204 | ``` |
| #205 | |
| #206 | These examples demonstrate how MCP enables natural language memory operations - the AI agent automatically determines when to add, search, update, or delete memories based on context. |
| #207 | |
| #208 | ## What you can do |
| #209 | |
| #210 | The Mem0 MCP server enables powerful memory capabilities for your AI applications: |
| #211 | |
| #212 | - **Health tracking**: "I'm allergic to peanuts and shellfish" - Add new health information |
| #213 | - **Research data**: "Store these trial parameters: 200 participants, double-blind, placebo-controlled" - Save structured data |
| #214 | - **Preference queries**: "What do you know about my dietary preferences?" - Search and retrieve relevant memories |
| #215 | - **Project updates**: "Update my project status: the mobile app is now 80% complete" - Modify existing memory |
| #216 | - **Data cleanup**: "Delete all memories from 2023" - Bulk remove outdated information |
| #217 | - **Topic overview**: "Show me everything about Project Phoenix" - List all memories for a subject |
| #218 | |
| #219 | ## Performance tips |
| #220 | |
| #221 | - Enable graph memories for relationship-aware recall |
| #222 | - Use specific filters when searching large memory sets |
| #223 | - Batch operations when adding multiple memories |
| #224 | - Monitor memory usage in the Mem0 dashboard |
| #225 | |
| #226 | ## Best practices |
| #227 | |
| #228 | - **Start simple**: Use the Python package for development |
| #229 | - **Use wildcards**: `user_id: "*"` to search across all users |
| #230 | - **Test locally**: Use the bundled Python agent to verify setup |
| #231 | - **Monitor usage**: Track memory operations in the dashboard |
| #232 | - **Document patterns**: Share successful prompt patterns with your team |
| #233 | |
| #234 | {/* DEBUG: verify CTA targets */} |
| #235 | |
| #236 | <CardGroup cols={2}> |
| #237 | <Card |
| #238 | title="Memory Filters" |
| #239 | description="Refine memory retrieval with powerful filtering capabilities" |
| #240 | icon="scale-balanced" |
| #241 | href="/platform/features/v2-memory-filters" |
| #242 | /> |
| #243 | <Card |
| #244 | title="Gemini 3 with MCP" |
| #245 | description="See MCP in action with Google's Gemini 3 model" |
| #246 | icon="book-open" |
| #247 | href="/cookbooks/frameworks/gemini-3-with-mem0-mcp" |
| #248 | /> |
| #249 | </CardGroup> |