mem-graph
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
mem-graph
mem-graph is a local-first MCP server that gives agents durable, inspectable, graph-relational memory. It stores memories with relationships (wikilinks, BM25 auto-links, parent-child edges) and retrieves them via FTS5 plus spreading activation with synaptic decay.
Features
Layered storage — five memory layers (
working,episodic,procedural,semantic,partner) with layer-aware decay and retrieval.Wikilinks —
[[reference]]markdown syntax creates hard, operator-curated graph edges.BM25 auto-linking — soft edges auto-created to textually-overlapping memories on every insert.
Spreading activation — retrieval is text-match plus neighborhood traversal with weight attenuation, not pure FTS.
Synaptic decay — synapse weights erode over time, with separate rates per layer pair and per connection type, and access-based exemption for hot edges.
Epistemic Memory kernel — strict v0.3/v0.4 records, bounded prime compilation, neutral synthesis, and stale-belief maintenance with deliberate challenge, belief-use, linked-outcome, contradiction, freshness, influence, and review-queue projections.
Related MCP server: supermem
Install
git clone https://github.com/GoVanAI/mem-graph
cd mem-graph
npm installRegister as an MCP server (e.g., ~/.config/opencode/opencode.jsonc or Claude Code's MCP config):
{
"mcpServers": {
"mem-graph": {
"command": "npm",
"args": ["start", "--prefix", "/absolute/path/to/mem-graph"],
"env": {
"MEM_GRAPH_DIR": "/absolute/path/to/your/mem-graph-db"
}
}
}
}The server reads MEM_GRAPH_DIR literally — ~ is not expanded at runtime. Default (without MEM_GRAPH_DIR) is ~/.local/share/mem-graph/memory.db.
Run
npm startTests
npm test # run once, exits 0 on success
npm run test:watch # watch modeThe Vitest suite runs the substrate, cognitive layer, and Epistemic Memory kernel against an in-memory SQLite (tests/helpers.ts, createInMemoryDb()). See tests/ for fixtures.
Tool surface
Group | Tools | Count |
SQL |
| 4 |
Orient |
| 4 |
Search |
| 5 |
Write |
| 7 |
Graph |
| 6 |
Cognitive layer |
| ~12 |
Epistemic |
| ~6 |
Workflow profiles |
| — |
The cognitive and epistemic layers are part of mem-graph's substrate; they are not a separate framework.
Source layout
src/
├── access.ts # SQLite access layer
├── activate.ts # spreading activation retrieval
├── auto-link.ts # BM25 auto-linking on insert
├── bootstrap.ts # substrate bootstrap
├── cognitive/ # cognitive layer
│ ├── agent-bootstrap.ts
│ ├── agent-practice-eval.ts
│ ├── bootstrap-disclosure.ts
│ ├── concept-diff/
│ ├── event-contracts.ts
│ ├── events.ts
│ ├── operator-adoption.ts
│ ├── policy.ts
│ ├── pre-mortem/
│ ├── retrieval.ts
│ ├── schema.ts
│ ├── task-state-manifest.ts
│ ├── task-state-server.ts
│ ├── task-state.ts
│ └── types.ts
├── db.ts # SQLite schema DDL
├── decay.ts # synaptic decay matrix
├── epistemic/ # Epistemic Memory kernel
│ ├── dream-bridge.ts
│ ├── index.ts # public import surface
│ ├── maintenance.ts
│ ├── maintenance-runtime.ts
│ ├── persistence.ts
│ ├── prime.ts
│ ├── projections.ts
│ ├── schema.ts
│ ├── self-correct-bridge.ts
│ ├── synthesize.ts
│ ├── task-ledger.ts
│ ├── types.ts
│ └── validate.ts
├── import-memsol.ts # one-shot migration from mem-sol v1
├── index.ts # MCP server entry point
├── memory-prime.ts # priming helpers
├── memory-read.ts # read helpers
├── migrations/ # DB migration system
│ ├── baseline.ts
│ ├── index.ts
│ └── registry.ts
├── tool-profiles.ts # workflow-oriented MCP profiles
├── tools/ # MCP tool implementations
│ ├── cognitive.ts
│ ├── epistemic.ts
│ ├── memory-graph.ts
│ ├── memory-import.ts
│ ├── memory-orient.ts
│ ├── memory-search.ts
│ ├── memory-tags.ts
│ ├── memory-write.ts
│ └── sql.ts
├── util.ts
└── wikilink.ts # wikilink extraction and resolutionSchema
See src/db.ts for the canonical DDL.
memories— relational layer; columns:id,layer,title,slug,content,project_id,category,lifecycle,status,confidence,boost,summary,session_id,source,created_at,updated_at,accessed_at,access_count,importance_score,expires_at,refresh_strategymemory_tag— junction table,(memory_id, tag)PK withON DELETE CASCADEsynapses— graph edges;source_id,target_id,connection_type(wikilink/bm25_auto/parent_child),weight(0.0–5.0),access_countmemories_fts— FTS5 mirror (porter stemmer + 2/3-char prefix), kept in sync by triggersdecay_matrix—(source_layer, target_layer, connection_type) → decay_rate; wildcard*for target_layer
Five layers
Layer | Purpose | Decay (vs same layer) |
| In-progress, in-flight | Aggressive (0.70 wikilink, 0.40 bm25) |
| Session events, time-anchored | Moderate (0.95 wikilink, 0.88 bm25) |
| Connective tissue, conceptual | Stable (0.99 wikilink, 0.93 bm25) |
| How-to, never-fade rules | Highly stable (0.995 wikilink, 0.98 bm25) |
| User model, prefs | Most stable (0.999 wikilink, 0.97 bm25) |
Locked decisions
# | Decision | Choice |
D1 | Tag storage | Junction table |
D2 | Wikilink direction | Author = source |
D3 | Cycle prevention |
|
D4 | Decay frequency | Tool exposed, runs via cron |
D5 | Synapse cap | 50 in + 50 out per memory, enforced on insert |
D6 | Wikilink rendering | Auto-render to title in tool output |
D7 |
| Both memories and synapses |
D8 | ID format | Integer, autoincrement |
License
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Persistent, portable memory for AI assistants — your private memory graph, from any MCP client.
Persistent memory, knowledge graph, task management and more for AI agents via MCP.
Graph-native persistent memory for AI agents — 33 MCP tools, zero-LLM writes.
Shared cross-LLM long-term memory over MCP: semantic recall, sessions, and media (pgvector).
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceOpen-source MCP server that gives any LLM long-term memory using a knowledge graph and vector search hybrid. It stores entities, observations, and relationships, enabling semantic recall across sessions with automatic clustering and fail-loud infrastructure.51MIT
- AlicenseNot gradedqualityBmaintenanceMCP server providing persistent AI memory with four-tier retrieval (SQLite FTS5, graph, vector, LLM agent) to give AI assistants structured, long-term memory without RAG.1Apache 2.0
- AlicenseNot gradedqualityFmaintenanceKnowledge-graph memory server for MCP-compatible AI tools, providing persistent, connected memory with typed relationships and auto-consolidation.34 npmMIT
- AlicenseAqualityAmaintenanceGraph-based MCP server for persistent AI memory, session checkpointing, context compression, and cross-session context management for LLM applications.645 PyPI35MIT