diff --git a/docs/cookbooks/frameworks/gemini-3-with-mem0-mcp.mdx b/docs/cookbooks/frameworks/gemini-3-with-mem0-mcp.mdx index 928a713c2..de51f1e2f 100644 --- a/docs/cookbooks/frameworks/gemini-3-with-mem0-mcp.mdx +++ b/docs/cookbooks/frameworks/gemini-3-with-mem0-mcp.mdx @@ -6,7 +6,7 @@ description: "Create snappy, smart, memory-aware agents by pairing Gemini 3 with Gemini 3, when paired with mem0-mcp-server, works in synergy to create snappy, smart, memory-aware agents. - You'll build a Gemini 3 agent that automatically stores user preferences and retrieves relevant context without manual memory management. + This is the primary example of MCP integration - the same patterns work with Claude Desktop, Cursor, or any MCP-compatible client. ## MCP Server Tools @@ -232,15 +232,15 @@ You've successfully built a Gemini 3 agent with persistent memory using Mem0's M \ No newline at end of file diff --git a/docs/core-concepts/memory-operations/add.mdx b/docs/core-concepts/memory-operations/add.mdx index 43d478f8f..e20086327 100644 --- a/docs/core-concepts/memory-operations/add.mdx +++ b/docs/core-concepts/memory-operations/add.mdx @@ -157,6 +157,10 @@ Add memory whenever your agent learns something useful: - A new entity is introduced - A user gives feedback or clarification + + **MCP Alternative**: With Mem0 MCP, AI agents can add memories automatically based on context. + + Storing this context allows the agent to reason better in future interactions. diff --git a/docs/core-concepts/memory-operations/delete.mdx b/docs/core-concepts/memory-operations/delete.mdx index c96e1014e..4e55a4b9a 100644 --- a/docs/core-concepts/memory-operations/delete.mdx +++ b/docs/core-concepts/memory-operations/delete.mdx @@ -154,6 +154,10 @@ memory.delete_all(user_id="alice") - Clean up memories after session expiration or retention deadlines. - Comply with privacy legislation (GDPR, CCPA) and internal policies. + + **MCP Alternative**: With Mem0 MCP, AI agents can delete their own memories when data becomes irrelevant or at user request. + + ## Method comparison | Method | Use when | IDs required | Filters | diff --git a/docs/core-concepts/memory-operations/search.mdx b/docs/core-concepts/memory-operations/search.mdx index 0d7f0cf4c..e4fa9f9ef 100644 --- a/docs/core-concepts/memory-operations/search.mdx +++ b/docs/core-concepts/memory-operations/search.mdx @@ -213,6 +213,10 @@ client.search("preferences", filters={ - **Tune parameters**: Adjust `top_k` for result count, `threshold` for relevance cutoff - **Enable reranking**: Use `rerank=True` (default) when you have a reranker configured + + **MCP Alternative**: With Mem0 MCP, AI agents can search their own memories proactively when needed. + + ### More Details For the full list of filter logic, comparison operators, and optional search parameters, see the diff --git a/docs/core-concepts/memory-operations/update.mdx b/docs/core-concepts/memory-operations/update.mdx index 0dea0752c..b53b6b562 100644 --- a/docs/core-concepts/memory-operations/update.mdx +++ b/docs/core-concepts/memory-operations/update.mdx @@ -134,6 +134,10 @@ memory.update( - Immutable memories must be deleted and re-added instead of updated. - Pair updates with feedback signals (thumbs up/down) to self-heal memories automatically. + + **MCP Alternative**: With Mem0 MCP, AI agents can update their own memories when users correct information. + + ## Managed vs OSS differences | Capability | Mem0 Platform | Mem0 OSS | diff --git a/docs/docs.json b/docs/docs.json index 5befd49e5..302b151a3 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -9,6 +9,11 @@ "dark": "#9C58FA" }, "favicon": "/logo/favicon.png", + "logo": { + "light": "/logo/light.svg", + "dark": "/logo/dark.svg", + "href": "https://app.mem0.ai/" + }, "navigation": { "versions": [ { @@ -36,6 +41,7 @@ "icon": "rocket", "pages": [ "platform/overview", + "platform/mem0-mcp", "platform/platform-vs-oss", "platform/quickstart" ] @@ -97,7 +103,8 @@ "pages": [ "platform/features/webhooks", "platform/features/feedback-mechanism", - "platform/features/group-chat" + "platform/features/group-chat", + "platform/features/mcp-integration" ] } ] @@ -383,6 +390,7 @@ "integrations/crewai", "integrations/autogen", "integrations/agno", + "integrations/camel-ai", "integrations/openai-agents-sdk", "integrations/google-ai-adk", "integrations/mastra", @@ -724,11 +732,6 @@ } ] }, - "logo": { - "light": "/logo/light.svg", - "dark": "/logo/dark.svg", - "href": "https://app.mem0.ai/" - }, "background": { "color": { "light": "#fff", diff --git a/docs/images/smithery-mem0-mcp.png b/docs/images/smithery-mem0-mcp.png new file mode 100644 index 000000000..ac115e87f Binary files /dev/null and b/docs/images/smithery-mem0-mcp.png differ diff --git a/docs/integrations.mdx b/docs/integrations.mdx index d8f9b93a1..fd18bdaff 100644 --- a/docs/integrations.mdx +++ b/docs/integrations.mdx @@ -11,6 +11,10 @@ Mem0 seamlessly integrates with popular AI frameworks and tools to enhance your - Framework-agnostic memory layer - Simple integration with existing AI tools and frameworks + + **Universal Integration**: Use Mem0 MCP for a standardized protocol that works with ANY AI client. + + Here are the available integrations for Mem0: ## Integrations @@ -33,6 +37,12 @@ Here are the available integrations for Mem0: > Monitor and analyze Mem0 operations with comprehensive AI agent analytics and LLM observability. + + Use Mem0Storage to persist Camel multi-agent conversations and share cloud memory across agents. + + **Prerequisites** + - Mem0: `MEM0_API_KEY` (or self-hosted endpoint), `pip install mem0ai` + - Camel AI: `pip install camel-ai` (requires Python 3.9+) + - Optional: OpenAI API key if you run LLM-backed agents + + +Camel provides a Python SDK today. A TypeScript path is not available yet. + +## Configure credentials + + + + + +```bash +export MEM0_API_KEY="sk-..." +``` + + +```bash +export MEM0_BASE_URL="https://your-mem0-domain" +``` + + + + + + +```bash +pip install "camel-ai>=0.2.0" mem0ai +``` + + +```bash +export OPENAI_API_KEY="sk-openai..." +``` + + + + + + + Mem0Storage reads `MEM0_API_KEY` automatically. Pass `api_key` explicitly only when you need to override the environment. + + +## Wire Mem0 into a Camel agent + + + +```python +import os +from camel.storages import Mem0Storage + +mem0_store = Mem0Storage( + api_key=os.environ.get("MEM0_API_KEY"), + agent_id="travel_agent", + user_id="alice", + metadata={"source": "camel-demo"}, +) +``` + + +```python +from camel.memories import ChatHistoryMemory, ScoreBasedContextCreator +from camel.utils import OpenAITokenCounter +from camel.types import ModelType + +memory = ChatHistoryMemory( + context_creator=ScoreBasedContextCreator( + token_counter=OpenAITokenCounter(ModelType.GPT_4O_MINI), + token_limit=1024, + ), + storage=mem0_store, + agent_id="travel_agent", +) +``` + + +```python +from camel.agents import ChatAgent +from camel.messages import BaseMessage + +agent = ChatAgent( + system_message=BaseMessage.make_assistant_message( + role_name="Agent", + content="You are a helpful travel assistant. Reuse stored memories." + ) +) + +agent.memory = memory + +response = agent.step( + BaseMessage.make_user_message( + role_name="User", + content="I prefer boutique hotels in Paris." + ) +) + +print(response.msgs[0].content) +``` + + + + + Run `python camel_mem0_demo.py` (or the snippet above in a REPL). You should see the agent respond and the memory persisted to Mem0. Re-running with a new prompt should include the stored preference. + + +## Verify the integration + +- Mem0 dashboard shows new memories under `agent_id=travel_agent` and `user_id=alice`. +- `mem0_store.load()` returns the records you just wrote. +- Camel agent replies reference prior user preferences on subsequent runs. + +## Troubleshooting + +- **Missing MEM0_API_KEY** — set `export MEM0_API_KEY="sk-..."` or pass `api_key` into `Mem0Storage`. +- **No memories returned** — ensure `agent_id`/`user_id` in your query match what you used when writing. +- **Network errors to Mem0** — if self-hosting, set `MEM0_BASE_URL` to your deployment URL. + + + + + diff --git a/docs/platform/features/mcp-integration.mdx b/docs/platform/features/mcp-integration.mdx new file mode 100644 index 000000000..928dff802 --- /dev/null +++ b/docs/platform/features/mcp-integration.mdx @@ -0,0 +1,249 @@ +--- +title: MCP Integration +description: "Connect any AI client to Mem0 using Model Context Protocol for universal memory access" +--- + +> Model Context Protocol (MCP) provides a standardized way for AI agents to manage their own memory through Mem0, without manual API calls. + +## Why use MCP + +When building AI applications, memory management often requires manual integration. MCP eliminates this complexity by: + +- **Universal compatibility**: Works with any MCP-compatible client (Claude Desktop, Cursor, custom agents) +- **Agent autonomy**: AI agents decide when to save, search, or update memories +- **Zero infrastructure**: No servers to maintain - Mem0 handles everything +- **Standardized protocol**: One integration works across all your AI tools + +## Available tools + +The MCP server exposes 9 memory tools to your AI client: + +| Tool | Purpose | +|------|---------| +| `add_memory` | Store conversations or facts | +| `search_memories` | Find relevant memories with filters | +| `get_memories` | List memories with pagination | +| `update_memory` | Modify existing memory content | +| `delete_memory` | Remove specific memories | +| `delete_all_memories` | Bulk delete memories | +| `delete_entities` | Remove user/agent/app entities | +| `get_memory` | Retrieve single memory by ID | +| `list_entities` | View stored entities | + +## Deployment options + +Choose the deployment method that fits your workflow: + + + + Install and run locally with uvx: + + ```bash + uv pip install mem0-mcp-server + ``` + + Configure your client: + ```json + { + "mcpServers": { + "mem0": { + "command": "uvx", + "args": ["mem0-mcp-server"], + "env": { + "MEM0_API_KEY": "m0-...", + "MEM0_DEFAULT_USER_ID": "your-handle" + } + } + } + } + ``` + + + + Containerized deployment with HTTP endpoint: + + ```bash + docker build -t mem0-mcp-server https://github.com/mem0ai/mem0-mcp.git + docker run --rm -d -e MEM0_API_KEY="m0-..." -p 8080:8081 mem0-mcp-server + ``` + + Configure for HTTP: + ```json + { + "mcpServers": { + "mem0-docker": { + "command": "curl", + "args": ["-X", "POST", "http://localhost:8080/mcp", "--data-binary", "@"], + "env": { + "MEM0_API_KEY": "m0-..." + } + } + } + } + ``` + + + + One-click setup with managed service: + + Visit [smithery.ai/server/@mem0ai/mem0-memory-mcp](https://smithery.ai/server/@mem0ai/mem0-memory-mcp) and: + + 1. Select your AI client (Cursor, Claude Desktop, etc.) + 2. Configure your Mem0 API key + 3. Set your default user ID + 4. Enable graph memory (optional) + 5. Copy the generated configuration + + Your client connects automatically - no installation required. + + + +## Configuration + +### Required environment variables +```bash +MEM0_API_KEY="m0-..." # Your Mem0 API key +MEM0_DEFAULT_USER_ID="your-handle" # Default user ID +``` + +### Optional variables +```bash +MEM0_ENABLE_GRAPH_DEFAULT="true" # Enable graph memories +MEM0_MCP_AGENT_MODEL="gpt-4o-mini" # LLM for bundled examples +``` + + + + The included Pydantic AI agent provides an interactive REPL to test memory operations: + + ```bash + # Install the package + pip install mem0-mcp-server + + # Set your API keys + export MEM0_API_KEY="m0-..." + export OPENAI_API_KEY="sk-openai-..." + + # Clone and test with the agent + git clone https://github.com/mem0ai/mem0-mcp.git + cd mem0-mcp-server + python example/pydantic_ai_repl.py + ``` + + **Testing different server configurations:** + + - **Local server** (default): `python example/pydantic_ai_repl.py` + + - **Docker container**: + ```bash + export MEM0_MCP_CONFIG_PATH=example/docker-config.json + export MEM0_MCP_CONFIG_SERVER=mem0-docker + python example/pydantic_ai_repl.py + ``` + + - **Smithery remote**: + ```bash + export MEM0_MCP_CONFIG_PATH=example/config-smithery.json + export MEM0_MCP_CONFIG_SERVER=mem0-memory-mcp + python example/pydantic_ai_repl.py + ``` + + Try these test prompts: + - "Remember that I love tiramisu" + - "Search for my food preferences" + - "Update my project: the mobile app is now 80% complete" + - "Show me all memories about project Phoenix" + - "Delete memories from 2023" + + + +## How the testing works + +1. **Configuration loads** - Reads from `example/config.json` by default +2. **Server starts** - Launches or connects to the Mem0 MCP server +3. **Agent connects** - Pydantic AI agent (Mem0Guide) attaches to the server +4. **Interactive REPL** - You get a chat interface to test all memory operations + +## Example interactions + +Once connected, your AI agent can: + +``` +User: Remember that I'm allergic to peanuts +Agent: [calls add_memory] Got it! I've saved your peanut allergy. + +User: What dietary restrictions do I know about? +Agent: [calls search_memories] You have a peanut allergy. +``` + +The agent automatically decides when to use memory tools based on context. + +## Try these prompts + +```python +# Multi-task operations +"Generate 5 user personas for our e-commerce app with different demographics, store them all, then search for existing personas" + +# Natural context retrieval +"Anything about my work preferences I should remember?" + +# Complex information updates +"Update my current project: the mobile app is now 80% complete, we've fixed the login issues, and the launch date is March 15" + +# Time-based queries +"What meetings did I have last week about Project Phoenix?" + +# Memory cleanup +"Delete all test data and temporary memories from our development phase" + +# Personal preferences +"I drink oat milk cappuccino with one sugar every morning, and I prefer standing desks" + +# Health and wellness tracking +"I'm allergic to peanuts and shellfish, and I go for 5km runs on weekday mornings" +``` + +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. + +## What you can do + +The Mem0 MCP server enables powerful memory capabilities for your AI applications: + +- **Health tracking**: "I'm allergic to peanuts and shellfish" - Add new health information +- **Research data**: "Store these trial parameters: 200 participants, double-blind, placebo-controlled" - Save structured data +- **Preference queries**: "What do you know about my dietary preferences?" - Search and retrieve relevant memories +- **Project updates**: "Update my project status: the mobile app is now 80% complete" - Modify existing memory +- **Data cleanup**: "Delete all memories from 2023" - Bulk remove outdated information +- **Topic overview**: "Show me everything about Project Phoenix" - List all memories for a subject + +## Performance tips + +- Enable graph memories for relationship-aware recall +- Use specific filters when searching large memory sets +- Batch operations when adding multiple memories +- Monitor memory usage in the Mem0 dashboard + +## Best practices + +- **Start simple**: Use the Python package for development +- **Use wildcards**: `user_id: "*"` to search across all users +- **Test locally**: Use the bundled Python agent to verify setup +- **Monitor usage**: Track memory operations in the dashboard +- **Document patterns**: Share successful prompt patterns with your team + +{/* DEBUG: verify CTA targets */} + + + + + \ No newline at end of file diff --git a/docs/platform/features/platform-overview.mdx b/docs/platform/features/platform-overview.mdx index a4b32cbfa..7376b7e20 100644 --- a/docs/platform/features/platform-overview.mdx +++ b/docs/platform/features/platform-overview.mdx @@ -33,8 +33,8 @@ Mem0 Platform features help managed deployments scale from basic filtering to gr Imports, exports, timestamps, and expirations. - - Webhooks, feedback loops, and multi-agent chat. + + Universal memory integration via MCP. diff --git a/docs/platform/mem0-mcp.mdx b/docs/platform/mem0-mcp.mdx new file mode 100644 index 000000000..3613287ca --- /dev/null +++ b/docs/platform/mem0-mcp.mdx @@ -0,0 +1,232 @@ +--- +title: "Mem0 MCP" +description: "Connect any AI client to Mem0 using Model Context Protocol in minutes" +icon: "puzzle-piece" +estimatedTime: "~5 minutes" +--- + + + **Prerequisites** + - Mem0 Platform account ([Sign up here](https://app.mem0.ai)) + - API key ([Get one from dashboard](https://app.mem0.ai/settings/api-keys)) + - Python 3.10+, Docker, or Node.js 14+ + - An MCP-compatible client (Claude Desktop, Cursor, or custom agent) + + +## What is Mem0 MCP? + +Mem0 MCP Server exposes Mem0's memory capabilities as MCP tools, letting AI agents decide when to save, search, or update information. + +## Deployment Options + +Choose from three deployment methods: + +1. **Python Package (Recommended)** - Install locally with `uvx` for instant setup +2. **Docker Container** - Isolated deployment with HTTP endpoint +3. **Smithery** - Remote hosted service for managed deployments + +## Available Tools + +The MCP server exposes these memory tools to your AI client: + +| Tool | Description | +|------|-------------| +| `add_memory` | Save text or conversation history for a user/agent | +| `search_memories` | Semantic search across existing memories with filters | +| `get_memories` | List memories with structured filters and pagination | +| `get_memory` | Retrieve one memory by its `memory_id` | +| `update_memory` | Overwrite a memory's text after confirming the ID | +| `delete_memory` | Delete a single memory by `memory_id` | +| `delete_all_memories` | Bulk delete all memories in scope | +| `delete_entities` | Delete a user/agent/app/run entity and its memories | +| `list_entities` | Enumerate users/agents/apps/runs stored in Mem0 | + +--- + +## Quickstart with Python (UVX) + + + +```bash +uv pip install mem0-mcp-server +``` + + + +Add this to your MCP client (e.g., Claude Desktop): + +```json +{ + "mcpServers": { + "mem0": { + "command": "uvx", + "args": ["mem0-mcp-server"], + "env": { + "MEM0_API_KEY": "m0-...", + "MEM0_DEFAULT_USER_ID": "your-handle" + } + } + } +} +``` + +Set your environment variables: + +```bash +export MEM0_API_KEY="m0-..." +export MEM0_DEFAULT_USER_ID="your-handle" +``` + + + +```bash +# Clone the mem0-mcp repository +git clone https://github.com/mem0ai/mem0-mcp.git +cd mem0-mcp + +# Set your API keys +export MEM0_API_KEY="m0-..." +export OPENAI_API_KEY="sk-openai-..." + +# Run the interactive agent +python example/pydantic_ai_repl.py +``` + +**Sample Interactions:** + +``` +User: Remember that I love tiramisu +Agent: Got it! I've saved that you love tiramisu. + +User: What do you know about my food preferences? +Agent: Based on your memories, you love tiramisu. + +User: Update my project: the mobile app is now 80% complete +Agent: Updated your project status successfully. +``` + + + +Your AI client can now: +- Automatically save information with `add_memory` +- Search memories with `search_memories` +- Update memories with `update_memory` +- Delete memories with `delete_memory` + + + If you get "Connection failed", ensure your API key is valid and the server is running. + + + + +--- + +## Quickstart with Docker + + + +```bash +docker build -t mem0-mcp-server https://github.com/mem0ai/mem0-mcp.git +``` + + + +```bash +docker run --rm -d \ + --name mem0-mcp \ + -e MEM0_API_KEY="m0-..." \ + -p 8080:8081 \ + mem0-mcp-server +``` + + + +For clients that connect via HTTP (instead of stdio): + +```json +{ + "mcpServers": { + "mem0-docker": { + "command": "curl", + "args": ["-X", "POST", "http://localhost:8080/mcp", "--data-binary", "@-"], + "env": { + "MEM0_API_KEY": "m0-..." + } + } + } +} +``` + + + +```bash +# Check container logs +docker logs mem0-mcp + +# Test HTTP endpoint +curl http://localhost:8080/health +``` + + + The container should start successfully and respond to HTTP requests. If port 8080 is occupied, change it with `-p 8081:8081`. + + + + +--- + +## Quickstart with Smithery (Hosted) + +For the simplest integration, use Smithery's hosted Mem0 MCP server - no installation required. + +**Example: One-click setup in Cursor** + +1. Visit [smithery.ai/server/@mem0ai/mem0-memory-mcp](https://smithery.ai/server/@mem0ai/mem0-memory-mcp) and select Cursor as your client + +![Smithery Mem0 MCP Configuration](/images/smithery-mem0-mcp.png) + +2. Open Cursor → Settings → MCP +3. Click `mem0-mcp` → Initiate authorization +4. Configure Smithery with your environment: + - `MEM0_API_KEY`: Your Mem0 API key + - `MEM0_DEFAULT_USER_ID`: Your user ID + - `MEM0_ENABLE_GRAPH_DEFAULT`: Optional, set to `true` for graph memories +5. Return to Cursor settings and wait for tools to load +6. Start chatting with Cursor and begin storing preferences + +**For other clients:** +Visit [smithery.ai/server/@mem0ai/mem0-memory-mcp](https://smithery.ai/server/@mem0ai/mem0-memory-mcp) to connect any MCP-compatible client with your Mem0 credentials. + +--- + +## Quick Recovery + +- **"uvx command not found"** → Install with `pip install uv` or use `pip install mem0-mcp-server` instead. Make sure your Python environment has `uv` installed (or system-wide). +- **"Connection refused"** → Check that the server is running and the correct port is configured +- **"Invalid API key"** → Get a new key from [Mem0 Dashboard](https://app.mem0.ai/settings/api-keys) +- **"Permission denied"** → Ensure Docker has access to bind ports (try with `sudo` on Linux) + +--- + +## Next Steps + + + + + + +## Additional Resources + +- **[Mem0 MCP Repository](https://github.com/mem0ai/mem0-mcp)** - Source code and examples +- **[Platform Quickstart](/platform/quickstart)** - Direct API integration guide +- **[MCP Specification](https://modelcontextprotocol.io)** - Learn about MCP protocol \ No newline at end of file diff --git a/docs/platform/overview.mdx b/docs/platform/overview.mdx index 37df07cb4..9e2b7ae61 100644 --- a/docs/platform/overview.mdx +++ b/docs/platform/overview.mdx @@ -36,10 +36,13 @@ Mem0 is the memory engine that keeps conversations contextual so users never rep ## Choose your path - + Create project and ship first memory. + + Use MCP for universal AI integration. + User, agent, and session memory behavior. diff --git a/docs/platform/quickstart.mdx b/docs/platform/quickstart.mdx index 0a35f7abe..3d9b22e2f 100644 --- a/docs/platform/quickstart.mdx +++ b/docs/platform/quickstart.mdx @@ -127,6 +127,10 @@ curl -X POST https://api.mem0.ai/v1/memories/search \ + + **Pro Tip**: Want AI agents to manage their own memory automatically? Use Mem0 MCP to let LLMs decide when to save, search, and update memories. + + ## What's Next?