mcp-knowledge-graph
mcp-knowledge-graph
Knowledge Graph Memory Server
Eine verbesserte Implementierung des persistenten Speichers mithilfe eines lokalen Wissensgraphen mit einem anpassbaren --memory-path .
Dadurch können sich KI-Modelle Informationen über den Benutzer über Chats hinweg merken. Es funktioniert mit jedem KI-Modell, das das Model Context Protocol (MCP) oder Funktionsaufruffunktionen unterstützt.
[!NOTE] Dies ist ein Fork des ursprünglichen Memory Servers und soll nicht die flüchtige Speicher-npx-Installationsmethode verwenden.
Servername
mcp-knowledge-graph

Related MCP server: Knowledge Graph Memory Server
Kernkonzepte
Entitäten
Entitäten sind die primären Knoten im Wissensgraphen. Jede Entität verfügt über:
Ein eindeutiger Name (Kennung)
Ein Entitätstyp (z. B. „Person“, „Organisation“, „Ereignis“)
Eine Liste von Beobachtungen
Beispiel:
{
"name": "John_Smith",
"entityType": "person",
"observations": ["Speaks fluent Spanish"]
}Beziehungen
Relationen definieren gerichtete Verbindungen zwischen Entitäten. Sie werden immer im Aktiv ausgedrückt und beschreiben, wie Entitäten miteinander interagieren oder in Beziehung zueinander stehen.
Beispiel:
{
"from": "John_Smith",
"to": "ExampleCorp",
"relationType": "works_at"
}Beobachtungen
Beobachtungen sind diskrete Informationen über eine Entität. Sie sind:
Als Zeichenfolgen gespeichert
An bestimmte Entitäten angehängt
Kann unabhängig hinzugefügt oder entfernt werden
Sollte atomar sein (eine Tatsache pro Beobachtung)
Beispiel:
{
"entityName": "John_Smith",
"observations": [
"Speaks fluent Spanish",
"Graduated in 2019",
"Prefers morning meetings"
]
}API
Werkzeuge
Entitäten erstellen
Erstellen Sie mehrere neue Entitäten im Wissensgraphen
Eingabe:
entities(Array von Objekten)Jedes Objekt enthält:
name(Zeichenfolge): EntitätskennungentityType(Zeichenfolge): Typklassifizierungobservations(Zeichenfolge[]): Zugehörige Beobachtungen
Ignoriert Entitäten mit vorhandenen Namen
Beziehungen erstellen
Erstellen Sie mehrere neue Beziehungen zwischen Entitäten
Eingabe:
relations(Array von Objekten)Jedes Objekt enthält:
from(Zeichenfolge): Name der Quell-Entitätto(Zeichenfolge): Name der ZielentitätrelationType(Zeichenfolge): Beziehungstyp im Aktiv
Überspringt doppelte Beziehungen
Beobachtungen hinzufügen
Hinzufügen neuer Beobachtungen zu vorhandenen Entitäten
Eingabe:
observations(Array von Objekten)Jedes Objekt enthält:
entityName(Zeichenfolge): Zielentitätcontents(Zeichenfolge[]): Neue hinzuzufügende Beobachtungen
Gibt hinzugefügte Beobachtungen pro Entität zurück
Schlägt fehl, wenn die Entität nicht existiert
Entitäten löschen
Entfernen von Entitäten und ihren Beziehungen
Eingabe:
entityNames(string[])Kaskadierendes Löschen von zugehörigen Relationen
Stiller Vorgang, wenn die Entität nicht existiert
Beobachtungen löschen
Entfernen Sie bestimmte Beobachtungen von Entitäten
Eingabe:
deletions(Array von Objekten)Jedes Objekt enthält:
entityName(Zeichenfolge): Zielentitätobservations(Zeichenfolge[]): Zu entfernende Beobachtungen
Leiser Betrieb, wenn keine Beobachtung vorhanden ist
delete_relations
Entfernen Sie bestimmte Beziehungen aus dem Diagramm
Eingabe:
relations(Array von Objekten)Jedes Objekt enthält:
from(Zeichenfolge): Name der Quell-Entitätto(Zeichenfolge): Name der ZielentitätrelationType(Zeichenfolge): Beziehungstyp
Stiller Vorgang, wenn keine Beziehung besteht
Diagramm lesen
Lesen Sie den gesamten Wissensgraphen
Keine Eingabe erforderlich
Gibt die vollständige Graphstruktur mit allen Entitäten und Beziehungen zurück
Suchknoten
Suche nach Knoten basierend auf der Abfrage
Eingabe:
query(Zeichenfolge)Sucht in:
Entitätsnamen
Entitätstypen
Beobachtungsinhalt
Gibt übereinstimmende Entitäten und ihre Beziehungen zurück
offene_Knoten
Abrufen bestimmter Knoten nach Namen
Eingabe:
names(Zeichenfolge[])Widerrufsfolgen:
Angeforderte Entitäten
Beziehungen zwischen angefragten Entitäten
Überspringt stillschweigend nicht vorhandene Knoten
Verwendung mit MCP-kompatiblen Plattformen
Dieser Server kann mit jeder KI-Plattform verwendet werden, die das Model Context Protocol (MCP) oder Funktionsaufruffunktionen unterstützt, darunter Claude, GPT, Llama und andere.
Einrichtung mit Claude Desktop
Fügen Sie dies zu Ihrer claude_desktop_config.json hinzu:
{
"mcpServers": {
"memory": {
"command": "npx",
"args": [
"-y",
"mcp-knowledge-graph",
"--memory-path",
"/Users/shaneholloman/Dropbox/shane/db/memory.jsonl"
],
"autoapprove": [
"create_entities",
"create_relations",
"add_observations",
"delete_entities",
"delete_observations",
"delete_relations",
"read_graph",
"search_nodes",
"open_nodes"
]
},
}
}Einrichtung mit anderen KI-Plattformen
Jede KI-Plattform, die Funktionsaufrufe oder den MCP-Standard unterstützt, kann sich mit diesem Server verbinden. Die spezifische Konfiguration hängt von der Plattform ab, der Server stellt jedoch Standardtools über die MCP-Schnittstelle bereit.
Benutzerdefinierter Speicherpfad
Sie können einen benutzerdefinierten Pfad für die Speicherdatei angeben:
{
"mcpServers": {
"memory": {
"command": "npx",
"args": [
"-y",
"mcp-knowledge-graph",
"--memory-path",
"/Users/shaneholloman/Dropbox/shane/db/memory.jsonl"
],
"autoapprove": [
"create_entities",
"create_relations",
"add_observations",
"delete_entities",
"delete_observations",
"delete_relations",
"read_graph",
"search_nodes",
"open_nodes"
]
},
}
}Wenn kein Pfad angegeben ist, wird standardmäßig memory.jsonl im Installationsverzeichnis des Servers verwendet.
Systemaufforderung
Die Eingabeaufforderung zur Speichernutzung hängt vom Anwendungsfall und dem verwendeten KI-Modell ab. Durch Ändern der Eingabeaufforderung kann das Modell die Häufigkeit und Art der erstellten Speicher bestimmen.
Hier ist ein Beispiel für eine Chat-Personalisierungsaufforderung, die für jedes KI-Modell angepasst werden kann. Claude-Nutzer können diese Aufforderung im Feld „Benutzerdefinierte Anweisungen“ eines Claude.ai-Projekts verwenden. Für andere Modelle passen Sie sie an die jeweiligen Anweisungsformate an.
Follow these steps for each interaction:
1. User Identification:
- You should assume that you are interacting with default_user
- If you have not identified default_user, proactively try to do so.
2. Memory Retrieval:
- Always begin your chat by saying only "Remembering..." and retrieve all relevant information from your knowledge graph
- Always refer to your knowledge graph as your "memory"
3. Memory Gathering:
- While conversing with the user, be attentive to any new information that falls into these categories:
a) Basic Identity (age, gender, location, job title, education level, etc.)
b) Behaviors (interests, habits, etc.)
c) Preferences (communication style, preferred language, etc.)
d) Goals (goals, targets, aspirations, etc.)
e) Relationships (personal and professional relationships up to 3 degrees of separation)
4. Memory Update:
- If any new information was gathered during the interaction, update your memory as follows:
a) Create entities for recurring organizations, people, and significant events
b) Connect them to the current entities using relations
c) Store facts about them as observationsIntegration mit anderen KI-Modellen
Dieser Server implementiert den Model Context Protocol (MCP)-Standard und ist daher mit jedem KI-Modell kompatibel, das Funktionsaufrufe unterstützt. Die Wissensgraphstruktur und die API sind modellunabhängig und ermöglichen eine flexible Integration in verschiedene KI-Plattformen.
So integrieren Sie es mit anderen Modellen:
Konfigurieren Sie das Modell für den Zugriff auf den MCP-Server
Stellen Sie sicher, dass das Modell Funktionsaufrufe an die bereitgestellten Tools durchführen kann
Passen Sie die Systemeingabeaufforderung an das Anweisungsformat des jeweiligen Modells an
Verwenden Sie unabhängig vom Modell dieselben Wissensgraph-Operationen
Lizenz
Dieser MCP-Server ist unter der MIT-Lizenz lizenziert. Das bedeutet, dass Sie die Software unter den Bedingungen der MIT-Lizenz frei verwenden, ändern und verbreiten dürfen. Weitere Informationen finden Sie in der LICENSE-Datei im Projekt-Repository.
Available Tools
10 toolsaim_memory_add_factsA
Add new facts to an existing memory. Use this to append information to something already stored.
IMPORTANT: Memory must already exist - use aim_memory_store first. Throws error if not found.
RETURNS: Array of {entityName, addedObservations} showing what was added (duplicates are ignored).
DATABASE: Adds to entities in the specified 'context' database, or master database if not specified.
EXAMPLES:
aim_memory_add_facts({observations: [{entityName: "John", contents: ["Lives in Seattle", "Works in tech"]}]})
aim_memory_add_facts({context: "work", observations: [{entityName: "Q4_Project", contents: ["Behind schedule", "Need more resources"]}]})
Inputs: observations (required), context, location.
aim_memory_forgetA
Forget memories. Removes memories and their associated links.
DATABASE SELECTION: Entities are deleted from the specified database's knowledge graph.
LOCATION OVERRIDE: Use the 'location' parameter to force deletion from 'project' (.aim directory) or 'global' (configured directory). Leave blank for auto-detection.
EXAMPLES:
Master database (default): aim_memory_forget({entityNames: ["OldProject"]})
Work database: aim_memory_forget({context: "work", entityNames: ["CompletedTask", "CancelledMeeting"]})
Master database in global location: aim_memory_forget({location: "global", entityNames: ["OldProject"]})
Personal database in project location: aim_memory_forget({context: "personal", location: "project", entityNames: ["ExpiredReminder"]})
Inputs: entityNames (required), context, location.
aim_memory_getA
Retrieve specific memories by exact name. Use this when you know exactly what you're looking for.
VS aim_memory_search: Use aim_memory_get for exact name lookup. Use aim_memory_search for fuzzy matching or when you don't know exact names.
RETURNS: Requested entities and relations between them. Non-existent names are silently ignored.
FORMAT OPTIONS:
"json" (default): Structured JSON for programmatic use
"pretty": Human-readable text format
EXAMPLES:
aim_memory_get({names: ["John", "TechConf2024"]}) - JSON format
aim_memory_get({names: ["Shane"], format: "pretty"}) - Human-readable
aim_memory_get({context: "work", names: ["Q4_Project"], format: "pretty"})
Inputs: names (required), context, location, format.
aim_memory_linkA
Link two memories together with a relationship. Use this to connect related information.
RELATION STRUCTURE: Each link has 'from' (subject), 'relationType' (verb), and 'to' (object).
Use active voice verbs: "manages", "works_at", "knows", "attended", "created"
Read as: "from relationType to" (e.g., "Alice manages Q4_Project")
Avoid passive: use "manages" not "is_managed_by"
IMPORTANT: Both 'from' and 'to' entities must already exist in the same database.
RETURNS: Array of created relations (duplicates are ignored).
DATABASE: Relations are created in the specified 'context' database, or master database if not specified.
EXAMPLES:
aim_memory_link({relations: [{from: "John", to: "TechConf2024", relationType: "attended"}]})
aim_memory_link({context: "work", relations: [{from: "Alice", to: "Q4_Project", relationType: "manages"}]})
Multiple: aim_memory_link({relations: [{from: "John", to: "Alice", relationType: "knows"}, {from: "John", to: "Acme_Corp", relationType: "works_at"}]})
Inputs: relations (required), context, location.
aim_memory_list_storesA
List all available memory databases and show current storage location.
DATABASE TYPES:
"default": The master database (memory.jsonl) - used when no context is specified
Named databases: Created via context parameter (e.g., "work" -> memory-work.jsonl)
RETURNS: {project_databases: [...], global_databases: [...], current_location: "..."}
project_databases: Databases in .aim directory (if project detected)
global_databases: Databases in global --memory-path directory
current_location: Where operations will default to
Use this to discover what databases exist before querying them.
EXAMPLES:
aim_memory_list_stores() - Shows all available databases and current storage location
Inputs: no named parameters.
aim_memory_read_allA
Read all memories in a database. Returns every stored memory and their links.
FORMAT OPTIONS:
"json" (default): Structured JSON for programmatic use
"pretty": Human-readable text format
DATABASE: Reads from the specified 'context' database, or master database if not specified.
EXAMPLES:
aim_memory_read_all({}) - JSON format
aim_memory_read_all({format: "pretty"}) - Human-readable
aim_memory_read_all({context: "work", format: "pretty"}) - Work database, pretty
Inputs: context, location, format.
aim_memory_remove_factsA
Remove specific facts from a memory. Keeps the memory but removes selected observations.
DATABASE SELECTION: Observations are deleted from entities within the specified database's knowledge graph.
LOCATION OVERRIDE: Use the 'location' parameter to force deletion from 'project' (.aim directory) or 'global' (configured directory). Leave blank for auto-detection.
EXAMPLES:
Master database (default): aim_memory_remove_facts({deletions: [{entityName: "John", observations: ["Outdated info"]}]})
Work database: aim_memory_remove_facts({context: "work", deletions: [{entityName: "Project", observations: ["Old deadline"]}]})
Master database in global location: aim_memory_remove_facts({location: "global", deletions: [{entityName: "John", observations: ["Outdated info"]}]})
Health database in project location: aim_memory_remove_facts({context: "health", location: "project", deletions: [{entityName: "Exercise", observations: ["Injured knee"]}]})
Inputs: deletions (required), context, location.
aim_memory_searchA
Search memories by keyword. Use this when you don't know the exact name of what you're looking for.
WHAT IT SEARCHES: Matches query (case-insensitive) against:
Memory names (e.g., "John" matches "John_Smith")
Memory types (e.g., "person" matches all person memories)
Facts/observations (e.g., "Seattle" matches memories mentioning Seattle)
VS aim_memory_get: Use aim_memory_search for fuzzy matching. Use aim_memory_get when you know exact names.
FORMAT OPTIONS:
"json" (default): Structured JSON for programmatic use
"pretty": Human-readable text format
EXAMPLES:
aim_memory_search({query: "John"}) - JSON format
aim_memory_search({query: "project", format: "pretty"}) - Human-readable
aim_memory_search({context: "work", query: "Shane", format: "pretty"})
Inputs: query (required), context, location, format.
aim_memory_storeA
Store new memories. Use this to remember people, projects, concepts, or any information worth persisting.
AIM (AI Memory) provides persistent memory for AI assistants. The 'aim_memory_' prefix groups all memory tools together.
WHAT'S STORED: Memories have a name, type (person/project/concept/etc.), and observations (facts about them).
DATABASES: Use the 'context' parameter to organize memories into separate graphs:
Leave blank: Uses the master database (default for general information)
Any name: Creates/uses a named database ('work', 'personal', 'health', 'research', etc.)
New databases are created automatically - no setup required
IMPORTANT: Use consistent, simple names - prefer 'work' over 'work-stuff'
STORAGE LOCATIONS: Files are stored as JSONL (e.g., memory.jsonl, memory-work.jsonl):
Project-local: .aim directory in project root (auto-detected if exists)
Global: User's configured --memory-path directory
Use 'location' parameter to override: 'project' or 'global'
RETURNS: Array of created entities.
EXAMPLES:
Master database (default): aim_memory_store({entities: [{name: "John", entityType: "person", observations: ["Met at conference"]}]})
Work database: aim_memory_store({context: "work", entities: [{name: "Q4_Project", entityType: "project", observations: ["Due December 2024"]}]})
Master database in global location: aim_memory_store({location: "global", entities: [{name: "John", entityType: "person", observations: ["Met at conference"]}]})
Work database in project location: aim_memory_store({context: "work", location: "project", entities: [{name: "Q4_Project", entityType: "project", observations: ["Due December 2024"]}]})
Inputs: entities (required), context, location.
aim_memory_unlinkA
Remove links between memories. Keeps the memories but removes their connections.
DATABASE SELECTION: Relations are deleted from the specified database's knowledge graph.
LOCATION OVERRIDE: Use the 'location' parameter to force deletion from 'project' (.aim directory) or 'global' (configured directory). Leave blank for auto-detection.
EXAMPLES:
Master database (default): aim_memory_unlink({relations: [{from: "John", to: "OldCompany", relationType: "worked_at"}]})
Work database: aim_memory_unlink({context: "work", relations: [{from: "Alice", to: "CancelledProject", relationType: "manages"}]})
Master database in global location: aim_memory_unlink({location: "global", relations: [{from: "John", to: "OldCompany", relationType: "worked_at"}]})
Personal database in project location: aim_memory_unlink({context: "personal", location: "project", relations: [{from: "Me", to: "OldHobby", relationType: "enjoys"}]})
Inputs: relations (required), context, location.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Each tool has a distinct action—store, retrieve, search, list, link, unlink, etc.—with no overlapping purposes. The descriptions clearly differentiate similar tools like get vs search and read_all vs list_stores.
All tools use the consistent prefix 'aim_memory_' followed by a clear snake_case action verb (store, add_facts, get, search, read_all, list_stores, forget, remove_facts, link, unlink). No mixing of styles.
10 tools cover the essential operations for a knowledge graph memory system—CRUD for entities and relations, plus search and listing. This is well-scoped without being excessive or sparse.
The tool set covers creation, retrieval, search, listing, linking, and deletion of entities and facts. Missing is a direct update for entity names or types (requires forget+re-store), but this is a minor gap given the add/remove facts functionality.
Maintenance
Related MCP Connectors
Persistent, outcome-grounded episodic memory for Claude. 14ms CPU retrieval, no GPU, no vector DB.
Persistent memory for AI assistants: store, search, and connect knowledge across conversations.
Persistent memory for Claude Code and Cursor. Stop re-explaining your project every session.
Your own memory inside ChatGPT and Claude, with the source of every note.
Related MCP Servers
- FlicenseAqualityBmaintenanceA basic implementation of persistent memory using a local knowledge graph. This lets Claude remember information about the user across chats.9340,089 npm92,139-
- AlicenseBqualityFmaintenanceA persistent memory implementation using a local knowledge graph that lets Claude remember information about users across conversations.96MIT
- AlicenseAqualityNot gradedmaintenanceAn implementation of persistent memory for Claude using a local knowledge graph, allowing the AI to remember information about users across conversations with customizable storage location.1162JavaScriptMIT
- AlicenseNot gradedqualityDmaintenanceEnables Claude to remember information about users across chats using a persistent local knowledge graph that stores entities, relationships, and observations.MIT