Compare commits

...

5 Commits

Author SHA1 Message Date
gabrielstein-mem0 50c1861a59 Merge remote-tracking branch 'origin/main' into fix/codex-install-docs
# Conflicts:
#	mem0-plugin/README.md
2026-04-27 11:04:22 -07:00
gabrielstein-mem0 674bb92423 docs(codex): lead sideload with CLI, flag auto-MCP, align server name
Rework the Codex install flow around `codex plugin marketplace add
<clone>` so users can lean on the repo's bundled
`.agents/plugins/marketplace.json` instead of hand-authoring one.
This removes the "path must be under ~/" constraint that was tripping
people up.

Also:
- Call out that sideloading auto-registers `mem0` via .codex-mcp.json,
  so Option A (Direct MCP) and Option B (sideload) must not be combined.
- Rename the Direct MCP snippet on the platform page from `mem0-mcp`
  to `mem0` to match the bundled plugin — prevents silent duplicate
  servers for users who follow one path then try the other.
- Drop the trailing slash in .codex-mcp.json's URL to match the rest
  of the docs.
- Add `codex plugin marketplace upgrade` / `remove` and the plugin
  cache path (~/.codex/plugins/cache/...).
- New troubleshooting entries for duplicate MCP registration and for
  hooks breaking after a clone is moved (the installer bakes absolute
  paths, so moving the clone requires re-running it).
2026-04-24 16:53:30 -07:00
gabrielstein-mem0 a723cb485a docs(codex): use relative source.path inside marketplace root
Re-checked the docs PR against developers.openai.com/codex/plugins/build,
which states: "Keep source.path relative to the marketplace root, start
it with ./, and keep it inside that root."

The earlier sideload instructions used an absolute path
(/Users/YOU/src/mem0/mem0-plugin) which violates that rule. Updated:

- docs/integrations/codex.mdx Option B — clone under ~/codex-plugins/,
  use "./codex-plugins/mem0-source/mem0-plugin", restart Codex made an
  explicit step.
- mem0-plugin/README.md Option B — same fix.
- Updated the "plugin/read failed in TUI" troubleshooting entry to
  point at the relative-path requirement.
2026-04-24 15:35:01 -07:00
gabrielstein-mem0 21043bab1f Merge remote-tracking branch 'origin/main' into fix/codex-install-docs 2026-04-24 15:34:47 -07:00
gabrielstein-mem0 43b222ca57 docs(codex): fix broken install instructions, lead with direct MCP
The support ticket that surfaced this found three overlapping issues:

1. docs/integrations/codex.mdx shipped a marketplace.json snippet with
   path "./plugins/mem0" — a directory that does not exist, with no clone
   prerequisite documented, and using a folder name that does not match
   the actual mem0-plugin/ directory. Users copy-pasted it verbatim and
   hit "plugin/read failed in TUI".

2. The "Manual MCP Configuration" option used a JSON mcpServers block.
   Codex reads MCP servers as TOML in ~/.codex/config.toml, not JSON.
   Same bug in docs/platform/mem0-mcp.mdx (no Codex accordion at all on
   main) and mem0-plugin/README.md Option C.

3. The page claimed "Codex uses a skill-based approach instead of
   lifecycle hooks" — stale; hooks are now available via opt-in
   installer (mem0-plugin/scripts/install_codex_hooks.py).

Lead with the working TOML MCP config (zero dependencies, works today),
demote the marketplace.json to a "Sideload (Advanced)" section with the
required git clone step and the correct mem0-plugin path, and point
sideloaders at the hooks installer + codex_hooks feature flag. Added
troubleshooting entries for the TUI read error and hooks-not-firing.
2026-04-23 15:04:35 -07:00
4 changed files with 147 additions and 134 deletions
+81 -68
View File
@@ -30,91 +30,100 @@ export MEM0_API_KEY="m0-your-api-key"
## Installation
### Option A — Repo Marketplace (Recommended for Teams)
### Option A — Direct MCP (Recommended)
Add a `.agents/plugins/marketplace.json` to your repository root:
The fastest way to connect Codex to Mem0 — no downloads, no marketplace. Codex reads MCP servers from `~/.codex/config.toml` as TOML. Add:
```json
{
"name": "mem0-plugins",
"interface": {
"displayName": "Mem0 Plugins"
},
"plugins": [
{
"name": "mem0",
"source": {
"source": "local",
"path": "./plugins/mem0"
},
"policy": {
"installation": "AVAILABLE",
"authentication": "ON_INSTALL"
},
"category": "Productivity"
}
]
}
```toml
[mcp_servers.mem0]
url = "https://mcp.mem0.ai/mcp"
bearer_token_env_var = "MEM0_API_KEY"
```
Then in Codex, browse the repo's plugin directory and install Mem0.
Make sure `MEM0_API_KEY` is exported in the shell you launch Codex from, then restart Codex.
### Option B — Personal Marketplace
<Info>
Codex's `codex mcp add` CLI only supports stdio MCP servers. Because Mem0's MCP is HTTP/streamable, you configure it by editing `config.toml` directly (or via the **Plugins → Connect to a custom MCP → Streamable HTTP** UI in the Codex app).
</Info>
Add to `~/.agents/plugins/marketplace.json`:
### Option B — Sideload the Plugin (Advanced)
```json
{
"name": "mem0-plugins",
"interface": {
"displayName": "Mem0 Plugins"
},
"plugins": [
{
"name": "mem0",
"source": {
"source": "local",
"path": "/path/to/mem0-plugin"
},
"policy": {
"installation": "AVAILABLE",
"authentication": "ON_INSTALL"
},
"category": "Productivity"
}
]
}
For the full plugin experience — MCP server **plus** the Mem0 SDK skill, memory protocol skill, and opt-in lifecycle hooks — sideload the plugin from a local clone. The Mem0 repo already ships a marketplace manifest at [`.agents/plugins/marketplace.json`](https://github.com/mem0ai/mem0/blob/main/.agents/plugins/marketplace.json), so there's no JSON to author by hand. This follows the Codex [build-plugins](https://developers.openai.com/codex/plugins/build) local-testing workflow.
<Info>
Don't combine Option B with Option A. The plugin manifest declares its MCP server via [`.codex-mcp.json`](https://github.com/mem0ai/mem0/blob/main/mem0-plugin/.codex-mcp.json), so Codex auto-registers the `mem0` MCP server when the plugin loads. Adding the same `[mcp_servers.mem0]` block to `~/.codex/config.toml` will create a duplicate registration.
</Info>
**Step 1.** Clone the Mem0 repository anywhere on disk:
```bash
git clone https://github.com/mem0ai/mem0.git ~/codex-plugins/mem0-source
```
### Option C — Manual MCP Configuration
**Step 2.** Register the bundled marketplace with Codex's CLI:
Add to your Codex MCP config:
```json
{
"mcpServers": {
"mem0": {
"type": "http",
"url": "https://mcp.mem0.ai/mcp/",
"headers": {
"Authorization": "Token ${MEM0_API_KEY}"
}
}
}
}
```bash
codex plugin marketplace add ~/codex-plugins/mem0-source
```
This points Codex at the repo's `.agents/plugins/marketplace.json`. The bundled file uses `path: "./mem0-plugin"`, which Codex resolves relative to the clone root.
<Info>
**Why we recommend this over hand-authoring `~/.agents/plugins/marketplace.json`:** Codex requires `source.path` in any marketplace manifest to be **relative** (starting with `./`) and **inside the marketplace root**. The repo's bundled manifest already satisfies this — the marketplace root is the clone directory, and `mem0-plugin/` lives inside it. With a personal `~/.agents/plugins/marketplace.json`, the root is `~/` and the clone has to live under `~/` too. The CLI form sidesteps that constraint.
</Info>
**Step 3.** Restart Codex, run `/plugins`, browse the `Mem0 Plugins` marketplace, and install **Mem0**.
**Step 4 (optional) — enable lifecycle hooks.** Codex doesn't auto-wire hooks from plugin manifests; it only reads them from `~/.codex/hooks.json` (or `<repo>/.codex/hooks.json`). Run the bundled installer once to merge the Mem0 entries into your global hooks file:
```bash
python3 ~/codex-plugins/mem0-source/mem0-plugin/scripts/install_codex_hooks.py
```
Then enable the hooks feature flag in `~/.codex/config.toml`:
```toml
[features]
codex_hooks = true
```
Restart Codex. The installer registers three hooks pointing at scripts inside your clone:
| Event | Behavior |
|-------|----------|
| `SessionStart` | Loads prior memories as bootstrap context |
| `UserPromptSubmit` | Injects relevant memories before each prompt |
| `Stop` | Reminds the agent to persist learnings at turn end |
Re-running the installer is idempotent. To remove the hooks: `python3 ~/codex-plugins/mem0-source/mem0-plugin/scripts/install_codex_hooks.py --uninstall`.
<Warning>
The hooks file stores absolute paths into your clone (e.g. `~/codex-plugins/mem0-source/mem0-plugin/scripts/...`). If you move or delete the clone, the hooks will break silently — re-run the installer from the new location, or run `--uninstall` first.
</Warning>
### Managing the Plugin
Codex provides CLI commands for managing marketplaces after install:
```bash
codex plugin marketplace upgrade # pull latest plugin versions
codex plugin marketplace remove mem0-plugins # unregister the marketplace
```
To pull updates to the plugin source itself, `git pull` inside your clone (`~/codex-plugins/mem0-source`) and then run `codex plugin marketplace upgrade` to refresh Codex's plugin cache. Plugins are cached at `~/.codex/plugins/cache/<marketplace>/<plugin>/<version>/`.
<Info icon="check">
Start a new Codex task and ask: *"List my mem0 entities"* or *"Search my memories for hello"*. If the `mem0` tools appear and respond, you're all set.
After either option, start a new Codex task 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 | Plugin Install | MCP Only |
|-----------|:--------------:|:--------:|
| Component | Sideloaded Plugin | Direct MCP |
|-----------|:-----------------:|:----------:|
| MCP Server (9 memory tools) | Yes | Yes |
| Memory Protocol Skill | Yes | No |
| Mem0 SDK Skill | Yes | No |
| Lifecycle Hooks (opt-in) | Yes | No |
## Available MCP Tools
@@ -134,7 +143,7 @@ Once installed, the following tools are available in every Codex session:
## Memory Protocol Skill
Codex uses a skill-based approach instead of lifecycle hooks. When installed via the plugin marketplace, the memory protocol skill instructs the agent to:
When the plugin is sideloaded, the memory protocol skill instructs the agent to:
### On Every New Task
1. Call `search_memories` with a query related to the current task to load relevant context
@@ -199,8 +208,12 @@ You: Add WebSocket support for real-time notification delivery.
- **"Connection failed"** — Verify `MEM0_API_KEY` is set in your shell: `echo $MEM0_API_KEY`
- **No tools appearing** — Restart your Codex session after plugin installation
- **Plugin not found** — Ensure `.agents/plugins/marketplace.json` is at the repository root and `source.path` points to the correct plugin directory
- **Skills not loading** — Verify the `skills` field in `plugin.json` points to a valid directory containing `SKILL.md` files
- **Duplicate `mem0` MCP server / "tool collision" errors** — You combined Option A (Direct MCP) with Option B (sideload). The sideloaded plugin auto-registers `mem0` from `.codex-mcp.json`, so remove the `[mcp_servers.mem0]` block from `~/.codex/config.toml`.
- **`plugin/read failed in TUI`** — Codex can't find the plugin directory the marketplace points at. If you used `codex plugin marketplace add <path>`, confirm the path is your clone root and that `<clone>/.agents/plugins/marketplace.json` exists. If you hand-authored `~/.agents/plugins/marketplace.json`, `source.path` must be relative (start with `./`), inside the marketplace root (`~/` for personal installs), and end in `mem0-plugin` — e.g. `"./codex-plugins/mem0-source/mem0-plugin"`.
- **Plugin not found in `/plugins`** — Run `codex plugin marketplace add ~/path/to/clone` again, or confirm the marketplace was registered with `codex plugin marketplace remove mem0-plugins` then re-add.
- **Skills not loading** — Verify the `skills` field in `plugin.json` points to a valid directory containing `SKILL.md` files.
- **Hooks not firing** — Confirm `codex_hooks = true` is in `~/.codex/config.toml` under `[features]`, and that `~/.codex/hooks.json` contains the Mem0 entries (re-run the installer if not). Restart Codex after enabling the flag.
- **Hooks broke after moving the clone** — The installer bakes absolute paths into `~/.codex/hooks.json` pointing at scripts inside your clone. If you moved or renamed the clone directory, run `python3 <new-clone>/mem0-plugin/scripts/install_codex_hooks.py` from the new location — the installer is idempotent and replaces the old entries.
<CardGroup cols={2}>
<Card title="Mem0 MCP Setup" icon="puzzle-piece" href="/platform/mem0-mcp">
+28 -1
View File
@@ -10,7 +10,7 @@ estimatedTime: "~2 minutes"
- Mem0 Platform account (<a href="https://app.mem0.ai?utm_source=oss&utm_medium=platform-mem0-mcp" rel="nofollow">Sign up here</a>)
- API key (<a href="https://app.mem0.ai/settings/api-keys?utm_source=oss&utm_medium=platform-mem0-mcp" rel="nofollow">Get one from dashboard</a>)
- Node.js 14+ (for npx)
- An MCP-compatible client (Claude, Claude Code, Cursor, Windsurf, VS Code, OpenCode)
- An MCP-compatible client (Claude, Claude Code, Codex, Cursor, Windsurf, VS Code, OpenCode)
</Info>
## What is Mem0 MCP?
@@ -86,6 +86,33 @@ You can also configure individual clients:
```
</Accordion>
<Accordion title="Codex">
**Direct MCP (fastest, MCP only).** Codex reads MCP servers from `~/.codex/config.toml` as TOML (not JSON). Add:
```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`).
</Accordion>
<Accordion title="Cursor">
```bash
npx mcp-add \
+1 -1
View File
@@ -1,7 +1,7 @@
{
"mcpServers": {
"mem0": {
"url": "https://mcp.mem0.ai/mcp/",
"url": "https://mcp.mem0.ai/mcp",
"bearer_token_env_var": "MEM0_API_KEY"
}
}
+37 -64
View File
@@ -49,72 +49,38 @@ This installs the full plugin including the MCP server, lifecycle hooks (automat
### Codex
**Option A — Repo marketplace** (recommended for teams):
**Option A — Direct MCP** (fastest, MCP only):
Add the plugin marketplace to your repo root (already included in this repository):
Codex reads MCP servers from `~/.codex/config.toml` as TOML. Add:
```
.agents/plugins/marketplace.json
```toml
[mcp_servers.mem0]
url = "https://mcp.mem0.ai/mcp"
bearer_token_env_var = "MEM0_API_KEY"
```
Then in Codex, browse the repo's plugin directory and install Mem0.
Export `MEM0_API_KEY` in your shell and restart Codex. `codex mcp add` only supports stdio servers, so HTTP servers like Mem0's must be added via `config.toml` directly (or via the **Plugins → Connect to a custom MCP → Streamable HTTP** UI in the Codex app).
**Option B — Personal marketplace**:
**Option B — Sideload the plugin** (full experience: MCP + skills + opt-in hooks):
Add to `~/.agents/plugins/marketplace.json`:
```json
{
"name": "mem0-plugins",
"interface": {
"displayName": "Mem0 Plugins"
},
"plugins": [
{
"name": "mem0",
"source": {
"source": "local",
"path": "/path/to/mem0/mem0-plugin"
},
"policy": {
"installation": "AVAILABLE",
"authentication": "ON_INSTALL"
},
"category": "Productivity"
}
]
}
```
**Option C — Manual MCP configuration**:
Add to your Codex MCP config:
```json
{
"mcpServers": {
"mem0": {
"type": "http",
"url": "https://mcp.mem0.ai/mcp/",
"headers": {
"Authorization": "Token ${MEM0_API_KEY}"
}
}
}
}
```
Options A, B, and C above install the MCP server and the Mem0 SDK skill.
**Optional — enable lifecycle hooks**
Codex only discovers hooks at `~/.codex/hooks.json` or `<repo>/.codex/hooks.json` ([docs](https://developers.openai.com/codex/hooks)) — there is no plugin-host mechanism that auto-wires hooks from an installed plugin. To opt in, run the installer once after installing the plugin:
Clone the repo and register the bundled marketplace with one CLI call:
```bash
python3 /path/to/mem0-plugin/scripts/install_codex_hooks.py
git clone https://github.com/mem0ai/mem0.git ~/codex-plugins/mem0-source
codex plugin marketplace add ~/codex-plugins/mem0-source
```
This merges three entries into `~/.codex/hooks.json` with absolute paths pointing into the plugin directory:
This points Codex at the repo's `.agents/plugins/marketplace.json`, which references `mem0-plugin/` as the local source. Restart Codex, run `/plugins`, and install **Mem0** from the **Mem0 Plugins** marketplace.
> **Don't combine with Option A.** The plugin manifest auto-registers `mem0` as an MCP server via `mem0-plugin/.codex-mcp.json` — adding a manual `[mcp_servers.mem0]` block would duplicate the registration.
**Optional — enable lifecycle hooks.** Codex doesn't auto-wire hooks from plugin manifests; it only reads `~/.codex/hooks.json` (or `<repo>/.codex/hooks.json`) ([docs](https://developers.openai.com/codex/hooks)). Run the bundled installer once to merge Mem0's entries:
```bash
python3 ~/codex-plugins/mem0-source/mem0-plugin/scripts/install_codex_hooks.py
```
This merges three entries into `~/.codex/hooks.json` with absolute paths pointing into your clone:
| Event | What it does |
|-------|--------------|
@@ -122,7 +88,7 @@ This merges three entries into `~/.codex/hooks.json` with absolute paths pointin
| `UserPromptSubmit` | Injects relevant memories into the prompt |
| `Stop` | Reminds the agent to persist learnings at turn end |
Re-running the installer is idempotent (replaces the Mem0 entries rather than duplicating) and preserves any other hooks you have. To remove: `python3 scripts/install_codex_hooks.py --uninstall`.
Re-running the installer is idempotent (replaces the Mem0 entries rather than duplicating) and preserves any other hooks you have. To remove: `python3 .../install_codex_hooks.py --uninstall`. If you move or delete the clone directory, re-run the installer from the new location — the hooks file stores absolute paths.
Codex hooks also require the `codex_hooks` feature flag in `~/.codex/config.toml`:
@@ -133,6 +99,13 @@ codex_hooks = true
The installer prints a reminder if the flag isn't set. Restart Codex after editing the config.
**Managing the plugin:**
```bash
codex plugin marketplace upgrade # pull latest plugin versions
codex plugin marketplace remove mem0-plugins # unregister the marketplace
```
### Cursor
> **Already have `mem0` configured as an MCP server?** Remove the existing entry from your Cursor MCP settings before installing to avoid duplicate tools.
@@ -172,17 +145,17 @@ After installing, confirm the MCP server is connected:
## What's included
| Component | Claude Code / Cowork | Cursor (Marketplace) | Cursor (Deeplink/Manual) | Codex |
|-----------|:--------------------:|:--------------------:|:------------------------:|:-----:|
| MCP Server | Yes | Yes | Yes | Yes |
| Lifecycle Hooks | Yes | Yes | No | Opt-in |
| Mem0 SDK Skill | Yes | Yes | No | Yes |
| Memory Protocol Skill | No | No | No | Yes |
| Component | Claude Code / Cowork | Cursor (Marketplace) | Cursor (Deeplink/Manual) | Codex (Sideload) | Codex (Direct MCP) |
|-----------|:--------------------:|:--------------------:|:------------------------:|:----------------:|:------------------:|
| MCP Server | Yes | Yes | Yes | Yes | Yes |
| Lifecycle Hooks | Yes | Yes | No | Opt-in | No |
| Mem0 SDK Skill | Yes | Yes | No | Yes | No |
| Memory Protocol Skill | No | No | No | 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. Claude Code and Cursor wire hooks up natively when the plugin is installed (session start, context compaction, task completion, session end). Codex hooks are opt-in via a one-time installer (`scripts/install_codex_hooks.py`) that writes entries into `~/.codex/hooks.json` for `SessionStart`, `UserPromptSubmit`, and `Stop`.
- **Mem0 SDK Skill** — Guides the AI on how to integrate the Mem0 SDK (Python & TypeScript) into your applications.
- **Memory Protocol Skill** — Codex-specific skill that instructs the agent to retrieve relevant memories at task start, store learnings on completion, and capture session state before context loss. Replaces lifecycle hooks on platforms that don't support them.
- **Memory Protocol Skill** — Codex-specific skill that instructs the agent to retrieve relevant memories at task start, store learnings on completion, and capture session state before context loss. Complements the lifecycle hooks on Codex.
## MCP Tools