> ## Documentation Index
> Fetch the complete documentation index at: https://agent-memory.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect AI Coding Agents to Agent Memory in One Command

> Wire up Claude Code, Cursor, GitHub Copilot, Codex, Gemini CLI, and 13+ other MCP-compatible agents to Agent Memory in one command.

Agent Memory supports **18 named agents** plus any agent that speaks MCP or the REST API. You connect via the `agentmemory connect` CLI command (recommended — it writes the right config file for each agent automatically) or by manually adding the MCP server JSON block to your agent's config.

Before connecting any agent, make sure the Agent Memory server is running:

```bash theme={null}
agentmemory
```

<Note>
  Agent Memory must be running before you start your agent. The MCP server is only reachable when `agentmemory` is active. If your agent starts before the server, it falls back to the 7-tool local set. Start the server first, then launch your agent.
</Note>

***

## Connect via CLI or manual config

<Tabs>
  <Tab title="CLI (Recommended)">
    Run `agentmemory connect [agent]` to automatically write the correct MCP server config for your agent. The command merges the Agent Memory entry into your agent's existing config without overwriting other servers.

    ```bash theme={null}
    agentmemory connect <agent-name>
    ```

    **Supported agent names:**

    | Agent              | Command                           |
    | ------------------ | --------------------------------- |
    | Claude Code        | `agentmemory connect claude-code` |
    | Cursor             | `agentmemory connect cursor`      |
    | GitHub Copilot CLI | `agentmemory connect copilot-cli` |
    | Codex CLI          | `agentmemory connect codex`       |
    | Gemini CLI         | `agentmemory connect gemini-cli`  |
    | Cline              | `agentmemory connect cline`       |
    | OpenCode           | `agentmemory connect opencode`    |
    | Zed                | `agentmemory connect zed`         |
    | Warp               | `agentmemory connect warp`        |
    | Continue.dev       | `agentmemory connect continue`    |
    | OpenCode           | `agentmemory connect opencode`    |
    | OpenClaw           | `agentmemory connect openclaw`    |
    | Hermes             | `agentmemory connect hermes`      |
    | pi                 | `agentmemory connect pi`          |
    | OpenHuman          | `agentmemory connect openhuman`   |
    | Droid (Factory.ai) | `agentmemory connect droid`       |
    | Kiro               | `agentmemory connect kiro`        |
    | Qwen Code          | `agentmemory connect qwen`        |
    | Antigravity        | `agentmemory connect antigravity` |

    After running the command, restart your agent (or run its MCP reload command) so it picks up the new server. In Claude Code, run `/mcp` to reload without restarting.
  </Tab>

  <Tab title="Manual MCP Config">
    If `agentmemory connect` does not support your agent or you prefer to configure manually, add this block to your agent's MCP config file. Merge the `agentmemory` entry into the existing `mcpServers` object — do not replace the whole file.

    ```json theme={null}
    {
      "mcpServers": {
        "agentmemory": {
          "command": "npx",
          "args": ["-y", "@agentmemory/mcp"],
          "env": {
            "AGENTMEMORY_URL": "http://localhost:3111",
            "AGENTMEMORY_SECRET": "${AGENTMEMORY_SECRET}"
          }
        }
      }
    }
    ```

    The `${AGENTMEMORY_SECRET}` placeholder inherits from your shell environment. If you have not set `AGENTMEMORY_SECRET`, leave the value as an empty string or omit it — the server is open on localhost by default.

    The MCP shim (`@agentmemory/mcp`) exposes the **full 53-tool surface** when it can reach a running Agent Memory server via `AGENTMEMORY_URL`. With no server reachable, it falls back to a 7-tool local set. If you see only 7 tools in your agent, start the server and reload MCP.

    **Config file locations by agent:**

    | Agent                        | Config file                                                                     |
    | ---------------------------- | ------------------------------------------------------------------------------- |
    | Cursor                       | `~/.cursor/mcp.json`                                                            |
    | Claude Desktop               | `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS)       |
    | Cline / Roo Code / Kilo Code | Cline Settings → MCP Servers → Edit JSON                                        |
    | Windsurf                     | `~/.codeium/windsurf/mcp_config.json`                                           |
    | Gemini CLI                   | `~/.gemini/settings.json`                                                       |
    | GitHub Copilot CLI           | `~/.copilot/mcp-config.json`                                                    |
    | Warp                         | `~/.warp/.mcp.json`                                                             |
    | Zed                          | `~/.config/zed/settings.json` (uses `context_servers` key, not `mcpServers`)    |
    | OpenCode                     | `~/.config/opencode/opencode.json` (uses top-level `mcp` key, not `mcpServers`) |
    | Kiro                         | `~/.kiro/settings/mcp.json`                                                     |
    | Droid                        | `~/.factory/mcp.json`                                                           |
  </Tab>
</Tabs>

***

## Agent-by-agent setup

### Claude Code

Claude Code supports two connection paths. The plugin path is recommended because it installs hooks, skills, and MCP in one step.

**Recommended: Plugin install (hooks + skills + MCP)**

Run these two commands inside a Claude Code session:

```text theme={null}
/plugin marketplace add rohitg00/agentmemory
/plugin install agentmemory
```

This registers:

* **12 auto-capture hooks** — `SessionStart`, `UserPromptSubmit`, `PreToolUse`, `PostToolUse`, `PostToolUseFailure`, `PreCompact`, `SubagentStart`, `SubagentStop`, `Stop`, `SessionEnd`, `Notification`, `TaskCompleted`
* **15 skills** — 8 invocable (`/recall`, `/remember`, `/session-history`, `/forget`, `/recap`, `/handoff`, `/commit-context`, `/commit-history`) + 7 reference skills
* **53 MCP tools** — automatically wired via the plugin's bundled `.mcp.json`

**Alternative: CLI connect**

```bash theme={null}
agentmemory connect claude-code
```

To also install hook scripts (useful if you wire MCP outside of the plugin):

```bash theme={null}
agentmemory connect claude-code --with-hooks
```

<Tip>
  Use the `/plugin install` path when possible. If you wire Agent Memory through `~/.claude.json` directly, hook scripts reference version-specific paths that break on upgrade. The plugin path handles this automatically.
</Tip>

***

### Cursor

```bash theme={null}
agentmemory connect cursor
```

This merges the MCP block into `~/.cursor/mcp.json`. Restart Cursor after running the command to load the new server. You can also paste the MCP JSON block manually via **Cursor Settings → MCP**.

After connecting, Cursor will list Agent Memory tools in its tool picker. You can invoke `memory_smart_search`, `memory_save`, and the full tool set directly from your Cursor agent sessions.

***

### GitHub Copilot CLI

```bash theme={null}
agentmemory connect copilot-cli
```

This merges `mcpServers.agentmemory` into `~/.copilot/mcp-config.json` (or `$COPILOT_HOME/mcp-config.json` if `COPILOT_HOME` is set) and preserves all existing servers. Copilot picks up the new server on the next launch or after running `/mcp`.

For the full plugin experience with hooks and skills, install the plugin separately:

```bash theme={null}
copilot plugin install rohitg00/agentmemory:plugin
```

<Note>
  The `agentmemory connect copilot-cli` command is Windows-safe even if other `connect` commands require manual Windows setup.
</Note>

***

### Codex CLI

```bash theme={null}
agentmemory connect codex
```

For the full plugin experience (MCP + 6 lifecycle hooks + 15 skills):

```bash theme={null}
codex plugin marketplace add rohitg00/agentmemory
codex plugin add agentmemory@agentmemory
```

The Codex plugin registers hooks for `SessionStart`, `UserPromptSubmit`, `PreToolUse`, `PostToolUse`, `PreCompact`, and `Stop`.

<Warning>
  **Codex Desktop users:** Plugin hooks are currently silent in the Desktop build due to an upstream issue. Run the following command to mirror hook scripts into the global hooks config as a workaround:

  ```bash theme={null}
  agentmemory connect codex --with-hooks
  ```

  MCP tools still work in all Codex variants — only lifecycle observation hooks are affected.
</Warning>

***

### Gemini CLI

```bash theme={null}
agentmemory connect gemini-cli
```

This writes the standard `mcpServers` block to `~/.gemini/settings.json`. You can also add Agent Memory via the Gemini CLI command:

```bash theme={null}
gemini mcp add agentmemory npx -y @agentmemory/mcp --scope user
```

After connecting, Gemini CLI picks up all 53 Agent Memory tools in your next session.

***

### Other MCP agents

For any other agent that supports the `mcpServers` JSON shape (Cline, Zed, Warp, Continue, Windsurf, Roo Code, Kilo Code, OpenCode, Goose, and more), use the manual config block:

<CodeGroup>
  ```json Standard mcpServers shape (most agents) theme={null}
  {
    "mcpServers": {
      "agentmemory": {
        "command": "npx",
        "args": ["-y", "@agentmemory/mcp"],
        "env": {
          "AGENTMEMORY_URL": "http://localhost:3111",
          "AGENTMEMORY_SECRET": "${AGENTMEMORY_SECRET}"
        }
      }
    }
  }
  ```

  ```json OpenCode (opencode.json) theme={null}
  {
    "mcp": {
      "agentmemory": {
        "type": "local",
        "command": ["npx", "-y", "@agentmemory/mcp"],
        "enabled": true
      }
    }
  }
  ```

  ```yaml Gemini CLI (settings.json — auto-merged via CLI) theme={null}
  mcpServers:
    agentmemory:
      command: npx
      args:
        - "-y"
        - "@agentmemory/mcp"
      env:
        AGENTMEMORY_URL: "http://localhost:3111"
  ```
</CodeGroup>

Merge the Agent Memory entry into your agent's **existing** `mcpServers` object. Do not replace the entire config file — add `agentmemory` as another key alongside your existing servers.

**Quick-connect commands for popular agents:**

```bash theme={null}
agentmemory connect cline        # ~/.cline/mcp.json
agentmemory connect opencode     # ~/.config/opencode/opencode.json (uses top-level mcp key)
agentmemory connect zed          # ~/.config/zed/settings.json (uses context_servers key)
agentmemory connect warp         # ~/.warp/.mcp.json
agentmemory connect continue     # ~/.continue/config.yaml or config.json
agentmemory connect kiro         # ~/.kiro/settings/mcp.json
agentmemory connect droid        # ~/.factory/mcp.json
agentmemory connect qwen         # ~/.qwen/settings.json
agentmemory connect antigravity  # ~/Library/Application Support/Antigravity/User/mcp_config.json (macOS)
```

#### Installing native skills (50+ agents)

After connecting via MCP, install the native skills so your agent knows *when* to use the memory tools — not just that they exist:

```bash theme={null}
npx skills add rohitg00/agentmemory -y
```

This auto-detects your agent and installs 15 skills (8 invocable action skills + 7 reference skills). To target a specific agent:

```bash theme={null}
npx skills add rohitg00/agentmemory -y -a warp
npx skills add rohitg00/agentmemory -y -a '*'   # install to every detected agent
```

***

## Verify your connection

After connecting your agent and restarting it, run:

```bash theme={null}
agentmemory status
```

You should see your agent listed under **Connected agents** with a ✓ next to it. You can also check directly from your agent — ask it to list available MCP tools. With the server running, you should see the full set of 53 tools including `memory_save`, `memory_smart_search`, `memory_sessions`, and `memory_profile`.

For a quick end-to-end check using the REST API directly:

```bash theme={null}
# Save a test memory
curl -X POST http://localhost:3111/agentmemory/remember \
  -H "Content-Type: application/json" \
  -d '{"content": "connection verification probe", "concepts": ["test"]}'

# Search for it
curl -X POST http://localhost:3111/agentmemory/smart-search \
  -H "Content-Type: application/json" \
  -d '{"query": "connection verification", "limit": 5}'
```

The search should return the memory you just saved. If it does, Agent Memory is wired correctly and ready to use.

<Note>
  If your agent shows only **7 tools** instead of 53, the MCP shim could not reach the Agent Memory server at `http://localhost:3111`. Make sure `agentmemory` is running in a separate terminal, then reload MCP in your agent (`/mcp` in Claude Code, or restart the agent entirely). Run `agentmemory doctor` for a full diagnostic.
</Note>
