The Knowledge Graph Memory Server enables persistent memory management using a local knowledge graph for storing and retrieving information.
Key capabilities:
- Create Entities: Add entities with name, type, observations, and optional subdomain
- Create Relations: Establish directed relationships between existing entities
- Add Observations: Attach new, atomic observations to existing entities
- Delete Entities: Remove entities and their associated relations
- Delete Observations: Remove specific observations from entities
- Delete Relations: Remove specific relationships between entities
- Read Graph: Retrieve the entire knowledge graph structure
- Search Nodes: Find entities using keywords across names, types, subdomains, and observations (using OR logic)
- Open Nodes: Retrieve specific entities by name, including all their details and relations
Implements persistent memory storage using a local knowledge graph to maintain information across different chat sessions, with capabilities for creating, retrieving, and manipulating structured memory data.
forked https://github.com/modelcontextprotocol/servers/tree/main
Knowledge Graph Memory Server
A basic implementation of persistent memory using a local knowledge graph. This lets Claude remember information about the user across chats.
Core Concepts
Entities
Entities are the primary nodes in the knowledge graph. Each entity has:
- A unique name (identifier)
- An entity type (e.g., "person", "organization", "event")
- A list of observations
Example:
Relations
Relations define directed connections between entities. They are always stored in active voice and describe how entities interact or relate to each other.
Example:
Observations
Observations are discrete pieces of information about an entity. They are:
- Stored as strings
- Attached to specific entities
- Can be added or removed independently
- Should be atomic (one fact per observation)
Example:
API
Tools
- create_entities
- Create multiple new entities in the knowledge graph
- Input:
entities
(array of objects)- Each object contains:
name
(string): Entity identifierentityType
(string): Type classificationobservations
(string[]): Associated observations
- Each object contains:
- Ignores entities with existing names
- create_relations
- Create multiple new relations between entities
- Input:
relations
(array of objects)- Each object contains:
from
(string): Source entity nameto
(string): Target entity namerelationType
(string): Relationship type in active voice
- Each object contains:
- Skips duplicate relations
- add_observations
- Add new observations to existing entities
- Input:
observations
(array of objects)- Each object contains:
entityName
(string): Target entitycontents
(string[]): New observations to add
- Each object contains:
- Returns added observations per entity
- Fails if entity doesn't exist
- delete_entities
- Remove entities and their relations
- Input:
entityNames
(string[]) - Cascading deletion of associated relations
- Silent operation if entity doesn't exist
- delete_observations
- Remove specific observations from entities
- Input:
deletions
(array of objects)- Each object contains:
entityName
(string): Target entityobservations
(string[]): Observations to remove
- Each object contains:
- Silent operation if observation doesn't exist
- delete_relations
- Remove specific relations from the graph
- Input:
relations
(array of objects)- Each object contains:
from
(string): Source entity nameto
(string): Target entity namerelationType
(string): Relationship type
- Each object contains:
- Silent operation if relation doesn't exist
- read_graph
- Read the entire knowledge graph
- No input required
- Returns complete graph structure with all entities and relations
- search_nodes
- Search for nodes based on one or more keywords
- Input:
query
(string)- Space-separated keywords (e.g., "budget utility")
- Multiple keywords are treated as OR conditions
- Searches across:
- Entity names
- Entity types
- Subdomains
- Observation content
- Matching behavior:
- Case-insensitive
- Partial word matching
- Any keyword can match any field
- Returns entities matching ANY of the keywords
- Returns matching entities and their relations
- Example queries:
- Single keyword: "budget"
- Multiple keywords: "budget utility"
- With special chars: "budget & utility"
- open_nodes
- Retrieve specific nodes by name
- Input:
names
(string[]) - Returns:
- Requested entities
- Relations between requested entities
- Silently skips non-existent nodes
Usage with Claude Desktop
Setup
Add this to your claude_desktop_config.json:
Docker
NPX
NPX with custom setting
The server can be configured using the following environment variables:
MEMORY_FILE_PATH
: Path to the memory storage JSON file (default:memory.json
in the server directory)
System Prompt
The prompt for utilizing memory depends on the use case. Changing the prompt will help the model determine the frequency and types of memories created.
Here is an example prompt for chat personalization. You could use this prompt in the "Custom Instructions" field of a Claude.ai Project.
Building
Docker:
License
This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Tools
This MCP server provides persistent memory integration for chat applications by utilizing a local knowledge graph to remember user information across interactions.
Related Resources
Related MCP Servers
- AsecurityAlicenseAqualityA customized MCP memory server that enables creation and management of a knowledge graph with features like custom memory paths and timestamping for capturing interactions via language models.Last updated -114JavaScriptMIT License
- -securityFlicense-qualityAn MCP server that allows Claude and other LLMs to manage persistent memories across conversations through text file storage, enabling commands to add, search, delete and list memory entries.Last updated -624TypeScript
- -securityFlicense-qualityMCP server that gives MCP clients (like Cursor, Claude, Windsurf) the ability to remember user information across conversations using vector search technology.Last updated -
- -securityFlicense-qualityA Model Context Protocol (MCP) server that provides persistent memory capabilities using OpenAI's vector stores, allowing AI assistants to save and search through memories across conversations.Last updated -Python