Configuration
You configure r3 through environment variables passed to the process your MCP client launches. This page covers the available variables, storage backends, intelligence modes, and an example with cloud sync enabled.
Environment variables
Section titled “Environment variables”MEM0_API_KEY
Section titled “MEM0_API_KEY”string
Enables Mem0 cloud sync. When unset, r3 runs entirely local and nothing leaves your machine.
REDIS_URL
Section titled “REDIS_URL”string · Default: embedded
URL of an external Redis server. Leave unset to use the embedded Redis server (recommended for most setups).
MEM0_USER_ID
Section titled “MEM0_USER_ID”string · Default: default
Default namespace for memory isolation. Individual tool calls can override this with the user_id argument.
INTELLIGENCE_MODE
Section titled “INTELLIGENCE_MODE”string · Default: enhanced
Set to enhanced (default) or basic. Enhanced mode adds entity extraction, knowledge graph tools, and HuggingFace embeddings. Basic mode uses a simpler word-hash fallback.
boolean · Default: false
Enable debug logging to stderr. Keep quiet mode enabled for normal MCP use so stdout stays reserved for protocol messages.
Storage backends
Section titled “Storage backends”Embedded Redis
Section titled “Embedded Redis”r3 uses redis-memory-server to download and manage a local Redis binary automatically. It stores memory content and metadata. If the embedded server cannot start, r3 falls back to an in-process store. No external Redis installation is required.
Local vector index
Section titled “Local vector index”r3 maintains a file-backed vector index at ./data/vectra-index relative to the process working directory. This powers semantic search with no network calls. Keep the working directory stable so the index path does not change between restarts.
Mem0 cloud (optional)
Section titled “Mem0 cloud (optional)”Setting MEM0_API_KEY activates Mem0 cloud sync. Without a key, r3 operates entirely offline. With a key, writes are also sent to Mem0 so memories can follow you across devices.
Intelligence modes
Section titled “Intelligence modes”Enhanced mode is the default. It adds three extra tools: extract_entities, get_knowledge_graph, and find_connections. It also loads @huggingface/transformers embeddings for semantic search. This mode needs network access for the initial model download and more CPU for inference.
Basic mode skips the HuggingFace model and entity extraction. Semantic search falls back to a word-hash implementation. Use this mode if you want faster startup, lower resource usage, or if enhanced initialization fails.
Example: cloud sync enabled
Section titled “Example: cloud sync enabled”Add the env block to your MCP config to enable Mem0 cloud sync:
{ "mcpServers": { "r3": { "command": "npx", "args": ["@n3wth/r3"], "env": { "MEM0_API_KEY": "mem0_..." } } }}