Knowledge Graph Memory MCP: AI Persistent Memory & Entity Mgmt
Knowledge Graph Memory MCP servers empower AI with persistent memory, entity management, and relation tracking through local knowledge graph interaction.
Knowledge Graph Memory Server
Overview
The MCP Knowledge Graph Memory Server provides AI models with persistent memory capabilities using a local knowledge graph. It enables AI to retain and recall information across conversational turns and sessions, enhancing conversational continuity, personalization, and overall intelligence.
Official Server:
Developed and maintained by Anthropic
Key Features
Persistent Memory
Enables AI models to retain and recall information across sessions
Entity & Relation Management
Create, update, and delete entities and their relationships
Observation Tracking
Store atomic facts and details associated with entities
Graph Search & Retrieval
Efficiently search and retrieve information from the knowledge graph
Available Tools
Quick Reference
| Tool | Purpose | Category |
|---|---|---|
create_entities | Add new entities to the graph | Write |
create_relations | Establish relations between entities | Write |
add_observations | Add observations to entities | Write |
delete_entities | Remove entities and their relations | Write |
delete_observations | Delete specific entity observations | Write |
delete_relations | Remove specific relations | Write |
read_graph | Retrieve the entire knowledge graph | Read |
search_nodes | Search entities by query | Discovery |
open_nodes | Retrieve specific entities by name | Read |
Detailed Usage
Installation
To get started with the Knowledge Graph Memory Server, follow the installation instructions below. The server can be integrated into various environments, including general setups, Claude Desktop, and VS Code.
{
"mcpServers": {
"memory": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-memory",
"--port",
"8000",
"--data-dir",
"./memory-data"
]
}
}
}
Custom Port & Data Directory:
Adjust --port and --data-dir as needed. The --data-dir specifies where your knowledge graph data will be stored persistently.
Common Use Cases
Persistent AI Memory▶
Store and retrieve long-term memories for AI agents, allowing them to retain information across sessions and interactions.
// Example: Storing a new memory about a user interaction
use_mcp_tool({
server_name: "memory",
tool_name: "create_entities",
arguments: {
entities: [
{
name: "User_Query_123",
entityType: "interaction",
observations: ["User asked about product pricing"]
}
]
}
});
// Example: Retrieving past interactions related to a product
use_mcp_tool({
server_name: "memory",
tool_name: "search_nodes",
arguments: {
query: "product pricing interaction"
}
});
Contextual Understanding▶
Enhance AI's ability to understand complex contexts by providing access to a structured knowledge base of entities and their relationships.
// Example: Adding context about a company's hierarchy
use_mcp_tool({
server_name: "memory",
tool_name: "create_entities",
arguments: {
entities: [
{ name: "CEO_Alice", entityType: "person" },
{ name: "CTO_Bob", entityType: "person" },
{ name: "Company_X", entityType: "organization" }
]
}
});
use_mcp_tool({
server_name: "memory",
tool_name: "create_relations",
arguments: {
relations: [
{ from: "CEO_Alice", to: "Company_X", relationType: "leads" },
{ from: "CTO_Bob", to: "Company_X", relationType: "works_at" }
]
}
});
// Example: Querying relationships to understand roles
use_mcp_tool({
server_name: "memory",
tool_name: "read_graph",
arguments: {
query: "relations involving Company_X"
}
});
Personalized Experiences▶
Tailor AI responses and behaviors based on individual user preferences, history, and known facts stored in the knowledge graph.
// Example: Storing user preferences
use_mcp_tool({
server_name: "memory",
tool_name: "create_entities",
arguments: {
entities: [
{
name: "User_Jane",
entityType: "user",
observations: ["Prefers dark mode", "Interested in AI news"]
}
]
}
});
// Example: Retrieving preferences for a personalized response
use_mcp_tool({
server_name: "memory",
tool_name: "open_nodes",
arguments: {
names: ["User_Jane"]
}
});
Dynamic Data Integration▶
Integrate real-time data from various sources into the knowledge graph, allowing AI to access and reason over up-to-date information.
// Example: Adding a new observation from an external API
use_mcp_tool({
server_name: "memory",
tool_name: "add_observations",
arguments: {
observations: [
{
entityName: "Product_A",
contents: ["Current stock: 150 units (updated 5 mins ago)"]
}
]
}
});
// Example: Updating a relation based on a system event
use_mcp_tool({
server_name: "memory",
tool_name: "create_relations",
arguments: {
relations: [
{ from: "Order_XYZ", to: "Product_A", relationType: "contains" }
]
}
});
Sources
Related Articles
Markdown to PDF MCP Server
Markdown to PDF MCP servers enable AI models to convert Markdown documents into PDF files, supporting syntax highlighting, custom styling, and flexible output options.
Seq MCP Server: Real-time Log Analytics for AI Models
Seq MCP servers empower AI models to interact with Seq, a structured log server, for log ingestion, querying, filtering, and real-time analysis.
Datadog MCP Server
Datadog MCP servers enable AI models to interact with Datadog observability: metrics, logs, traces, monitors, dashboards, incidents, and infrastructure insights.