Mem0 MCP Server
Provides long-term memory capabilities for MCP clients by wrapping the Mem0 API, enabling semantic search, storage, retrieval, and management of conversation memories across users and agents.
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.
Ways to Run
You can run this server in three modes depending on your setup:
- Local Stdio (Recommended): Best for Claude Desktop, Cursor, or local development. No server port management needed.
- Smithery: Best for deploying as a hosted HTTP endpoint or using the Smithery platform.
- Docker: Best for containerized deployments where you need an HTTP endpoint.
How to Connect
Claude Desktop & Cursor (Stdio)
The easiest way to use Mem0 is by letting uvx handle the installation. Add this configuration to your claude_desktop_config.json or Cursor MCP settings:
{
"mcpServers": {
"mem0": {
"command": "uvx",
"args": ["mem0-mcp-server"],
"env": {
"MEM0_API_KEY": "sk_mem0_...",
"MEM0_DEFAULT_USER_ID": "your-handle"
}
}
}
}
Manual Installation (CLI)
If you prefer installing the package yourself:
pip install mem0-mcp-server
Then run it directly:
export MEM0_API_KEY="sk_mem0_..."
mem0-mcp-server
Agent Example
This repository includes a standalone agent (powered by Pydantic AI) to test the server interactively.
# Clone repo & install deps
git clone https://github.com/mem0-ai/mem0-mcp-server.git
cd mem0-mcp-server
pip install -e ".[smithery]"
# Run the agent REPL
export MEM0_API_KEY="sk_mem0_..."
export OPENAI_API_KEY="sk-openai-..."
python example/pydantic_ai_repl.py
This launches "Mem0Guide". Try prompts like "search memories for favorite food" to test your API key and memory storage.
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.
Config Files
For advanced usage (like switching the agent example to use Docker), this repo includes standard MCP config files in the example/ directory:
example/config.json: Local Stdio (default)example/docker-config.json: Docker HTTP
Switch configurations for the agent REPL by setting MEM0_MCP_CONFIG_PATH.
Detailed Setup Guides
<details> <summary><strong>Click to expand: Smithery, Docker, and Troubleshooting</strong></summary>
1. Smithery HTTP
To run the HTTP transport with Smithery:
pip install -e ".[smithery]"(orpip install "mem0-mcp-server[smithery]").- Ensure
MEM0_API_KEY(and optionalMEM0_DEFAULT_USER_ID) are exported. uv run smithery devfor a local endpoint (http://127.0.0.1:8081/mcp).- Optional:
uv run smithery playgroundto open an ngrok tunnel + Smithery web UI. - Testing: Create a config copying
example/config.jsonbut changing the entry to{ "type": "http", "url": "http://127.0.0.1:8081/mcp" }, then pointMEM0_MCP_CONFIG_PATHto it before running the agent REPL. - Hosted deploy: Push to GitHub, connect at smithery.ai, click Deploy.
2. Docker HTTP
To containerize the server:
- Build the image:
docker build -t mem0-mcp-server . - Run the container (ensure env vars are passed):
docker run --rm -e MEM0_API_KEY=sk_mem0_... -p 8081:8081 mem0-mcp-server - Connect clients using
example/docker-config.json:export MEM0_MCP_CONFIG_PATH="$PWD/example/docker-config.json" python example/pydantic_ai_repl.py
Troubleshooting Docker:
- The container must be running before HTTP clients connect.
- Ensure
MEM0_API_KEYis passed via-e. - If clients can't connect, check that port 8081 is forwarded correctly (
-p 8081:8081) and that the config URL is reachable.
3. FAQ / Troubleshooting
RuntimeWarning: 'mem0_mcp_server.server' found in sys.modules…: Harmless warning when running the Pydantic AI REPL.session_config not found in request scope: Expected when running outside Smithery; the server falls back to environment variables.- Smithery CLI "server reference not found": Ensure
[tool.smithery] server = "mem0_mcp_server.server:create_server"is present inpyproject.toml.
</details>
Development
uv sync --python 3.11 # optional, installs dev extras and lockfile
uv run --from . mem0-mcp-server # run local checkout via uvx
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Neon Database
MCP server for interacting with Neon Management API and databases