localmem-mcp-zh
A fully local, offline Chinese-optimized MCP memory server using SQLite and local embeddings, enabling MCP clients to store, semantically search, recall, and count memories without any API calls.
README
localmem-mcp-zh
🇨🇳 本地优先、零 API 的中文 AI 记忆 MCP — SQLite + fastembed 中文优化

localmem-mcp-zh 给任何 MCP 兼容客户端(Claude Code、Codex、Gemini CLI、Cursor、Windsurf、Cline …)一个完全本地、零云调用的长期记忆。所有记忆存于一个 SQLite 文件,搜索走本地余弦相似度 + 中文 FTS5 + jieba 分词加权 BM25,检索不花一个 token。
灵感来自 OpenAgentHQ/localmem-mcp(6 ⭐,2026-08-14 创建),原版纯英文。本仓库做中文优化:
- jieba 中文分词,避免英文 unicode61 分词器在中文上失灵
- 默认嵌入模型
BAAI/bge-small-zh-v1.5(中文检索 SOTA 小模型) - 工具说明全部中英双语,方便中文 agent 理解意图
为什么需要它
大部分 AI 记忆工具(Mem0、Zep、Graphiti)在存储和检索路径上都要调 LLM。本仓库只在本机跑一次嵌入模型,之后永远离线。隐私之外更重要的是成本:存储 1 万条记忆、检索 1 万次,localmem-mcp-zh 调用 LLM 的次数是 0。
安装
pip install localmem-mcp-zh
# 或
uvx localmem-mcp-zh
第一次运行会从 Hugging Face 下载嵌入模型(约 90 MB),之后完全离线。
接入客户端
Claude Code / Codex / Gemini CLI
把下面这段加到 MCP 配置(~/.config/mcp/servers.json 或对应客户端的配置文件):
{
"mcpServers": {
"localmem-zh": {
"command": "uvx",
"args": ["localmem-mcp-zh"],
"env": {
"LOCALMEM_DB": "~/.localmem-mcp-zh/memories.db"
}
}
}
}
Cursor / Windsurf / VS Code
在 IDE 的 MCP 设置里新增同名 server,参数同上。
四个工具
| 工具 | 用途 |
|---|---|
store_memory |
保存一条持久记忆 — 决策、偏好、事实,可带 tags |
search_memory |
按语义查找记忆。"哪个数据库?"能找到"我们选了 SQLite" |
recall_memory |
按 id 重新读取一条记忆,或追最近的几条 |
memory_stats |
数据库在哪、存了多少条 |
隐私
没有任何网络请求,除了一次性下载嵌入模型。删掉 ~/.localmem-mcp-zh/memories.db 记忆就没了。
开发
git clone https://github.com/lvyuan1688/localmem-mcp-zh
cd localmem-mcp-zh
pip install -e ".[dev]"
pytest
License
MIT — 见 LICENSE。
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.