Th Memory MCP logo

Th Memory MCP

Local SQLite memory for MCP clients, with preference recall, lesson tracking, hybrid retrieval, and memory-graph management.

Install Th Memory MCP

Pick your client, then add it in one click or paste the config.

STDIONode.js
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "th-memory-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "th-memory-mcp"
      ],
      "env": {
        "MEMORY_DB_PATH": "YOUR_VALUE_HERE"
      }
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Values are written into the snippet above so you can paste it as is. They never leave your browser.

Install not yet sandbox-tested— the server itself is confirmed live (we called its tools/list endpoint). The stdio install command is a separate, ongoing check.

Overview

th-memory-mcp provides a local, SQLite-backed memory layer for OpenCode and other MCP clients. Its 16 tools store preferences and lessons, search prior interactions, assemble task-specific context, and manage relationships, consolidation, imports, and exports. The server communicates over stdio and shares one database with an optional OpenCode auto-capture plugin. Use it when an agent needs persistent, private context across sessions without an external service.

Use cases

  • Remember user preferences across OpenCode sessions
  • Recall corrections and lessons before starting a task
  • Assemble token-budgeted context from related memories
  • Consolidate duplicate memories and preserve provenance
  • Export or import local memory records as JSON

Key features

  • Local SQLite storage over MCP stdio
  • Preference confidence scoring and structured lessons
  • FTS5 and lexical fuzzy hybrid retrieval
  • Memory graph relationships and provenance tracking
  • OpenCode auto-capture plugin
  • JSON import and export under data/exports/

Tools16

What Th Memory MCP lets your agent do. Expand a tool for its parameters.

Verified live~2.8k tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked Today

Recent health check succeeded.

11/11 checks healthy over the last 60d

What it can do

From the 16 tools this server returned when we ran it.

Can delete or modify data · 1Handles credentials · 1Read-only tools · 15
Network at startup3 connections
Files written at startup4
Install scriptsNone
npm provenanceNot published
Package age60 days
Maintainers1

Observed 2026-10-28 in an isolated sandbox. A description of reach, not a security audit.

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 6d ago via OSV.dev · th-memory-mcp (npm)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars3Stargazers on the source repository.
npm downloads1.8kPackage downloads in the last 30 days.
Last commitTodayMost recent push to the default branch.
Tools exposed16Callable tools this server registers over MCP.
Directory activity1 viewsConfig copies, upvotes, and views on AllMCPs.

How Th Memory MCP works

What th-memory-mcp does

th-memory-mcp gives MCP-compatible agents persistent memory backed by a local SQLite file. It focuses on user preferences, lessons learned from corrections, captured prompts and interactions, and a distilled profile. Memory records can carry confidence, importance, validity periods, lifecycle states, and relationships such as supersedes, contradicts, supports, or derived_from.

The server is designed for OpenCode, where its companion learning-capture plugin can record prompts, tool activity, errors, and compaction events. The MCP tools can also be used from other clients, including Claude Code, Qwen Code, Codex, and Cursor. Data remains on the local machine, and secrets matching patterns such as API keys, passwords, and tokens are filtered before capture.

How it works

The server runs as a Node.js stdio process and reads and writes a shared SQLite database. remember upserts a preference by category and key; saving the same key again raises confidence by 0.1, up to 1.0. save_lesson stores a situation, mistake, and correction, while recall, get_profile, and search_history retrieve stored knowledge and prior prompts.

For task preparation, get_context combines full-text keyword search with dependency-free lexical fuzzy matching and can expand results through the memory graph. It applies a token budget when assembling the returned context. consolidate clusters similar memories and can create derived records with provenance links. link_memory, merge_memory, and update_memory support relationship, duplicate, and field management while preserving supersession behavior for content changes.

Captured interactions can be reviewed with get_recent_interactions, summarized with memory_stats, or processed by extract_memories, which proposes candidates from memory-intent phrases without using an LLM. Import and export operate through JSON files under data/exports/.

Setup and configuration

Use Node.js 22, 24, or 26 patched releases and npm. The project can be built from source with npm install followed by npm run build, then started with npm start. It can also be installed globally from npm or run with npx th-memory-mcp.

Set MEMORY_DB_PATH to the SQLite file that both the MCP server and any capture plugin should use. On Windows, configure it with setx; on macOS or Linux, export it from the shell profile. OpenCode configuration points its local MCP command at dist/index.js or the installed th-memory-mcp executable.

The optional OpenCode plugin is deployed as ~/.config/opencode/plugins/learning-capture/index.ts and supports OpenCode V1 and V2 layouts. Restart OpenCode after changing its configuration. The server itself needs no external service, account, or API key.

Tools and capabilities

  • Store and update preferences with confidence scoring through remember.
  • Search preferences, lessons, and matching recent interactions with recall.
  • Retrieve profile sections, high-confidence preferences, and recent lessons with get_profile.
  • Record corrections as structured lessons with save_lesson.
  • Search timestamped prompt snippets with search_history.
  • Assemble token-budgeted task context with hybrid retrieval through get_context.
  • Create, merge, update, consolidate, and relate memory records.
  • Import validated JSON memories in dry-run or apply mode, and export data with a preview.
  • Inspect recent interactions and database usage statistics.
  • Extract candidate memories deterministically from captured interactions.

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Th Memory MCP

th-memory-mcp is an MCP server that connects AI clients to a local SQLite memory database. Its main tools store preferences, record lessons, recall relevant history, assemble task context, manage memory relationships, consolidate duplicates, and import or export records. It communicates over stdio and can share data with OpenCode’s capture plugin.

Install it from source with `npm install` and `npm run build`, or use `npm install -g th-memory-mcp` or `npx th-memory-mcp`. Configure the MCP client to run `dist/index.js` or the installed executable, and use a patched Node.js 22, 24, or 26 release.

Set `MEMORY_DB_PATH` to the database file shared by the MCP server and any capture plugin. Configure it as a system or user environment variable, or provide it in the OpenCode MCP environment configuration. The server stores data locally and does not require an external service.

Yes, th-memory-mcp works with Cursor through its MCP tools. Cursor can use the 16 tools and lexical fuzzy matching, while memory capture and profile injection are manual through tools or rules rather than an automatic background plugin.

Automatic capture uses the optional OpenCode `learning-capture` plugin, which records prompts, tool activity, errors, and compaction events in the shared SQLite database. The server also provides `extract_memories` for deterministic candidate generation from captured interactions; candidates are dry-run by default.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewTh Memory MCP AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/th-memory-mcp?style=directory)](https://allmcps.com/mcp/th-memory-mcp)
HTML Embed
<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>