Skip to main content
Glama
Dali MCP Server

Dali MCP Server

by linnaxis

🦞 Dali Memory

Local vector memory system for AI coding assistants. Gives Claude Code (or any MCP client) persistent semantic memory across sessions using SQLite + sqlite-vec + Ollama embeddings.

Includes an optional OpenClaw plugin adapter for automatic context injection.

Why

AI coding assistants forget everything between sessions. The typical workaround β€” dumping large .md files into every prompt β€” wastes tokens on irrelevant context.

Dali replaces static context dumps with semantic retrieval: only memories relevant to the current conversation are injected, saving ~1,000 tokens per turn.

Related MCP server: io.github.cdnsteve/sugar

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Claude Code / MCP Client                           β”‚
β”‚                                                     β”‚
β”‚  store_memory ──┐    search_memory ──┐              β”‚
β”‚  search_by_type ─    forget_memory   ─              β”‚
β”‚  get_audit_log  ─    list_recent     ─              β”‚
β”‚  get_session    β”˜                    β”˜              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚ stdio (MCP)          β”‚
               v                      v
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Dali MCP Server (src/)                              β”‚
β”‚                                                      β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚ memory/  β”‚  β”‚ embeddings/β”‚  β”‚ audit/           β”‚ β”‚
β”‚  β”‚ store.ts β”‚  β”‚ ollama.ts  │──│ logger.ts        β”‚ β”‚
β”‚  β”‚ search.tsβ”‚  β”‚            β”‚  β”‚ query.ts         β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚       β”‚              β”‚                               β”‚
β”‚       v              v                               β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                         β”‚
β”‚  β”‚  SQLite + sqlite-vec    β”‚                         β”‚
β”‚  β”‚  768-dim cosine KNN     β”‚                         β”‚
β”‚  β”‚  WAL mode               β”‚                         β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
               v
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Ollama (local)          β”‚
β”‚  nomic-embed-text        β”‚
β”‚  768-dim embeddings      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Quickstart

1. Install Ollama

brew install ollama        # macOS
ollama pull nomic-embed-text
ollama serve               # start the server

2. Clone and Build

git clone https://github.com/linnaxis/dali-memory-openclaw.git
cd dali-memory-openclaw
npm install
npm run build

3. Configure MCP

Copy .mcp.json.example to ~/.claude/mcp.json (or merge into your existing config):

{
  "mcpServers": {
    "dali": {
      "command": "node",
      "args": ["/absolute/path/to/dali-memory-openclaw/dist/index.js"],
      "env": {
        "DALI_DB_PATH": "~/.claude/dali/dali.db",
        "OLLAMA_BASE_URL": "http://localhost:11434",
        "OLLAMA_MODEL": "nomic-embed-text"
      }
    }
  }
}

4. Verify

Start Claude Code. You should see 7 new tools:

  • store_memory β€” persist a memory with auto-embedding

  • search_memory β€” semantic vector search

  • search_by_type β€” filter by type + text query

  • get_audit_log β€” query tool invocation history

  • get_session_summary β€” all memories for a session

  • list_recent_memories β€” chronological listing

  • forget_memory β€” archive or delete

Efficiency Benchmarks

Based on a real deployment with 165 memories (3.5 MB database):

Token Savings Per Turn

Metric

Static (Before)

Dynamic (After)

Savings

Managed .md files

1,287 tokens

~20 token stubs

-1,267

Dali context injection

0

~100-400 avg

+100-400

Net per turn

1,287 tokens

~220-420 tokens

~870-1,070

Cost Projections (Claude Sonnet 4, $3/M input tokens)

Scenario

Tokens/turn

100 turns/day

Monthly cost

Static (all .md)

3,373

337,300

$30.36

With Dali (avg)

2,406

240,600

$21.65

Savings

~967

96,700

$8.70

Latency

Operation

Latency

Notes

Ollama embed (nomic-embed-text)

15-50ms

Local inference

SQLite KNN search (768-dim)

<5ms

In-memory after first query

Full retrieval pipeline

20-60ms

Dominated by Ollama

Ollama down (fallback)

0ms

Graceful no-op

Database Size

Memories

Size

165

3.5 MB

~1,000

~15 MB

~10,000

~120 MB

Run npm run benchmark for live measurements against your instance.

OpenClaw Integration

The openclaw/ directory contains an optional plugin adapter that integrates Dali into OpenClaw. It provides:

  • Automatic context injection β€” a before_prompt_build hook embeds the user's message, searches for relevant memories, and injects them into the system prompt

  • Agent tools β€” dali_search and dali_store let the agent query and persist memories

  • Workspace indexer β€” one-time script to seed Dali from existing .md workspace files

Install the Plugin

# From npm
openclaw plugins install @openclaw/dali-memory

# From GitHub (no npm publish required)
openclaw plugins install github:linnaxis/dali-memory-openclaw

# From a local clone
openclaw plugins install ./openclaw

See openclaw/README.md for configuration and detailed setup.

Claude Code Integration Prompts

The prompts/ directory contains ready-to-paste prompts for Claude Code:

Prompt

Purpose

INSTALL_DALI.md

Install and configure the Dali MCP server

INSTALL_OPENCLAW_PLUGIN.md

Wire the plugin into an OpenClaw instance

VERIFY_INTEGRATION.md

Test the full integration end-to-end

Configuration

Environment Variables

Variable

Default

Description

DALI_DB_PATH

~/.claude/dali/dali.db

SQLite database path

DALI_PROJECT

Current directory name

Default project name

OLLAMA_BASE_URL

http://localhost:11434

Ollama API endpoint

OLLAMA_MODEL

nomic-embed-text

Embedding model

Database Schema

Dali uses SQLite with the sqlite-vec extension for vector search.

Tables

Table

Purpose

memories

Core storage β€” type, content, summary, tags, metadata, project

memory_vec_map

Bridge: maps UUID memory_id to integer rowid for vec0

memory_embeddings

vec0 virtual table β€” 768-dim cosine distance vectors

audit_log

Tool invocation history with timing

sessions

Session tracking with project association

file_changes

File modification records linked to memories

schema_version

Migration version tracking

Design Decisions

  • Bridge table pattern: sqlite-vec requires integer rowids; memories use UUIDs. The memory_vec_map table bridges them.

  • WAL mode: Enables concurrent reads during writes.

  • Graceful degradation: Memories are stored immediately; embeddings are backfilled asynchronously when Ollama becomes available.

  • JSON storage: Tags and metadata stored as JSON strings, parsed on read.

Project Structure

dali-memory-openclaw/
β”œβ”€β”€ README.md
β”œβ”€β”€ package.json
β”œβ”€β”€ tsconfig.json
β”œβ”€β”€ .mcp.json.example
β”œβ”€β”€ LICENSE
β”œβ”€β”€ src/                          # Dali MCP server
β”‚   β”œβ”€β”€ index.ts                  # Entry point (stdio transport)
β”‚   β”œβ”€β”€ server.ts                 # Tool + resource definitions
β”‚   β”œβ”€β”€ types.ts                  # Interfaces + Zod schemas
β”‚   β”œβ”€β”€ db/
β”‚   β”‚   β”œβ”€β”€ client.ts             # Database init, WAL, migrations
β”‚   β”‚   └── schema.ts             # DDL + version tracking
β”‚   β”œβ”€β”€ memory/
β”‚   β”‚   β”œβ”€β”€ search.ts             # KNN vector search + text filtering
β”‚   β”‚   └── store.ts              # Insert, embed, archive, delete
β”‚   β”œβ”€β”€ embeddings/
β”‚   β”‚   └── ollama.ts             # Ollama /api/embed client
β”‚   └── audit/
β”‚       β”œβ”€β”€ logger.ts             # Audit log insertion
β”‚       └── query.ts              # Audit log query + filtering
β”œβ”€β”€ openclaw/                     # OpenClaw plugin (optional)
β”‚   β”œβ”€β”€ README.md
β”‚   β”œβ”€β”€ package.json
β”‚   β”œβ”€β”€ openclaw.plugin.json
β”‚   β”œβ”€β”€ api.ts
β”‚   β”œβ”€β”€ index.ts
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ db.ts
β”‚   β”‚   β”œβ”€β”€ embedder.ts
β”‚   β”‚   β”œβ”€β”€ search-tool.ts
β”‚   β”‚   β”œβ”€β”€ store-tool.ts
β”‚   β”‚   └── context-hook.ts
β”‚   └── scripts/
β”‚       └── index-workspace.ts
β”œβ”€β”€ scripts/
β”‚   └── benchmark.ts              # Token savings + latency benchmark
└── prompts/
    β”œβ”€β”€ INSTALL_DALI.md
    β”œβ”€β”€ INSTALL_OPENCLAW_PLUGIN.md
    └── VERIFY_INTEGRATION.md

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      A
      maintenance
      Provides persistent memory for AI coding agents via MCP, enabling agents to store and semantically recall facts, events, and lessons across sessions, all running locally without cloud dependencies.
      Apache 2.0
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables AI coding agents to read and write persistent, local-first memory over MCP, storing decisions, preferences, error patterns, research, and cross-project guidelines in SQLite with semantic search. Agents can recall relevant context before tasks and store new learnings mid-session, keeping knowledge across sessions and projects without any external API calls.
      -
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables AI coding agents to store, search, and recall project-specific and global memory through MCP, using local SQLite and semantic search. It also optionally supports autonomous task execution powered by the same memory layer.
      -
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables MCP-compatible AI coding tools to store and recall persistent memories across sessions and projects, with keyword and semantic search backed by a local SQLite database.
      2,060 npm
      76
      Apache 2.0