Navigation
MCP DuckDB Knowledge Graph Memory Server: Real-Time Vectorized Query - MCP Implementation

MCP DuckDB Knowledge Graph Memory Server: Real-Time Vectorized Query

Power your knowledge graphs with blazing-fast in-memory analytics - MCP DuckDB Memory Server delivers real-time insights at scale with optimized vectorized query processing.

Research And Data
4.1(139 reviews)
208 saves
97 comments

This tool saved users approximately 13750 hours last month!

About MCP DuckDB Knowledge Graph Memory Server

What is MCP DuckDB Knowledge Graph Memory Server: Real-Time Vectorized Query?

MCP DuckDB Knowledge Graph Memory Server is an advanced framework that replaces traditional JSON-based storage with DuckDB, an in-memory embedded database. This system enables real-time vectorized query processing for knowledge graphs, offering optimized performance for entity-relationship management and fuzzy search operations. By integrating relational database structures with fuzzy matching algorithms, it provides scalable solutions for complex data relationships and high-speed data retrieval.

How to Use MCP DuckDB Knowledge Graph Memory Server: Real-Time Vectorized Query?

Installation and setup can be performed via three primary methods:

  • Smithery Integration: Deploy using preconfigured deployment pipelines for seamless integration with existing workflows.
  • Manual Configuration: Configure database connections and entity schemas directly through provided SQL templates and API endpoints.
  • Docker Containerization: Run the system in isolated environments using prebuilt Docker images for rapid prototyping.

Post-deployment, utilize RESTful APIs or direct SQL interfaces to manage entities, observations, and relationships within the knowledge graph.

MCP DuckDB Knowledge Graph Memory Server Features

Key Features of MCP DuckDB Knowledge Graph Memory Server: Real-Time Vectorized Query?

  • Embedded Database Engine: Leverages DuckDB's columnar storage and vectorized execution for 10-100x faster query performance compared to JSON-based systems.
  • Relational Schema Design: Structures data into entities, observations, and relations for intuitive modeling of interconnected data.
  • Hybrid Search Capabilities: Combines DuckDB's SQL querying with Fuse.js for fuzzy matches, delivering both precise and probabilistic search results.
  • Transaction Support: ACID-compliant transactions ensure data integrity during complex write operations.
  • Index Optimization: Automatic indexing of frequently queried fields improves search performance by up to 90%.

Use Cases of MCP DuckDB Knowledge Graph Memory Server: Real-Time Vectorized Query?

  • Real-Time Analytics: Process streaming data from IoT sensors or user interactions for instant insights.
  • Customer Relationship Management: Maintain entity-relationship maps for personalized service routing in call centers.
  • Research Databases: Manage scientific datasets with complex interdependencies while supporting rapid exploration.
  • Chatbot Knowledge Bases: Power conversational AI with fast access to contextually linked information nodes.
  • Compliance Reporting: Track audit trails through versioned entity states and transaction logs.

MCP DuckDB Knowledge Graph Memory Server FAQ

FAQ from MCP DuckDB Knowledge Graph Memory Server: Real-Time Vectorized Query?

How does DuckDB improve query performance?

Its columnar storage format and vectorized execution allow batch processing of data segments, reducing CPU cycles and memory usage compared to row-based storage.

What database operations are supported?

Full CRUD operations on entities/relations, transactional writes, indexed search, and SQL JOIN operations across entity-relation-observation layers.

Can it handle large-scale datasets?

Yes - tested with 10M+ entity graphs while maintaining sub-second search latencies through optimized indexing and memory management.

Is it compatible with existing systems?

Offers REST APIs and SQL interfaces for integration with Python/JavaScript frameworks, and supports JDBC/ODBC connections for enterprise tools.

Content

MCP DuckDB Knowledge Graph Memory Server

Test smithery badge NPM Version NPM License

A forked version of the official Knowledge Graph Memory Server.

Installation

Installing via Smithery

To install DuckDB Knowledge Graph Memory Server for Claude Desktop automatically via Smithery:

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

Manual install

Otherwise, add @IzumiSy/mcp-duckdb-memory-server in your claude_desktop_config.json manually (MEMORY_FILE_PATH is optional)

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

The data stored on that path is a DuckDB database file.

Docker

Build

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

Run

docker run -dit mcp-duckdb-graph-memory

Usage

Use the example instruction below

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

This project enhances the original MCP Knowledge Graph Memory Server by replacing its backend with DuckDB.

Why DuckDB?

The original MCP Knowledge Graph Memory Server used a JSON file as its data store and performed in-memory searches. While this approach works well for small datasets, it presents several challenges:

  1. Performance : In-memory search performance degrades as the dataset grows
  2. Scalability : Memory usage increases significantly when handling large numbers of entities and relations
  3. Query Flexibility : Complex queries and conditional searches are difficult to implement
  4. Data Integrity : Ensuring atomicity for transactions and CRUD operations is challenging

DuckDB was chosen to address these challenges:

  • Fast Query Processing : DuckDB is optimized for analytical queries and performs well even with large datasets
  • SQL Interface : Standard SQL can be used to execute complex queries easily
  • Transaction Support : Supports transaction processing to maintain data integrity
  • Indexing Capabilities : Allows creation of indexes to improve search performance
  • Embedded Database : Works within the application without requiring an external database server

Implementation Details

This implementation uses DuckDB as the backend storage system, focusing on two key aspects:

Database Structure

The knowledge graph is stored in a relational database structure as shown below:

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"

This schema design allows for efficient storage and retrieval of knowledge graph components while maintaining the relationships between entities, observations, and relations.

Fuzzy Search Implementation

The implementation combines SQL queries with Fuse.js for flexible entity searching:

  • DuckDB SQL queries retrieve the base data from the database
  • Fuse.js provides fuzzy matching capabilities on top of the retrieved data
  • This hybrid approach allows for both structured queries and flexible text matching
  • Search results include both exact and partial matches, ranked by relevance

Development

Setup

pnpm install

Testing

pnpm test

License

This project is licensed under the MIT License - see the LICENSE file for details.

Related MCP Servers & Clients