Skip to main content
Glama
README.md
# MCP-Loci

**Your AI forgets everything between sessions. Loci fixes that.**

Loci is a persistent memory server for [Model Context Protocol](https://modelcontextprotocol.io) — giving Claude and other MCP-compatible assistants a cross-session memory that actually works. Store facts, recall them semantically, and synthesize a full portrait of everything your AI knows.

[![Python](https://img.shields.io/badge/python-3.11%2B-blue)](https://www.python.org)
[![License: MIT](https://img.shields.io/badge/license-MIT-green)](LICENSE)
[![FastMCP](https://img.shields.io/badge/built%20with-FastMCP%203.x-purple)](https://gofastmcp.com)

---

## What it does

| Tool | Description |
|---|---|
| `remember` | Store a named memory with type, description, and content |
| `recall` | Search memories — keyword, semantic, or hybrid |
| `forget` | Remove a memory by name or ID |
| `synthesize` | Cross-memory portrait: changes, uncertainties, and recommendations |
| `health` | Server status: memory count, embedding count, model state |

Hybrid search combines BM25 keyword matching (SQLite FTS5) with local semantic embeddings (`all-MiniLM-L6-v2`) — so recall works whether you remember the exact word or just the general idea.

---

## Quickstart

### Install

```bash
pip install mcp-loci
```

Or with semantic search support (recommended):

```bash
pip install "mcp-loci[embeddings]"
```

### Add to Claude Desktop

Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "memory": {
      "command": "python",
      "args": ["-m", "mcp_loci.server"]
    }
  }
}
```

Restart Claude Desktop. That's it — Claude now has persistent memory across sessions.

### Try it

In Claude:

> "Remember that my preferred code style is no trailing commas and 4-space indentation."

Close Claude. Reopen it.

> "What's my preferred code style?"

Claude remembers.

---

## Memory types

Use types to organize and filter your memories:

| Type | Use for |
|---|---|
| `user` | Personal preferences, identity, background |
| `feedback` | Things Claude should always/never do |
| `project` | Active work context, goals, deadlines |
| `reference` | Where to find things — links, locations, sources |

---

## Semantic search

Install with `[embeddings]` to enable semantic recall. The first call loads the model (~90MB, local — no API key needed). Subsequent calls use a background-warmed model for instant response.

```
recall("what does adam prefer for formatting")
# → surfaces "preferred code style" memory even without exact keyword match
```

Set `semantic: false` for pure keyword search, or leave it on for hybrid (default).

---

## Configuration

| Env var | Default | Description |
|---|---|---|
| `MCP_MEMORY_DB_PATH` | `~/.mcp-loci/memory.db` | SQLite database location |

---

## Development

```bash
git clone https://github.com/underratedf00l/MCP-Loci
cd MCP-Loci
pip install -e ".[dev,embeddings]"
pytest
```

28 tests (24 unit + 4 integration). All green.

---

## Why "Loci"?

The [method of loci](https://en.wikipedia.org/wiki/Method_of_loci) is a 2,500-year-old memorization technique — you place memories in specific locations in an imagined space so you can walk back and find them. That's exactly what this does, at the data layer.

---

## License

MIT — see [LICENSE](LICENSE).

TDQS

B3.4/5.0

Scored across 5 tools

Disambiguation5/5

Each tool maps to a distinct memory operation: health for status, remember for writes, recall for retrieval, forget for deletion, and synthesize for cross-memory analysis. The potential recall/synthesize overlap is resolved by clear descriptions distinguishing ranked retrieval from derived insights.

Naming Consistency4/5

All names are lowercase single words with a predictable, readable style. Four are action verbs (remember, recall, forget, synthesize) while health is a noun, which is a minor deviation from the otherwise consistent verb pattern.

Tool Count5/5

Five tools is well-scoped for a memory service, covering health, write, retrieval, deletion, and synthesis without padding. Each tool earns its place in the lifecycle.

Completeness4/5

The core memory lifecycle is covered: status, create/update, search, soft-delete, and synthesis. Minor gaps include no explicit list/get-by-ID operation and only soft deletion, though recall and name-based forget likely let agents work around these.

Maintenance

ActivityInactive
ResponsivenessNo recent community issues