Skip to main content
AgentsUse

MCP server, by Model Context Protocol

Knowledge Graph Memory Server

Node.js MCP server that persists memory locally as a knowledge graph of entities, relations, and observations.

stdio (local process)Checked 2026-11-03Config checked

Quick facts

Transport
stdio (local process)
Runs as
npx (@modelcontextprotocol/server-memory)
Review state
Config checked against the official source on 2026-11-03; not locally tested by AgentsUse.

What it does

The memory server gives a model a persistent, local knowledge graph so it can remember information about the user across chats. The graph has three concepts. An entity is a node with a unique name, an entity type such as person, organization or event, and a list of observations. A relation is a directed connection between two entities, stored in active voice. An observation is a discrete fact stored as a string and attached to one entity, which the README says should be atomic, one fact per observation.

Nine tools make up the API. create_entities takes an array of objects with name, entityType and observations. It ignores entities whose name already exists, including repeats within the same call, and the observations of skipped entities are not added; the result lists skipped names, and add_observations is the way to extend an existing entity. create_relations takes from, to and relationType, skips duplicates, and fails if either entity does not exist. add_observations takes entityName and contents and fails if the entity does not exist. The three delete tools remove entities (cascading to their relations), specific observations, or specific relations, and do not error on missing items: delete_entities reports which names were not found, and the other two report how many were deleted.

Reading comes in three forms. read_graph returns the whole graph, entities and relations. search_nodes takes a query string and matches entity names, entity types and observation content, returning matching entities and their relations. open_nodes takes an array of names and returns those entities plus the relations between them, silently skipping names that do not exist. A resource, memory://knowledge-graph with MIME type application/json, returns the same shape as read_graph, and the mutation tools emit notifications/resources/updated for that URI so a subscribed client sees changes. A 2026-07-28 client subscribes by naming the URI in the resourceSubscriptions of its subscriptions/listen request, and a 2025-era client calls resources/subscribe.

Storage is a JSONL file, memory.jsonl in the server directory by default, and MEMORY_FILE_PATH selects another file. If MEMORY_FILE_PATH is not set and the server directory holds a legacy memory.json but no memory.jsonl, the server renames it at startup. If that rename fails, the server exits with an error naming both paths and the cause rather than starting on an empty graph; fix the cause, such as a permission problem, and restart, or set MEMORY_FILE_PATH.

Sharing one file between clients is supported with a lock. Each client starts its own server process, so two clients on the same file are two processes writing it. Every write tool takes an exclusive lock file, the memory file path plus .lock, while it reads, changes and saves the graph, so writes take turns. A lock left by a crashed process is removed once its process is known to have exited on the same machine, or after 30 seconds without a refresh (a live holder refreshes every 15 seconds). A write that cannot get the lock within 60 seconds fails with a tool error rather than overwriting the file. The README warns that this relies on exclusive file creation, which a network filesystem may not honour. The server needs Node.js 24 or later, serves both protocol eras on stdio, and also runs from Docker with a mounted volume.

Configuration

Run with npx -y @modelcontextprotocol/server-memory. Set MEMORY_FILE_PATH to choose the storage file.

MCP config (placeholders)
{
  "mcpServers": {
    "memory": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-memory"],
      "env": {"MEMORY_FILE_PATH": "/path/to/custom/memory.jsonl"}
    }
  }
}

Source: https://github.com/modelcontextprotocol/servers/tree/main/src/memory. Placeholders only. Replace them in your own environment, and never commit real keys to a repository.

Environment variableRequiredPurpose
MEMORY_FILE_PATHOptionalPath to the JSONL storage file. Defaults to memory.jsonl in the server directory.

Tools and features on record

  • create_entities Config checked

    Creates entities from objects with name, entityType and observations. Existing names (and repeats in one call) are skipped and their observations are not added. The result lists skipped names.

  • create_relations Config checked

    Creates directed relations from objects with from, to and relationType (active voice). Skips duplicates and fails if either entity does not exist.

  • add_observations Config checked

    Adds strings to existing entities from objects with entityName and contents. Returns what was added per entity and fails if the entity does not exist.

  • delete_entities, delete_observations and delete_relations Config checked

    Remove entities (cascading to their relations), listed observations, or listed relations. Missing items are not errors; the response says what was not found or how many were deleted.

  • read_graph Config checked

    Returns the whole graph, all entities and relations. No input.

  • search_nodes Config checked

    Takes a query string and matches entity names, entity types and observation text, returning matching entities and their relations.

  • open_nodes Config checked

    Takes an array of names and returns those entities and the relations between them. Silently skips names that do not exist.

  • knowledge-graph resource Config checked

    memory://knowledge-graph, application/json, same shape as read_graph. Mutation tools emit notifications/resources/updated for subscribed clients.

  • Shared file locking Config checked

    Write tools take an exclusive <memory file>.lock. Stale locks clear after the holder exits or after 30 seconds without a refresh. A write that waits 60 seconds fails with a tool error.

Security notes

Security notes
  • Everything the model saves is stored in plain text in a JSONL file, memory.jsonl by default. Anyone or any process with read access to that file can read what the model saved, so choose a private MEMORY_FILE_PATH and set file permissions accordingly.
  • The model decides what to store. Observations are free text, so personal details a user mentions can end up on disk. The README suggests a system prompt to shape how often and what kinds of memories are created; review that prompt before using the server for anything sensitive.
  • Delete tools can remove entities, observations and relations, and deleting an entity cascades to its relations. There is no undo in the README, so back up the file if the memory matters.
  • search_nodes, open_nodes and read_graph return stored text back into the model context. Anything saved earlier, including text that came from untrusted pages, is read back as context in later chats.
  • If several clients share one file, writes are serialized by a lock file next to it. A network filesystem that does not honour exclusive file creation cannot be shared safely this way, according to the README.
  • A failed legacy rename at startup stops the server with an error instead of starting on an empty graph. Treat that as a signal to fix permissions, not to delete the file.
  • The server describes no network access and no credentials. Its reach is the one memory file and the process it runs in.

An MCP server runs with the permissions of the process you start it from. Scope credentials to the narrowest access the job needs, and review what the client will send before connecting anything sensitive.

Sources and freshness

Checked 2026-11-03. Config-checked means the configuration and feature list trace to the official source above; it does not mean AgentsUse ran the server. Send corrections through the contact page. Back to the MCP server index.