[docs] Series of docs for mem0-mcp (#3831)
This commit is contained in:
@@ -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.
|
||||
|
||||
<Callout type="info" icon="sparkles" color="#8B5CF6">
|
||||
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.
|
||||
</Callout>
|
||||
|
||||
## MCP Server Tools
|
||||
@@ -232,15 +232,15 @@ You've successfully built a Gemini 3 agent with persistent memory using Mem0's M
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card
|
||||
title="Advanced Memory Patterns"
|
||||
description="Learn about memory filtering, entities, and advanced search techniques"
|
||||
icon="brain"
|
||||
href="/platform/features/v2-memory-filters"
|
||||
title="MCP Integration Feature"
|
||||
description="Learn about MCP configuration options and deployment methods"
|
||||
icon="plug"
|
||||
href="/platform/features/mcp-integration"
|
||||
/>
|
||||
<Card
|
||||
title="MCP Integration Guide"
|
||||
description="Explore deeper integration with Model Context Protocol"
|
||||
icon="plug"
|
||||
href="/platform/integrations/mcp"
|
||||
title="MCP Quickstart"
|
||||
description="Get started with MCP for any AI client in minutes"
|
||||
icon="rocket"
|
||||
href="/platform/mem0-mcp"
|
||||
/>
|
||||
</CardGroup>
|
||||
@@ -157,6 +157,10 @@ Add memory whenever your agent learns something useful:
|
||||
- A new entity is introduced
|
||||
- A user gives feedback or clarification
|
||||
|
||||
<Callout type="tip" icon="plug">
|
||||
**MCP Alternative**: With <Link href="/platform/mem0-mcp">Mem0 MCP</Link>, AI agents can add memories automatically based on context.
|
||||
</Callout>
|
||||
|
||||
Storing this context allows the agent to reason better in future interactions.
|
||||
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
<Callout type="tip" icon="plug">
|
||||
**MCP Alternative**: With <Link href="/platform/mem0-mcp">Mem0 MCP</Link>, AI agents can delete their own memories when data becomes irrelevant or at user request.
|
||||
</Callout>
|
||||
|
||||
## Method comparison
|
||||
|
||||
| Method | Use when | IDs required | Filters |
|
||||
|
||||
@@ -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
|
||||
|
||||
<Callout type="tip" icon="plug">
|
||||
**MCP Alternative**: With <Link href="/platform/mem0-mcp">Mem0 MCP</Link>, AI agents can search their own memories proactively when needed.
|
||||
</Callout>
|
||||
|
||||
### More Details
|
||||
|
||||
For the full list of filter logic, comparison operators, and optional search parameters, see the
|
||||
|
||||
@@ -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.
|
||||
|
||||
<Callout type="tip" icon="plug">
|
||||
**MCP Alternative**: With <Link href="/platform/mem0-mcp">Mem0 MCP</Link>, AI agents can update their own memories when users correct information.
|
||||
</Callout>
|
||||
|
||||
## Managed vs OSS differences
|
||||
|
||||
| Capability | Mem0 Platform | Mem0 OSS |
|
||||
|
||||
+9
-6
@@ -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",
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 426 KiB |
@@ -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
|
||||
|
||||
<Callout type="tip" icon="puzzle-piece">
|
||||
**Universal Integration**: Use <Link href="/platform/mem0-mcp">Mem0 MCP</Link> for a standardized protocol that works with ANY AI client.
|
||||
</Callout>
|
||||
|
||||
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.
|
||||
</Card>
|
||||
<Card
|
||||
title="Camel AI"
|
||||
href="/integrations/camel-ai"
|
||||
>
|
||||
Use Mem0Storage to persist Camel multi-agent conversations and share cloud memory across agents.
|
||||
</Card>
|
||||
<Card
|
||||
title="LangChain"
|
||||
icon={
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
---
|
||||
title: Camel AI
|
||||
description: "Plug Mem0 cloud memory into Camel's agents with the built‑in Mem0Storage."
|
||||
partnerBadge: "Camel AI"
|
||||
---
|
||||
|
||||
# Camel AI integration
|
||||
|
||||
Connect Camel's agent framework to Mem0 so every agent can persist and recall conversation context across sessions with minimal setup.
|
||||
|
||||
<Info>
|
||||
**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
|
||||
</Info>
|
||||
|
||||
<Note>Camel provides a Python SDK today. A TypeScript path is not available yet.</Note>
|
||||
|
||||
## Configure credentials
|
||||
|
||||
<Tabs>
|
||||
<Tab title="Mem0">
|
||||
<Steps>
|
||||
<Step title="Export your API key">
|
||||
```bash
|
||||
export MEM0_API_KEY="sk-..."
|
||||
```
|
||||
</Step>
|
||||
<Step title="(Self-host) Point to your Mem0 API">
|
||||
```bash
|
||||
export MEM0_BASE_URL="https://your-mem0-domain"
|
||||
```
|
||||
</Step>
|
||||
</Steps>
|
||||
</Tab>
|
||||
<Tab title="Camel">
|
||||
<Steps>
|
||||
<Step title="Install Camel with Mem0 dependency">
|
||||
```bash
|
||||
pip install "camel-ai>=0.2.0" mem0ai
|
||||
```
|
||||
</Step>
|
||||
<Step title="(Optional) Add your model credentials">
|
||||
```bash
|
||||
export OPENAI_API_KEY="sk-openai..."
|
||||
```
|
||||
</Step>
|
||||
</Steps>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
<Tip>
|
||||
Mem0Storage reads `MEM0_API_KEY` automatically. Pass `api_key` explicitly only when you need to override the environment.
|
||||
</Tip>
|
||||
|
||||
## Wire Mem0 into a Camel agent
|
||||
|
||||
<Steps>
|
||||
<Step title="Create a Mem0-backed memory store">
|
||||
```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"},
|
||||
)
|
||||
```
|
||||
</Step>
|
||||
<Step title="Attach it to Camel memory">
|
||||
```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",
|
||||
)
|
||||
```
|
||||
</Step>
|
||||
<Step title="Let your agent read and write Mem0">
|
||||
```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)
|
||||
```
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Info icon="check">
|
||||
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.
|
||||
</Info>
|
||||
|
||||
## 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.
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card
|
||||
title="Memory types in Mem0"
|
||||
description="Choose between chat history and semantic search for your Camel agents."
|
||||
icon="sparkles"
|
||||
href="/core-concepts/memory-types"
|
||||
/>
|
||||
<Card
|
||||
title="Try LangChain next"
|
||||
description="Wire the same Mem0 project into LangChain workflows."
|
||||
icon="rocket"
|
||||
href="/integrations/langchain"
|
||||
/>
|
||||
</CardGroup>
|
||||
@@ -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:
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="Python package (recommended)">
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Docker container">
|
||||
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-..."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Smithery">
|
||||
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.
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
## 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
|
||||
```
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="Test your setup with the Python agent">
|
||||
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"
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
## 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 */}
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card
|
||||
title="Memory Filters"
|
||||
description="Refine memory retrieval with powerful filtering capabilities"
|
||||
icon="scale-balanced"
|
||||
href="/platform/features/v2-memory-filters"
|
||||
/>
|
||||
<Card
|
||||
title="Gemini 3 with MCP"
|
||||
description="See MCP in action with Google's Gemini 3 model"
|
||||
icon="book-open"
|
||||
href="/cookbooks/frameworks/gemini-3-with-mem0-mcp"
|
||||
/>
|
||||
</CardGroup>
|
||||
@@ -33,8 +33,8 @@ Mem0 Platform features help managed deployments scale from basic filtering to gr
|
||||
<Card title="Manage Data Lifecycle" icon="database" href="/platform/features/direct-import">
|
||||
Imports, exports, timestamps, and expirations.
|
||||
</Card>
|
||||
<Card title="Extend With Integrations" icon="plug" href="/platform/features/webhooks">
|
||||
Webhooks, feedback loops, and multi-agent chat.
|
||||
<Card title="Connect Any AI Client" icon="puzzle-piece" href="/platform/mem0-mcp">
|
||||
Universal memory integration via MCP.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
|
||||
@@ -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"
|
||||
---
|
||||
|
||||
<Info>
|
||||
**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)
|
||||
</Info>
|
||||
|
||||
## 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)
|
||||
|
||||
<Steps>
|
||||
<Step title="Install the MCP Server">
|
||||
```bash
|
||||
uv pip install mem0-mcp-server
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Configure your MCP client">
|
||||
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"
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Test with the Python agent">
|
||||
```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.
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Verify the setup">
|
||||
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`
|
||||
|
||||
<Info icon="check">
|
||||
If you get "Connection failed", ensure your API key is valid and the server is running.
|
||||
</Info>
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
---
|
||||
|
||||
## Quickstart with Docker
|
||||
|
||||
<Steps>
|
||||
<Step title="Build the Docker image">
|
||||
```bash
|
||||
docker build -t mem0-mcp-server https://github.com/mem0ai/mem0-mcp.git
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Run the container">
|
||||
```bash
|
||||
docker run --rm -d \
|
||||
--name mem0-mcp \
|
||||
-e MEM0_API_KEY="m0-..." \
|
||||
-p 8080:8081 \
|
||||
mem0-mcp-server
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Configure your client for HTTP">
|
||||
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-..."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
</Step>
|
||||
|
||||
<Step title="Verify the setup">
|
||||
```bash
|
||||
# Check container logs
|
||||
docker logs mem0-mcp
|
||||
|
||||
# Test HTTP endpoint
|
||||
curl http://localhost:8080/health
|
||||
```
|
||||
|
||||
<Info icon="check">
|
||||
The container should start successfully and respond to HTTP requests. If port 8080 is occupied, change it with `-p 8081:8081`.
|
||||
</Info>
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
---
|
||||
|
||||
## 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
|
||||
|
||||

|
||||
|
||||
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
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card
|
||||
title="MCP Integration Feature"
|
||||
description="Learn about MCP configuration options and advanced patterns"
|
||||
icon="plug"
|
||||
href="/platform/features/mcp-integration"
|
||||
/>
|
||||
<Card
|
||||
title="Gemini 3 with Mem0 MCP"
|
||||
description="See how to integrate Gemini 3 with Mem0 MCP server"
|
||||
icon="book-open"
|
||||
href="/cookbooks/frameworks/gemini-3-with-mem0-mcp"
|
||||
/>
|
||||
</CardGroup>
|
||||
|
||||
## 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
|
||||
@@ -36,10 +36,13 @@ Mem0 is the memory engine that keeps conversations contextual so users never rep
|
||||
|
||||
## Choose your path
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<CardGroup cols={3}>
|
||||
<Card title="Launch Your Workspace" icon="rocket" href="/platform/quickstart">
|
||||
Create project and ship first memory.
|
||||
</Card>
|
||||
<Card title="Connect Any AI Client" icon="puzzle-piece" href="/platform/mem0-mcp">
|
||||
Use MCP for universal AI integration.
|
||||
</Card>
|
||||
<Card title="Understand Memory Types" icon="brain" href="/core-concepts/memory-types">
|
||||
User, agent, and session memory behavior.
|
||||
</Card>
|
||||
|
||||
@@ -127,6 +127,10 @@ curl -X POST https://api.mem0.ai/v1/memories/search \
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
<Callout type="tip" icon="plug">
|
||||
**Pro Tip**: Want AI agents to manage their own memory automatically? Use <Link href="/platform/mem0-mcp">Mem0 MCP</Link> to let LLMs decide when to save, search, and update memories.
|
||||
</Callout>
|
||||
|
||||
## What's Next?
|
||||
|
||||
<CardGroup cols={3}>
|
||||
|
||||
Reference in New Issue
Block a user