MCP Roo Memory

MCP Roo Memory

Persistent, graph-based memory for Roo Code via the Model Context Protocol, enabling structured knowledge management with semantic search and context window control.

Category
访问服务器

README

MCP Roo Memory

Persistent, graph-based memory for Roo Code via the Model Context Protocol (MCP).

LLMs have a short memory. Every new conversation starts from scratch — context windows overflow, past decisions fade, and reasoning chains disappear.

MCP Roo Memory gives your AI agent a structured, persistent brain:

  • Graph memory — knowledge is not a flat dump, but a fractal graph of tasks, entities, facts, and decisions
  • Semantic search — find what matters by meaning, not keywords (50+ languages)
  • Context window control — hot/cold/archive tiers so you don't drown in tokens
  • Knowledge evolution — decisions can be superseded, facts can be updated, stale data gets archived
  • Temporal awareness — time as first-class citizen: chronological walks, session timelines, temporal vector filters

Python 3.11+ MIT Status Docker

⚠️ Disclaimer

This is an experimental project — a search for form and architecture. It works, it has tests, but treat it as a Proof of Concept (PoC). The software is provided "AS IS", without any warranty of any kind. Use it at your own risk. See LICENSE for details.


Quick Start

🐳 Docker (recommended)

Zero system dependencies — just Docker. Everything runs in containers; no Python, no venv, no pip.

1. Start the stack

git clone https://github.com/mcasdfgf/mcp-roo-memory.git
cd mcp-roo-memory
docker compose up -d

This starts two containers:

Container What it does
cortex-qdrant Vector database (port 6333)
cortex-mcp Cortex server (idle, waits for MCP connections)

2. Global MCP configuration

Add Cortex as a global MCP server for all your projects. The server is always running in Docker, so any project can connect.

Edit ~/.config/VSCodium/User/globalStorage/rooveterinaryinc.roo-cline/settings/mcp_settings.json (or the equivalent path for VS Code):

{
  "mcpServers": {
    "cortex": {
      "command": "docker",
      "args": ["exec", "-i", "cortex-mcp", "python3", "-m", "src.cortex"]
    }
  }
}

VSCode users: replace VSCodium with Code in the path above.

3. Project-level configuration (for workspace isolation)

If you want memory isolated per project, copy the reference .roo/ directory into your project:

cp -r ./mcp-roo-memory/.roo ./your-project/

Then edit .roo/mcp.json in your project and add --workspace your-project-name:

{
  "mcpServers": {
    "cortex": {
      "command": "docker",
      "args": [
        "exec", "-i", "cortex-mcp", "python3",
        "-m", "src.cortex", "--workspace", "your-project-name"
      ],
      "alwaysAllow": ["desktop_open", "graph_add_node", "vector_search", "graph_get_node",
                       "graph_add_relation", "graph_search", "desktop_focus",
                       "desktop_history", "graph_traverse", "graph_walk",
                       "graph_decompose", "graph_update_node", "graph_supersede",
                       "graph_delete_node", "vector_store",
                       "temporal_walk", "session_timeline"]
    }
  }
}

Replace your-project-name with a unique identifier — mcp-roo-memory, researcher, ai-pulse, etc.

How isolation works:

  • desktop_open() and graph_add_node() — always write to your project's workspace
  • vector_search() without workspace_id — searches across all projects (cross-project recall)
  • vector_search(workspace_id="project") — narrows search to one project

4. Done

Restart Roo Code. Your agent now has persistent memory — zero system pollution.


🏠 Native pip (advanced)

If you prefer running without Docker — or you're developing Cortex itself:

# Requirements: Python 3.11+
git clone https://github.com/mcasdfgf/mcp-roo-memory.git
cd mcp-roo-memory
python -m venv .venv
source .venv/bin/activate
pip install -e .

# Qdrant is still needed:
docker run -d --name qdrant -p 6333:6333 qdrant/qdrant

MCP config:

{
  "mcpServers": {
    "cortex": {
      "command": "python",
      "args": ["-m", "src.cortex"],
      "env": {
        "CORTEX_DB_PATH": "/path/to/cortex.db",
        "CORTEX_QDRANT_HOST": "localhost",
        "CORTEX_QDRANT_PORT": "6333"
      }
    }
  }
}

Problems This Solves

Problem How Cortex solves it
Flat memory — facts are stored as unrelated chunks Fractal graph — tasks decompose into subtasks, facts connect to decisions, entities index files
Context window overflow — everything grows unbounded Desktop Viewport — Hot (always loaded) / Cold (on focus) / Archive (search only) tiers
No navigation — can't walk a reasoning chain Graph traversal — follow supersedes, derives_from, leads_to relations like a path
Stale facts linger — old decisions pollute context Mutation strategy — Update (typo fix) / Supersede (approach changed) / Stale-cascade (rework)
Keyword search fails — "auth implementation" doesn't find "JWT with RS256" Semantic vector search — multilingual embeddings (50+ languages) via Qdrant + fastembed
No time axis — can't answer "what happened in what order" Temporal layer — chronological walks, session timelines, temporal vector filters

Architecture

┌──────────────────────────────────────────────┐
│              MCP Client (Roo Code)            │
└──────────────────────┬───────────────────────┘
                        │ stdio (MCP protocol)
┌──────────────────────▼───────────────────────┐
│               CortexServer                     │
│         17 tools · 4 resources                 │
├──────────┬──────────┬──────────┬─────────────┤
│ Graph    │ Vector   │ Desktop  │ Database    │
│ CRUD,    │ Qdrant + │ Hot/     │ SQLite      │
│ traverse,│ fastembed│ Cold/    │ graph +     │
│ walk     │ semantic │ Archive  │ history     │
└──────────┴──────────┴──────────┴─────────────┘

Three layers of intelligence:

  1. Graph (SQLite) — who relates to who, what decomposes into what
  2. Vector (Qdrant) — what does this mean, what's semantically similar
  3. Desktop (viewport) — what fits in the context window right now

Using as Primary Roo Memory

Make Cortex your agent's default memory system by copying the .roo/ directory into your project:

# Copy reference config from this repo
cp -r ./mcp-roo-memory/.roo ./your-project/

The .roo/ directory contains ready-to-use reference configs:

File / Dir Purpose
custom_instructions.md Cortex bootstrap — mandatory sequence, core principles
mcp.json Reference MCP server config (edit --workspace for your project)
rules/ Boot, save, templates, triggers — memory lifecycle
rules-architect/ Memory rules for Architect mode
rules-ask/ Memory rules for Ask mode
rules-code/ Memory rules for Code mode
rules-coding-teacher/ Memory rules for Coding Teacher mode
rules-debug/ Memory rules for Debug mode
rules-documentation-writer/ Memory rules for Documentation Writer mode
rules-orchestrator/ Memory rules for Orchestrator mode
rules-project-research/ Memory rules for Project Research mode

For deep understanding of the memory model, see CONCEPT.md.


Tools Overview

Tool What it does
desktop_open Open/restore a workspace session
desktop_focus Bring a node into hot context
desktop_history Get navigation history for a workspace
graph_add_node Store any knowledge: entity, fact, decision, task...
graph_get_node Retrieve a node with its relations
graph_add_relation Create a relation between two nodes
graph_traverse Walk the graph from a starting node
graph_walk Walk along a reasoning chain
graph_decompose Break a task into structured subtasks
graph_update_node Update a node's data in-place
graph_supersede Replace outdated knowledge (keeps history)
graph_delete_node Delete a node and its vector
vector_search Find things by meaning, across 50+ languages
vector_store Store text with automatic vectorization
graph_search Hybrid: semantic + graph subgraph expansion
temporal_walk Chronological graph traversal (time axis)
session_timeline Flat timeline of all events in a session
That's all 17 tools See full list in CONCEPT.md §8

Configuration

All via CORTEX_* environment variables:

Variable Default Description
CORTEX_DB_PATH cortex.db SQLite database path
CORTEX_QDRANT_HOST localhost Qdrant host
CORTEX_QDRANT_PORT 6333 Qdrant port
CORTEX_QDRANT_TIMEOUT 30 Connection timeout (s)
CORTEX_COLLECTION_NAME cortex_memory Qdrant collection name
CORTEX_EMBEDDING_MODEL sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2 Embedding model (50+ languages)
CORTEX_ARCHIVE_DAYS_THRESHOLD 7 Days before auto-archive
CORTEX_DESKTOP_HOT_LIMIT 5 Max hot nodes in viewport
CORTEX_DESKTOP_HISTORY_LIMIT 10 Max history entries

Project Structure

.
├── docker-compose.yml    ← Two services: cortex + qdrant
├── Dockerfile            ← Multi-stage, python:3.11-slim
├── .dockerignore
├── src/cortex/
│   ├── __init__.py    — Cortex factory (component assembly)
│   ├── __main__.py    — MCP server entry point (stdio)
│   ├── config.py      — Configuration (pydantic-settings)
│   ├── db.py          — DatabaseManager (SQLite)
│   ├── desktop.py     — DesktopManager (viewport + timeline)
│   ├── graph.py       — GraphManager (CRUD, navigation, mutation, temporal)
│   ├── models.py      — Pydantic models (Node, Relation, Viewport)
│   ├── server.py      — MCP server (17 tools, 4 resources)
│   └── vector.py      — VectorManager (Qdrant, embeddings, temporal filters)
└── tests/

Deep Dive

Document What you'll find
CONCEPT.md Full philosophy, data model, node taxonomy (17 types), relation taxonomy (22 types), SQL schema
ADR-001 Fractal memory architecture decision
ADR-002 SQLite + JSON for graph instead of Neo4j/Cayley
ADR-003 Qdrant for vectors (existing)
ADR-004 fastembed for embeddings (paraphrase-multilingual-MiniLM-L12-v2)
ADR-005 Desktop Viewport — context window strategy
ADR-006 Knowledge evolution: update / supersede / stale
ADR-007 Regression search: meaning → context → files
ADR-008 Temporal layer — time as first-class citizen
CHANGELOG.md Project release history
CONTRIBUTING.md Development guidelines

Development

# Native install (inside venv)
pip install -e .
pip install pytest pytest-asyncio

# Run all tests (188+ tests)
pytest tests/ -v

# With coverage
pytest tests/ --cov=src.cortex -v

Tests cover every component: models (17), config (19), database (26), graph (19), desktop (14), vector (19), server (19), integration (3) — 136+ total.

See CONTRIBUTING.md for guidelines.


License

MIT © 2026

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选