Skip to main content
Glama
MCP DuckDB Knowledge Graph Memory Server

MCP DuckDB Knowledge Graph Memory Server

by IzumiSy

MCP DuckDB Knowledge Graph Memory Server

Prüfen Schmiedeabzeichen NPM-VersionNPM-Lizenz

Eine gegabelte Version des offiziellen Knowledge Graph Memory Server .

Installation

Installation über Smithery

So installieren Sie den DuckDB Knowledge Graph Memory Server für Claude Desktop automatisch über Smithery :

npx -y @smithery/cli install @IzumiSy/mcp-duckdb-memory-server --client claude

Manuelle Installation

Andernfalls fügen Sie @IzumiSy/mcp-duckdb-memory-server manuell in Ihre claude_desktop_config.json ein ( MEMORY_FILE_PATH ist optional).

{
  "mcpServers": {
    "graph-memory": {
      "command": "npx",
      "args": [
        "-y",
        "@izumisy/mcp-duckdb-memory-server"
      ],
      "env": {
        "MEMORY_FILE_PATH": "/path/to/your/memory.data"
      }
    }
  }
}

Die auf diesem Pfad gespeicherten Daten sind eine DuckDB-Datenbankdatei.

Docker

Bauen

docker build -t mcp-duckdb-graph-memory .

Laufen

docker run -dit mcp-duckdb-graph-memory

Related MCP server: Knowledge Graph Memory Server

Verwendung

Verwenden Sie die Beispielanweisung unten

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 search relevant information from your knowledge graph
   - Create a search query from user words, and search things from "memory". If nothing matches, try to break down words in the query at first ("A B" to "A" and "B" for example).
   - Always refer to your knowledge graph as your "memory"

3. Memory
   - 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
     b) Store facts about them as observations

Motivation

Dieses Projekt erweitert den ursprünglichen MCP Knowledge Graph Memory Server, indem sein Backend durch DuckDB ersetzt wird.

Warum DuckDB?

Der ursprüngliche MCP Knowledge Graph Memory Server verwendete eine JSON-Datei als Datenspeicher und führte In-Memory-Suchen durch. Dieser Ansatz eignet sich zwar gut für kleine Datensätze, bringt aber einige Herausforderungen mit sich:

  1. Leistung : Die Leistung der In-Memory-Suche nimmt mit zunehmendem Datensatz ab

  2. Skalierbarkeit : Der Speicherverbrauch steigt erheblich, wenn eine große Anzahl von Entitäten und Beziehungen verarbeitet wird

  3. Abfrageflexibilität : Komplexe Abfragen und bedingte Suchen sind schwierig zu implementieren

  4. Datenintegrität : Die Gewährleistung der Atomizität von Transaktionen und CRUD-Operationen ist eine Herausforderung

DuckDB wurde ausgewählt, um diese Herausforderungen zu bewältigen:

  • Schnelle Abfrageverarbeitung : DuckDB ist für analytische Abfragen optimiert und bietet auch bei großen Datensätzen eine gute Leistung

  • SQL-Schnittstelle : Mit Standard-SQL können komplexe Abfragen einfach ausgeführt werden

  • Transaktionsunterstützung : Unterstützt die Transaktionsverarbeitung, um die Datenintegrität aufrechtzuerhalten

  • Indizierungsfunktionen : Ermöglicht die Erstellung von Indizes zur Verbesserung der Suchleistung

  • Eingebettete Datenbank : Funktioniert innerhalb der Anwendung, ohne dass ein externer Datenbankserver erforderlich ist

Implementierungsdetails

Diese Implementierung verwendet DuckDB als Backend-Speichersystem und konzentriert sich auf zwei Schlüsselaspekte:

Datenbankstruktur

Der Wissensgraph wird in einer relationalen Datenbankstruktur gespeichert, wie unten dargestellt:

erDiagram
    ENTITIES {
        string name PK
        string entityType
    }
    OBSERVATIONS {
        string entityName FK
        string content
    }
    RELATIONS {
        string from_entity FK
        string to_entity FK
        string relationType
    }

    ENTITIES ||--o{ OBSERVATIONS : "has"
    ENTITIES ||--o{ RELATIONS : "from"
    ENTITIES ||--o{ RELATIONS : "to"

Dieses Schemadesign ermöglicht die effiziente Speicherung und Abfrage von Wissensgraphkomponenten, während die Beziehungen zwischen Entitäten, Beobachtungen und Relationen erhalten bleiben.

Implementierung der Fuzzy-Suche

Die Implementierung kombiniert SQL-Abfragen mit Fuse.js für eine flexible Entitätssuche:

  • DuckDB SQL-Abfragen rufen die Basisdaten aus der Datenbank ab

  • Fuse.js bietet Fuzzy-Matching-Funktionen zusätzlich zu den abgerufenen Daten

  • Dieser hybride Ansatz ermöglicht sowohl strukturierte Abfragen als auch flexibles Textmatching

  • Die Suchergebnisse umfassen sowohl exakte als auch teilweise Übereinstimmungen, sortiert nach Relevanz

Entwicklung

Aufstellen

pnpm install

Testen

pnpm test

Lizenz

Dieses Projekt ist unter der MIT-Lizenz lizenziert – Einzelheiten finden Sie in der Datei LICENSE .

Available Tools

8 tools
add_observationsC

Add new observations to existing entities in the knowledge graph

Inputs: observations (required).

create_entitiesC

Create multiple new entities in the knowledge graph

Inputs: entities (required).

create_relationsC

Create multiple new relations between entities in the knowledge graph. Relations should be in active voice

Inputs: relations (required).

delete_entitiesC

Delete multiple entities and their associated relations from the knowledge graph

Inputs: entityNames (required).

delete_observationsC

Delete specific observations from entities in the knowledge graph

Inputs: deletions (required).

delete_relationsC

Delete multiple relations from the knowledge graph

Inputs: relations (required).

open_nodesC

Open specific nodes in the knowledge graph by their names

Inputs: names (required).

search_nodesC

Search for nodes in the knowledge graph based on a query

Inputs: query (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 8 tools

    Disambiguation4/5

    Most tools have distinct purposes targeting different aspects of the knowledge graph (entities, relations, observations, nodes), though 'open_nodes' and 'search_nodes' could potentially overlap in functionality if opening involves searching. The descriptions clarify that 'open_nodes' accesses specific named nodes while 'search_nodes' performs query-based lookup, but agents might still confuse them in some scenarios.

    Naming Consistency5/5

    All tools follow a consistent verb_noun pattern with snake_case naming (e.g., add_observations, create_entities, delete_relations). The verbs are clear and appropriate for the actions (add, create, delete, open, search), and there are no deviations in style or convention throughout the set.

    Tool Count5/5

    With 8 tools, this server is well-scoped for a knowledge graph memory system. Each tool appears to serve a specific and necessary function for managing entities, relations, observations, and nodes, without being overly sparse or bloated. The count aligns well with the domain's typical CRUD and query operations.

    Completeness4/5

    The tool set provides strong coverage for core knowledge graph operations, including creation, deletion, and querying of entities, relations, and observations. A minor gap is the lack of update tools (e.g., update_entities or update_relations), which might require workarounds like delete-and-recreate, but the surface is otherwise comprehensive for the stated purpose.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      A persistent memory system using a local knowledge graph that enables Claude to remember information about users across chats, with advanced search, graph traversal, and filtering capabilities for entities, relations, and observations.
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      A persistent memory server for Claude Code that captures session context and tool outputs to inject relevant history into future sessions. It enables long-term recall through semantic search and automatic context management, allowing for more consistent and context-aware coding interactions.
      253
      AGPL 3.0