> ## 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 Any MCP-Compatible Agent to Agent Memory

> Add Agent Memory to Cline, Continue, Zed, Warp, OpenCode, Kiro, Droid, Qwen, Antigravity, Gemini CLI, and other MCP-compatible AI coding agents.

Any agent that supports the Model Context Protocol (MCP) can connect to Agent Memory using the `@agentmemory/mcp` shim package. All agents share the same memory store on your machine — what Cline learns in one session, Cursor can recall in the next.

## Universal MCP Config

Add this block to your agent's MCP server configuration file. The exact file path varies by agent (see the agent-specific sections below), but the config structure is the same for all of them:

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

The `${VAR:-default}` syntax means the config works without any environment variables set (falling back to `localhost:3111`, no auth, all 53 tools) but also picks up your shell exports automatically when they are set.

<Note>
  Start `agentmemory` before opening any agent. The shim connects to the server at startup — if the server is not running, the shim falls back to the 8-tool core set instead of exposing all 53 tools.
</Note>

## Agent-Specific Instructions

<Accordion title="Cline (VS Code)">
  **Quick connect:**

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

  This writes the `mcpServers.agentmemory` block to `~/.cline/mcp.json`.

  **VS Code extension users:** paste the same JSON block via **Cline Settings → MCP Servers → Edit JSON** inside VS Code. The config file is managed through the UI rather than the filesystem in that case.

  Cline uses the standard `mcpServers` schema, identical to Claude Code.
</Accordion>

<Accordion title="Continue">
  **Quick connect:**

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

  Continue v1+ prefers `~/.continue/config.yaml`. The connect command handles three cases automatically:

  * If `config.yaml` does not exist, it creates one with the Agent Memory entry.
  * If `config.json` exists (legacy path), it adds the entry to `mcpServers`.
  * If `config.yaml` already exists, it prints the block to add manually (to avoid clobbering your existing YAML comments and anchors).

  **Manual entry for `~/.continue/config.yaml`:**

  ```yaml theme={null}
  mcpServers:
    - name: agentmemory
      command: npx
      args:
        - "-y"
        - "@agentmemory/mcp"
      env:
        AGENTMEMORY_URL: "${AGENTMEMORY_URL:-http://localhost:3111}"
        AGENTMEMORY_SECRET: "${AGENTMEMORY_SECRET:-}"
        AGENTMEMORY_TOOLS: "${AGENTMEMORY_TOOLS:-all}"
  ```
</Accordion>

<Accordion title="Zed">
  **Quick connect:**

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

  This writes the config to `~/.config/zed/settings.json`.

  **Important:** Zed uses `context_servers` as the config key, not `mcpServers`. The connect command handles this automatically. If you configure it manually, the block goes under `"context_servers"` in your Zed settings:

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

<Accordion title="Warp">
  **Quick connect:**

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

  This writes the standard `mcpServers` block to `~/.warp/.mcp.json`.

  **Bonus:** Warp auto-discovers skills from `.claude/skills/`. If you have the Claude Code plugin installed, Warp automatically surfaces Agent Memory's 8 action skills (`/recall`, `/remember`, `/recap`, `/handoff`, `/forget`, `/commit-context`, `/commit-history`, `/session-history`) in its slash-command palette.
</Accordion>

<Accordion title="Gemini CLI">
  **Quick connect:**

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

  This writes the `mcpServers.agentmemory` block to `~/.gemini/settings.json`. MCP is the only protocol Gemini CLI speaks for external tool integrations.
</Accordion>

<Accordion title="Kiro">
  **Quick connect:**

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

  This writes the user-level config to `~/.kiro/settings/mcp.json`. For workspace-scoped overrides, add the same block to `.kiro/settings/mcp.json` in your project directory.
</Accordion>

<Accordion title="Droid (Factory.ai)">
  **Quick connect:**

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

  This writes the config to `~/.factory/mcp.json`. Droid requires an explicit `"type": "stdio"` field on each MCP entry, which the connect command adds automatically.

  For workspace-scoped overrides, add the same block to `.factory/mcp.json` in your project directory. You can verify the registered servers with the `/mcp` slash command inside a Droid session.
</Accordion>

<Accordion title="OpenCode">
  **Quick connect:**

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

  This writes the config to `~/.config/opencode/opencode.json`.

  **Important:** OpenCode does not use the standard `mcpServers` schema. Its config uses a top-level `mcp` key, with `command` as an array and explicit `type` and `enabled` fields. The connect command writes the correct shape automatically and preserves any other MCP servers you have configured. If you configure it manually, the block looks like this:

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

  OpenCode does not expand shell-style `${VAR:-default}` placeholders in its config, so the entry omits an `environment` block. The stdio child process inherits your shell environment instead — export `AGENTMEMORY_URL` or `AGENTMEMORY_SECRET` in your shell if you need non-default values.
</Accordion>

<Accordion title="Qwen Code">
  **Quick connect:**

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

  This writes the `mcpServers.agentmemory` block to `~/.qwen/settings.json`. Qwen Code uses the same MCP schema as Claude Code, so the standard config block works without modification.
</Accordion>

<Accordion title="Antigravity">
  **Quick connect:**

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

  This writes the config to the platform-appropriate path:

  * **macOS:** `~/Library/Application Support/Antigravity/User/mcp_config.json`
  * **Linux:** `~/.config/Antigravity/User/mcp_config.json`

  Antigravity uses the standard `mcpServers` schema. Note that Antigravity replaces Gemini CLI as of 2026-06-18 — if you were previously using `agentmemory connect gemini-cli`, switch to `agentmemory connect antigravity`.
</Accordion>

<Accordion title="OpenClaw">
  **Quick connect:**

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

  This writes the config to `~/.openclaw/openclaw.json`.

  For deeper integration with OpenClaw's memory slot system, copy `integrations/openclaw` from the Agent Memory repository to `~/.openclaw/extensions/agentmemory` and enable `plugins.slots.memory = "agentmemory"` in `~/.openclaw/openclaw.json`. This gives OpenClaw native memory slot access rather than just MCP tool access.
</Accordion>

<Accordion title="Codex CLI">
  **Quick connect:**

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

  Codex CLI uses a TOML config at `~/.codex/config.toml`. The connect command appends the MCP block in the correct TOML format.

  **Full plugin install** (recommended for hooks and skills):

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

  The Codex plugin registers 6 lifecycle hooks (`SessionStart`, `UserPromptSubmit`, `PreToolUse`, `PostToolUse`, `PreCompact`, `Stop`) and 8 invocable skills on top of the MCP tools.

  **Codex Desktop workaround:** Codex Desktop builds currently do not dispatch plugin-local `hooks.json`. MCP tools still work; only lifecycle hooks are affected. Until this is fixed upstream, run:

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

  This mirrors the hook commands into `~/.codex/hooks.json` with absolute paths.
</Accordion>

## Standalone MCP Mode

You can run Agent Memory's MCP server without the full engine if you only need MCP tool access without the persistence layer:

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

Or via npx without installing anything globally:

```bash theme={null}
npx @agentmemory/mcp
```

<Note>
  In standalone MCP mode (no server running at `AGENTMEMORY_URL`), the shim exposes 8 core tools with local-only storage. For the full 53-tool set with hybrid search, confidence scoring, and knowledge graphs, run the full `agentmemory` server alongside it.
</Note>

## Available MCP Tools

When your agent connects and the Agent Memory server is reachable, it has access to the following tools. The core set is always available; the extended set requires a running server.

### Core Tools

| Tool                  | Description                                                  |
| --------------------- | ------------------------------------------------------------ |
| `memory_recall`       | Full-text and semantic search across all past observations   |
| `memory_save`         | Save an insight, decision, or pattern to long-term memory    |
| `memory_smart_search` | Hybrid BM25 + embedding search with RRF fusion and reranking |
| `memory_file_history` | Past observations about a specific file                      |
| `memory_patterns`     | Surface recurring patterns across sessions                   |
| `memory_sessions`     | List recent sessions with summaries                          |
| `memory_timeline`     | Chronological view of observations                           |
| `memory_profile`      | Full project profile: concepts, files, and patterns          |

### Extended Tools

Set `AGENTMEMORY_TOOLS=all` when starting the server to expose all 53 tools. Extended tools include multi-agent coordination (`memory_lease`, `memory_signal_send`, `memory_signal_read`), knowledge graph traversal (`memory_relations`, `memory_graph_query`), governance (`memory_governance_delete`, `memory_audit`), and more.

<Tip>
  Use `AGENTMEMORY_TOOLS=core` when starting the server to limit to the 8 most essential tools if your agent has a small context window. This keeps the MCP tool list lean without losing the tools you use most.
</Tip>

## MCP Resources

In addition to tools, agents can read Agent Memory's resources directly using the `agentmemory://` scheme:

| Resource                               | Description                                            |
| -------------------------------------- | ------------------------------------------------------ |
| `agentmemory://status`                 | Server health, session count, and total memory count   |
| `agentmemory://memories/latest`        | The 10 most recently created active memories           |
| `agentmemory://project/{name}/profile` | Per-project intelligence profile for the named project |
| `agentmemory://graph/stats`            | Knowledge graph statistics                             |

## All Agents Share One Memory Store

A key benefit of Agent Memory's architecture: every connected agent reads from and writes to the same memory store on your machine. You can use Claude Code in the morning, switch to Cursor in the afternoon, and both agents have access to the same observations, decisions, and project context. There is no per-agent silo.
