docs/platform/mem0-mcp.mdx
MCP (Model Context Protocol) is a standard way for AI clients to call external tools. The Mem0 MCP server hands your agent a set of memory tools, so it can decide for itself when to save something, look something up, or update what it already knows. Nothing runs on your machine: the server is hosted by Mem0, and your client connects to it over HTTPS.
Memories you store this way live in your Mem0 account, not on your computer.
Point your clients at the hosted server with a single command:
npx mcp-add \
--name mem0-mcp \
--type http \
--url "https://mcp.mem0.ai/mcp" \
--clients "claude,claude code,cursor,windsurf,vscode,opencode"
mcp-add is a helper that writes the Mem0 server into each client's own MCP config file, so you do not have to edit them by hand. Name only the clients you actually use. If you would rather see the change yourself, every client's manual config is under Client-specific setup.
Restart each client afterwards so it picks up the new server.
The server is authenticated, so connecting is not enough on its own. There are two ways in:
<Tabs> <Tab title="Sign in through the client"> Most clients handle this for you. The first time your agent uses a Mem0 tool, the client opens a browser window asking you to authorize access to your Mem0 account. Approve it once and the client stores the token, refreshing it as needed.This is the easier path, and it is what happens by default if you followed the quick setup above.
Get a key from the <a href="https://app.mem0.ai/dashboard/api-keys?utm_source=oss&utm_medium=platform-mem0-mcp" rel="nofollow">Mem0 dashboard</a>, and keep it out of any file you commit.
If neither is set up, the server replies 401 Authentication required and your client reports the connection as failed.
The MCP server exposes these memory tools to your AI client:
| Tool | Description |
|---|---|
add_memory | Save text or conversation history for a user/agent |
search_memories | Semantic search across existing memories with filters |
get_memories | List memories with structured filters and pagination |
get_memory | Retrieve one memory by its memory_id |
update_memory | Overwrite a memory's text and/or metadata after confirming the ID |
delete_memory | Delete a single memory by memory_id |
delete_all_memories | Bulk delete all memories in scope |
delete_entities | Delete a user/agent/app/run entity and its memories |
list_entities | Enumerate users/agents/apps/runs stored in Mem0 |
list_events | List memory operation events with filters and pagination |
get_event_status | Check the status of an async memory operation by event_id |
You can also configure individual clients:
<AccordionGroup> <Accordion title="Claude Desktop"> ```bash npx mcp-add \ --name mem0-mcp \ --type http \ --url "https://mcp.mem0.ai/mcp" \ --clients "claude" ```Or manually add to your Claude Desktop configuration (`claude_desktop_config.json`):
```json
{
"mcpServers": {
"mem0-mcp": {
"type": "http",
"url": "https://mcp.mem0.ai/mcp"
}
}
}
```
```toml
[mcp_servers.mem0]
url = "https://mcp.mem0.ai/mcp"
bearer_token_env_var = "MEM0_API_KEY"
```
Export `MEM0_API_KEY` in the shell you launch Codex from, then restart Codex. `codex mcp add` only supports stdio servers, so HTTP servers must be added via `config.toml` directly, or via the **Plugins → Connect to a custom MCP → Streamable HTTP** UI in the Codex app.
<Note>
Codex uses the server name `mem0` (not `mem0-mcp` like the other clients on this page) so it matches the name the bundled plugin registers if you ever sideload it later.
</Note>
**Sideloaded plugin (full experience).** If you want the memory protocol skill, Mem0 SDK skill, and opt-in lifecycle hooks alongside the MCP server, sideload the plugin from a clone of `mem0ai/mem0`. The repo ships a marketplace manifest at `.agents/plugins/marketplace.json`, so you can register it with one CLI call:
```bash
git clone https://github.com/mem0ai/mem0.git ~/codex-plugins/mem0-source
codex plugin marketplace add ~/codex-plugins/mem0-source
```
Then run `codex` and `/plugins`, browse the **Mem0 Plugins** marketplace, and install **Mem0**. Don't combine this with the Direct MCP setup above; the sideloaded plugin auto-registers `mem0` via `.codex-mcp.json`, so a manual `[mcp_servers.mem0]` block would create a duplicate.
See the [Codex integration guide](/integrations/codex) for full details, lifecycle-hook setup, and management commands (`codex plugin marketplace upgrade` / `remove`).
Or go to Cursor → Settings → MCP and add:
```json
{
"mcpServers": {
"mem0-mcp": {
"type": "http",
"url": "https://mcp.mem0.ai/mcp"
}
}
}
```
Restart your client, then ask it to store something and read it back in a later message:
You: Remember that I prefer TypeScript over JavaScript for new projects.
Agent: Saved.
You: What language do I prefer for new projects?
Agent: You prefer TypeScript over JavaScript.
The second answer only works if the memory was really stored, so this is a genuine round-trip test rather than the model repeating itself.
Two things to look for while you do it:
To confirm from outside the client, open the <a href="https://app.mem0.ai/dashboard?utm_source=oss&utm_medium=platform-mem0-mcp" rel="nofollow">Mem0 dashboard</a>: anything the agent saved appears there.
| What you see | What it means | What to do |
|---|---|---|
401 or "Authentication required" | The client connected but is not signed in | Complete the browser sign-in, or set your API key as a bearer token |
| "Connection refused" or "failed to connect" | The client cannot reach the server | Check your internet connection, then confirm the URL is exactly https://mcp.mem0.ai/mcp |
| The agent has no Mem0 tools | The config was written but the client has not reloaded it | Restart the client. If the tools are still missing, check that mcp-add wrote to the config file your client actually reads |
npx: command not found | Node.js is not installed | Install it from nodejs.org |
| "Invalid API key" | The key is wrong, revoked, or from a different account | Get a new one from the <a href="https://app.mem0.ai/dashboard/api-keys?utm_source=oss&utm_medium=platform-mem0-mcp" rel="nofollow">Mem0 dashboard</a> |