Integrate Mem0 with MCP for Coding Knowledge
An archived MCP server wrapping Mem0's long-term memory API with 9 tools - now superseded by Mem0's official cloud-hosted MCP server.
Maintainer of this project? Claim this page to edit the listing.
1.0.0Add to Favorites
Why it matters
Leverage Mem0's persistent storage and semantic search to enhance your coding workflow. This MCP connector allows you to store, retrieve, and analyze coding preferences and best practices.
Outcomes
What it gets done
Save and manage coding snippets and patterns with detailed context.
Perform semantic searches across your saved coding knowledge.
Integrate with Agent mode in Cursor for seamless access.
Establish a persistent, cloud-oriented system for coding best practices.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/vb-mem0-mcp | bash Capabilities
Tools your agent gets
Saves code snippets, implementation details, and coding patterns with detailed context.
Retrieves all saved coding preferences for pattern analysis and implementation review.
Semantic search across saved coding preferences to find relevant code implementations.
Overview
mem0-mcp Server
An archived MCP server exposing 9 tools wrapping the Mem0 memory API - add, search, update, and delete long-term memories - superseded by Mem0's official cloud-hosted MCP server. Archived and no longer maintained - for new setups, install Mem0's official cloud-hosted MCP server instead of this standalone package.
What it does
This MCP server wraps the official Mem0 Memory API so any MCP-compatible client (Claude Desktop, Cursor, custom agents) can add, search, update, and delete long-term memories. It exposes nine tools: add_memory saves text, conversation history, or explicit message objects for a user or agent; search_memories runs semantic search across existing memories with filters and a result limit; get_memories lists memories with structured filters and pagination, while get_memory retrieves one by memory_id; update_memory overwrites a memory's text once the user confirms the ID; delete_memory removes a single memory, delete_all_memories bulk-deletes all memories in a confirmed scope (user/agent/app/run), delete_entities deletes an entity and its memories, and list_entities enumerates the users/agents/apps/runs stored in Mem0. All responses are JSON strings passed through directly from the Mem0 API. Example uses include remembering a stated allergy, storing structured research parameters, retrieving all memories on a topic, updating a project's status, or bulk-deleting memories from a given time period.
When to use - and when NOT to
This repository is archived and no longer actively maintained. Mem0 now offers an official cloud-hosted MCP server instead - for new setups, install that directly rather than this standalone package, using npx mcp-add --name mem0-mcp --type http --url "https://mcp.mem0.ai/mcp" --clients "claude,claude code,cursor,windsurf,vscode,opencode".
When it was current, this self-hosted version was for teams that wanted to run and control the Mem0 MCP integration themselves (via Python package, Docker, or a Smithery-hosted deployment) rather than depend on Mem0's managed cloud endpoint.
Inputs and outputs
Input is a MEM0_API_KEY (required) and memory operations - text/conversation content to store, a search query with filters, or a memory_id to update/retrieve/delete. Output is a JSON string from the Mem0 API for every operation. Optional configuration includes MEM0_DEFAULT_USER_ID (default mem0-mcp), MEM0_ENABLE_GRAPH_DEFAULT (default false), and MEM0_MCP_AGENT_MODEL (default openai:gpt-4o-mini) for the bundled example agent.
How to install
Historically installable three ways: as a Python package (uv pip install mem0-mcp-server or pip install mem0-mcp-server, then configured in an MCP client with uvx mem0-mcp-server and the MEM0_API_KEY/MEM0_DEFAULT_USER_ID environment variables), via Docker (docker build -t mem0-mcp-server . then docker run exposing an /mcp HTTP endpoint), or via a Smithery-hosted remote deployment (npx -y @smithery/cli@latest run @mem0ai/mem0-memory-mcp with a Smithery key and profile). A bundled Pydantic AI agent example (example/pydantic_ai_repl.py) could test any of these three configurations locally. The project is Apache 2.0-licensed.
Who it's for
Teams evaluating Mem0's memory API integration who should now use Mem0's official cloud-hosted MCP server instead of this archived, self-hosted implementation.
npx mcp-add \
--name mem0-mcp \
--type http \
--url "https://mcp.mem0.ai/mcp" \
--clients "claude,claude code,cursor,windsurf,vscode,opencode"
Source README
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 |
|---|---|
add_memory |
Save text or conversation history (or explicit message objects) for a user/agent. |
search_memories |
Semantic search across existing memories (filters + limit supported). |
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 once the user confirms the memory_id. |
delete_memory |
Delete a single memory by memory_id. |
delete_all_memories |
Bulk delete all memories in the confirmed scope (user/agent/app/run). |
delete_entities |
Delete a user/agent/app/run entity (and its memories). |
list_entities |
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 client - Docker - Containerized deployment that creates an
/mcpHTTP endpoint - Smithery - Remote hosted service for managed deployments
Quick Start
Installation
uv pip install mem0-mcp-server
Or with pip:
pip install mem0-mcp-server
Client Configuration
Add 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"
}
}
}
}
Test with the Python Agent
Click to expand: 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="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
Using 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.py
What 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_ENABLE_GRAPH_DEFAULT(optional) - Enable graph memories by default (defaults tofalse).MEM0_MCP_AGENT_MODEL(optional) - default LLM for the bundled agent example (defaults toopenai:gpt-4o-mini).
Advanced Setup
Click to expand: Docker, Smithery, and Development
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=m0-... \ -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 the MCP server (Smithery dependencies are now bundled):
pip install mem0-mcp-serverConfigure 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": "m0-..." } } } }
Development Setup
Clone and run from source:
git clone https://github.com/mem0ai/mem0-mcp.git
cd mem0-mcp-server
pip install -e ".[dev]"
# Run locally
mem0-mcp-server
# Or with uv
uv sync
uv run mem0-mcp-server
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.