# Mem0 MCP

> Mem0 gives your AI agent persistent memory. Store, search, and recall facts, preferences, and context across conversations using an industry-standard memory layer. Your agent remembers things—user habits, project details, past decisions—even after the chat window closes.

## Overview
- **Category:** ai-frontier
- **Price:** Free
- **Tags:** long-term-memory, personalization, context-retention, semantic-search, user-profiles, ai-memory

## Description

Your AI agent needs a memory, and Mem0 provides it. It's an industry-standard layer that lets your client remember things—user preferences, project details, past decisions—even after the chat window closes. You don't want your system forgetting context just 'cause the conversation ends; you need facts to stick around.

When you connect your agent using Mem0, it gains persistent memory capabilities. It handles structured data extraction and makes those facts searchable for a specific user ID. This means your agent isn't just talking in the moment; it's drawing on everything it’s learned about the user over time. You're building an actual profile of the person interacting with your system.

### **`add_memory`**

The **`add_memory`** tool pulls structured facts and specific preferences right out of text, saving them as searchable memories tied to a user ID. When you use this, the system doesn't just store a chunk of text; it extracts core information—like 'the client prefers blue widgets' or 'Project Alpha is due next month'—and saves it in a persistent format. This ensures that when your agent needs to reference something foundational about the user, that fact is right there and structured for quick retrieval.

### **`search_memories`**

If you need your agent to recall specific details without knowing exactly where they were stored, use **`search_memories`**. You can query it using natural language—you just ask a question like, 'What was the budget cap for Q3?' and the tool handles the rest. It searches all saved memories against your query and returns only the most relevant facts. These results are ranked by score, so you always get the top hits first, letting you see exactly what aligns with your current conversational need.

### **`get_memories`**

To build a complete historical picture of a user—a full profile of everything the agent knows about them—you call **`get_memories`**. This tool lists every single memory record currently saved for that specific user ID. It gives you visibility into the entire knowledge base, letting you see all past facts and preferences that have accumulated over time. You can use this list to verify if certain critical data points are present in the system’s memory layer.

### **`delete_memory`**

When things get messy or inaccurate, you gotta clean house. The **`delete_memory`** tool lets you permanently remove outdated or incorrect facts from the knowledge base. You pass it a unique memory ID and that record vanishes completely. This is something to use with caution—you're making a permanent deletion of data—but it gives you necessary control over maintaining data integrity, ensuring your agent only relies on accurate information.

Overall, Mem0 makes sure your AI client doesn't forget crucial details. It allows your agent to constantly remember user habits, project constraints, and past decisions across multiple sessions. You get a reliable memory layer that keeps the context alive, making interactions feel natural and consistent.

## Tools

### add_memory
The system extracts facts and stores them as searchable memories for a user ID.

### delete_memory
Deletes one specific memory record by its unique ID. Use this only when absolutely sure the data is wrong.

### get_memories
Lists all stored memories for a user, helping you build a complete historical profile.

### search_memories
Searches saved memories using natural language and returns the most relevant facts, ranked by score.

## Prompt Examples

**Prompt:** 
```
Remember that I prefer dark mode, use VS Code, and my favorite language is TypeScript.
```

**Response:** 
```
Stored 3 new memories for your profile:
1. 'User prefers dark mode for UI'
2. 'User's primary IDE is VS Code'
3. 'User's favorite programming language is TypeScript'
These will be automatically recalled in future conversations.
```

**Prompt:** 
```
What do you remember about my coding preferences?
```

**Response:** 
```
Found 3 relevant memories (ranked by relevance):
🧠 'User's favorite programming language is TypeScript' (relevance: 0.95)
🧠 'User's primary IDE is VS Code' (relevance: 0.89)
🧠 'User prefers dark mode for UI' (relevance: 0.72)
```

**Prompt:** 
```
Show me all the memories you have stored for my user profile.
```

**Response:** 
```
Found 5 memories for user_123:
🧠 'User prefers dark mode'
🧠 'User's primary IDE is VS Code'
🧠 'Favorite language is TypeScript'
🧠 'Works best in the morning'
🧠 'Prefers functional programming patterns'
Created between 2026-01-15 and 2026-04-01.
```

## Capabilities

### Store New Facts
The `add_memory` tool pulls structured facts and preferences from text, saving them as persistent, searchable user memories.

### Search Past Context
Use `search_memories` to find the most relevant stored facts or user preferences matching a natural language query.

### Review All Memories
The `get_memories` tool pulls a list of every single memory record currently saved for a specific user ID.

### Remove Old Data
Call `delete_memory` to permanently remove outdated or incorrect facts from the user's knowledge base.

## Use Cases

### The Onboarding Flow Failure
A new client talks to the support bot about their account setup, mentioning they use a specific payment gateway and have an enterprise license. If the agent doesn't remember this, it asks for the info again next month. Solution: Use `add_memory` immediately after the conversation ends. The agent stores 'Gateway X used' and 'License Type Enterprise,' so when the user returns, the bot already knows those details.

### Troubleshooting an Error
A developer reports a bug but vaguely mentions 'the build pipeline.' If the system relies on current chat context, it might miss that the developer previously stored their preferred branch name. Solution: Run `search_memories` with 'build pipeline' to pull up the specific details (like the correct Git branch) that were saved last week.

### Building a Recommendation Engine
You want an agent to suggest features, but it needs to know what the user already owns. Without memory, suggestions are generic. Solution: Use `get_memories` to pull all stored facts (e.g., 'Owns feature A,' 'Needs integration with tool B'). The agent uses this full context list before making a recommendation.

### Data Cleanup After Pivot
The business changes direction, and the bot starts referencing old product lines or deprecated features. This clutters the memory base and confuses users. Solution: Systematically use `delete_memory` to wipe out memories related to the old product line, keeping the knowledge base focused only on current offerings.

## Benefits

- **Persistence:** Use `add_memory` to ensure the agent keeps facts, even after sessions end. It stops the need for users to repeat themselves every time they talk to the bot.
- **Contextual Recall:** The `search_memories` tool lets your agent find relevant past information (like 'user prefers dark mode') instead of guessing or asking vague follow-up questions.
- **Full User Profiling:** Call `get_memories` to pull every piece of data associated with a user. This builds the deep profile necessary for advanced, tailored experiences.
- **Data Integrity:** Need to fix bad info? Use `delete_memory`. It gives you explicit control over cleaning up outdated or incorrect memories, keeping your knowledge base clean.
- **Reliability:** By separating memory storage from active context, your agent's understanding stays reliable. You don't lose critical data just because the chat window refreshed.

## How It Works

The bottom line is: your AI client can now keep track of user history and preferences indefinitely, regardless of how many times the chat restarts.

1. First, subscribe your AI agent client to the Mem0 MCP Server and enter an API key.
2. Your agent uses `add_memory` whenever a new fact or preference is discussed in a chat session.
3. Later, when context is needed, the agent calls `search_memories` to pull relevant facts into the current conversation.

## Frequently Asked Questions

**How does add_memory work with my user ID?**
When you call `add_memory`, you must provide a unique User ID. This tells Mem0 exactly which profile the new fact belongs to, ensuring data stays separated and organized for retrieval.

**Is search_memories better than get_memories?**
Yes. `get_memories` returns *everything* stored for a user—a massive list. You usually want to use `search_memories`, which filters the results and ranks them by relevance score, giving you only what matters right now.

**Can I delete all memories at once using delete_memory?**
No. The `delete_memory` tool requires a specific memory ID for deletion. You must first use `get_memories` to list the IDs you want to remove.

**Does Mem0 handle different types of data (e.g., preferences vs facts)?**
The system pulls out key information automatically, structuring it as a searchable memory record regardless of whether it's a preference ('dark mode') or a hard fact ('user is based in Berlin').

**What happens if I use add_memory with unstructured or ambiguous text?**
The system attempts to automatically extract structured facts. If the input is too vague, it stores a less granular memory and may return an extraction warning. Always review the stored output for accuracy.

**If I run many queries with search_memories, are there rate limits?**
Yes, Vinkius implements rate limiting to ensure stability. If you exceed the limit, your agent will receive a specific HTTP error code. Implement exponential backoff in your client logic.

**Can I filter results when using get_memories?**
You can filter retrieved memories by creation date range or memory type (e.g., 'preference' vs 'fact'). This allows you to narrow down the scope of your user profile review.

**Are my memories encrypted when I use delete_memory?**
The data is secured both in transit and at rest using industry-standard encryption protocols. Deletion requests immediately flag the memory ID for irreversible removal from the active database.

**Is Mem0 free to use?**
Yes! Mem0 offers a free Hobby tier with 10,000 memories and 1,000 search calls per month — no credit card required. Paid plans start at $19/month for higher limits. An open-source version (Apache 2.0) is also available for self-hosting.

**How does Mem0 extract and store memories?**
When you send content to Mem0, its AI automatically extracts key facts and structured information. For example, if you send 'I prefer Python over JavaScript and work best in the morning', Mem0 creates two separate memories: one about language preference and one about work schedule. These are stored in a hybrid architecture (key-value + vector + graph) for fast semantic retrieval.

**Can I organize memories by user or agent?**
Yes! Every memory operation supports scoping by user_id, agent_id, or run_id. This means you can maintain separate memory banks for different users, different agents, or even different conversation runs — keeping context perfectly isolated.