Metadata-Version: 2.4
Name: memoraeu-mcp
Version: 0.1.10
Summary: Zero-knowledge persistent memory layer for Claude — MCP server
Project-URL: Homepage, https://memoraeu.com
Project-URL: Repository, https://github.com/pquattro/memoraeu-mcp
Project-URL: Documentation, https://memoraeu.com/docs/mcp
Author-email: MemoraEU <contact@memoraeu.com>
License: AGPL-3.0-or-later
License-File: LICENSE
Keywords: ai,claude,llm,mcp,memory,zero-knowledge
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.11
Requires-Dist: cryptography>=44.0.0
Requires-Dist: httpx>=0.27.0
Requires-Dist: mcp>=1.0.0
Description-Content-Type: text/markdown

# memoraeu-mcp

<!-- mcp-name: io.github.pquattro/memoraeu-mcp -->

> 🇬🇧 [English](#english) | 🇫🇷 [Français](#français)

---

## English

**Zero-knowledge persistent memory layer for Claude — MCP server**

MemoraEU gives Claude a persistent, encrypted memory. All content is encrypted **client-side** with AES-256-GCM before reaching the server — the server never sees your plaintext. Semantic search is powered by Mistral embeddings generated locally on your machine, before encryption.

### Features

- 🔒 **Zero-knowledge** — AES-256-GCM encryption, key never leaves your machine
- 🧠 **Semantic search** — embeddings generated locally before encryption (Qdrant on server)
- 🔄 **Auto memory** — remembers and recalls context automatically
- 🚫 **Deduplication** — detects near-duplicate memories before storing
- 🇪🇺 **EU hosted** — GDPR compliant infrastructure

### Installation

```bash
pip install memoraeu-mcp
```

Or with `uvx` (no install required, recommended):

```bash
uvx memoraeu-mcp
```

### Claude Desktop configuration

Add to your `claude_desktop_config.json`, under `mcpServers`:

```json
{
  "mcpServers": {
    "memoraeu": {
      "command": "uvx",
      "args": ["memoraeu-mcp"],
      "env": {
        "MEMORAEU_API_URL": "https://api.memoraeu.com",
        "MEMORAEU_API_KEY": "meu-sk-...",
        "MEMORAEU_SECRET": "your-memoraeu-password",
        "MEMORAEU_SALT": "your-kdf-salt",
        "MISTRAL_API_KEY": "your-mistral-key"
      }
    }
  }
}
```

### Understanding the variables

These five variables serve three distinct purposes — they are **not interchangeable**:

| Variable | Purpose | Where to get it |
|---|---|---|
| `MEMORAEU_API_KEY` | HTTP authentication (Bearer token sent with every request) | Dashboard → Settings → API Keys |
| `MEMORAEU_SECRET` | Your MemoraEU login password — used as the PBKDF2 input to derive the encryption key locally | Your account password |
| `MEMORAEU_SALT` | KDF salt generated by the server, unique to your account — combined with `MEMORAEU_SECRET` to produce the encryption key | Dashboard → Settings → Encryption Keys |
| `MEMORAEU_API_URL` | API endpoint (use `https://api.memoraeu.com` for the hosted service) | — |
| `MISTRAL_API_KEY` | Used to generate embeddings **locally** before encryption — required for zero-knowledge search (see below) | [console.mistral.ai](https://console.mistral.ai) |

> **Why does the MCP need its own Mistral key?**
>
> Zero-knowledge means the server never sees your plaintext. To enable semantic search, embeddings must be computed **before** the content is encrypted — on your machine. The MCP calls Mistral directly with the plaintext, gets the embedding vector, encrypts the content, then sends both to the server. The server stores the opaque blob and the vector, but cannot reconstruct the original text. Without `MISTRAL_API_KEY`, semantic search will not work.

> **Without `MISTRAL_API_KEY`:** The MCP will still work — `remember` and `recall` will function, but semantic search will fall back to keyword-based search on the server side. Zero-knowledge encryption is unaffected.

### Getting your keys

1. Sign up at [app.memoraeu.com](https://app.memoraeu.com)
2. Go to **Settings → Encryption Keys** → copy `MEMORAEU_SALT`
3. `MEMORAEU_SECRET` is your MemoraEU login password
4. Go to **Settings → API Keys** → create a key → copy `MEMORAEU_API_KEY`
5. Get a Mistral API key at [console.mistral.ai](https://console.mistral.ai)

### Remote MCP via SSE (no local install)

You can connect directly from claude.ai web, Cursor, Windsurf or any remote MCP client without installing anything locally:

```
SSE endpoint: https://api.memoraeu.com/mcp/sse
Auth: Authorization: Bearer meu-sk-...
```

Example config for Cursor / Windsurf:

```json
{
  "mcpServers": {
    "memoraeu": {
      "type": "sse",
      "url": "https://api.memoraeu.com/mcp/sse",
      "headers": {
        "Authorization": "Bearer meu-sk-..."
      }
    }
  }
}
```

> **Note:** In SSE remote mode, content is not zero-knowledge encrypted (the server handles plaintext). Use the local `stdio` install for full zero-knowledge guarantees.

### Available tools

| Tool | Description |
|------|-------------|
| `remember` | Memorizes important information automatically |
| `recall` | Semantic search across stored memories |
| `forget` | Deletes a memory by ID |
| `list_memories` | Lists recent memories with optional category filter |
| `list_categories` | Returns existing categories sorted by usage |
| `remember_fact` | Stores a structured fact (subject/predicate/object) with temporal validity |
| `recall_facts` | Retrieves active facts for a subject |
| `invalidate_fact` | Marks a fact as expired by its ID |

### Auto-memory behavior

The MCP server is designed to work without manual intervention:

**Automatic recall** — On the first user message of each session, `recall` is called automatically
with the detected topic as query. Recent memories are also loaded via the `memoraeu://context`
resource and injected as session context.

**Automatic remember** — When Claude detects a memorable piece of information (preference, decision,
biographical fact, technical constraint), it calls `remember` autonomously without waiting to be asked.
It confirms with a single discreet line.

**System prompt injection** — On the first `recall` call, the full behavior system prompt is injected
into Claude's context, reinforcing the auto-memory rules for the rest of the session.

This behavior is encoded directly in the tool descriptions. Claude models follow these instructions
as part of tool use — no additional configuration is required.

### Deduplication & compression

Before storing a memory, the MCP checks for near-duplicates using vector similarity:

| Similarity | Action |
|---|---|
| ≥ 94% | Memory skipped — exact duplicate detected |
| 85–94% | Warning logged, memory stored anyway |
| < 85% | Memory stored normally |

Long memories (> 300 characters) are compressed by Mistral before encryption, reducing token usage
and improving search relevance. Compression happens in plaintext, before the content is encrypted —
the server never sees the uncompressed original either.

### Self-hosting

The API is open source. Deploy your own instance with Docker:

```bash
git clone https://github.com/pquattro/memoraEu
cd memoraEu
docker compose up -d
```

---

## Français

**Couche mémoire persistante zero-knowledge pour Claude — serveur MCP**

MemoraEU donne à Claude une mémoire persistante et chiffrée. Tout le contenu est chiffré **côté client** en AES-256-GCM avant d'atteindre le serveur — le serveur ne voit jamais le texte en clair. La recherche sémantique repose sur des embeddings Mistral générés localement, avant chiffrement.

### Fonctionnalités

- 🔒 **Zero-knowledge** — chiffrement AES-256-GCM, la clé ne quitte jamais votre machine
- 🧠 **Recherche sémantique** — embeddings générés localement avant chiffrement (Qdrant côté serveur)
- 🔄 **Mémoire automatique** — mémorise et rappelle le contexte sans intervention
- 🚫 **Déduplication** — détecte les doublons avant stockage
- 🇪🇺 **Hébergé en Europe** — infrastructure conforme RGPD

### Installation

```bash
pip install memoraeu-mcp
```

Ou avec `uvx` (sans installation, recommandé) :

```bash
uvx memoraeu-mcp
```

### Configuration Claude Desktop

Ajoutez dans votre `claude_desktop_config.json`, section `mcpServers` :

```json
{
  "mcpServers": {
    "memoraeu": {
      "command": "uvx",
      "args": ["memoraeu-mcp"],
      "env": {
        "MEMORAEU_API_URL": "https://api.memoraeu.com",
        "MEMORAEU_API_KEY": "meu-sk-...",
        "MEMORAEU_SECRET": "votre-mot-de-passe-memoraeu",
        "MEMORAEU_SALT": "votre-kdf-salt",
        "MISTRAL_API_KEY": "votre-clé-mistral"
      }
    }
  }
}
```

### Rôle de chaque variable

Ces cinq variables ont trois rôles distincts — elles **ne sont pas interchangeables** :

| Variable | Rôle | Où la trouver |
|---|---|---|
| `MEMORAEU_API_KEY` | Authentification HTTP (Bearer token envoyé à chaque requête) | Dashboard → Paramètres → Clés API |
| `MEMORAEU_SECRET` | Votre mot de passe MemoraEU — utilisé comme entrée PBKDF2 pour dériver la clé de chiffrement localement | Votre mot de passe de connexion |
| `MEMORAEU_SALT` | Salt KDF généré par le serveur, unique à votre compte — combiné avec `MEMORAEU_SECRET` pour produire la clé de chiffrement | Dashboard → Paramètres → Clés de chiffrement |
| `MEMORAEU_API_URL` | Endpoint API (utilisez `https://api.memoraeu.com` pour le service hébergé) | — |
| `MISTRAL_API_KEY` | Génération des embeddings **localement** avant chiffrement — requis pour la recherche zero-knowledge (voir ci-dessous) | [console.mistral.ai](https://console.mistral.ai) |

> **Pourquoi le MCP a-t-il besoin d'une clé Mistral ?**
>
> Le zero-knowledge signifie que le serveur ne voit jamais votre texte en clair. Pour permettre la recherche sémantique, les embeddings doivent être calculés **avant** le chiffrement — sur votre machine. Le MCP appelle Mistral directement avec le texte clair, obtient le vecteur d'embedding, chiffre le contenu, puis envoie les deux au serveur. Le serveur stocke le blob opaque et le vecteur, mais ne peut pas reconstituer le texte original. Sans `MISTRAL_API_KEY`, la recherche sémantique ne fonctionnera pas.

> **Sans `MISTRAL_API_KEY` :** Le MCP continue de fonctionner — `remember` et `recall` restent opérationnels, mais la recherche sémantique bascule sur une recherche par mots-clés côté serveur. Le chiffrement zero-knowledge n'est pas affecté.

### Obtenir vos clés

1. Créez un compte sur [app.memoraeu.com](https://app.memoraeu.com)
2. Allez dans **Paramètres → Clés de chiffrement** → copiez `MEMORAEU_SALT`
3. `MEMORAEU_SECRET` est votre mot de passe de connexion MemoraEU
4. Allez dans **Paramètres → Clés API** → créez une clé → copiez `MEMORAEU_API_KEY`
5. Obtenez une clé Mistral sur [console.mistral.ai](https://console.mistral.ai)

### MCP Remote via SSE (sans installation locale)

Connectez-vous directement depuis claude.ai web, Cursor, Windsurf ou tout client MCP distant sans rien installer :

```
Endpoint SSE : https://api.memoraeu.com/mcp/sse
Auth : Authorization: Bearer meu-sk-...
```

Exemple de config Cursor / Windsurf :

```json
{
  "mcpServers": {
    "memoraeu": {
      "type": "sse",
      "url": "https://api.memoraeu.com/mcp/sse",
      "headers": {
        "Authorization": "Bearer meu-sk-..."
      }
    }
  }
}
```

> **Note :** En mode SSE distant, le contenu n'est pas chiffré zero-knowledge (le serveur traite le texte en clair). Utilisez l'installation locale `stdio` pour les garanties zero-knowledge complètes.

### Outils disponibles

| Outil | Description |
|-------|-------------|
| `remember` | Mémorise automatiquement les informations importantes |
| `recall` | Recherche sémantique dans les mémoires stockées |
| `forget` | Supprime une mémoire par son ID |
| `list_memories` | Liste les mémoires récentes avec filtre optionnel |
| `list_categories` | Retourne les catégories existantes triées par usage |
| `remember_fact` | Stocke un fait structuré (sujet/prédicat/objet) avec validité temporelle |
| `recall_facts` | Récupère les faits actifs pour un sujet |
| `invalidate_fact` | Marque un fait comme expiré par son ID |

### Comportement de mémoire automatique

Le serveur MCP est conçu pour fonctionner sans intervention manuelle :

**Rappel automatique** — Au premier message de chaque session, `recall` est appelé automatiquement
avec le sujet détecté comme requête. Les mémoires récentes sont également chargées via la ressource
`memoraeu://context` et injectées dans le contexte de session.

**Mémorisation automatique** — Lorsque Claude détecte une information durable (préférence, décision,
fait biographique, contrainte technique), il appelle `remember` de façon autonome, sans attendre qu'on
le lui demande. Il confirme par une simple ligne discrète.

**Injection du prompt système** — Au premier appel à `recall`, le prompt système complet de comportement
est injecté dans le contexte de Claude, renforçant les règles de mémoire automatique pour le reste
de la session.

Ce comportement est encodé directement dans les descriptions des outils. Les modèles Claude suivent
ces instructions dans le cadre de l'utilisation des outils — aucune configuration supplémentaire
n'est requise.

### Déduplication et compression

Avant de stocker une mémoire, le MCP vérifie les quasi-doublons par similarité vectorielle :

| Similarité | Action |
|---|---|
| ≥ 94 % | Mémoire ignorée — doublon exact détecté |
| 85–94 % | Avertissement journalisé, mémoire stockée quand même |
| < 85 % | Mémoire stockée normalement |

Les mémoires longues (> 300 caractères) sont compressées par Mistral avant chiffrement, réduisant
la consommation de tokens et améliorant la pertinence des recherches. La compression s'effectue en
texte clair, avant chiffrement du contenu — le serveur ne voit jamais l'original non compressé non plus.

### Auto-hébergement

L'API est open source. Déployez votre propre instance avec Docker :

```bash
git clone https://github.com/pquattro/memoraEu
cd memoraEu
docker compose up -d
```

---

## License

MIT © 2026 MemoraEU
