Skip to content

dgpl-mcps/memory-mcp-sql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Memory MCP Server

✨ Built with the mind and idea of a human, and the execution and speed of an AI.

A graph-based memory system for AI agents using Model Context Protocol (MCP). Provides persistent memory storage with knowledge graph capabilities, vector search, and multi-user perspective support.


Credit

Contributors: DGPL (Durbhasi Gurukulam Private Limited)


Features

  • Persistent Memory - Store and recall conversations with long-term memory
  • Knowledge Graph - Entity and relationship management
  • Vector Search - Semantic similarity search (sqlite-vec / sqlite-vss)
  • Multi-User - Share memories across users with perspective tracking
  • Context Building - LLM-optimized context retrieval
  • Session Management - Organize conversations by session/topic

Requirements

  • Node.js 18+
  • npm or pnpm

Installation

# Clone repository
git clone https://github.com/dgpl-test/memory-mcp-sql.git
cd memory-mcp-sql

# Install dependencies
npm install

# Build
npm run build

Usage

Start Server

# Production
npm start

# Development (with hot reload)
npm run dev

Configuration

Create .env file (optional):

TOOL_PREFIX=memory
ENABLE_DEFER_LOADING=false

# Short-term memory
MAX_SHORT_TERM_CHATS=10
SHORT_TERM_THRESHOLD=20

# Long-term memory
LONG_TERM_THRESHOLD=75
MAX_LONG_TERM_MEMORIES=1000

# Search
DEFAULT_SEARCH_LIMIT=10

Tools Reference

Tool Operations Description
memory 15 ops Store, search, manage memories
entity 5 ops Knowledge graph entities
relation 3 ops Entity relationships
short_term 6 ops Fast KV storage
project 14 ops Projects, tasks, workflows
session 8 ops Sessions and timelines
context 5 ops Conversation context
extract 9 ops Extract/remember info
share 5 ops Share with others

Core Operations

// Store a memory
{
  "op": "remember",
  "userId": "user1",
  "projectId": "project1",
  "userMessage": "What is the project deadline?",
  "agentMessage": "The deadline is Friday."
}

// Search memories
{
  "op": "recall",
  "userId": "user1",
  "query": "deadline"
}

// Get statistics
{
  "op": "stats",
  "userId": "user1"
}

// Create entity
{
  "op": "create",
  "userId": "user1",
  "entityType": "Person",
  "name": "John",
  "properties": {"role": "Developer"}
}

Entity Types

Person, Bot, Organization, Task, Rule, CoreRule, LongTermGoal, Epic, Todo, Insight, Walkthrough

Relation Types

DEPENDS_ON, SUBTASK_OF, FOLLOWS, GOVERNED_BY, PART_OF, WORKS_WITH, KNOWS, TOLD, CONTACTS, BELONGS_TO, MANAGED_BY, OWNS, DEADLINE_FOR


OpenClaw Integration

{
  "mcpServers": {
    "memory": {
      "command": "node",
      "args": ["/path/to/memory-mcp-sql/build/index.js"],
      "env": {},
      "defer_loading": true
    }
  }
}

For detailed setup instructions, see docs/setup.md.


Database

Default location: ./memory_mcp.db

For vector search, install extensions:

npm install sqlite-vss sqlite-vec
npm run build

The server auto-detects available extensions (priority: sqlite-vss → sqlite-vec → text matching).


Project Structure

memory-mcp-sql/
├── src/
│   ├── index.ts           # Main entry point
│   ├── db/
│   │   └── sqlite.ts    # Database
│   ├── tools/           # Tool implementations
│   ├── prompts/        # MCP prompts
│   ├── resources/     # MCP resources
│   └── utils/          # Utilities
├── migrations/         # Database migrations
├── docs/              # Documentation
│   ├── setup.md       # Setup guide
│   └── tools.md       # Tools reference
└── build/             # Compiled output

Documentation


License

MIT


Built with ❤️ by DGPL

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors