Cortex

Cortex

Cortex is a local-first MCP server that provides persistent, shared, semantically searchable memory for AI agents across all MCP clients using a single SQLite file.

Category
Visit Server

README

<p align="center"> <img src="cortex.png" alt="Cortex" width="200" /> </p>

<h1 align="center">Cortex</h1>

<p align="center"> <strong>Persistent shared memory for every AI agent, across every MCP client, from one local file.</strong> </p>

<p align="center"> <img src="https://img.shields.io/badge/Python-3.11+-3776AB?logo=python&logoColor=white" alt="Python"> <img src="https://img.shields.io/badge/FastMCP-2.0+-blueviolet?logo=fastapi&logoColor=white" alt="FastMCP"> <img src="https://img.shields.io/badge/SQLite-FTS5%20%2B%20WAL-003B57?logo=sqlite&logoColor=white" alt="SQLite"> <img src="https://img.shields.io/badge/fastembed-BAAI%2Fbge--small-orange?logoColor=white" alt="fastembed"> <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-22c55e" alt="MIT License"></a> </p>


The Problem

Every agent you run today has amnesia.

Claude Desktop forgets what Cursor found. Cursor does not know what Claude Code wrote yesterday. Each session starts from zero.

Cortex is the persistent nervous system that connects them all.


What is Cortex?

Cortex is a local-first MCP server that gives every AI agent a shared, semantically searchable memory layer.

  • No cloud. No Docker. No API keys.
  • One SQLite file at ~/.cortex/cortex.db — shared across all clients
  • Every memory is origin-tagged: who wrote it, from which client, with which model
  • Hybrid search: BM25 keyword + cosine semantic retrieval fused with RRF
  • Built-in deduplication: exact hash + near-duplicate detection (cosine ≥ 0.95)
  • Soft-delete and audit trail on every write and delete

Quick Start

uvx cortex-mcp

That's it. The server starts, creates ~/.cortex/cortex.db, and is ready to accept connections from any MCP client.


Client Configuration

Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "cortex": {
      "command": "uvx",
      "args": ["cortex-mcp"]
    }
  }
}

Claude Code

claude mcp add cortex -- uvx cortex-mcp

Cursor / Zed / Windsurf

{
  "mcpServers": {
    "cortex": {
      "command": "uvx",
      "args": ["cortex-mcp"]
    }
  }
}

Local Development

git clone https://github.com/yourusername/cortex-mcp
cd cortex-mcp
uv sync
uv run cortex-mcp

Point any MCP client at your local clone:

{
  "mcpServers": {
    "cortex": {
      "command": "uv",
      "args": ["--directory", "/path/to/cortex-mcp", "run", "cortex-mcp"]
    }
  }
}

Tools

Tool Description
remember_fact Store a single atomic fact with automatic deduplication
save_memory Compact a full session into structured, searchable memories
recall Hybrid semantic + keyword search across all stored memories
list_memories Chronological listing with optional filters
forget Soft-delete a memory by ID (retained for audit)
correct_memory Replace an incorrect memory with a corrected version
verify_memory Explicitly mark a memory as verified
get_agents List all agents that have written memories
get_stats Operational health snapshot (counts, DB size, expiry)
cortex_ping Health check — verify the server is running

How Memory Works

Session ends
    │
    ▼
save_memory / remember_fact
    │
    ├── Exact dedup (SHA-256 hash)
    ├── Near-dedup (cosine similarity ≥ 0.95)
    ├── Embed (BAAI/bge-small-en-v1.5, 384-dim)
    └── Write to SQLite + FTS5 index
                │
                ▼
            recall(query)
                │
                ├── FTS5 pre-filter (top 200 candidates)
                ├── BM25 keyword rank
                ├── Cosine semantic rank
                └── RRF fusion → top_k results

Configuration

All settings are environment variables with the CORTEX_ prefix:

Variable Default Description
CORTEX_DB_PATH ~/.cortex/cortex.db SQLite database path
CORTEX_EMBED_MODEL BAAI/bge-small-en-v1.5 Sentence embedding model
CORTEX_TOP_K_DEFAULT 5 Default recall result count
CORTEX_DEDUP_THRESHOLD 0.95 Near-duplicate cosine threshold
CORTEX_LOG_LEVEL INFO Log level (DEBUG/INFO/WARNING/ERROR)

Requirements

  • Python 3.11+
  • uv (recommended) or pip

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured