A multi-category knowledge graph memory server using SQLite for persistent storage
Multi-Memory MCP Server
A multi-category knowledge graph memory server using SQLite for persistent storage. Organize memories into isolated contexts for different purposes (work, personal, projects, etc.).
Based on @modelcontextprotocol/server-memory with enhancements:
- SQLite database storage with proper indexing and transactions
- Multi-category support with isolated memory contexts
- LRU connection cache (prevents memory leaks)
- ID-based operations - all objects have unique IDs for precise operations
- Dual identification - use ID or name/type composite key
- Custom properties - JSON properties on entities, observations, and relations (searchable)
- Override mode - update existing records instead of skipping duplicates
- SQL injection protection
- Full test coverage (141 tests)
Quick Start
Run Directly with npx (No Installation Required)
The fastest way to use multi-memory-mcp is to run it directly from GitHub using npx:
npx github:DanNsk/multi-memory-mcp
This will download, build, and run the server automatically. Perfect for trying it out or using in Claude Desktop config:
{
"mcpServers": {
"multi-memory": {
"command": "npx",
"args": ["github:DanNsk/multi-memory-mcp"],
"env": {
"MEMORY_BASE_DIR": "/path/to/.memory",
"DEFAULT_CATEGORY": "default"
}
}
}
}
Installation (Local Development)
git clone https://github.com/DanNsk/multi-memory-mcp
cd multi-memory-mcp
npm install
npm run build
Configuration
Add to Claude Desktop config:
Config file locations:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
Using npx (recommended):
{
"mcpServers": {
"multi-memory": {
"command": "npx",
"args": ["github:DanNsk/multi-memory-mcp"],
"env": {
"MEMORY_BASE_DIR": "/Users/yourname/.memory",
"DEFAULT_CATEGORY": "default"
}
}
}
}
Using local installation (macOS/Linux):
{
"mcpServers": {
"multi-memory": {
"command": "node",
"args": ["/absolute/path/to/multi-memory-mcp/dist/index.js"],
"env": {
"MEMORY_BASE_DIR": "/Users/yourname/.memory",
"DEFAULT_CATEGORY": "default"
}
}
}
}
Using local installation (Windows):
{
"mcpServers": {
"multi-memory": {
"command": "node",
"args": ["C:\\path\\to\\multi-memory-mcp\\dist\\index.js"],
"env": {
"MEMORY_BASE_DIR": "C:\\Users\\yourname\\.memory",
"DEFAULT_CATEGORY": "default"
}
}
}
}
Environment Variables
MEMORY_BASE_DIR: Base directory for all memory categories (default:.aimin current working directory)DEFAULT_CATEGORY: Default category when none specified (default:"default")SERIALIZATION_FORMAT: Output format for tool responses (default:"json")json- Standard JSON with 2-space indentationtoon- TOON (Token-Oriented Object Notation) - compact format optimized for LLMs with 30-60% fewer tokens
TOON Format
When SERIALIZATION_FORMAT=toon, responses use TOON format which is more token-efficient for LLM contexts.
Structure:
- Objects:
key: valuewith 2-space indentation for nesting - Arrays:
name[count]{field1,field2}:followed by comma-separated rows - Primitives: unquoted unless containing special characters
Escaping rules (only these escape sequences are valid):
\\- backslash\"- double quote\n- newline\r- carriage return\t- tab
Quoting required when: empty string, leading/trailing spaces, matches true/false/null, numeric, or contains : " \ [ ] { } ,
Example JSON vs TOON:
JSON (standard):
{
"entities": [
{"id": "1", "name": "AuthService", "entityType": "module", "observations": []}
]
}
TOON (compact):
entities[1]{id,name,entityType,observations}:
1,AuthService,module,[]
See TOON specification for full format details.
Database Schema
Each category stores data in a separate SQLite database with the following schema:
Tables
`entities`
Primary storage for graph nodes.
| Column | Type | Description |
|---|---|---|
id |
INTEGER PRIMARY KEY AUTOINCREMENT | Unique entity identifier |
name |
TEXT NOT NULL | Entity name |
entity_type |
TEXT NOT NULL | Entity classification type |
properties |
TEXT | JSON properties (searchable) |
created_at |
INTEGER | Unix timestamp of creation |
updated_at |
INTEGER | Unix timestamp of last update |
Unique Constraint: (name, entity_type) - entities are identified by name+type combination
`observations`
Facts and notes associated with entities.
| Column | Type | Description |
|---|---|---|
id |
INTEGE |
Environment Variables
MEMORY_BASE_DIRBase directory for all memory categoriesDEFAULT_CATEGORYDefault category when none specifiedSERIALIZATION_FORMATOutput format for tool responses (json or toon)Configuration
{"mcpServers": {"multi-memory": {"command": "npx", "args": ["github:DanNsk/multi-memory-mcp"], "env": {"MEMORY_BASE_DIR": "/path/to/.memory", "DEFAULT_CATEGORY": "default"}}}}