The Mem0 MCP Server wraps the official Mem0 Memory API as a Model Context Protocol (MCP) server, allowing any MCP-compatible client (like Claude Desktop, Cursor, or custom agents) to work with long-term memories through adding, searching, updating, and deleting operations.
The server provides the following memory management tools to your LLM:
| Tool | Description |
|---|---|
add_memory |
Save text or conversation history for a user/agent |
search_memories |
Perform semantic search across existing memories |
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 user confirmation |
delete_memory |
Delete a single memory by memory_id |
delete_all_memories |
Bulk delete all memories in the confirmed scope |
delete_entities |
Delete a user/agent/app/run entity and its memories |
list_entities |
Enumerate users/agents/apps/runs stored in Mem0 |
You can install the Mem0 MCP Server using uv:
uv pip install mem0-mcp-server
Or with standard pip:
pip install mem0-mcp-server
MEM0_API_KEY (required) – Your Mem0 platform API keyMEM0_DEFAULT_USER_ID (optional) – Default user ID for requests (defaults to mem0-mcp)MEM0_ENABLE_GRAPH_DEFAULT (optional) – Enable graph memories (defaults to false)MEM0_MCP_AGENT_MODEL (optional) – Default LLM for the bundled agent exampleAdd this configuration to your MCP client:
{
"mcpServers": {
"mem0": {
"command": "uvx",
"args": ["mem0-mcp-server"],
"env": {
"MEM0_API_KEY": "m0-...",
"MEM0_DEFAULT_USER_ID": "your-handle"
}
}
}
}
There are three ways to use the Mem0 MCP Server:
Install and run locally using uvx with any MCP client as shown in the configuration above.
For containerized deployment:
docker build -t mem0-mcp-server .
Run the container:
docker run --rm -d \
--name mem0-mcp \
-e MEM0_API_KEY=m0-... \
-p 8080:8081 \
mem0-mcp-server
Configure your MCP client to use Smithery:
{
"mcpServers": {
"mem0-memory-mcp": {
"command": "npx",
"args": [
"-y",
"@smithery/cli@latest",
"run",
"@mem0ai/mem0-memory-mcp",
"--key",
"your-smithery-key",
"--profile",
"your-profile-name"
],
"env": {
"MEM0_API_KEY": "m0-..."
}
}
}
}
The Mem0 MCP server enables these memory capabilities:
To quickly test functionality, use the included Pydantic AI agent:
# 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
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "mem0" '{"command":"uv","args":["run","main.py"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:
{
"mcpServers": {
"mem0": {
"command": "uv",
"args": [
"run",
"main.py"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json~/.config/Claude/claude_desktop_config.json2. Add this to your configuration file:
{
"mcpServers": {
"mem0": {
"command": "uv",
"args": [
"run",
"main.py"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect