MCP Directory

How to add Memory (Knowledge Graph) to Cursor

Official MCP server providing persistent, file-backed knowledge-graph memory across sessions. Paste the config into ~/.cursor/mcp.json and restart Cursor.

Last updated June 15, 2026 · 74k · stdio · no auth · official

Cursor config for Memory (Knowledge Graph)

npx -y @modelcontextprotocol/server-memory
{
  "mcpServers": {
    "memory-knowledge-graph": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-memory"
      ],
      "env": {
        "MEMORY_FILE_PATH": "/absolute/path/to/memory.jsonl"
      }
    }
  }
}

Setup steps

  1. 1Open Cursor → Settings → MCP → Add new MCP server (or edit ~/.cursor/mcp.json directly).
  2. 2Paste the Memory (Knowledge Graph) config below into the "mcpServers" object.
  3. 3Fill in placeholder secrets, then save.
  4. 4Cursor reloads MCP servers automatically — check Settings → MCP for a green status dot.
  5. 5Ask Cursor to use one of Memory (Knowledge Graph)'s tools to confirm it's connected.

Before you start

  • Node.js 18+ (to run via `npx @modelcontextprotocol/server-memory`), OR Docker if using the container image
  • No credentials or auth required
  • A writable location for the JSONL memory file (defaults to `memory.jsonl`; set `MEMORY_FILE_PATH` to relocate it, and a Docker volume if you want persistence in a container)

What Memory (Knowledge Graph) can do in Cursor

create_entities

Add one or more new entities, each with a type and initial observations.

create_relations

Create directed, active-voice relations between existing entities.

add_observations

Append new observation strings to existing entities.

delete_entities

Remove entities and any relations that reference them.

delete_observations

Remove specific observations from an entity.

delete_relations

Remove specific relations between entities.

read_graph

Return the entire knowledge graph (all entities and relations).

search_nodes

Search entities by name, type, or observation content.

Security

Memory contents are stored unencrypted in a local JSON-lines file; treat that file as sensitive if the model stores personal data. Anyone with disk access can read or tamper with the stored graph.

Memory (Knowledge Graph) + Cursor FAQ

Where is the Cursor config file?

Cursor reads MCP servers from ~/.cursor/mcp.json. Paste the Memory (Knowledge Graph) config there under the "mcpServers" key and restart the client.

Is Memory (Knowledge Graph) safe to use with Cursor?

Memory contents are stored unencrypted in a local JSON-lines file; treat that file as sensitive if the model stores personal data. Anyone with disk access can read or tamper with the stored graph.

Where is my memory data stored?

In a single JSONL file — `memory.jsonl` by default, next to the server. Override the location with the `MEMORY_FILE_PATH` environment variable.

Does the model automatically remember things?

Not on its own. You should add prompt instructions telling it when to call the memory tools; the README provides a sample system prompt for this.

How do I keep memory when running in Docker?

Mount a named volume (e.g. `-v claude-memory:/app/dist`) so the JSONL file isn't lost when the container is removed.

View repo Full Memory (Knowledge Graph) page