Semantic search MCP server for Claude Code sessions
Project description
deja
Semantic search over your Claude Code session history. Ask questions about past conversations by meaning, not just keywords.
deja is an MCP server that indexes Claude Code JSONL sessions and provides hybrid search (vector + full-text) directly from Claude Code.
How it works
~/.claude/projects/*/ deja index index.db
*.jsonl ──────────────► (SQLite + vec + FTS5)
embeddings
│
│ deja serve (MCP stdio)
▼
Claude Code
"search past sessions"
- Index — parses JSONL session files, extracts conversation turns, embeds with
multilingual-e5-small, stores in SQLite - Serve — MCP server opens the index and answers search queries via stdio transport
Search combines vector KNN (semantic similarity) and FTS5 (keyword matching) via Reciprocal Rank Fusion.
Install
pip install dejasearch
Or from source:
git clone https://github.com/CynepMyx/deja.git
cd deja
pip install -e .
First run downloads the embedding model (~117 MB).
Usage
Build the index
deja index # incremental — only new/changed files
deja index --reindex # full rebuild
Scans all ~/.claude/projects/*/*.jsonl files.
Add to Claude Code
Add to ~/.claude.json under mcpServers:
"deja": {
"type": "stdio",
"command": "/path/to/deja/.venv/Scripts/deja.exe",
"args": ["serve"],
"env": {
"PYTHONUNBUFFERED": "1"
}
}
Restart Claude Code — deja will appear as a connected MCP server.
MCP Tools
| Tool | Description |
|---|---|
search |
Hybrid semantic + keyword search across all sessions |
get_context |
Get a chunk with surrounding turns (±window) |
get_session_chunks |
Get indexed chunks for a session (not raw messages) |
search parameters:
query(string) — what to search forlimit(int, default 10) — max resultsproject(string, optional) — filter by projectdate_from/date_to(string, optional) — ISO date range
Auto-indexing (optional)
Index automatically when a Claude Code session ends. Add a Stop hook to ~/.claude/settings.json:
"hooks": {
"Stop": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "/path/to/deja/.venv/bin/deja index"
}
]
}
]
}
On Windows with Git Bash, wrap in a shell script:
#!/bin/bash
DEJA="/path/to/deja/.venv/Scripts/deja.exe"
[ -f "$DEJA" ] && "$DEJA" index >/dev/null 2>&1 &
"command": "bash /path/to/deja-index.sh"
PID lock prevents concurrent indexers — safe with multiple sessions.
Stack
- fastembed — ONNX embeddings (
intfloat/multilingual-e5-small, 384-dim) - sqlite-vec — vector KNN search in SQLite
- SQLite FTS5 — full-text keyword search
- FastMCP — MCP server framework
Performance
| Metric | Value |
|---|---|
| Incremental index | < 30 sec |
| Search latency (warm) | < 500 ms |
| First search (cold start) | < 5 sec |
| RAM (search) | ~150 MB |
| RAM (indexing) | ~300 MB |
Development
pip install -e ".[dev]"
pytest
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dejasearch-0.3.1.tar.gz.
File metadata
- Download URL: dejasearch-0.3.1.tar.gz
- Upload date:
- Size: 22.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e75abc74cbd53f82b00883ffbe794b1cfa4c7c85ea36d273be623cc65120afd
|
|
| MD5 |
e5a10e13526469e03d5e54e60433780c
|
|
| BLAKE2b-256 |
3a7fa9c5b496ca5d4285e2a5940dfe7fd44e6b5ab60a7a08e661faafc08afac1
|
Provenance
The following attestation bundles were made for dejasearch-0.3.1.tar.gz:
Publisher:
release.yml on CynepMyx/deja
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dejasearch-0.3.1.tar.gz -
Subject digest:
7e75abc74cbd53f82b00883ffbe794b1cfa4c7c85ea36d273be623cc65120afd - Sigstore transparency entry: 1255637092
- Sigstore integration time:
-
Permalink:
CynepMyx/deja@5de612d0e78ebd61b6c89cf7ec5400003a46c513 -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/CynepMyx
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5de612d0e78ebd61b6c89cf7ec5400003a46c513 -
Trigger Event:
push
-
Statement type:
File details
Details for the file dejasearch-0.3.1-py3-none-any.whl.
File metadata
- Download URL: dejasearch-0.3.1-py3-none-any.whl
- Upload date:
- Size: 18.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e2522eb81345f992f0913848408834d75f90f2c009d75da1f469e129ded9af1
|
|
| MD5 |
2426de9e8debc5c5db0d76836680d45c
|
|
| BLAKE2b-256 |
85c5c13a674c029bc3353e242968aae8f471a73e62fd7ad383d6ffe537cd7355
|
Provenance
The following attestation bundles were made for dejasearch-0.3.1-py3-none-any.whl:
Publisher:
release.yml on CynepMyx/deja
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dejasearch-0.3.1-py3-none-any.whl -
Subject digest:
6e2522eb81345f992f0913848408834d75f90f2c009d75da1f469e129ded9af1 - Sigstore transparency entry: 1255637166
- Sigstore integration time:
-
Permalink:
CynepMyx/deja@5de612d0e78ebd61b6c89cf7ec5400003a46c513 -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/CynepMyx
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5de612d0e78ebd61b6c89cf7ec5400003a46c513 -
Trigger Event:
push
-
Statement type: