Add persistent memory to Cursor with the Mem0 plugin. Your AI assistant forgets everything between sessions — this plugin fixes that by connecting to Mem0’s cloud memory layer via MCP, automatically capturing learnings at key lifecycle points, and retrieving relevant context before every response.Documentation Index
Fetch the complete documentation index at: https://docs.mem0.ai/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before setting up Mem0 with Cursor, ensure you have:-
A Mem0 Platform account and API key:
- Sign up at app.mem0.ai
- Get your API key (starts with
m0-)
- Cursor installed (cursor.com)
- Your API key added to your shell profile (persists across sessions):
Installation
Option A — One-Click Deeplink (MCP Only)
The fastest way to get started. Click the link below to install the Mem0 MCP server directly in Cursor: Install Mem0 MCP in CursorOption B — npx (MCP Only)
Option C — Manual Configuration (MCP Only)
Add the following to your.cursor/mcp.json:
Option D — Cursor Marketplace (Full Plugin)
Install from the Cursor Marketplace for the complete experience including lifecycle hooks, the Mem0 SDK skill, and automatic memory capture.Start a new Cursor session and ask: “List my mem0 entities” or “Search my memories for hello”. If the
mem0 tools appear and respond, you’re all set.What’s Included
| Component | Marketplace Install | Deeplink / Manual / npx |
|---|---|---|
| MCP Server (9 memory tools) | Yes | Yes |
| Lifecycle Hooks | Yes | No |
| Mem0 SDK Skill | Yes | No |
Available MCP Tools
Once installed, the following tools are available in every Cursor session:| Tool | Description |
|---|---|
add_memory | Save text or conversation history for a user/agent |
search_memories | Semantic search across memories with filters |
get_memories | List memories with filters and pagination |
get_memory | Retrieve a specific memory by ID |
update_memory | Overwrite a memory’s text by ID |
delete_memory | Delete a single memory by ID |
delete_all_memories | Bulk delete all memories in scope |
delete_entities | Delete a user/agent/app/run entity and its memories |
list_entities | List users/agents/apps/runs stored in Mem0 |
Lifecycle Hooks (Marketplace Install)
When installed via the Cursor Marketplace, Mem0 hooks into Cursor’s lifecycle:| Hook | Event | What it does |
|---|---|---|
| Session start | sessionStart | Loads prior memories and displays status banner |
| User prompt | beforeSubmitPrompt | Searches relevant memories before each message; skips short prompts |
| Pre-tool (2 handlers) | preToolUse | Blocks MEMORY.md writes, enforces user_id/app_id on mem0 tool calls |
| Post-tool (2 handlers) | postToolUse | Tracks stats, scans bash errors for related memories |
| Pre-compact | preCompact | Stores a session summary before context compaction |
Example Workflow
Troubleshooting
- “Connection failed” — Verify
MEM0_API_KEYis set:echo $MEM0_API_KEY - Duplicate tools — If you had a previous MCP config for
mem0, remove it before installing the plugin - No tools appearing — Go to Cursor Settings > MCP and verify the
mem0server shows as connected - Hooks not running — Hooks require the Marketplace install (Option D). Deeplink/manual installs only provide MCP tools.
Mem0 MCP Setup
Detailed MCP configuration for all clients
Claude Code Integration
Add Mem0 memory to Claude Code workflows