CORTEX Memory MCP
Integrates with Ollama to run local language models for memory scoring, tagging, reranking, and consolidation.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@CORTEX Memory MCPremember that my favorite color is blue"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
π§ CORTEX Memory MCP
Persistent semantic memory for AI agents. TypeScript Β· LangGraph.js Β· Qdrant Β· fastembed ONNX Β· Ollama β 100% local, zero mandatory cloud.
What is CORTEX?
CORTEX is a Model Context Protocol (MCP) server that gives AI agents a persistent, semantically searchable long-term memory. Unlike simple key-value stores, CORTEX understands what information is important, how memories relate to each other, and which memories are becoming stale over time.
Built for agents running in CPU-only environments β no GPU required, no cloud dependencies.
Related MCP server: RecallNest
Architecture β 3 Memory Layers
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CORTEX v3.2 β
β β
β β WORKING MEMORY temp_memories (Qdrant) β
β ββ quick_observe β instant write, no LLM β
β β
β β‘ SEMANTIC MEMORY cortex_<project> (Qdrant) β
β ββ dense (all-MiniLM-L6-v2) + sparse (SPLADE) β
β ββ scored by qwen3 Β· linked Β· decay-weighted β
β β
β β’ EPISODIC MEMORY cortex_episodes_<project> (Qdrant) β
β ββ sessions with timestamped events, no LLM β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββKey Features
Feature | Details |
LLM scoring on ingest |
|
Hybrid search | Dense (all-MiniLM-L6-v2) + Sparse (SPLADE_PP_en_v1) via Qdrant RRF fusion |
Cross-encoder reranking | Single |
Dual decay engine | Bayesian (DECISION/FACT/ERROR) + FSRS-inspired (PREFERENCE/CONTEXT) |
Contradiction detection | Auto-marks superseded memories on ingest |
Episodic sessions | Zero-LLM session tracking with typed events |
Operator Profile | Persistent coding preferences and work patterns |
20 MCP tools | Complete CRUD + search + analytics surface |
100% local | fastembed ONNX for embeddings, Ollama for LLM β no API keys needed |
Competitive Landscape (June 2026)
CORTEX | mem0 | Graphiti | Basic Memory | MCP Official | |
LLM scoring on ingest | β | β | β | β | β |
Hybrid search (dense+sparse) | β | β οΈ cloud | β | β | β |
Cross-encoder reranking | β | β οΈ cloud | β | β | β |
Episodic layer (no LLM) | β | β | β | β | β |
Dual decay engine | β | β | β bi-temporal | β | β |
Contradiction detection | β | β | β | β | β |
TypeScript + LangGraph.js | β | β Python | β Python | β Python | β |
100% local | β | β οΈ MCP=cloud | β | β | β |
Prerequisites
# 1. Qdrant (Docker)
docker run -d -p 6333:6333 --name qdrant qdrant/qdrant
# 2. Ollama + models
ollama pull qwen3:8b # scoring, tagging, reranking, consolidation
# optional faster alternative:
# ollama pull qwen3:1.7b # 3-5Γ faster on CPU, slightly lower accuracyfastembed (embeddings) is bundled as an npm dependency β no separate installation needed. Models download automatically to
.fastembed_cache/on first use (~22 MB dense, ~110 MB sparse).
Installation
git clone git@github.com:alainrc2005/cortex_memory_mcp.git
cd cortex_memory_mcp
npm install
npm run buildEnvironment Configuration
Create a .env file in the project root:
QDRANT_URL=http://localhost:6333
FASTEMBED_CACHE_DIR=/absolute/path/to/cortex_memory_mcp/.fastembed_cache
# Optional β only needed if Qdrant has auth enabled
# QDRANT_API_KEY=your_key
# Optional β defaults to http://localhost:11434
# OLLAMA_URL=http://localhost:11434MCP Configuration
Add to your MCP client config (e.g. ~/.gemini/config/mcp_config.json):
{
"mcpServers": {
"langgraph-memory-mcp": {
"command": "/absolute/path/to/cortex_memory_mcp/cortex-mcp.sh"
}
}
}Tool Reference β 20 Tools
Semantic Memory (17 tools)
Tool | Description | Trigger |
| Store a memory through the full pipeline: score β embed β link β persist | Manual / session close |
| Hybrid BM25+dense search with LLM cross-encoder reranking | On demand |
| RAG-style context injection for a project + message | Auto (cold start) |
| Merge duplicate/similar memories using LLM | End of long session |
| Extract operator behavior patterns, update Operator Profile | Periodic |
| Read coding preferences and detected patterns | Auto (cold start) |
| System health: collections, engram counts, pending buffer | Diagnostic |
| Delete a single engram by ID | On demand |
| Update engram content, recalculate embedding + score | On demand |
| List all engrams for a project sorted by decay score | Audit |
| β οΈ Irreversible reset of a project (requires | Explicit only |
| Store up to 20 memories in one call | Bulk import |
| Export project as JSON (backup/migration) | On demand |
| Write to working buffer instantly β no LLM, no embedding | Auto (post-turn hook) |
| View working buffer contents by project | Diagnostic |
| Promote buffer β semantic memory with ONNX embedding + LLM scoring | Auto (next cold start) |
| Search both buffer (keyword) and indexed memories (semantic) simultaneously | On demand |
Episodic Memory (3 tools)
Tool | Description |
| Open an episodic session for a project. Auto-closes any previous open session. Returns |
| Record a typed event in the active session. Types: |
| Semantic search over past session summaries using fastembed ONNX |
Indexing Pipeline
quick_observe(content)
β
βΌ (instant, no LLM, no embedding)
temp_memories βββββ working buffer (Qdrant, dummy vectors)
β
β index_temp() β called at next session cold start
βΌ
fastembed ONNX
ββ AllMiniLML6V2 β dense vector 384d
ββ SpladePPEnV1 β sparse BM25 vector
β
qwen3 (Ollama)
ββ importance: 1-10
ββ type: DECISION | FACT | ERROR | PATTERN | PREFERENCE | CONTEXT
ββ tags: [keyword, ...]
β
Contradiction detection (qwen3)
ββ marks superseded memories if similarity > 0.88
β
βΌ
Qdrant upsert (dense + sparse vectors)
ββ bidirectional links to related engramsDecay Engine
CORTEX uses a dual decay model tuned per memory type:
Bayesian (DECISION Β· FACT Β· ERROR Β· PATTERN)
utility = alpha / (alpha + beta)
alpha += importance on access
beta += 1 per day without accessFSRS-inspired (PREFERENCE Β· CONTEXT)
stability = log1p(accessCount) Γ (importance / 5)
retrievability = exp(-daysSinceAccess / stability)Memories accessed frequently become more stable. Stale, unaccessed memories decay toward zero and eventually become candidates for consolidation.
Project Structure
src/
βββ server.ts # MCP server β 20 tools, ~1500 LOC
βββ bootstrap.ts # Qdrant collection init on startup
βββ graph/
β βββ observe/
β β βββ workflow.ts # LangGraph pipeline: scoreβembedβlinkβpersist
β β βββ state.ts # Graph state types
β β βββ nodes/
β β βββ score.ts # qwen3: importance + type + tags
β β βββ embed.ts # fastembed ONNX: dense + sparse vectors
β β βββ link.ts # Bidirectional links in Qdrant
β β βββ persist.ts # Final upsert
β βββ consolidate/
β βββ nodes.ts # LLM merge of duplicate engrams
βββ services/
β βββ qdrant.ts # Qdrant client, collections, hybrid search
β βββ fastembed.ts # ONNX embeddings: dense (AllMiniLM) + sparse (SPLADE)
β βββ ollama.ts # qwen3: scoring, reranking, contradiction detection
β βββ decay.ts # Dual decay engine: Bayesian + FSRS-inspired
β βββ episode.ts # Episodic session management
βββ types/
βββ engrama.ts # Engram TypeScript types
βββ episode.ts # Episode/event typesRunning Tests
npm test
# Covers all 20 tools with valid, invalid, and connectivity test casesMemory Lifecycle
Session N (active)
Agent detects storable fact
β
quick_observe() β instant, no CPU cost
β
Written to temp_memories
Session N+1 cold start
get_context_for() + get_operator_profile() β parallel
β
Pending in temp_memories? β index_temp()
β
fastembed ONNX + qwen3 scoring applied
β
Promoted to cortex_<project> with full embeddings
β
Available for recall() and get_context_for()License
MIT Β© 2026 β Built by Zeus with Antigravity
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/alainrc2005/cortex_memory_mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server