118 lines
4.1 KiB
Markdown
118 lines
4.1 KiB
Markdown
# Mem0 Plugin for Claude Code, Claude Cowork & Cursor
|
|
|
|
Add persistent memory to your AI workflows. Store, retrieve, and manage memories across sessions using the Mem0 Platform. Works with **Claude Code** (CLI), **Claude Cowork** (desktop app), and **Cursor**.
|
|
|
|
## Step 1: Set your API key
|
|
|
|
> **You must complete this step before installing the plugin.**
|
|
|
|
1. Sign up at [app.mem0.ai](https://app.mem0.ai) if you haven't already
|
|
2. Go to [app.mem0.ai/dashboard/api-keys](https://app.mem0.ai/dashboard/api-keys)
|
|
3. Click **Create API Key** and copy the key (starts with `m0-`)
|
|
4. Add it to your shell profile:
|
|
|
|
```bash
|
|
# For zsh (default on macOS)
|
|
echo 'export MEM0_API_KEY="m0-your-api-key"' >> ~/.zshrc
|
|
source ~/.zshrc
|
|
|
|
# For bash
|
|
echo 'export MEM0_API_KEY="m0-your-api-key"' >> ~/.bashrc
|
|
source ~/.bashrc
|
|
```
|
|
|
|
5. Confirm it's set:
|
|
|
|
```bash
|
|
echo $MEM0_API_KEY
|
|
# Should print: m0-your-api-key
|
|
```
|
|
|
|
## Step 2: Install the plugin
|
|
|
|
Choose one of the options below. All require `MEM0_API_KEY` to be set first (see above).
|
|
|
|
### Claude Code (CLI) / Claude Cowork (Desktop)
|
|
|
|
Claude Code and Claude Cowork share the same plugin system.
|
|
|
|
**CLI:**
|
|
|
|
```
|
|
/plugin marketplace add mem0ai/mem0
|
|
/plugin install mem0@mem0-plugins
|
|
```
|
|
|
|
**Cowork desktop app:** Open the Cowork tab, click **Customize** in the sidebar, click **Browse plugins**, and install Mem0.
|
|
|
|
This installs the full plugin including the MCP server, lifecycle hooks (automatic memory capture), and the Mem0 SDK skill.
|
|
|
|
### Cursor
|
|
|
|
> **Already have `mem0` configured as an MCP server?** Remove the existing entry from your Cursor MCP settings before installing to avoid duplicate tools.
|
|
|
|
**Option A — One-click deeplink** (installs MCP server only):
|
|
|
|
[Install Mem0 MCP in Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=mem0&config=eyJtY3BTZXJ2ZXJzIjp7Im1lbTAiOnsidXJsIjoiaHR0cHM6Ly9tY3AubWVtMC5haS9tY3AvIiwiaGVhZGVycyI6eyJBdXRob3JpemF0aW9uIjoiVG9rZW4gJHtlbnY6TUVNMF9BUElfS0VZfSJ9fX19)
|
|
|
|
**Option B — Manual configuration** (MCP server only):
|
|
|
|
Add the following to your `.cursor/mcp.json`:
|
|
|
|
```json
|
|
{
|
|
"mcpServers": {
|
|
"mem0": {
|
|
"url": "https://mcp.mem0.ai/mcp/",
|
|
"headers": {
|
|
"Authorization": "Token ${env:MEM0_API_KEY}"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
**Option C — Cursor Marketplace** (full plugin with hooks and skills):
|
|
|
|
Install from the [Cursor Marketplace](https://cursor.com/marketplace) for the complete experience including lifecycle hooks and the Mem0 SDK skill.
|
|
|
|
## Verify it works
|
|
|
|
After installing, confirm the MCP server is connected:
|
|
|
|
1. Start a new session (or restart your current one)
|
|
2. Ask: *"List my mem0 entities"* or *"Search my memories for hello"*
|
|
3. If the `mem0` tools appear and respond, you're all set
|
|
|
|
## What's included
|
|
|
|
| Component | Claude Code / Cowork | Cursor (Marketplace) | Cursor (Deeplink/Manual) |
|
|
|-----------|:--------------------:|:--------------------:|:------------------------:|
|
|
| MCP Server | Yes | Yes | Yes |
|
|
| Lifecycle Hooks | Yes | Yes | No |
|
|
| Mem0 SDK Skill | Yes | Yes | No |
|
|
|
|
- **MCP Server** — Connects to the Mem0 remote MCP server (`mcp.mem0.ai`), providing tools to add, search, update, and delete memories. No local dependencies required.
|
|
- **Lifecycle Hooks** — Automatic memory capture at key points: session start, context compaction, task completion, and session end.
|
|
- **Mem0 SDK Skill** — Guides the AI on how to integrate the Mem0 SDK (Python & TypeScript) into your applications.
|
|
|
|
## MCP Tools
|
|
|
|
Once installed, the following tools are available:
|
|
|
|
| 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 |
|
|
|
|
## License
|
|
|
|
Apache-2.0
|