# sqlite-graph-memory

> sqlite-graph-memory is an open-source MCP server for knowledge and memory. Search your markdown notes by meaning and by their [[wikilinks]], all in local SQLite. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, macOS, Linux, Windows, Self-hosted
- **Repository:** https://github.com/tonydzi/sqlite-graph-memory
- **GitHub stars:** 18
- **License:** MIT
- **MCP Registry name:** io.github.tonydzi/sqlite-graph-memory
- **Categories:** [knowledge and memory](https://ai-powered.com/categories/knowledge-and-memory), [databases](https://ai-powered.com/categories/databases)
- **Listing updated:** 2026-12-02

## About

This server gives a coding assistant recall over a folder of markdown notes, such as an Obsidian vault. Search combines vector similarity with the links between notes, so a question that never names a note can still reach it through a [[wikilink]]. The ask command prints two lists, direct memory and associative memory, and marks notes found only through a link.

You build an index once with sgm-index, which downloads about 1.1 GB of search models on first use and re-embeds only new or changed notes afterward. The [lite] install uses ONNX Runtime instead of PyTorch, and no account, API key or token is needed. The index folder is set with BRAIN_INDEX_DIR.

The README warns that recalled fragments become part of the chat and so reach your client's model provider, and it includes a section written for an AI agent to perform setup with the human's approval. Optional settings cover recall timeout, reranking and a turn-ledger SQLite file.

## Features

- **Link-aware recall:** Follows [[wikilinks]] to find related notes that a plain similarity search misses.
- **Direct and associative lists:** sgm-ask --ab prints both result lists and flags link-only finds.
- **Incremental indexing:** Re-running sgm-index embeds only new or changed notes; --full forces a rebuild.
- **Lightweight install:** The [lite] option avoids PyTorch; a GPU option exists.
- **No account needed:** Runs locally with no API key or token.
- **Doctor command:** sgm-doctor checks the setup and ends with All good when healthy.

## Good for

- Give Claude Code memory of an Obsidian vault
- Surface a related note through a link when the question doesn't name it
- Search personal project notes from Cursor or Codex
- Compare plain and link-based recall with the A/B mode

## Install

### Claude Code: Add with the CLI (Terminal)

```sh
claude mcp add sqlite-graph-memory --env BRAIN_INDEX_DIR='<BRAIN_INDEX_DIR>' -- uvx sqlite-graph-memory
```

Add --scope user to use it in every project, or --scope project to share it in .mcp.json.

### Claude Code: Or share it with your project (.mcp.json)

```json
{
  "mcpServers": {
    "sqlite-graph-memory": {
      "command": "uvx",
      "args": [
        "sqlite-graph-memory"
      ],
      "env": {
        "BRAIN_INDEX_DIR": "<BRAIN_INDEX_DIR>"
      }
    }
  }
}
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "sqlite-graph-memory": {
      "command": "uvx",
      "args": [
        "sqlite-graph-memory"
      ],
      "env": {
        "BRAIN_INDEX_DIR": "<BRAIN_INDEX_DIR>"
      }
    }
  }
}
```

Settings → Developer → Edit Config, then quit and reopen Claude Desktop.

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "sqlite-graph-memory": {
      "command": "uvx",
      "args": [
        "sqlite-graph-memory"
      ],
      "env": {
        "BRAIN_INDEX_DIR": "<BRAIN_INDEX_DIR>"
      }
    }
  }
}
```

Use .cursor/mcp.json in a project to share it with the project.

### VS Code (~/.copilot/mcp-config.json)

```json
{
  "mcpServers": {
    "sqlite-graph-memory": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "sqlite-graph-memory"
      ],
      "env": {
        "BRAIN_INDEX_DIR": "<BRAIN_INDEX_DIR>"
      }
    }
  }
}
```

Or put the same entry in .mcp.json at your workspace root to share it.

### Codex: Add with the CLI (Terminal)

```sh
codex mcp add sqlite-graph-memory --env BRAIN_INDEX_DIR='<BRAIN_INDEX_DIR>' -- uvx sqlite-graph-memory
```

### Codex: Or add to config.toml (~/.codex/config.toml)

```toml
[mcp_servers.sqlite-graph-memory]
command = "uvx"
args = ["sqlite-graph-memory"]
env = { BRAIN_INDEX_DIR = "<BRAIN_INDEX_DIR>" }
```

### Gemini CLI and Antigravity: Gemini CLI (~/.gemini/settings.json)

```json
{
  "mcpServers": {
    "sqlite-graph-memory": {
      "command": "uvx",
      "args": [
        "sqlite-graph-memory"
      ],
      "env": {
        "BRAIN_INDEX_DIR": "<BRAIN_INDEX_DIR>"
      }
    }
  }
}
```

Or run: gemini mcp add -s user -e BRAIN_INDEX_DIR='<BRAIN_INDEX_DIR>' sqlite-graph-memory uvx -- sqlite-graph-memory

### Gemini CLI and Antigravity: Antigravity (~/.gemini/config/mcp_config.json)

```json
{
  "mcpServers": {
    "sqlite-graph-memory": {
      "command": "uvx",
      "args": [
        "sqlite-graph-memory"
      ],
      "env": {
        "BRAIN_INDEX_DIR": "<BRAIN_INDEX_DIR>"
      }
    }
  }
}
```

Use .agents/mcp_config.json to add it to one workspace only.

### Devin Desktop (~/.config/devin/mcp_config.json)

```json
{
  "mcpServers": {
    "sqlite-graph-memory": {
      "command": "uvx",
      "args": [
        "sqlite-graph-memory"
      ],
      "env": {
        "BRAIN_INDEX_DIR": "<BRAIN_INDEX_DIR>"
      }
    }
  }
}
```

On Windows the file is %APPDATA%\\devin\\mcp_config.json. Use .devin/mcp_config.json to share it with a project.

### Cline (cline_mcp_settings.json)

```json
{
  "mcpServers": {
    "sqlite-graph-memory": {
      "command": "uvx",
      "args": [
        "sqlite-graph-memory"
      ],
      "env": {
        "BRAIN_INDEX_DIR": "<BRAIN_INDEX_DIR>"
      }
    }
  }
}
```

Open it from the MCP Servers icon → Configure → Configure MCP Servers.

### Zed (Zed settings.json)

```json
{
  "context_servers": {
    "sqlite-graph-memory": {
      "command": "uvx",
      "args": [
        "sqlite-graph-memory"
      ],
      "env": {
        "BRAIN_INDEX_DIR": "<BRAIN_INDEX_DIR>"
      }
    }
  }
}
```

Open it with zed: open settings file. Merge context_servers into the settings you already have.

### JetBrains AI Assistant and Junie: AI Assistant (Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add)

```json
{
  "mcpServers": {
    "sqlite-graph-memory": {
      "command": "uvx",
      "args": [
        "sqlite-graph-memory"
      ],
      "env": {
        "BRAIN_INDEX_DIR": "<BRAIN_INDEX_DIR>"
      }
    }
  }
}
```

The AI Assistant docs only show command and args. If the env block is ignored, use Junie for this server.

### JetBrains AI Assistant and Junie: Junie (~/.junie/mcp/mcp.json)

```json
{
  "mcpServers": {
    "sqlite-graph-memory": {
      "command": "uvx",
      "args": [
        "sqlite-graph-memory"
      ],
      "env": {
        "BRAIN_INDEX_DIR": "<BRAIN_INDEX_DIR>"
      }
    }
  }
}
```

Use .junie/mcp/mcp.json to share it with a project.

### Kiro (~/.kiro/settings/mcp.json)

```json
{
  "mcpServers": {
    "sqlite-graph-memory": {
      "command": "uvx",
      "args": [
        "sqlite-graph-memory"
      ],
      "env": {
        "BRAIN_INDEX_DIR": "<BRAIN_INDEX_DIR>"
      }
    }
  }
}
```

Use .kiro/settings/mcp.json to add it to one workspace only.

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "sqlite-graph-memory": {
      "command": "uvx",
      "args": [
        "sqlite-graph-memory"
      ],
      "env": {
        "BRAIN_INDEX_DIR": "<BRAIN_INDEX_DIR>"
      }
    }
  }
}
```

## FAQ

### What does setup need?

Python 3.12 is the tested choice, plus about 1.3 GB of disk: roughly 155 MB of software and 1.1 GB of models.

### Does sqlite-graph-memory need an API key?

No account, API key or token is needed.

### Is there a privacy caveat?

Yes. Recalled fragments become part of the chat, so they reach your client's model provider.

### Which clients are documented?

Claude Code, Codex, Cursor, Claude Desktop, Zed, Windsurf and VS Code.

### Which environment variable is required?

BRAIN_INDEX_DIR, the absolute path of the folder sgm-index wrote.

### Is sqlite-graph-memory free?

Yes. sqlite-graph-memory is open source, so you can use and self-host it for free.

### How do I add sqlite-graph-memory to Claude Code?

Run this command in your terminal: claude mcp add sqlite-graph-memory --env BRAIN_INDEX_DIR='<BRAIN_INDEX_DIR>' -- uvx sqlite-graph-memory

### What are the best alternatives to sqlite-graph-memory?

The closest alternatives to sqlite-graph-memory are Codebase Memory, XERJ, MCP Toolbox for Databases, Claude Code Ultimate Guide and IWE (iwe.md).

## Where this comes from

- Description: written from the project's README.
- Install steps: from the official MCP Registry entry.

## Alternatives

- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Codebase Memory is an open-source MCP server for knowledge and memory.
- [XERJ](https://ai-powered.com/mcp/xerj): XERJ is an open-source MCP server for knowledge and memory.
- [MCP Toolbox for Databases](https://ai-powered.com/mcp/mcp-toolbox-for-databases-2): MCP Toolbox for Databases is an open-source MCP server for databases.
- [Claude Code Ultimate Guide](https://ai-powered.com/mcp/claude-code-ultimate-guide): Claude Code Ultimate Guide is an open-source MCP server for ai models and llm tooling.
- [IWE (iwe.md)](https://ai-powered.com/mcp/iwe-iwe-md): IWE (iwe.md) is an open-source MCP server for knowledge and memory.
- [Deja Vu](https://ai-powered.com/mcp/deja-vu): Deja Vu is a free MCP server for developer tools.
- [Nautilus Compass Memory](https://ai-powered.com/mcp/nautilus-compass-memory): Nautilus Compass Memory is an open-source MCP server for knowledge and memory.
- [Code-Graph-RAG](https://ai-powered.com/mcp/code-graph-rag): Code-Graph-RAG is an open-source MCP server for knowledge and memory.

---
Source: https://ai-powered.com/mcp/sqlite-graph-memory
