coding-memory-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@coding-memory-mcpremember that our CI uses GitHub Actions"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Coding Memory MCP
Coding Memory MCP 是一个面向 Cursor、Claude Code、Codex、Qoder、Trae 等 AI 编程工具的本地长期记忆系统。它的目标不是简单保存聊天记录,而是把项目事实、用户偏好、工程决策、错误经验、文件关系和可复用工作流沉淀为一个可检索、可扩散、可反思的共享记忆层。
一句话目标:
给所有 AI 编程助手接入同一个本地记忆大脑,让它们跨会话、跨工具、跨项目地记住「发生过什么、为什么这么做、下次怎么做更好」。
当前版本:1.0.9(完整功能版 + Web 管理台 + 多 IDE 一行安装 / HTTP Leader 选举)
分层交付
阶段 | 目标 | 关键能力 | 状态 |
MVP-Core | 可依赖的项目级笔记与检索 | remember / search / recall_context / list / forget、FTS、scope 硬隔离、secret 防护、CLI | ✅ |
MVP-Plus | 可解释联想与可选沉淀 | 高置信实体图、2-hop 扩散、explain、reflect(默认 preview) | ✅ |
完整版(1.0.0) | 语义与技能 | embedding(可选)、skills、MCP Resources、feedback、update/merge/link | ✅ |
Web 管理台 | 本地可视化与配置 | HTTP API(可嵌入静态)、记忆/Skill CRUD、LLM Provider、Reflect、检索实验室、Sessions、审计、图谱 | ✅ |
先保证写入、隔离、检索正确,再叠加图扩散、反思与向量。
Related MCP server: LumenCore
文档导航
用户与架构(推荐阅读)
使用文档 — npm 安装、主流 AI IDE 接入、MCP Tools、Scope、FAQ
技术架构文档 — 分层架构、数据流、存储、检索、安全
功能模块文档 — 各模块职责、流程、代码路径
Web 管理台与 LLM 接入方案 — HTTP API、管理台模块、分阶段计划
会话收集与多 IDE 自动化 — 收集原理、Hook、多 IDE
上下文压缩 — recall 档 A/B/C + tiktoken
设计与规范
推荐实现顺序
SQLite(WAL)存储、repo 身份、基础 CRUD。
memory.remember/list/forget+ secret redaction + 统一{ok,data}响应。FTS5 搜索、scope 硬隔离、CLI。
memory.recall_context+ 归一化 ranking + retrieval fixtures。安装各工具规则模板(集成契约)。
高置信实体图、2-hop 扩散、
memory.explain。memory.reflect(mock / preview;远程 opt-in)。可选 embedding、skill、resources、feedback。
技术栈
Runtime: Node.js 20+
Language: TypeScript
Protocol: Model Context Protocol
Storage: SQLite(WAL)
Full-text search: SQLite FTS5(trigram / n-gram 策略)
Vector search: 内存 cosine(hash / OpenAI embedding,默认关闭)
Embedding: hash 或 OpenAI,需
CODING_MEMORY_EMBEDDING_ENABLED=trueTest: Vitest(92 条)
Web Admin: React + Ant Design + Rsbuild(
packages/admin)HTTP API: Hono(
src/http,默认127.0.0.1:3721;生产可嵌入 Admin 静态)Token 估算:
js-tiktoken(cl100k_base)
中文检索说明
使用 trigram/n-gram 友好匹配,不是完整中文分词。对中文子串和中英混合通常可用,但不等价于 jieba 级分词。
建议:
重要记忆补充英文 tags / summary,提高跨语言可检索性。
用 CLI
search/recall验证实际召回。开启 embedding 可改善语义相近但字面不同的召回。
集成契约
记忆系统依赖 agent 调用工具,并可选 Hook 兜底。推荐用一行脚本安装(见下方「快速开始」),或手工放入模板:
会话收集原理(为何不自动读 IDE 聊天记录、推荐 Hook 全自动方案):见 docs/13-session-collection-and-multi-ide-automation.md。
多工具必须指向同一个本地 DB(如 CODING_MEMORY_DB=~/.coding-memory/memory.db)。
快速开始(推荐:一行接入 IDE)
在业务项目根目录(无需先 clone 本仓库):
# Cursor(MCP → 用户级;全局 Rules → ~/.cursor/rules/coding-memory-global.mdc;项目 Rules/Hooks → 当前项目)
# 也可用 --ide claude|codex|qoder|trae|all
curl -fsSL https://raw.githubusercontent.com/ChinaCarlos/coding-memory-mcp/main/scripts/remote-install.sh | bash -s -- --ide cursor
coding-memory ping
# Admin(任一 MCP 进程可作为 Leader 自动拉起):http://127.0.0.1:3721/仅装 CLI / 包:
npm install -g coding-memory-mcp
coding-memory ping
# MCP:coding-memory-mcp
# Admin:node "$(npm root -g)/coding-memory-mcp/dist/http/server.js"包地址:https://www.npmjs.com/package/coding-memory-mcp
从源码开发(可选)
pnpm install && pnpm build && pnpm test
pnpm cli ping
pnpm dev # API :3721 + Admin :3722
pnpm start:http # 生产一体 Admin :3721npm 脚本一览(源码仓)
命令 | 说明 |
| 一键开发:HTTP API + 管理台(concurrently) |
| 一键构建:后端 tsc + 前端 Rsbuild |
| 仅 HTTP API(3721) |
| 仅管理台 dev server(3722) |
| 仅 MCP stdio(给 Cursor 用) |
| 仅编译后端 |
| 仅构建管理台静态资源 |
| 生产:HTTP API + 嵌入式 Admin(:3721) |
| 运行全部测试(92) |
详见 Web 管理台方案。
若 better-sqlite3 原生模块未编译,见 使用文档 §3.4。
MCP 配置(主流 AI IDE)
一行安装(推荐,无需 clone)
# 在业务项目根目录
curl -fsSL https://raw.githubusercontent.com/ChinaCarlos/coding-memory-mcp/main/scripts/remote-install.sh | bash -s -- --ide cursor
curl -fsSL https://raw.githubusercontent.com/ChinaCarlos/coding-memory-mcp/main/scripts/remote-install.sh | bash -s -- --ide claude
curl -fsSL https://raw.githubusercontent.com/ChinaCarlos/coding-memory-mcp/main/scripts/remote-install.sh | bash -s -- --ide codex
curl -fsSL https://raw.githubusercontent.com/ChinaCarlos/coding-memory-mcp/main/scripts/remote-install.sh | bash -s -- --ide qoder
curl -fsSL https://raw.githubusercontent.com/ChinaCarlos/coding-memory-mcp/main/scripts/remote-install.sh | bash -s -- --ide trae
curl -fsSL https://raw.githubusercontent.com/ChinaCarlos/coding-memory-mcp/main/scripts/remote-install.sh | bash -s -- --ide all
# 卸载
curl -fsSL https://raw.githubusercontent.com/ChinaCarlos/coding-memory-mcp/main/scripts/remote-uninstall.sh | bash -s -- --ide all多 IDE 同时开:MCP 无端口冲突(stdio + 共用 SQLite);Admin 仅 Leader 占用 :3721,其余自动 Follower。详见 使用文档 §3.3。
本地 scripts 安装
npm i -g coding-memory-mcp
CM="$(npm root -g)/coding-memory-mcp/scripts"
# Cursor / Claude Code / Codex / Qoder / Trae
bash "$CM/install.sh" --project . --ide cursor
bash "$CM/install.sh" --project . --ide claude
bash "$CM/install.sh" --project . --ide codex
bash "$CM/install.sh" --project . --ide all # 一次装齐
bash "$CM/uninstall.sh" --project . --ide cursor # 卸载对应 IDE
bash "$CM/uninstall.sh" --project . --ide all # 全卸(默认保留 DB)各 IDE 落点与选项见 使用文档 §3.6。
手动 MCP 片段
{
"mcpServers": {
"coding-memory": {
"command": "npx",
"args": ["-y", "coding-memory-mcp"],
"env": {
"CODING_MEMORY_DB": "/Users/你的用户名/.coding-memory/memory.db"
}
}
}
}IDE | 一键脚本 | 配置落点 | 规则模板 |
Cursor |
|
|
|
Claude Code |
|
|
|
Codex |
|
|
|
Claude Code |
|
|
|
Codex |
|
|
|
Qoder |
|
|
|
Trae |
|
|
|
其他 MCP 客户端 | 手动粘贴 JSON | 各自 MCP 设置 |
|
全局安装后可将 command 改为 coding-memory-mcp(去掉 npx args)。
多工具必须共用同一 CODING_MEMORY_DB。完整步骤:docs/09-user-guide.md §5。
源码开发时可用:
{
"mcpServers": {
"coding-memory": {
"command": "pnpm",
"args": ["--dir", "/绝对路径/coding-memory-mcp", "dev:mcp"],
"env": {
"CODING_MEMORY_DB": "/Users/你的用户名/.coding-memory/memory.db"
}
}
}
}已实现的 MCP Tools(1.0.9)
Tool | 说明 |
| 健康检查 |
| 检测当前仓库身份(path / git / |
| 写入记忆 |
| FTS + 可选向量/图排序 |
| 召回并压缩上下文 |
| 列出记忆 |
| 归档/删除/脱敏 |
| 更新已有记忆 |
| 创建实体关系边 |
| 解释为何命中 |
| 从 transcript 提取候选(默认 preview) |
| 合并多条记忆 |
| 召回质量反馈 |
| 将 procedure 提升为 skill |
| Skill 管理 |
MCP Resources
URI | 说明 |
| 用户 global 核心记忆摘要(markdown) |
| Skill 列表(JSON) |
| 项目记忆摘要 |
| 项目决策列表 |
所有 tool 返回统一 JSON:{ "ok": true, "data": ... } 或 { "ok": false, "error": ... }。
可选环境变量(完整版)
变量 | 默认值 | 说明 |
|
| 开启向量检索 |
|
|
|
|
| OpenAI 模型 |
|
| 允许远程 LLM 反思 |
|
| 图扩散跳数 |
|
| 图扩散衰减系数 |
|
| HTTP API 绑定地址 |
|
| HTTP API 端口 |
This server cannot be installed
Maintenance
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
- Alicense-quality-maintenanceProvides AI coding agents with persistent, long-term memory through local semantic search and SQLite storage. It enables agents to save and retrieve architectural decisions or project context across different conversation sessions without requiring cloud services.Last updated
- Alicense-qualityCmaintenanceProvides AI coding assistants with persistent project memory to retain architectural decisions, code patterns, and domain knowledge across sessions. It stores data locally in a SQLite database, allowing agents to remember, recall, and manage project-specific context using full-text search.Last updated19Apache 2.0
- AlicenseAqualityCmaintenanceProvides persistent cross-session memory and full-text search for AI coding assistants, storing project context, decisions, and preferences while enabling searchable access to conversation history via local SQLite.Last updated8MIT
- Alicense-qualityDmaintenanceProvides long-term memory for AI coding agents, enabling them to remember, search, and organize information across sessions and platforms like Claude Code, ChatGPT, and Cursor.Last updated187MIT
Related MCP Connectors
User-owned memory for AI agents, Copilot, Claude, IDEs, CLIs, and chat apps over remote MCP.
Persistent memory for AI agents. Search, store, and recall across sessions.
Universal memory for AI agents and tools. Save, organize and search context anywhere.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/ChinaCarlos/coding-memory-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server