# Nacre

Nacre is an MCP server for Claude Code with a self-hosted knowledge index and granular access control. Agents see only documents the requesting user may read.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 2 repo stars
- Author: nacre-work
- License: Apache-2.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/nacre-work/nacre
- Updated: 2026-10-10
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/mcp/nacre

## What it does

Nacre is a permission-aware context layer. Organizations hold workspaces, workspaces hold layers, layers hold documents. Rights (`read`, `write`, `admin`) cascade top-down; `write` does not grant `read` automatically. Access filters run during HNSW traversal: `top_k` yields k permitted results, not k minus whatever got stripped afterward.

Hybrid retrieval combines dense vectors, BM25, and optional cross-encoder reranking. The parser extracts text from PDF, Office, OpenDocument, EPUB and RTF. Embeddings go through any OpenAI-compatible endpoint bound to a layer. Switching a layer to a different model triggers reindexing with recall validation: if the new model loses relevance on your reference query set, the migration halts instead of going live.

Runs via `docker compose --profile minimal up -d`. The CLI client `npx @nacre.work/cli` authenticates, provisions a layer, ingests a directory, and searches. On Apple Silicon read `docs/apple-silicon.md` before starting: images are arm64, but the embedder runs on the host.

## Requirements
- Needs: Node.js (commands run via npx)
- Environment variables: `NACRE_SERVICE_KEY` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add nacre -e NACRE_SERVICE_KEY=<NACRE_SERVICE_KEY> -- npx -y @nacre.work/mcp
```
Replace <…> with your own values

### Codex

**Platform CLI**
```bash
codex mcp add nacre --env NACRE_SERVICE_KEY=<NACRE_SERVICE_KEY> -- npx -y @nacre.work/mcp
```
Replace <…> with your own values

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "nacre": {
            "command": "npx",
            "args": [
                "-y",
                "@nacre.work/mcp"
            ],
            "env": {
                "NACRE_SERVICE_KEY": "<NACRE_SERVICE_KEY>"
            }
        }
    }
}
```
Replace <…> with your own values

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "nacre": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "@nacre.work/mcp"
            ],
            "env": {
                "NACRE_SERVICE_KEY": "<NACRE_SERVICE_KEY>"
            }
        }
    }
}
```
Replace <…> with your own values

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e NACRE_SERVICE_KEY=<NACRE_SERVICE_KEY> nacre npx -y @nacre.work/mcp
```
Replace <…> with your own values

## When to use it
- Give an agent access to a company index without exposing documents the user lacks clearance for
- Ensure search returns exactly k permitted results rather than filtering after ranking
- Match literal identifiers (error codes, invoice numbers, variable names) where dense vectors fail
- Migrate a layer to a different embedding model and stop the switch if recall drops
- Parse PDF, DOCX, PPTX, EPUB or RTF and index the extracted text

## Example prompts
- Search our index for mentions of `SQLSTATE 23505`
- Show authentication architecture docs the current user can read
- Ingest files from `docs/` into the `engineering-kb` layer

## Similar
- [platform-policy-rule-generate](https://affpapa.org/en/nevibecode/skills/platform-policy-rule-generate.md) — skill · 4300 installs
- [V3 Memory Unification](https://affpapa.org/en/nevibecode/skills/v3-memory-unification.md) — skill · 1100 installs
- [vector-search](https://affpapa.org/en/nevibecode/skills/vector-search.md) — skill · 752 installs
- [Willder](https://affpapa.org/en/nevibecode/mcp/willder.md) — MCP server · ★ 12 repo stars
- [Koma Core MCP](https://affpapa.org/en/nevibecode/mcp/koma-core-mcp.md) — MCP server · ★ 13 repo stars
- [memory-lancedb-pro-openclaw](https://affpapa.org/en/nevibecode/skills/memory-lancedb-pro-openclaw.md) — skill · 1300 installs

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
