MCP DuckDB Knowledge Graph Memory Server

Integrations

  • Supports containerized deployment through Docker, allowing the memory server to be run in isolated containers with appropriate build and run commands.

  • Uses DuckDB as the backend database for storing knowledge graph data, leveraging its fast query processing, SQL interface, and transaction support for efficient storage and retrieval of entities, observations, and relations.

MCP DuckDB ナレッジグラフ メモリサーバー

公式 Knowledge Graph Memory Serverのフォーク バージョンです。

インストール

Smithery経由でインストール

Smithery経由で Claude Desktop 用の DuckDB Knowledge Graph Memory Server を自動的にインストールするには:

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

手動インストール

それ以外の場合は、 claude_desktop_config.json@IzumiSy/mcp-duckdb-memory-serverを手動で追加します ( MEMORY_FILE_PATHはオプションです)

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

そのパスに保存されるデータは、DuckDB データベース ファイルです。

ドッカー

建てる

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

走る

docker run -dit mcp-duckdb-graph-memory

使用法

以下の例の指示を使用してください

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

モチベーション

このプロジェクトでは、バックエンドを DuckDB に置き換えることで、元の MCP ナレッジ グラフ メモリ サーバーを強化します。

なぜ DuckDB なのか?

従来のMCP Knowledge Graph Memory Serverは、JSONファイルをデータストアとして使用し、インメモリ検索を実行していました。このアプローチは小規模なデータセットには適していますが、いくつかの課題があります。

  1. パフォーマンス: データセットが大きくなるにつれて、メモリ内検索のパフォーマンスは低下します。
  2. スケーラビリティ: 多数のエンティティとリレーションを処理する場合、メモリ使用量が大幅に増加します。
  3. クエリの柔軟性: 複雑なクエリや条件付き検索は実装が難しい
  4. データ整合性: トランザクションとCRUD操作のアトミック性を保証することは困難です

DuckDB は次のような課題に対処するために選択されました。

  • 高速クエリ処理: DuckDBは分析クエリに最適化されており、大規模なデータセットでも優れたパフォーマンスを発揮します。
  • SQLインターフェース: 標準SQLを使用して複雑なクエリを簡単に実行できます
  • トランザクションサポート: データの整合性を維持するためのトランザクション処理をサポートします
  • インデックス機能: 検索パフォーマンスを向上させるためのインデックスの作成を可能にします
  • 組み込みデータベース: 外部データベースサーバーを必要とせずにアプリケーション内で動作します

実装の詳細

この実装では、バックエンド ストレージ システムとして DuckDB を使用し、次の 2 つの重要な側面に重点を置いています。

データベース構造

ナレッジ グラフは、次に示すようにリレーショナル データベース構造に保存されます。

このスキーマ設計により、エンティティ、観察、関係間の関係を維持しながら、ナレッジ グラフ コンポーネントを効率的に保存および取得できるようになります。

あいまい検索の実装

この実装では、SQL クエリと Fuse.js を組み合わせて、柔軟なエンティティ検索を実現します。

  • DuckDB SQLクエリはデータベースから基本データを取得します
  • Fuse.jsは取得したデータにあいまい一致機能を提供する
  • このハイブリッドアプローチは、構造化されたクエリと柔軟なテキストマッチングの両方を可能にします。
  • 検索結果には完全一致と部分一致の両方が含まれ、関連性に基づいてランク付けされます。

発達

設定

pnpm install

テスト

pnpm test

ライセンス

このプロジェクトは MIT ライセンスに基づいてライセンスされています - 詳細についてはLICENSEファイルを参照してください。

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

Claude のメモリ サーバーは、DuckDB にナレッジ グラフ データを保存および取得し、永続的なユーザー情報との会話のパフォーマンスとクエリ機能を強化します。

  1. Installation
    1. Installing via Smithery
    2. Manual install
    3. Docker
  2. Usage
    1. Motivation
      1. Why DuckDB?
    2. Implementation Details
      1. Database Structure
      2. Fuzzy Search Implementation
    3. Development
      1. Setup
      2. Testing
    4. License

      Related MCP Servers

      • A
        security
        A
        license
        A
        quality
        An improved implementation of persistent memory using a local knowledge graph with a customizable --memory-path. This lets Claude remember information about the user across chats.
        Last updated -
        9
        32
        144
        JavaScript
        MIT License
        • Apple
      • -
        security
        A
        license
        -
        quality
        A basic implementation of persistent memory using a local knowledge graph. This lets Claude remember information about the user across chats.
        Last updated -
        9
        7,903
        42,550
        JavaScript
        MIT License
        • Apple
        • Linux
      • A
        security
        F
        license
        A
        quality
        This MCP server provides persistent memory integration for chat applications by utilizing a local knowledge graph to remember user information across interactions.
        Last updated -
        9
        7,903
        1
        JavaScript
      • -
        security
        A
        license
        -
        quality
        A persistent memory implementation using a local knowledge graph that lets Claude remember information about users across conversations.
        Last updated -
        4
        Python
        MIT License

      View all related MCP servers

      ID: 4mqwh1toao