> ## Documentation Index
> Fetch the complete documentation index at: https://mem0-feature-hermes-standalone-migration.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Cursor

> Add persistent memory to Cursor with automatic capture, explicit recall, a search tool, and six memory skills.

Add persistent memory to [**Cursor**](https://cursor.com) with the Mem0 plugin. Cursor captures completed work in the background, and its agent can search relevant project context in later sessions. You can also connect only the hosted MCP server when you do not need lifecycle capture.

<Info>Current plugin version: `0.3.1`.</Info>

Sidekick is available only in the [Claude Code plugin](/integrations/claude-code#sidekick-agent).

## Prerequisites

Before setting up Mem0 with Cursor, ensure you have:

1. A Mem0 Platform account and API key:
   * <a href="https://app.mem0.ai?utm_source=oss&utm_medium=integration-cursor">Sign up at app.mem0.ai</a>
   * <a href="https://app.mem0.ai/dashboard/api-keys?utm_source=oss&utm_medium=integration-cursor">Get your API key</a> (starts with `m0-`)

2. Cursor installed ([cursor.com](https://cursor.com))

3. Python 3.10 or newer available as `python3`

4. Your API key added to your shell profile (persists across sessions):

<CodeGroup>
  ```bash zsh theme={null}
  echo 'export MEM0_API_KEY="m0-your-api-key"' >> ~/.zshrc
  source ~/.zshrc
  ```

  ```bash bash theme={null}
  echo 'export MEM0_API_KEY="m0-your-api-key"' >> ~/.bashrc
  source ~/.bashrc
  ```
</CodeGroup>

<Warning>
  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.
</Warning>

## Installation

### Option A: Full Plugin (Recommended)

Add the Mem0 marketplace:

```bash theme={null}
cursor-agent plugin marketplace add https://github.com/mem0ai/mem0
```

Open Cursor's **Customize** page or run `/plugins`, select the **Mem0 Plugins** marketplace, and install **Mem0** at user or project scope. Enter your Mem0 API key when Cursor asks for the plugin configuration, then restart Cursor.

The full plugin includes automatic capture, the `search_memories` recall tool, lifecycle hooks, and six memory skills.

### Option B: 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 Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=mem0\&config=eyJtY3BTZXJ2ZXJzIjp7Im1lbTAiOnsidXJsIjoiaHR0cHM6Ly9tY3AubWVtMC5haS9tY3AvIiwiaGVhZGVycyI6eyJBdXRob3JpemF0aW9uIjoiVG9rZW4gJHtlbnY6TUVNMF9BUElfS0VZfSJ9fX19)

### Option C: npx (MCP Only)

```bash theme={null}
npx mcp-add \
  --name mem0-mcp \
  --type http \
  --url "https://mcp.mem0.ai/mcp/" \
  --clients "cursor"
```

### Option D: Manual Configuration (MCP Only)

Add the following to your `.cursor/mcp.json`:

```json theme={null}
{
  "mcpServers": {
    "mem0": {
      "url": "https://mcp.mem0.ai/mcp/",
      "headers": {
        "Authorization": "Token ${env:MEM0_API_KEY}"
      }
    }
  }
}
```

<Info icon="check">
  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.
</Info>

## What's included

| Component         |    Full plugin    |     MCP only     |
| ----------------- | :---------------: | :--------------: |
| Memory tools      | `search_memories` |   9 CRUD tools   |
| Automatic capture |        Yes        |        No        |
| Recall            | `search_memories` | MCP search tools |
| Lifecycle hooks   |        Yes        |        No        |
| Memory skills     |         6         |        No        |

## MCP-only tools

Options B, C, and D expose the following hosted tools. The full plugin uses the focused `search_memories` tool and captures writes through lifecycle hooks.

| 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

The full plugin translates Cursor's native events into the shared Mem0 memory lifecycle:

| Cursor event                         | What Mem0 does                                                                                   |
| ------------------------------------ | ------------------------------------------------------------------------------------------------ |
| `sessionStart`                       | Initializes the project session and recovers pending capture                                     |
| `beforeSubmitPrompt`                 | Observes the submitted prompt; recall stays tool-driven because this event cannot inject context |
| `postToolUse` / `postToolUseFailure` | Records useful tool results and failures                                                         |
| `afterAgentResponse` / `stop`        | Captures the completed exchange                                                                  |
| `preCompact` / `sessionEnd`          | Flushes pending capture in the background                                                        |

<Note>
  Cursor's `beforeSubmitPrompt` hook cannot add context to a prompt. Use `search_memories` to recall memories.
</Note>

The plugin does not register subagent start or stop hooks.

## Example Workflow

```text theme={null}
# Session 1: Debugging a performance issue
You: The API endpoint /users is taking 3 seconds. Help me optimize it. Prefer query-level fixes over caching.

# Cursor agent searches memories, proceeds with investigation.
# Mem0 stores what you said as yours:
#   - Your preference: "Prefers query-level fixes over caching"
# ...and what the agent did as the assistant's:
#   - Learning: "N+1 query in UserService.getAll(): fixed with eager loading"
#   - Decision: "Added database index on users.email column"

# 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.
```

## Search and capture

The local `search_memories` tool accepts `query`, `top_k`, `category`, `scope` (`repo`, `dir`, or `mine`), and optional `run_id` with every scope. Use a known session ID to recall memories saved in that session; omit it to search across sessions. See [search scopes](/integrations/claude-code#search-scope) for the shared Python search contract, including legacy repository memory compatibility.

Captured prompts and responses retain their full redacted text without a per-message character cutoff. Large extraction inputs are split across requests without dropping message text; recall output and tool-result previews have separate limits.

## Troubleshooting

* **"Connection failed"**: Verify `MEM0_API_KEY` is set: `echo $MEM0_API_KEY`
* **Duplicate tools**: Do not combine the full plugin with an MCP-only option. Remove the standalone `mem0` MCP entry before installing the plugin.
* **No tools appearing**: Go to Cursor Settings > MCP and verify the `mem0` server shows as connected

<CardGroup cols={2}>
  <Card title="Mem0 MCP Setup" icon="puzzle-piece" href="/platform/mem0-mcp">
    Detailed MCP configuration for all clients
  </Card>

  <Card title="Claude Code Integration" icon="https://mintcdn.com/mem0-feature-hermes-standalone-migration/KlqdVHJghJddWMyM/images/provider-icons/anthropic.svg?fit=max&auto=format&n=KlqdVHJghJddWMyM&q=85&s=776cd7a62edbd5a02df3e59fa01757f4" href="/integrations/claude-code" width="16" height="16" data-path="images/provider-icons/anthropic.svg">
    Add Mem0 memory to Claude Code workflows
  </Card>
</CardGroup>

<Snippet file="star-on-github.mdx" />
