> ## 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.

# Add Persistent Memory to Cursor

> Connect Agent Memory to Cursor via MCP in one command. Your Cursor Agent will remember file patterns, decisions, and context across every session.

Cursor supports MCP servers natively. Agent Memory connects as an MCP server that Cursor's AI automatically calls when it needs context about your project. Once connected, Cursor Agent can search past decisions, recall what files do, and pick up where you left off — across every session.

<Note>
  Make sure `agentmemory` is running before opening Cursor. Start it with `agentmemory` or `npx @agentmemory/agentmemory` in a terminal.
</Note>

## Quick Connect

The fastest way to connect is with the CLI. It writes the MCP server config to `~/.cursor/mcp.json` automatically:

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

That is it. Restart Cursor and the Agent will have access to Agent Memory's MCP tools.

## Manual Setup

If you prefer to configure it yourself, add the following block to Cursor's MCP settings. You can reach it via **Settings → MCP** or by editing `~/.cursor/mcp.json` directly:

```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}"
      }
    }
  }
}
```

Save the file and reload Cursor's MCP servers. The `@agentmemory/mcp` shim connects to the Agent Memory server at `localhost:3111` and proxies all 53 tools into Cursor.

<Note>
  If you see only 8 tools listed in Cursor's MCP panel, the shim cannot reach the server — it has fallen back to the standalone core set. Make sure `agentmemory` is running and `AGENTMEMORY_URL` points at it correctly.
</Note>

## What Cursor Agent Can Do

With Agent Memory connected, Cursor's AI has access to the following tools:

<CardGroup cols={2}>
  <Card title="memory_recall" icon="clock-rotate-left">
    Search all past observations from previous sessions. Cursor uses this to surface relevant context at the start of a conversation.
  </Card>

  <Card title="memory_save" icon="floppy-disk">
    Explicitly save an insight, architectural decision, or pattern. Ask Cursor to remember something and it will call this tool.
  </Card>

  <Card title="memory_smart_search" icon="magnifying-glass">
    Hybrid semantic and keyword search using BM25 + embeddings with RRF fusion. Returns the most contextually relevant results for complex queries.
  </Card>

  <Card title="memory_file_history" icon="file-lines">
    Retrieve everything Agent Memory has recorded about a specific file — past edits, decisions, and observations from earlier sessions.
  </Card>

  <Card title="memory_patterns" icon="chart-line">
    Surface recurring patterns across your sessions — frequently touched files, repeated bug categories, common workflows.
  </Card>

  <Card title="memory_sessions" icon="list">
    List recent sessions with summaries so Cursor can orient itself to recent work.
  </Card>
</CardGroup>

## Install Native Skills (optional)

To make Cursor more proactively use memory tools, install Agent Memory's skills:

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

This installs 15 skills that teach Cursor when to recall, save, and reference memory — automatically detected for the Cursor environment.

## Verification

<Steps>
  <Step title="Open Cursor Agent mode">
    Switch to Agent mode in Cursor (the mode that can call tools).
  </Step>

  <Step title="Ask Cursor to recall project context">
    Type a prompt like:

    > Use memory\_recall to check what you know about this project.

    Cursor Agent will call the tool and return what Agent Memory has stored from previous sessions.
  </Step>

  <Step title="Confirm from the terminal">
    In your terminal, run:

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

    This shows the number of stored memories and active sessions. The real-time viewer at `http://localhost:3113` shows memories as they are created.
  </Step>
</Steps>

## Remote or Authenticated Deployments

If you run the Agent Memory server on a remote host or behind authentication, update the MCP config to pass your credentials:

```json theme={null}
{
  "mcpServers": {
    "agentmemory": {
      "command": "npx",
      "args": ["-y", "@agentmemory/mcp"],
      "env": {
        "AGENTMEMORY_URL": "https://your-server:3111",
        "AGENTMEMORY_SECRET": "your-secret-here"
      }
    }
  }
}
```

All agents that share the same `AGENTMEMORY_URL` access the same memory store, so Cursor and Claude Code can both read and write the same memories.
