mcp-server-claude
mcp-server-claude
MCP Memory Server for Claude Code — persistent context across sessions using semantic search (RAG).
Problem
Claude Code compacts conversation history when it exceeds the context window (~200k tokens). This causes loss of operational context between sessions. A database alone doesn't fix this — the solution is selective context retrieval (RAG), not full history loading.
Solution
A local MCP server that:
Saves key fragments from each session with embeddings
On new sessions, retrieves only the top-K semantically relevant fragments (~5-10k tokens)
Provides structured project context (decisions, status, todos) on demand
Architecture
Claude Code CLI
│ MCP Protocol (JSON-RPC 2.0 / stdio)
▼
MCP Memory Server (FastMCP)
├── Tools: remember, recall, get_project_context, list_sessions
├── ChromaDB ← vector store (semantic search)
└── SQLite ← session metadataQuick Start
git clone <repo>
cd mcp-server-claude
pip install -r requirements.txt
cp .env.example .env
# edit .env — set MEMORY_DB_PATH to a directory outside the repo
# Register with Claude Code:
# Add the contents of mcp_config.example.json to ~/.claude/settings.jsonEnvironment
Designed for Zurich Insurance GenAI Platform (LiteLLM proxy UAT, WSL2 Ubuntu 24).
CLAUDE_CODE_DISABLE_PROMPT_CACHING=1— proxy doesn't support caching; this server compensatesAll embeddings run locally (sentence-transformers) — no external calls