# Citadel

> Citadel is an open-source MCP server for knowledge and memory. Local encrypted memory for agents with hybrid recall and key-destroying erasure. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, macOS, Windows, Linux, self-hosted
- **Website:** https://citadeldb.dev
- **Repository:** https://github.com/yp3y5akh0v/citadel/tree/HEAD/crates/citadel-mcp
- **MCP Registry name:** dev.citadeldb/mcp
- **Categories:** knowledge and memory, databases
- **Listing updated:** 2026-11-16

## About

Memory is stored in a local, encrypted Citadel region on your own machine. Recall blends vector search, keyword matching, recency and importance over a PRISM nearest-neighbour index, and memories are linked by a typed edge graph. Forgetting works by destroying keys rather than overwriting data, which the project calls cryptographic erasure, and the engine can issue erasure receipts.

Setup needs a passphrase in the CITADEL_KEY environment variable. For semantic recall the README recommends pulling the e5-large embedder and ms-marco-minilm reranker once with uvx; models are never downloaded automatically and pulls are checked against pinned revisions and SHA-256 digests. The server speaks stdio JSON-RPC and supports several MCP protocol revisions.

Behind it is an embedded database with SQL, key-value access, JSON and vector columns, ACID transactions with shadow paging, and encrypted peer-to-peer sync. The site reports historical scores of 87.2% on LoCoMo and 86.2% on LongMemEval-S, and lists 15 MCP tools. A desktop client, Citadel Studio, can open and inspect vaults.

## Features

- **Encrypted memory:** Memory is AES-256 encrypted at rest and each atom is sealed and authenticated.
- **Hybrid recall:** Combines vector, keyword, recency and importance scores.
- **Memory graph:** Typed edges link atoms and can be expanded during recall.
- **Cryptographic forgetting:** Destroys keys to erase an atom or region.
- **Integrity checks:** mem_verify reports whether atoms are authentic, tampered or erased.
- **Local-first:** No API keys; data stays on your machine.

## Good for

- Give a desktop assistant private long-term memory
- Erase a memory with a verifiable receipt
- Link and summarise what an agent knows about a topic
- Keep project knowledge encrypted on disk
- Store notes with idempotent writes

## Install

### Claude Code (Terminal)

```sh
claude mcp add mcp --env CITADEL_KEY='<CITADEL_KEY>' -- uvx citadeldb-mcp
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "mcp": {
      "command": "uvx",
      "args": [
        "citadeldb-mcp"
      ],
      "env": {
        "CITADEL_KEY": "<CITADEL_KEY>"
      }
    }
  }
}
```

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

```json
{
  "mcpServers": {
    "mcp": {
      "command": "uvx",
      "args": [
        "citadeldb-mcp"
      ],
      "env": {
        "CITADEL_KEY": "<CITADEL_KEY>"
      }
    }
  }
}
```

### VS Code (.vscode/mcp.json)

```json
{
  "servers": {
    "mcp": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "citadeldb-mcp"
      ],
      "env": {
        "CITADEL_KEY": "<CITADEL_KEY>"
      }
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

```json
{
  "mcpServers": {
    "mcp": {
      "command": "uvx",
      "args": [
        "citadeldb-mcp"
      ],
      "env": {
        "CITADEL_KEY": "<CITADEL_KEY>"
      }
    }
  }
}
```

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

```json
{
  "mcpServers": {
    "mcp": {
      "command": "uvx",
      "args": [
        "citadeldb-mcp"
      ],
      "env": {
        "CITADEL_KEY": "<CITADEL_KEY>"
      }
    }
  }
}
```

## Tools

- `mem_recall`: Hybrid retrieval over memory with filters and graph expansion.
- `mem_fetch`: Cursor-based listing of a kind.
- `mem_get`: Exact-id batch retrieval.
- `mem_edges`: Introspect typed graph edges.
- `mem_profile`: Recall plus graph neighbourhood for a query.
- `mem_summarize`: Per-kind digest of a region.
- `mem_verify`: Re-authenticate atoms and return integrity verdicts.
- `mem_remember`: Store one atom.
- `mem_remember_batch`: Atomically store an ordered batch.
- `mem_update`: Replace an atom's payload in place.
- `mem_link`: Add a typed edge.
- `mem_unlink`: Remove a typed edge.
- `mem_evolve`: Recompute an atom's neighbour links and importance.
- `mem_evict`: Selective forgetting by policy.

## FAQ

### Does it need API keys?

No; set the CITADEL_KEY passphrase and run it locally.

### How does forgetting work?

By destroying the keys for an atom or region, not overwriting it.

### Are embedding models downloaded automatically?

No, you pull them explicitly and they are verified against pinned digests.

### How do I install it?

Run uvx citadeldb-mcp, or install with pip or cargo.

### Is Citadel free?

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

### How do I add Citadel to Claude Code?

Run this command in your terminal: claude mcp add mcp --env CITADEL_KEY='<CITADEL_KEY>' -- uvx citadeldb-mcp

### What are the best alternatives to Citadel?

The closest alternatives to Citadel are Codebase Memory, XERJ, Claude Code Ultimate Guide, Nautilus Compass Memory and Midplane.

## 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.
- [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.
- [Nautilus Compass Memory](https://ai-powered.com/mcp/nautilus-compass-memory): Nautilus Compass Memory is an open-source MCP server for knowledge and memory.
- [Midplane](https://ai-powered.com/mcp/midplane): Midplane is an open-source MCP server for databases.
- [note1](https://ai-powered.com/mcp/note1): note1 is an MCP server for productivity.
- [MedXpert 图书馆连接器（通用版）](https://ai-powered.com/mcp/medxpert): MedXpert 图书馆连接器（通用版） is an open-source MCP server for knowledge and memory.
- [Context Nest](https://ai-powered.com/mcp/context-nest): Context Nest is a freemium MCP server for knowledge and memory.

---
Source: https://ai-powered.com/mcp/citadel
