Skip to main content
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.

Overview

  1. MCP Server — Connect to Mem0’s remote MCP server for memory tools (add, search, update, delete)
  2. Lifecycle Hooks — Automatic memory capture at session start, compaction, and user prompts (Marketplace install)
  3. SDK Skill — Teaches the agent how to integrate the Mem0 SDK into your applications
  4. Zero local dependencies — Cloud-hosted MCP server, no local setup required

Prerequisites

Before setting up Mem0 with Cursor, ensure you have:
  1. A Mem0 Platform account and API key:
  2. Cursor installed (cursor.com)
  3. Your API key exported in your shell:
export MEM0_API_KEY="m0-your-api-key"
Already have mem0 configured as an MCP server in Cursor? Remove the existing entry from your Cursor MCP settings before installing to avoid duplicate tools.

Installation

The fastest way to get started. Click the link below to install the Mem0 MCP server directly in Cursor: Install Mem0 MCP in Cursor

Option B — npx (MCP Only)

npx mcp-add \
  --name mem0-mcp \
  --type http \
  --url "https://mcp.mem0.ai/mcp" \
  --clients "cursor"

Option C — Manual Configuration (MCP Only)

Add the following to your .cursor/mcp.json:
{
  "mcpServers": {
    "mem0": {
      "url": "https://mcp.mem0.ai/mcp/",
      "headers": {
        "Authorization": "Token ${env:MEM0_API_KEY}"
      }
    }
  }
}

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

ComponentMarketplace InstallDeeplink / Manual / npx
MCP Server (9 memory tools)YesYes
Lifecycle HooksYesNo
Mem0 SDK SkillYesNo

Available MCP Tools

Once installed, the following tools are available in every Cursor session:
ToolDescription
add_memorySave text or conversation history for a user/agent
search_memoriesSemantic search across memories with filters
get_memoriesList memories with filters and pagination
get_memoryRetrieve a specific memory by ID
update_memoryOverwrite a memory’s text by ID
delete_memoryDelete a single memory by ID
delete_all_memoriesBulk delete all memories in scope
delete_entitiesDelete a user/agent/app/run entity and its memories
list_entitiesList users/agents/apps/runs stored in Mem0

Lifecycle Hooks (Marketplace Install)

When installed via the Cursor Marketplace, Mem0 hooks into Cursor’s lifecycle:

Session Start

On every new session, the plugin prompts the agent to call search_memories to load relevant context from prior sessions.

User Prompt

Before processing each user message, the plugin searches Mem0 for relevant memories and injects them into context. Short prompts are skipped to minimize latency.

Pre-Compaction

Before context compaction, the plugin captures a comprehensive session summary so nothing is lost when the context window resets.

Example Workflow

# Session 1: Debugging a performance issue
You: The API endpoint /users is taking 3 seconds. Help me optimize it.

# Cursor agent searches memories, proceeds with investigation.
# After completing the task, Mem0 stores:
#   - Learning: "N+1 query in UserService.getAll() — fixed with eager loading"
#   - Decision: "Added database index on users.email column"
#   - Preference: "User prefers query-level fixes over caching"

# Session 2 (next week): Similar issue
You: The /orders endpoint is also slow, same pattern as before.

# Agent searches memories, retrieves the optimization learnings.
# Immediately checks for N+1 queries and missing indexes.

Troubleshooting

  • “Connection failed” — Verify MEM0_API_KEY is 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 mem0 server 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