home / mcp / memory mcp server
Provides a persistent local memory store using a knowledge graph to remember user information across chats.
Configuration
View docs{
"mcpServers": {
"bughide010-smtest": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-memory"
],
"env": {
"MEMORY_FILE_PATH": "/path/to/memory.json"
}
}
}
}The Memory Context Protocol (MCP) Memory Server provides a persistent memory store using a local knowledge graph. It lets you remember details about users and entities across chats, enabling personalized, context-aware interactions. You can create entities, define relationships, and store observations to build a living memory that a client can read and update over time.
You interact with the Memory MCP server from your MCP client just like you would with any other memory service. Start by running the server locally or in a container, then connect your client to it using the available MCP connection methods. Once connected, you can: create entities to represent people, organizations, or places; add observations that describe facts about those entities; and read back the graph to retrieve remembered information before starting a new chat.
Practical usage patterns include building a profile for a user by creating a user entity with observations such as preferences or scheduling habits, linking related organizations via relations, and updating memory as new information becomes available. Use the search and open operations to retrieve relevant nodes before you respond, and use extract_locations to automatically populate location entities from user-provided text.
Prerequisites: ensure you have a runtime capable of running MCP servers, plus either Docker or Node.js with npm/yarn installed on your system.
Option 1: Run via NPX (recommended for quick start) You can start the memory server directly with NPX. This runs without needing a local install.
{
"mcpServers": {
"memory": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-memory"]
}
}
}Option 2: Run via NPX with custom memory file path You can specify where the memory JSON is stored. This is useful if you want to keep memory data in a specific location.
{
"mcpServers": {
"memory": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-memory"],
"env": {
"MEMORY_FILE_PATH": "/path/to/custom/memory.json"
}
}
}
}Option 3: Run via Docker This builds and runs the Memory MCP server inside a container. It uses a named volume to persist memory data.
docker run -i -v claude-memory:/app/dist --rm mcp/memoryIf you use the NPX variant with a custom memory file path, memory will be stored at the path you specify in MEMORY_FILE_PATH. The default location is memory.json in the server directory if you do not provide a custom path.
For Docker usage, memory persistence is managed by the claude-memory Docker volume. If you need to reset the memory, you can remove or recreate the volume, then restart the container.
If you want to build the container image locally, use the Docker build command shown here.
docker build -t mcp/memory -f src/memory/Dockerfile .Memory is modeled as a knowledge graph consisting of entities, relations, and observations. You can create multiple entities, link them with directed relationships, and attach atomic observations to each entity. Use read_graph to inspect the complete graph, and use search_nodes or open_nodes to retrieve specific parts of memory.
Create multiple new entities in the knowledge graph. Each entity must include a name, an entityType, and an array of observations. Existing names are ignored.
Create multiple new relations between entities. Each relation includes a from, to, and relationType. Duplicate relations are skipped.
Add new observations to existing entities. Returns added observations per entity; fails if the target entity does not exist.
Remove entities and their relations from the graph. Performs cascading deletion of associated relations and operates silently if the entity does not exist.
Remove specific observations from entities. Silent if observations do not exist.
Remove specific relations from the graph. Silent if the relation does not exist.
Retrieve the entire knowledge graph, including all entities and relations, with no input required.
Search the graph for nodes matching a query across entity names, types, and observation content. Returns matching entities and their relations.
Retrieve specific nodes by name, including the relations between the requested entities. Non-existent nodes are skipped silently.
Extract and add location entities from text, creating location nodes and geographic hierarchy relationships (city → state → country). Returns created entities and relations.