MCP Mem0
A template implementation of the Model Context Protocol server that integrates with Mem0 to provide AI agents with persistent memory capabilities for storing, retrieving, and searching memories using semantic search.
What is MCP Mem0?
MCP Mem0 is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to template implementation of the model context protocol server that integrates with mem0 to provide ai agents with persistent memory capabilities for storing, retrieving, and searching memories using se...
A template implementation of the Model Context Protocol server that integrates with Mem0 to provide AI agents with persistent memory capabilities for storing, retrieving, and searching memories using semantic search.
This server falls under the Knowledge & Memory category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- A template implementation of the Model Context Protocol serv
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx mcp-mem0Configuration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use MCP Mem0
MCP-Mem0 is a Model Context Protocol server that integrates with the Mem0 memory platform to give AI agents persistent, semantically searchable long-term memory. It exposes three tools — save_memory, get_all_memories, and search_memories — backed by a PostgreSQL database and a configurable LLM provider for embedding and retrieval. Use it to build AI assistants that remember user preferences, past conversations, and domain knowledge across sessions.
Prerequisites
- Python 3.10+ and uv or pip installed
- PostgreSQL database accessible (local or cloud, e.g. Supabase free tier)
- An LLM provider API key: OpenAI (OPENAI_API_KEY), OpenRouter, or a local Ollama instance
- An MCP client such as Claude Desktop or Cursor
- Docker (optional, for the containerized deployment path)
Clone the repository
Clone the mcp-mem0 repository from GitHub to get the source code and example configuration files.
git clone https://github.com/coleam00/mcp-mem0.git
cd mcp-mem0Install dependencies
Install the Python dependencies using uv in editable mode.
pip install uv
uv pip install -e .Configure environment variables
Copy the example env file and fill in your database URL, LLM provider, and API keys.
cp .env.example .env
# Edit .env with your values:
# TRANSPORT=stdio
# LLM_PROVIDER=openai
# LLM_API_KEY=sk-your-openai-key
# LLM_CHOICE=gpt-4o-mini
# EMBEDDING_MODEL_CHOICE=text-embedding-3-small
# DATABASE_URL=postgresql://user:password@localhost:5432/mem0Configure Claude Desktop for stdio transport
Add mcp-mem0 to Claude Desktop's configuration file, pointing to the Python executable in the virtual environment.
{
"mcpServers": {
"mem0": {
"command": "/path/to/mcp-mem0/.venv/bin/python",
"args": ["/path/to/mcp-mem0/src/main.py"],
"env": {
"TRANSPORT": "stdio",
"LLM_PROVIDER": "openai",
"LLM_API_KEY": "sk-your-openai-key",
"LLM_CHOICE": "gpt-4o-mini",
"EMBEDDING_MODEL_CHOICE": "text-embedding-3-small",
"DATABASE_URL": "postgresql://user:password@localhost:5432/mem0"
}
}
}
}Or run with Docker for SSE transport
Build and run the Docker image, then configure your MCP client to connect via SSE to localhost:8050.
docker build -t mcp/mem0 --build-arg PORT=8050 .
docker run --env-file .env -p 8050:8050 mcp/mem0Connect via SSE (Docker deployment)
When running with Docker in SSE mode, configure your MCP client to use the HTTP SSE transport.
{
"mcpServers": {
"mem0": {
"transport": "sse",
"url": "http://localhost:8050/sse"
}
}
}MCP Mem0 Examples
Client configuration
Claude Desktop stdio configuration for mcp-mem0 with OpenAI as the LLM provider.
{
"mcpServers": {
"mem0": {
"command": "/path/to/mcp-mem0/.venv/bin/python",
"args": ["/path/to/mcp-mem0/src/main.py"],
"env": {
"TRANSPORT": "stdio",
"LLM_PROVIDER": "openai",
"LLM_API_KEY": "sk-your-openai-key",
"LLM_CHOICE": "gpt-4o-mini",
"EMBEDDING_MODEL_CHOICE": "text-embedding-3-small",
"DATABASE_URL": "postgresql://user:password@localhost:5432/mem0"
}
}
}
}Prompts to try
Once connected, use these prompts to store and retrieve persistent memories:
- "Remember that I prefer TypeScript over JavaScript for all new projects"
- "Save that my AWS production account ID is 123456789012"
- "What do you remember about my coding preferences?"
- "Search your memories for anything related to my database setup"
- "Recall everything you know about my current project architecture"Troubleshooting MCP Mem0
Database connection errors on startup
Verify the DATABASE_URL is correct and the PostgreSQL server is running and accessible. Test with 'psql $DATABASE_URL' from your terminal. Ensure the database exists and the user has CREATE TABLE permissions (Mem0 creates its schema automatically on first run).
Embedding or search returning irrelevant results
Ensure EMBEDDING_MODEL_CHOICE matches the model used when memories were originally saved. Changing embedding models mid-use requires re-indexing existing memories, as embeddings from different models are not compatible.
Server fails to start with 'module not found' errors
Ensure you installed with 'uv pip install -e .' from the project root directory while the virtual environment is active. The command in claude_desktop_config.json must point to the Python executable inside .venv, not the system Python.
Frequently Asked Questions about MCP Mem0
What is MCP Mem0?
MCP Mem0 is a Model Context Protocol (MCP) server that template implementation of the model context protocol server that integrates with mem0 to provide ai agents with persistent memory capabilities for storing, retrieving, and searching memories using semantic search. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install MCP Mem0?
Follow the installation instructions on the MCP Mem0 GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with MCP Mem0?
MCP Mem0 works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is MCP Mem0 free to use?
Yes, MCP Mem0 is open source and available under the MIT License license. You can use it freely in both personal and commercial projects.
MCP Mem0 Alternatives — Similar Knowledge & Memory Servers
Looking for alternatives to MCP Mem0? Here are other popular knowledge & memory servers you can use with Claude, Cursor, and VS Code.
MemPalace
★ 52.6kA local AI memory system that stores all conversations verbatim and organizes them into navigable structures. It provides 19 MCP tools for AI assistants to search and retrieve past decisions, debugging sessions, and architecture debates automatically
Kratos
★ 25.7k🏛️ Memory System for AI Coding Tools - Never explain your codebase again. MCP server with perfect project isolation, 95.8% context accuracy, and the Four Pillars Framework.
Context Mode
★ 15.4kAn MCP server that preserves LLM context by intercepting large data outputs and returning only concise summaries or relevant sections. It enables efficient sandboxed code execution, file processing, and documentation indexing across multiple programm
Memu
★ 13.7kMemory for 24/7 proactive agents like OpenClaw.
MemOS
★ 9.3kMemOS (Memory Operating System) is a memory management operating system designed for AI applications. Its goal is: to enable your AI system to have long-term memory like a human, not only remembering what users have said but also actively invoking, u
Everos
★ 5.4kBuild, evaluate, and integrate long-term memory for self-evolving agents.
Browse More Knowledge & Memory MCP Servers
Explore all knowledge & memory servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up MCP Mem0 in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use MCP Mem0?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.