# Mem0

> Persistent memory layer for AI agents — auto-summarised, cross-session recall.

[Canonical HTML page](https://top-mcps.com/mcp/mem0) · [server.json](https://top-mcps.com/mcp/mem0.json) · [methodology](https://top-mcps.com/about/methodology)

## Install

### Claude Desktop — `claude_desktop_config.json`

Paste under mcpServers. Fully quit and reopen Claude after editing.

```json
{
  "mcpServers": {
    "mem0": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "-e",
        "MEM0_API_KEY",
        "mem0ai/mem0-mcp:latest"
      ],
      "env": {
        "MEM0_API_KEY": "${MEM0_API_KEY}",
        "MEM0_USER_ID": "${MEM0_USER_ID}"
      }
    }
  }
}
```

### Claude Code — `CLI or .mcp.json`

Run from your repo. Commit .mcp.json to share with your team.

```shell
# export MEM0_API_KEY=changeme
# export MEM0_USER_ID=optional-default-user
claude mcp add mem0 -- docker run --rm -i -e MEM0_API_KEY mem0ai/mem0-mcp:latest
```

### Cursor — `.cursor/mcp.json`

Global path: ~/.cursor/mcp.json. Reload window after editing.

```json
{
  "mcpServers": {
    "mem0": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "-e",
        "MEM0_API_KEY",
        "mem0ai/mem0-mcp:latest"
      ],
      "env": {
        "MEM0_API_KEY": "${MEM0_API_KEY}",
        "MEM0_USER_ID": "${MEM0_USER_ID}"
      }
    }
  }
}
```

### VS Code — `.vscode/mcp.json`

VS Code uses the "servers" key (not "mcpServers").

```jsonc
{
  "servers": {
    "mem0": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "-e",
        "MEM0_API_KEY",
        "mem0ai/mem0-mcp:latest"
      ],
      "env": {
        "MEM0_API_KEY": "${MEM0_API_KEY}",
        "MEM0_USER_ID": "${MEM0_USER_ID}"
      }
    }
  }
}
```

### Windsurf — `~/.codeium/windsurf/mcp_config.json`

Open via Cascade → hammer icon → Configure.

```json
{
  "mcpServers": {
    "mem0": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "-e",
        "MEM0_API_KEY",
        "mem0ai/mem0-mcp:latest"
      ],
      "env": {
        "MEM0_API_KEY": "${MEM0_API_KEY}",
        "MEM0_USER_ID": "${MEM0_USER_ID}"
      }
    }
  }
}
```

### Cline — `cline_mcp_settings.json`

Open via the Cline sidebar → MCP Servers → Edit.

```json
{
  "mcpServers": {
    "mem0": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "-e",
        "MEM0_API_KEY",
        "mem0ai/mem0-mcp:latest"
      ],
      "env": {
        "MEM0_API_KEY": "${MEM0_API_KEY}",
        "MEM0_USER_ID": "${MEM0_USER_ID}"
      }
    }
  }
}
```

### Continue — `~/.continue/config.json`

Continue uses modelContextProtocolServers with a transport block.

```json
{
  "experimental": {
    "modelContextProtocolServers": [
      {
        "transport": {
          "type": "stdio",
          "command": "docker",
          "args": [
            "run",
            "--rm",
            "-i",
            "-e",
            "MEM0_API_KEY",
            "mem0ai/mem0-mcp:latest"
          ],
          "env": {
            "MEM0_API_KEY": "${MEM0_API_KEY}",
            "MEM0_USER_ID": "${MEM0_USER_ID}"
          }
        }
      }
    ]
  }
}
```

### Codex CLI — `~/.codex/config.toml`

Codex uses TOML. Each server is a [mcp_servers.<name>] subtable.

```shell
# ~/.codex/config.toml
[mcp_servers.mem0]
command = "docker"
args = [
  "run",
  "--rm",
  "-i",
  "-e",
  "MEM0_API_KEY",
  "mem0ai/mem0-mcp:latest",
]
env = { MEM0_API_KEY = "${MEM0_API_KEY}", MEM0_USER_ID = "${MEM0_USER_ID}" }
```

### Zed — `~/.config/zed/settings.json`

Zed calls them "context_servers". Settings live-reload on save.

```jsonc
{
  "context_servers": {
    "mem0": {
      "command": {
        "path": "docker",
        "args": [
          "run",
          "--rm",
          "-i",
          "-e",
          "MEM0_API_KEY",
          "mem0ai/mem0-mcp:latest"
        ]
      },
      "env": {
        "MEM0_API_KEY": "${MEM0_API_KEY}",
        "MEM0_USER_ID": "${MEM0_USER_ID}"
      }
    }
  }
}
```

### ChatGPT — `ChatGPT → Apps directory`

Mem0 doesn't ship a hosted HTTPS endpoint today. ChatGPT supports remote MCP servers only — to use this server in ChatGPT you'll need to deploy it to a public HTTPS URL first (e.g. via Cloudflare Workers or Vercel) or wait for an official remote build.

```none

```

## At a glance

- **Maintainer:** Mem0
- **Transport:** stdio
- **Auth model:** API key
- **Required secrets:** MEM0_API_KEY, MEM0_USER_ID
- **Supported clients:** Claude, Cursor, VS Code, Windsurf, Any MCP-compatible client, Mem0 Cloud, Self-hosted Mem0
- **License:** Apache-2.0
- **Language:** Python
- **Latest version:** latest
- **Last verified:** 2026-06-02
- **GitHub stars:** 57,390 (fetched 2026-06-02T13:16:41.411Z)
- **Score:** 98/100 (rubric 2026-04 — see https://top-mcps.com/about/methodology)
- **Source:** https://github.com/mem0ai/mem0

## Tools & permissions

| Tool | Description | Args | Side effects |
|------|-------------|------|--------------|
| `add_memory` | Store a piece of context against a user. | `content: string, user_id: string` | write |
| `search_memory` | Semantically retrieve relevant memories for a user. | `query: string, user_id: string` | read |
| `list_memories` | List all memories for a user. | `user_id: string` | read |
| `delete_memory` | Delete a specific memory. | `memory_id: string` | write |

## Security & scope

- **Access scope:** read-write
- **Sandbox:** Cloud mode talks to api.mem0.ai with an API key scoped to one workspace. Self-hosted mode talks to a local server you operate; memories never leave the host.
- **Gotchas:**
  - API keys carry full workspace access — rotate on any team change.
  - user_id must be set per-conversation; without it, memories pool into a shared bucket and leak across users.
  - Mem0 stores embeddings of your raw turns — review your privacy contract before sending PII into it.

## Quick answer

**What it does.** Stores, queries, and updates a managed memory store keyed by user/session. Handles summarisation, deduplication, and expiry behind a small tool surface.

**Best for:**
- Cross-session agent memory
- Personalised assistants
- Customer-context retrieval
- Long-running coding agents
- Removing "re-explain my project" friction

**Not for:**
- One-off pipelines
- Workflows that need raw embedding control
- Workloads where memory cannot leave the host (use a self-hosted store)

## Description

The Mem0 MCP gives an AI agent a managed memory layer that survives across sessions and conversations. The agent stores facts, preferences, and context with a single tool call; on the next conversation, the MCP retrieves the right slices semantically. Unlike a raw vector store, Mem0 does the summarisation, deduplication, and decay automatically — closer to "human memory" than "embedding index."

## Why it matters

The single most common agent failure mode is "I told you this last session." Mem0 fixes that without forcing the developer to design a memory schema, manage embeddings, or write summarisation prompts.

## Key features

- Managed summarisation and deduplication
- Per-user and per-session scoping
- Auto-decay of low-value memories
- Hosted Mem0 Cloud or self-hosted OSS
- Tool surface designed for agentic recall

## FAQ

### Cloud or self-hosted?

Both. The default points at Mem0 Cloud with an API key; self-hosted runs the OSS server in Docker and points the MCP at it via MEM0_BASE_URL.

### How is memory scoped?

By user_id and optional session_id. The MCP rejects cross-user reads — even an agent given a shared API key cannot list another user's memories.

### Does it auto-summarise?

Yes. Mem0 ingests raw turns and runs a summarisation step before storing. The MCP exposes the summarised slice, not the raw chat — what reaches the agent is already deduped.

## Changelog

- **2026-06-02** — Refreshed install snippets and fact sheet; verified for 2026.
- **2025-03-25** — Initial directory listing.
