Labsco
RetroRobAI logo

mcp-memory-graph

from RetroRobAI

Persistent memory for AI agents using a semantic knowledge graph. Store, retrieve, and connect memories with semantic search โ€” so your AI remembers context across sessions.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedFreeQuick setup

mcp-memory-graph

<!-- mcp-name: io.github.RetroRobAI/mcp-memory-graph -->

A context-aware memory MCP server for Claude Code and any MCP-compatible AI agent.

Goes beyond basic vector search by adding authority weighting, conflict detection, and typed relationship edges between memories โ€” so your agent always retrieves the right answer when sources disagree.

Inspired by the context engine architecture described in Unblocked's "How a Context Engine Actually Works".


Why this exists

Standard memory MCP servers store and retrieve memories by semantic similarity. That works until you have conflicting memories โ€” an old instruction saying one thing and a new one saying another. Without authority weighting, the agent retrieves whichever is semantically closer to the query, not whichever is more trustworthy.

mcp-memory-graph solves this with three mechanisms:

ProblemSolution
All memories treated equallyPriority tiers: high / medium / low โ†’ authority scores 1.0 / 0.6 / 0.3
Stale memories persist silentlySupersession tracking: old memories marked status=superseded with typed edges
Duplicates accumulate over timeConflict detection before every store; auto-resolve by authority

Migrating from an existing memory service

If you have an existing memory service (mcp-memory-service, Mem0, or a markdown-based memory system), you can import your memories into mcp-memory-graph using the included migration script.

Migration is manual and opt-in โ€” it never runs automatically. Nothing is written until you explicitly confirm.

Run the migration script

Copy & paste โ€” that's it
python -m mcp_memory_graph.migrate

The script will:

  1. Auto-detect any existing mcp-memory-service SQLite database
  2. Ask if you have a markdown memory directory to import
  3. Show you how many memories it found
  4. Present three choices:
    • [1] Migrate โ€” import everything into mcp-memory-graph
    • [2] Run in parallel โ€” start mcp-memory-graph fresh, keep your old service running
    • [3] Skip โ€” do nothing
  5. Ask for a final confirmation before writing anything

Your existing memory service is never modified โ€” the script only reads from it.


Tools

ToolDescription
store_memoryStore with conflict detection and optional auto-resolve
retrieve_memoriesSemantic search ranked by similarity ร— authority
check_conflictsPreview conflicts before storing
update_memoryUpdate content/priority with supersession tracking
delete_memorySoft delete (preserves history)
add_memory_edgeManually add typed relationship
get_related_memoriesTraverse relationship graph for a memory
list_memoriesList with filters (status, type, priority)

Priority system

Copy & paste โ€” that's it
priority="high"    # authority_score=1.0  โ€” explicit instructions, confirmed preferences
priority="medium"  # authority_score=0.6  โ€” inferred preferences, reference data
priority="low"     # authority_score=0.3  โ€” session summaries, historical context

Retrieval ranking: weighted_score = 1 - (distance / (authority_score + 0.001) / 10)

A high-authority memory will rank above a semantically closer low-authority one when their similarity scores are within ~3x of each other.


Edge types

  • supersedes โ€” this memory replaces another
  • relates_to โ€” connected but not conflicting
  • contradicts โ€” explicitly conflicting, unresolved
  • referenced_by โ€” another memory cites this one

Stack


License

MIT