MCP DuckDB Knowledge Graph Memory Server
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
MCP DuckDB Knowledge Graph Memory Server
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:
Manual install
Otherwise, add @IzumiSy/mcp-duckdb-memory-server
in your claude_desktop_config.json
manually (MEMORY_FILE_PATH
is optional)
The data stored on that path is a DuckDB database file.
Docker
Build
Run
Usage
Use the example instruction below
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:
- Performance: In-memory search performance degrades as the dataset grows
- Scalability: Memory usage increases significantly when handling large numbers of entities and relations
- Query Flexibility: Complex queries and conditional searches are difficult to implement
- 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:
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
Testing
License
This project is licensed under the MIT License - see the LICENSE file for details.
You must be authenticated.
A memory server for Claude that stores and retrieves knowledge graph data in DuckDB, enhancing performance and query capabilities for conversations with persistent user information.