redis-memory-mcp
This repo is no longer developed. Development continues at
sergesha/claude-essentials
as an independently-versioned package, starting from v0.5.0 (this repo's last release was
v0.4.0). start.sh here only redirects there now — existing installs that curl this file from
main pick up new releases automatically, no config changes needed. New installs should use
sergesha/claude-essentials directly; see its README for install instructions.
Persistent cross-session memory for AI agents — semantic search + KV store with auto-expiry
Long-term self-managing memory for LLM agents (Cursor, Claude Code, etc.) via MCP.
Features
- Semantic search (
mem_*) — save facts with vector embeddings, find by meaning
- Key-value store (
kv_*) — instant O(1) lookup for named facts
- Auto-expiry — TTL resets on every read; unused facts expire, popular ones live forever
- Multi-project —
NAMESPACE isolates data between projects/agents; tags filter within one
- Dual-scope access — every tool call takes
shared: bool, so one client can reach both its own namespaced area and the always-present shared area, per call
- Shared deployment —
REDIS_MEMORY_MCP_MODE=shared lets many agents reuse one backend instead of each starting its own
- Self-contained — Docker stack: Redis Stack + HuggingFace TEI embeddings + MCP server
Quick Start
# 1. Clone
git clone https://github.com/yourname/redis-memory-mcp
cd redis-memory-mcp
# 2. Start infrastructure
docker compose up -d
# 3. Add to your AI tool's MCP config
Cursor (~/.cursor/mcp.json)
{
"mcpServers": {
"redis-memory-mcp": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"-e", "REDIS_URL=redis://host.docker.internal:6379/0",
"-e", "EMBED_URL=http://host.docker.internal:8081",
"-e", "INDEX_NAME=idx:memories",
"redis-memory-mcp"
]
}
}
}
Claude Code
Works automatically via .mcp.json in the repo root when using as a Claude plugin.
Tools (8 total)
Key-Value Storage — instant lookup
| Tool | Description |
|---|
kv_set(key, value, tags?, ttl_days?, shared?) | Store a named fact |
kv_get(key, shared?) | Retrieve by exact key (refreshes TTL) |
kv_delete(key, shared?) | Delete by key |
kv_list(tag?, pattern?, shared?) | List entries with filtering |
Semantic Memory — vector search
| Tool | Description |
|---|
mem_save(text, code?, tags?, ttl_days?, shared?) | Save fact with embedding |
mem_search(query, tags?, top_k?, shared?) | Find by meaning (refreshes TTL on hits) |
mem_list(limit?, tag?, shared?) | Browse by recency |
mem_delete(memory_id, shared?) | Delete by ID |
shared (default false, all tools) — see shared — reaching both areas from one client below.
TTL & Auto-Expiry
| TTL | Use case |
|---|
ttl_days=90 (default) | Normal facts — expire if unused for 90 days |
ttl_days=0 | Permanent — API keys, critical config |
ttl_days=7 | Short-lived context |
- TTL resets on every read — frequently accessed facts never expire
- Redis
volatile-lru evicts least-recently-used facts under memory pressure
- Only facts with TTL can be evicted; permanent facts (
ttl_days=0) are safe
Architecture
┌─────────────────┐ ┌────────────────────┐ ┌───────────────────┐
│ Cursor / Claude │────▶│ redis-memory-mcp │────▶│ Redis Stack │
│ (MCP client) │ MCP │ (Python, stdio) │ │ + RediSearch │
└─────────────────┘ └────────┬───────────┘ │ + HNSW index │
│ └───────────────────┘
▼
┌────────────────────┐
│ HuggingFace TEI │
│ (embeddings, CPU) │
└────────────────────┘
- Redis Stack — RediSearch module with HNSW vector index (768 dim, cosine)
- TEI —
paraphrase-multilingual-mpnet-base-v2 (multilingual, runs on CPU)
- MCP server — Python FastMCP over stdio
Environment Variables
| Variable | Default | Description |
|---|
REDIS_URL | redis://localhost:6379/0 | Redis connection URL |
EMBED_URL | http://localhost:8081 | TEI embeddings endpoint |
INDEX_NAME | idx:memories (or idx:memories:{NAMESPACE}, see below) | Redis search index name |
NAMESPACE | unset | Isolates kv_*/mem_* data on a shared instance — see below |
DEFAULT_TTL | 7776000 (90 days) | Default TTL in seconds |
REDIS_MEMORY_MCP_MODE | dedicated | start.sh only — see Shared Deployment below |
Shared Deployment (one backend, many agents)