Skip to main content
Glama
lvyuan1688

localmem-mcp-zh

by lvyuan1688

localmem-mcp-zh

🇨🇳 Local-first, zero-API Chinese AI memory MCP — SQLite + fastembed Chinese-optimized

Demo

localmem-mcp-zh gives any MCP-compatible client (Claude Code, Codex, Gemini CLI, Cursor, Windsurf, Cline …) a fully local, zero-cloud long-term memory. All memories are stored in a single SQLite file; search uses local cosine similarity + Chinese FTS5 + jieba tokenization weighted BM25, and retrieval costs zero tokens.

Inspired by OpenAgentHQ/localmem-mcp (6 ⭐, created 2026-08-14), the original is English-only. This repo makes Chinese optimizations:

  • jieba Chinese tokenization, avoiding the English unicode61 tokenizer failing on Chinese

  • Default embedding model BAAI/bge-small-zh-v1.5 (SOTA small model for Chinese retrieval)

  • All tool descriptions are bilingual (Chinese/English), making it easy for Chinese agents to understand intent

Why you need it

Most AI memory tools (Mem0, Zep, Graphiti) call an LLM on both the storage and retrieval paths. This repo only runs the embedding model once locally, then stays offline forever. Beyond privacy, cost matters even more: storing 10,000 memories and retrieving 10,000 times, localmem-mcp-zh makes 0 LLM calls.

Related MCP server: tartarus-mcp

Installation

pip install localmem-mcp-zh
# 或
uvx localmem-mcp-zh

The first run downloads the embedding model from Hugging Face (~90 MB), then it's fully offline afterwards.

Connecting clients

Claude Code / Codex / Gemini CLI

Add the following to your MCP config (~/.config/mcp/servers.json or your client's config file):

{
  "mcpServers": {
    "localmem-zh": {
      "command": "uvx",
      "args": ["localmem-mcp-zh"],
      "env": {
        "LOCALMEM_DB": "~/.localmem-mcp-zh/memories.db"
      }
    }
  }
}

Cursor / Windsurf / VS Code

Add a server with the same name in the IDE's MCP settings, with the same parameters as above.

Four tools

Tool

Purpose

store_memory

Save a persistent memory — decisions, preferences, facts, optionally with tags

search_memory

Search memories by semantics. "Which database?" can find "we chose SQLite"

recall_memory

Re-read a memory by id, or fetch the most recent few

memory_stats

Where the database is, how many entries are stored

Privacy

No network requests at all, except for the one-time embedding model download. Delete ~/.localmem-mcp-zh/memories.db and the memories are gone.

Development

git clone https://github.com/lvyuan1688/localmem-mcp-zh
cd localmem-mcp-zh
pip install -e ".[dev]"
pytest

License

MIT — see LICENSE.

A
license - permissive license
Not graded
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
1Releases (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

View all related MCP servers

Related MCP Connectors

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/lvyuan1688/localmem-mcp-zh'

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