claudecode-infinite-memory
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
claudecode-infinite-memory
A lightweight MCP memory server built on SQLite + FTS5, providing cross-session long-term memory for Claude Code. Supports three-source merged retrieval: long-term memories, session history, and knowledge base indexing.
Features
Long-term memory — Store and retrieve persistent memories across sessions with deduplication
Session indexing — Automatically indexes Claude Code session transcripts (user + assistant messages)
Knowledge base — Drop
.mdfiles in a folder and get them auto-indexed with FTS5Three-source search — Queries all three sources simultaneously with importance-weighted re-ranking
Incremental sync — Only re-indexes files that actually changed (hash + mtime detection)
Zero external model dependencies — Pure keyword-based retrieval using FTS5 BM25, no embedding models needed
Related MCP server: recall-mcp
How It Works
graph BT
subgraph Data Sources
CC["Claude Code Sessions\nauto-generated .jsonl"]
MD["Knowledge Files\nuser-managed .md"]
STORE["memory_store() calls\nfrom Claude Code"]
end
subgraph Index & Storage
SESS["Layer 1: session_chunks\nFTS5 indexed"]
KNOW["Layer 2: knowledge_chunks\nFTS5 indexed"]
MEM["Layer 3: memories\nFTS5 indexed"]
end
CC -->|auto sync| SESS
MD -->|auto sync| KNOW
STORE -->|store + dedup| MEM
SESS --> SEARCH["memory_search(query)"]
KNOW --> SEARCH
MEM --> SEARCH
subgraph Claude Code Client
USER["User Input"] --> LLM["Claude LLM"]
end
SEARCH -->|results| LLMRequirements
Node.js 18+ (20+ recommended)
Run
npm installin the project directory
Quick Start
# Development mode (stdio)
npm run dev
# Production build
npm run build
npm startIntegration with Claude Code
Add the following to your Claude Code MCP config (~/.claude.json):
{
"mcpServers": {
"claudecode-infinite-memory": {
"command": "npm",
"args": ["--prefix", "/path/to/claudecode-infinite-memory", "run", "-s", "dev"],
"env": {
"MCP_MEMORY_DB_PATH": "/path/to/claudecode-infinite-memory/memory.sqlite",
"MCP_MEMORY_CLAUDE_HISTORY_PATH": "~/.claude/history.jsonl",
"MCP_MEMORY_SESSIONS_PATH": "~/.claude/projects",
"MCP_MEMORY_KNOWLEDGE_PATH": "/path/to/your/knowledge-base",
"MCP_MEMORY_DEFAULT_LIMIT": "5",
"MCP_MEMORY_MAX_LIMIT": "20",
"MCP_MEMORY_WATCH": "false"
}
}
}
}Replace
/path/to/...with your actual paths. Merge into your existingmcpServersif needed.
Tools
memory_store(text, category?)
Store a long-term memory entry.
text(required) — The memory contentcategory(optional) — One of:preference,fact,decision,entity,otherDeduplication — Uses
sha256(text + category)as a unique hash. Duplicate writes returnaction: "duplicate", successful writes returnaction: "stored".
memory_search(query, limit?)
Search across all three data sources with merged ranking.
Data sources:
Long-term memories (
memoriestable) — FTS5 full-text search with BM25 ranking, LIKE fallbackSession history (session JSONL files) — FTS5 full-text search on indexed session transcripts
Knowledge base (
knowledge_chunkstable) — FTS5 full-text search on chunked.mdfiles
Ranking strategy:
Each source produces TopK candidates (
limit * 5, capped at 50)Results are re-ranked:
finalScore = baseScore + importanceBoostImportance boost factors: source weight + structure weight + category weight
Final results sorted by
finalScoredesc, thencreatedAtdesc
memory_forget(id)
Delete a specific memory entry by ID. Returns { deleted: true | false }.
Environment Variables
Variable | Default | Description |
|
| SQLite database path |
|
| Claude Code session history file |
|
| Directory containing session JSONL files |
| (empty, disabled) | Knowledge directory path; put |
|
| Default search result count |
|
| Maximum search result count |
|
| Knowledge indexing chunk size (approximate tokens) |
|
| Chunk overlap size (approximate tokens) |
|
| Cooldown before incremental sync on search (ms) |
|
| Full sync on server startup |
|
| Enable file watcher for knowledge directory |
|
| File watcher debounce interval (ms) |
Knowledge Base (Layer 2)
Set MCP_MEMORY_KNOWLEDGE_PATH to a directory containing .md files.
How it works:
On startup — Full scan, approximate token-based chunking (default 400 tokens/chunk, 80 overlap), FTS5 indexing
On search — Cooldown check + change detection, incremental rebuild if needed
Incremental sync — mtime change triggers hash comparison, only changed files are re-chunked
Deletion sync — Files removed from disk are automatically cleaned from the index
Config change rebuild — Changing chunk parameters triggers a full rebuild (detected via
knowledge_meta)File watcher (optional) — Set
MCP_MEMORY_WATCH=trueforfs.watch-based monitoring with debounce
When MCP_MEMORY_KNOWLEDGE_PATH is not set, this feature is silently skipped.
Three-Layer Memory Architecture
Layer | Source | Write Method | Index Method | Characteristics |
Layer 1 | Session JSONL files | Auto (Claude Code) | FTS5 chunked index | Zero-config, session transcript search |
Layer 2 | Knowledge | Manual (user drops files) | FTS5 chunked index (approx. tokens) | High precision, requires file maintenance |
Layer 3 |
| Claude Code / user-triggered | FTS5 + triggers | Precise, driven by CLAUDE.md instructions |
See ARCHITECTURE.md for detailed technical documentation.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Shared memory MCP server for Claude Code, Codex, Gemini CLI and Cursor. Cited, editable.
Persistent memory for AI assistants. Save once; recall from Claude, ChatGPT, or any MCP client.
Persistent memory for AI agents across Claude, ChatGPT and any MCP client.
Private persistent memory for Claude, ChatGPT & Gemini via MCP - semantic search, zero-code setup.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceLong-term memory MCP server for Claude Code with SQLite FTS5 full-text search, BM25 ranking, access tracking, and upsert deduplication. Zero config via npx.65 npmMIT
- AlicenseNot gradedqualityDmaintenancePersistent memory MCP server for AI coding agents. Stores, searches, and retrieves context across sessions using SQLite and FTS5.MIT
- AlicenseNot gradedqualityCmaintenanceLong-term memory MCP server for Claude Code with SQLite persistence, encryption, semantic search, and automatic memory linking.14 npm1MIT
- AlicenseAqualityDmaintenanceA zero-dependency MCP server for cross-session memory recall in Claude Code. Provides lexical search, listing, and retrieval of past session memories to avoid re-explaining context.310 npmMIT