Mem0 MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Mem0 MCP Server search for my memories about dietary preferences"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Mem0 MCP Server
mem0-mcp-server wraps the official Mem0 Memory API as a Model Context Protocol (MCP) server so any MCP-compatible client (Claude Desktop, Cursor, custom agents) can add, search, update, and delete long-term memories.
Tools
The server exposes the following tools to your LLM:
Tool | Description |
| Save text or conversation history (or explicit message objects) for a user/agent. |
| Semantic search across existing memories (filters + limit supported). |
| List memories with structured filters and pagination. |
| Retrieve one memory by its |
| Overwrite a memory's text once the user confirms the |
| Delete a single memory by |
| Bulk delete all memories in the confirmed scope (user/agent/app/run). |
| Delete a user/agent/app/run entity (and its memories). |
| Enumerate users/agents/apps/runs stored in Mem0. |
All responses are JSON strings returned directly from the Mem0 API.
Usage Options
There are three ways to use the Mem0 MCP Server:
Python Package - Install and run locally using
uvxwith any MCP clientDocker - Containerized deployment that creates an
/mcpHTTP endpointSmithery - Remote hosted service for managed deployments
Quick Start
Installation
uv pip install mem0-mcp-serverOr with pip:
pip install mem0-mcp-serverClient Configuration
Add this configuration to your MCP client:
{
"mcpServers": {
"mem0": {
"command": "uvx",
"args": ["mem0-mcp-server"],
"env": {
"MEM0_API_KEY": "sk_mem0_...",
"MEM0_DEFAULT_USER_ID": "your-handle"
}
}
}
}Test with the Python Agent
To test the server immediately, use the included Pydantic AI agent:
# Install the package
pip install mem0-mcp-server
# Or with uv
uv pip install mem0-mcp-server
# Set your API keys
export MEM0_API_KEY="sk_mem0_..."
export OPENAI_API_KEY="sk-openai-..."
# Clone and test with the agent
git clone https://github.com/mem0ai/mem0-mcp-server.git
cd mem0-mcp-server
python example/pydantic_ai_repl.pyUsing different server configurations:
# Use with Docker container
export MEM0_MCP_CONFIG_PATH=example/docker-config.json
export MEM0_MCP_CONFIG_SERVER=mem0-docker
python example/pydantic_ai_repl.py
# Use with Smithery remote server
export MEM0_MCP_CONFIG_PATH=example/config-smithery.json
export MEM0_MCP_CONFIG_SERVER=mem0-memory-mcp
python example/pydantic_ai_repl.pyWhat You Can Do
The Mem0 MCP server enables powerful memory capabilities for your AI applications:
Remember that I'm allergic to peanuts and shellfish - Add new health information to memory
Store these trial parameters: 200 participants, double-blind, placebo-controlled study - Save research data
What do you know about my dietary preferences? - Search and retrieve all food-related memories
Update my project status: the mobile app is now 80% complete - Modify existing memory with new info
Delete all memories from 2023, I need a fresh start - Bulk remove outdated memories
Show me everything I've saved about the Phoenix project - List all memories for a specific topic
Configuration
Environment Variables
MEM0_API_KEY(required) – Mem0 platform API key.MEM0_DEFAULT_USER_ID(optional) – defaultuser_idinjected into filters and write requests (defaults tomem0-mcp).MEM0_MCP_AGENT_MODEL(optional) – default LLM for the bundled agent example (defaults toopenai:gpt-4o-mini).
Advanced Setup
Docker Deployment
To run with Docker:
Build the image:
docker build -t mem0-mcp-server .Run the container:
docker run --rm -d \ --name mem0-mcp \ -e MEM0_API_KEY=sk_mem0_... \ -p 8080:8081 \ mem0-mcp-serverMonitor the container:
# View logs docker logs -f mem0-mcp # Check status docker ps
Running with Smithery Remote Server
To connect to a Smithery-hosted server:
Install with Smithery support:
pip install "mem0-mcp-server[smithery]"Configure MCP client with 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": "sk_mem0_..." } } } }
Development Setup
Clone and run from source:
git clone https://github.com/mem0ai/mem0-mcp-server.git
cd mem0-mcp-server
pip install -e ".[dev]"
# Run locally
mem0-mcp-server
# Or with uv
uv sync
uv run mem0-mcp-serverLicense
Available Tools
9 toolsadd_memoryB
Store a new preference, fact, or conversation snippet. Requires at least one: user_id, agent_id, or run_id.
Inputs: text (required), messages, user_id, agent_id, +4 more. Returns: result
delete_all_memoriesC
Delete every memory in the given user/agent/app/run but keep the entity.
Inputs: user_id, agent_id, app_id, run_id. Returns: result
delete_entitiesA
Remove a user/agent/app/run record entirely (and cascade-delete its memories).
Inputs: user_id, agent_id, app_id, run_id. Returns: result
delete_memoryB
Delete one memory after the user confirms its memory_id.
Inputs: memory_id (required). Returns: result
get_memoriesA
Page through memories using filters instead of search.
Use filters to list specific memories. Common filter patterns:
- Single user: {"AND": [{"user_id": "john"}]}
- Agent memories: {"AND": [{"agent_id": "agent_name"}]}
- Recent memories: {"AND": [{"user_id": "john"}, {"created_at": {"gte": "2024-01-01"}}]}
- Multiple users: {"AND": [{"user_id": {"in": ["john", "jane"]}}]}
Pagination: Use page (1-indexed) and page_size for browsing results.
user_id is automatically added to filters if not provided.
Inputs: filters, page, page_size, enable_graph. Returns: result
get_memoryB
Fetch a single memory once you know its memory_id.
Inputs: memory_id (required). Returns: result
list_entitiesB
List which users/agents/apps/runs currently hold memories.
Inputs: no named parameters. Returns: result
search_memoriesA
Run a semantic search over existing memories.
Use filters to narrow results. Common filter patterns:
- Single user: {"AND": [{"user_id": "john"}]}
- Agent memories: {"AND": [{"agent_id": "agent_name"}]}
- Recent memories: {"AND": [{"user_id": "john"}, {"created_at": {"gte": "2024-01-01"}}]}
- Multiple users: {"AND": [{"user_id": {"in": ["john", "jane"]}}]}
- Cross-entity: {"OR": [{"user_id": "john"}, {"agent_id": "agent_name"}]}
user_id is automatically added to filters if not provided.
Inputs: query (required), filters, limit, enable_graph. Returns: result
update_memoryB
Overwrite an existing memory’s text.
Inputs: memory_id (required), text (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Most tools have distinct purposes, but there is some potential confusion between get_memories (filtered listing) and search_memories (semantic search), as both involve retrieving memories with filters. The descriptions clarify the difference, but an agent might initially struggle to choose between them. Other tools like add_memory, delete_memory, and update_memory are clearly differentiated.
All tool names follow a consistent verb_noun pattern using snake_case, such as add_memory, delete_memory, and get_memories. This predictability makes it easy for agents to understand and use the tools without confusion about naming conventions.
With 9 tools, this server is well-scoped for memory management, covering core operations like adding, retrieving, updating, deleting, and searching memories, as well as entity management. Each tool serves a clear purpose without redundancy, making the count appropriate for the domain.
The tool set provides comprehensive coverage for memory management, including CRUD operations (add, get, update, delete), bulk and entity-level deletions, listing entities, and both filtered and semantic search capabilities. There are no obvious gaps, allowing agents to handle full memory lifecycles effectively.
Related MCP Connectors
Hosted memory for AI agents over MCP. One memory shared by all your agents.
Hosted agent memory: store, search, and recall facts across sessions from any MCP client.
Persistent memory for AI agents to retain, retrieve, and recall conversation context through MCP.
Persistent memory for AI agents across Claude, ChatGPT and any MCP client.