refactor(integrations): shared agent plugin runtimes and native adapters (#7203)

This commit is contained in:
Kartik
2026-09-08 23:32:25 +05:30
committed by GitHub
parent dae67f74f5
commit 73e7b8763a
369 changed files with 31056 additions and 20464 deletions
+55 -9
View File
@@ -1,9 +1,11 @@
---
title: Cursor
description: "Add persistent memory to Cursor with the Mem0 MCP server for context-aware coding."
description: "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 MCP server. Your AI assistant forgets everything between sessions. Mem0 fixes that by connecting Cursor to Mem0's cloud memory layer via MCP so you can save and retrieve relevant context during coding sessions.
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>
## Prerequisites
@@ -15,7 +17,9 @@ Before setting up Mem0 with Cursor, ensure you have:
2. Cursor installed ([cursor.com](https://cursor.com))
3. Your API key added to your shell profile (persists across sessions):
3. Python 3.10 or newer available as `python3`
4. Your API key added to your shell profile (persists across sessions):
<CodeGroup>
```bash zsh
@@ -35,13 +39,25 @@ source ~/.bashrc
## Installation
### Option A: One-Click Deeplink (MCP Only)
### Option A: Full Plugin (Recommended)
Add the Mem0 marketplace:
```bash
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, a sidekick agent, 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 B: npx (MCP Only)
### Option C: npx (MCP Only)
```bash
npx mcp-add \
@@ -51,7 +67,7 @@ npx mcp-add \
--clients "cursor"
```
### Option C: Manual Configuration (MCP Only)
### Option D: Manual Configuration (MCP Only)
Add the following to your `.cursor/mcp.json`:
@@ -73,9 +89,20 @@ Add the following to your `.cursor/mcp.json`:
</Info>
## Available MCP Tools
## What's included
Once installed, the following tools are available in every Cursor session:
| 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 |
| Sidekick agent | Yes | 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 |
|------|-------------|
@@ -89,6 +116,25 @@ Once installed, the following tools are available in every Cursor session:
| `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 |
| `subagentStart` / `subagentStop` | Records the Mem0 Sidekick lifecycle and completed result |
| `afterAgentResponse` / `stop` | Captures the completed exchange |
| `preCompact` / `sessionEnd` | Flushes pending capture in the background |
<Note>
Cursor's `beforeSubmitPrompt` hook can allow or block a prompt, but it cannot add context to that prompt. The plugin therefore gives the agent `search_memories` and a memory-aware sidekick for recall instead of claiming automatic per-prompt injection.
</Note>
Cursor's `subagentStart` hook also cannot inject parent context. The bundled Sidekick searches Mem0 itself, while the lifecycle hooks correlate its start and completion for later capture.
## Example Workflow
```text
@@ -112,7 +158,7 @@ You: The /orders endpoint is also slow, same pattern as before.
## 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
- **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}>