Adaptive Memory MCP server - SQLite-backed memory for OpenCode
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
Status: v2.2.8 β a temporal, conflict-aware, hybrid-retrieval memory engine. 16 MCP tools, 25 passing test suites. Non-destructive schema migration from v1 (all v1 data preserved). New in v2.2: lifecycle states, temporal validity, conflict/dedup resolution with USER/SESSION/PROJECT/GLOBAL scope, hybrid FTS+vector retrieval (RRF), memory graph, get_context assembly, periodic consolidation, and link_memory / merge_memory / update_memory / import_memory / extract_memories. New in v2.2.3: scope-enforced retrieval, graph scope isolation, export/import round-trip, hardened import path (realpath), strict import validation, N+1 query elimination, cold/ablation benchmark, and MEMORY_RETRIEVAL_MODE switch. New in v2.2.7: synced secret filter between Claude hook and capture-core (6-pattern redact instead of line-drop), fixed err() to return isError:true per MCP spec, fixed backup rotation (backup only when migrations pending + prune to 5 files), and added hook error logging for SessionEnd distill. New in v2.2.8: fixed scope contamination 0.75β0 (critical) and conflict false 0β1 (GLOBAL leak), fixed graph hop1 0.52β1.0 via includeGraph, and rescaled benchmark profiles to 5K/20K/100K/500K/1M (pre-commit now quick 5K + normal 20K only).
better-sqlite3 native build and import.meta.url resolution) and the MCP SDK requires a modern runtime. CI tests on Node 20.x and 22.x.npm install, npm run build, npm test).MEMORY_DB_PATH is easiest to set with setx; on macOS/Linux use export in your shell profile.No external services, accounts, or API keys are required β everything lives in a single local SQLite file.
Fastest path: after cloning, run npm run quickstart β it builds, wires opencode.json, deploys the plugin, and sets MEMORY_DB_PATH for you in one command. The steps below show exactly what it does (use them if you prefer manual control).
Install via npm (alternative): install the server globally with npm install -g th-memory-mcp (or run it on demand with npx th-memory-mcp), then point the mcp command in opencode.json to th-memory-mcp instead of the built dist/index.js. The auto-capture plugin still comes from this repo (copy src/plugin/learning-capture.ts as described in step 4 below).
~/.config/opencode/opencode.json (replace <REPO> with the absolute clone path):src/plugin/learning-capture.ts β ~/.config/opencode/plugins/See ARCHITECTURE_v2.md for the full architecture spec.
LLMs don't remember you between sessions β every new chat starts blank. th-memory-mcp gives your AI a private, local long-term memory:
th-memory-mcp is a standard MCP server, so the 9 tools run anywhere MCP-over-stdio is supported. Full auto-capture (background prompt/tool/error capture + profile injection) needs a hook runtime β OpenCode has it built in; Claude Code gets it via our hooks bridge; Codex and Cursor use the tools manually (no hook runtime yet).
| Feature | OpenCode | Claude Code | Qwen Code | Codex | Cursor |
|---|---|---|---|---|---|
| 16 MCP tools | β | β | β | β | β |
| Auto-capture (background) | β plugin | β hooks | β οΈ adapter | β manual | β Rules |
| Profile injection | β compaction | β UserPromptSubmit | β get_profile | β get_profile | β get_profile |
| Lexical fuzzy matching | β (v2.0) | β (v2.0) | β (v2.0) | β (v2.0) | β (v2.0) |
UserPromptSubmit/PreCompact, rule-based distill on SessionEnd).All harnesses share one SQLite file via MEMORY_DB_PATH, so memory captured
anywhere is readable everywhere.
lesson records (situation β mistake β correction) for capturing corrections,
not just flat facts.get_context blends FTS5 keyword search with a
dependency-free lexical fuzzy matching (hashed n-gram similarity, 512-dim FNV-1a) (RRF fusion + scoring), then assembles
a token-budgeted context with optional memory-graph expansion.derived_from links).api_key=, password:, token) filtered before storage.better-sqlite3, no extra native
extensions; every tool degrades gracefully so the AI keeps working if the DB
is unavailable.No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/th-memory-mcp)<a href="https://allmcps.com/mcp/th-memory-mcp"><img src="https://allmcps.com/api/badge/th-memory-mcp?style=directory" alt="Th Memory MCP on AllMCPs" /></a>