Claude Code, Codex and Cursor
What is an MCP memory server?
Alexandru Lupascu, CTO & Co-founder · Updated
An MCP memory server is a program that gives an AI agent tools to save and look up knowledge through the Model Context Protocol (MCP), so any MCP client, such as Claude Code, OpenAI Codex or Cursor, can store a fact in one session and find it in a later one. The official reference server, @modelcontextprotocol/server-memory, keeps a knowledge graph of entities, relations and observations in a local JSONL file and exposes 9 tools, including create_entities, add_observations and search_nodes. Stored knowledge reaches the model only when the agent calls one of those tools or the client reads the server's resource.
How does an MCP memory server work?
An MCP memory server works like any MCP server: the host application creates one MCP client per server, and the server offers tools, resources and prompts. The MCP architecture overview defines tools as "executable functions that AI applications can invoke" and resources as "data sources that provide contextual information to AI applications".
In the reference memory server, the graph has three parts:
- Entities: a unique name, a type such as "person" or "organization", and a list of observations.
- Relations: directed links between entities, written in active voice, such as
works_at. - Observations: single facts stored as strings, which can be added or removed independently.
Writes go to memory.jsonl in the server directory unless you set MEMORY_FILE_PATH. The README's example system prompt tells the model to retrieve from memory at the start of each chat; without an instruction like that, recall depends on the model deciding to call a tool.
How do you add a memory server to Claude Code, Codex and Cursor?
All three tools speak MCP, so the same server can be registered in each. According to each vendor's MCP docs:
| Tool | How to add it | Config file |
|---|---|---|
| Claude Code | claude mcp add memory -- npx -y @modelcontextprotocol/server-memory | ~/.claude.json (local and user scope), .mcp.json at the project root (project scope, shared via version control) |
| OpenAI Codex | codex mcp add memory -- npx -y @modelcontextprotocol/server-memory | ~/.codex/config.toml, or .codex/config.toml for trusted projects |
| Cursor | Customize page, or edit the file | ~/.cursor/mcp.json (global), .cursor/mcp.json (project) |
In Cursor's mcp.json, the same server is one entry:
{ "mcpServers": { "memory": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-memory"] } } }
The reference server needs Node.js 24 or later when it runs through npx.
What are the limits of a basic MCP memory server?
The reference memory server calls itself "a basic implementation of persistent memory using a local knowledge graph." The MCP servers repository adds that its servers are "educational examples for developers building their own MCP servers, not as production-ready solutions", and asks you to evaluate your own security requirements.
Sharing is local. Each MCP client starts its own server process, so two clients pointed at the same memory file are two processes writing one file. Writes take turns through a lock file, but the README warns that a network filesystem without reliable exclusive file creation cannot be shared safely this way.
Recall is on demand. The agent has to call search_nodes or open_nodes, and read_graph returns the entire graph. Deciding which observation is outdated, or which of two conflicting facts is current, is left to the model or to you, through the delete tools.
When do you need more than a memory server?
A memory server stores and returns facts; it does not decide what the model sees on a given turn. For one developer with a personal knowledge graph, that is enough. Teams running several agents often also need to rank what is current, flag sources that disagree, and keep a record of why.
elephant.broker is a pluggable runtime for AI agents that connects through an MCP server, native plugins or a REST API. On every turn, elephant.broker retrieves and reranks from one graph and vector store, drops stale or duplicate facts, and places the working set before the model turn; when two sources conflict, both are placed and weighed by proof. Its memory is pluggable, so you can bring the memory you already run. Compare the architectures on the elephant.broker comparison section, and see Can Claude Code, Codex and Cursor share one memory? for a cross-tool setup.
Sources
- Model Context Protocol: What is MCP?, Architecture overview, reference servers, Knowledge Graph Memory Server
- Anthropic, Claude Code: Connect Claude Code to tools via MCP
- OpenAI, Codex: Model Context Protocol
- Cursor: Model Context Protocol (MCP)
- elephant.broker: how a turn flows, comparison
Product details come from each vendor's public documentation as viewed on 2026-10-23 and may have changed. Product names are trademarks of their respective owners; elephant.broker is not affiliated with them.