Skip to main content
Glama

memory-mcp

A local MCP server that manages an agent's long-term memory. Memory is treated not as something to "store and retrieve" but as a lifecycle in which it is born, recalled, amended, judged, and sinks.

Core idea

An agent's memories are of two kinds. Memories with ground truth (such as code indexes) can rely on hash synchronization, but assertion memories without ground truth — user utterances, decisions, and lessons — need state, version, confidence, and a verdict gate. memory-mcp combines the two with a dual structure:

  • source — human-readable markdown files managed with git (<store>/memories/*.md, frontmatter metadata). Lifecycle state, supersede chains, and confidence live here.

  • derivatives — a SQLite index (FTS, ranking, conflict ledger). It can be discarded at any time and rebuilt entirely from the source with a single memory_reindex call.

Designed by analyzing three sources (evidence trails in §12 of docs/design/architecture.md):

Source

What was adopted

codebase-memory-mcp hands-on analysis

source–derivative separation, stat-gate → hash → partial reindexing, coverage honesty, store = directory isolation

Codebase-Memory paper (arXiv:2603.27277)

token economy (return path and excerpt only), confidence attached to derived links, path containment

MemOS paper (arXiv:2507.03724)

state machine + archived staging layer, non-destructive supersede version chain, trust × state × heat ranking

AX workspace memory lifecycle policy

verdict gate (no automatic overwrite), pair-hash idempotency, latest-wins signal, distillation-first compaction, entity dictionary

Related MCP server: cardloom-mcp

How it works

remember ──► active ◄─────────── 본문 수정 시 자동 복귀
               │ supersede 되면 자동
               ▼
            archived ──forget(deprecate, reason 필수)──► deprecated
               │                                            │
               └────────── forget(purge, confirm 필수) ──────┘
                            (파일 삭제 — git 이력이 백스톱)
  • Conflict gate: when memory_remember detects neighboring memories, it returns the verdict material (shared entity, time gap, latest_wins_eligible) in the response. The verdict belongs to the calling agent (and the user) — no automatic overwrite without a verdict. Surfaced pairs are recorded by pair-hash so they are not presented again.

  • Weathering: old, unused memories are not deleted but sink in the ranking — score = text × trust × state × (1 + freshness + heat). When memory_status proposes aging episodes as compaction candidates, the agent summarizes them into a knowledge memory and supersedes the originals.

  • reconcile: no daemon. At the entry of every tool invocation, a stat-gate (mtime + size) → sha256 → only the changed parts are reindexed. Manually edited files also converge on the next invocation. If the body of an archived memory is edited directly, it automatically returns to active (latest intent wins).

  • Korean search: without embeddings, a query planner combines word FTS (prefixes absorb postpositional variants) + trigram FTS (phrases) + a LIKE fallback for unterminated 2-char or smaller queries. So "보안을 끄는" ↔ "보안을 끄고" match.

  • Honesty: recall/status always report index freshness, unparseable files, and unresolved conflicts. A lack of report ≠ completeness.

Tools (7)

Tool

Role

memory_remember

Create a memory (with supersedes). Duplicates are idempotent, conflicts are returned as verdict material.

memory_recall

Hybrid search — path, pay-TM*, and score components only (no body injection).

memory_read

Full text by id/path, supersede chain, conflict history.

memory_index

edit / supersede / set_state / link / resolve_conflict.

memory_forget

archive / deprecate (reason required) / purge (confirmation required). No automatic deletion.

memory_status

aggregates, unresolved conflicts, reviews due, compaction candidates, unparseable files, index freshness.

memory_reindex

full derivative rebuild (disaster recovery) / conditional re-hash audit of everything.

Installation

Node ≥ 22.5 (node:sqlite built-in — no external native dependencies).

pnpm install && pnpm build

Register via Claude Code:

claude mcp add memory-mcp -- node /path/to/memory-mcp/dist/main.js

Or via .mcp.json:

{
  "mcpServers": {
    "memory-mcp": {
      "type": "stdio",
      "command": "node",
      "args": ["/path/to/memory-mcp/dist/main.js"],
      "env": { "MEMORY_MCP_ROOT": "/path/to/your/store" }
    }
  }
}

The default store is ~/.memory-mcp/default (replace with the MEMORY_MCP_ROOT env var, or per-store invocation). If you manage the store in git, the git history becomes the backstop for purge.

Memory file format

---
id: 01JD2K3A9FZQ4W8XVBH5T6N7RM
type: fact | preference | decision | episode | reference | knowledge
state: active | archived | deprecated
trust: user-stated | agent-inferred | imported
entities: [ads-genisys, pacing]
source: "2026-08-24 세션, 사용자 교정"
created: 2026-08-24T14:03:00Z
updated: 2026-08-24T14:03:00Z
review_after: 2026-11-01
---
# 제목 한 줄

본문. 첫 문단이 recall 발췌로 쓰인다.

Adding a <store>/dictionary.md normalizes entity notation (- 정식명: 설명 (aka: 동의어, 약어)).

Development

pnpm typecheck   # tsc --noEmit
pnpm test        # node --test (29 tests)
pnpm lint        # biome
pnpm build       # dist/

Documentation

License

MIT

Install Server
A
license - permissive license
A
quality
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides persistent long-term memory for AI assistants with tag-based retrieval, wiki-style linking, and source references, storing memories as markdown files with SQLite index.
    1
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Provides long-lived, cross-project technical memory for AI agents via markdown cards stored in git and indexed by SQLite, enabling search, retrieval, and human-reviewed knowledge management.
    ISC
  • A
    license
    Not graded
    quality
    A
    maintenance
    Provides AI agents with persistent, long-term memory via OKF-formatted markdown and SQLite indexing, enabling stateful storage, retrieval, and search across sessions.
    188
    MIT

View all related MCP servers

Related MCP Connectors

  • Persistent memory for AI agents. Search, store, and recall across sessions.

  • Shared, governed long-term memory for AI agents across tools and sessions via MCP and REST.

  • Token-efficient MCP memory for Markdown vaults. Tiered search, GraphRAG, AI memories.

View all MCP Connectors

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/drakejin/memory-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server