
Aifp Mcp
io.github.wjabanjjPublished by GitHub account wjabanjjv1.5.8Updated Oct 25, 2026
Persistent memory MCP server for AI coding assistants. Chinese-first and fully local.
Overview
A local, Chinese-first persistent memory server that lets AI coding assistants save, search and recall memories across sessions and tools.
- What you can do
- Save, list, fetch and deduplicate memories, with keyword plus vector semantic search and one-step context recall across causal and associative links. Trace perception chains, find shortest paths between memories, diffuse across the graph and surface co-occurring related memories. Build a user profile of preferences, facts and habits, and record conversation turns into a recognition queue for automatic memory capture. Import external note directories such as Obsidian and export memories back as Markdown notes. Run maintenance tasks: consolidate, merge, validate, deduplicate, batch update or delete, export, and inspect statistics and confidence.
- When to use it
- Useful when you want coding assistants to remember project facts, preferences and past troubleshooting across sessions, and to share one memory store between several MCP-capable tools on the same machine. Especially suited to Chinese-language conversations where typos, colloquialisms and relative time words should still match.
- Requirements
- Runs locally via npm (Node.js 22+). Data is stored by default under the user's home directory. First start downloads a roughly 30MB embedding model, which can block for up to 45 seconds. Optional: COGNITION_LLM_API_KEY (or ANTHROPIC_API_KEY) with COGNITION_RECOGNIZER=1 to enable automatic recognition; COGNITION_SERVER_URL and COGNITION_API_KEY for the server-enhanced mode.
Installation
In SourceWeft
- Open Aifp Mcp in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
AiFP 记忆感知系统 — MCP Server
通过 Model Context Protocol 为 AI 编程助手提供持久记忆。
让 Obsidian、DeepSeek Harness、Claude Code、Cursor、Codex 等一切支持 MCP 的 AI 工具拥有跨会话的持续记忆。完全本地运行,数据不出本机(默认 ~/.ai-cognition/)。
为什么选 AiFP — 一套记忆,所有 AI 共享
你受够了 AI 的"健忘"吗?
- 聊了一上午,它忘了项目名——存了,但用不上
- 你说"拍森",它只认 Python——说错一个字就搜不到
- 昨天说 Docker 连不上,今天说 MySQL 连不上,它不知道是同一件事——相关的记不住
- DeepSeek Harness 学会的,Claude Code 不知道——每个 AI 都是记忆孤岛
多数 AI 记忆系统只是存——存是存了,但用不上。AiFP 是让 AI 真正记住、想通、共享,把上面这些毛病一次解决。
先讲别人做不到的(共享):
一套记忆,所有 AI 共用。 今天 DeepSeek Harness 学会的,明天 Claude Code 还记得;Codex 攒的偏好,VS Code Copilot 不用重新问。别的记忆系统做不到——因为它们每个各记各的,互不相通。AiFP 让同电脑上所有 AI 工具共用一个大脑,记一份,处处用。
再讲它为什么好用(能力):
- 会掂量着记——不是每句话都存。聊的东西先进"待定区",由识别器判断这条值不值得长期记住:值得才正式记下,不值得就跳过。不会一股脑全存,也不会错漏重要的。
- 能听懂人话——你说"拍森",它知道是 Python;你说"上个月",它知道是哪个月。说错字、口语、时间词都能理解。
- 能看出关联——昨天说"连不上数据库",今天说"改了配置还不行",它知道是同一件事的延续。还能顺着一条线索联想出相关的内容。
- 记得清,用得上——一条记忆只留核心意思,不堆垃圾。用的时候只挑最相关的几条给你,又快又不乱。
- 越用越懂你——你的偏好、习惯它会慢慢积累成"画像",但它分得清"事实"和"建议",不会把你的想法和它自己的混在一起。
- 该忘的就忘——太久没用的记忆会自然淡出,重要的记忆会越来越牢。记忆库永远干净,不会变成堆不动的垃圾场。
看这些名字,就知道它不简单——记忆被做成了大脑的结构:
天生为中文服务:认错字、懂口语、认时间词,全都是为中文设计的。英文为主的记忆系统,遇到"拍森找 Python"这种就抓瞎了。
默认完全私有:所有数据都存你本机,不上云、不注册、不偷偷上报。所谓"共享"只是多个工具读写同一份本地记忆——你的数据从没离开过这台电脑。
一条命令装好:npm install -g 自动帮你配好 12 个 AI 工具(Claude Code、Cursor、Windsurf、Cline、Gemini CLI、Qwen Code、Zed、VS Code Copilot、Codex CLI、Trae、DeepSeek Harness、pi-coding-agent)。
一个大脑,多个助手:今天 DeepSeek Harness 学到的,明天 Claude Code 还记得——像跟一个有记忆的同事说话,不用每次都重新自我介绍。
快速开始
重启 Claude Code 即可使用。数据存在 ~/.ai-cognition/data/cognition.db。
DeepSeek Harness (dsh) 自动接入
装完 aifp-mcp 后自动接入 dsh,无需手动执行任何 dsh 命令:
安装时会自动检测 dsh 并写入配置(~/.dsh/cordis.patch.yml)。重启 dsh,记忆工具自动注册为 mcp__aifp__*(如 mcp__aifp__search_memories、mcp__aifp__save_memory),无需手动改任何配置。
在任意 AI 对话中安装(推荐)
不需要手动配任何东西。在 Claude Code、Codex、Cursor、DeepSeek Harness 等任意工具里直接输入:
帮我安装记忆系统:
npm install -g aifp-mcp
postinstall 钩子会自动检测并配置所有已安装的 AI 工具(Claude Code、Cursor、Windsurf、Cline、Gemini CLI、Qwen Code、Zed、VS Code Copilot、Codex CLI、Trae、DeepSeek Harness、pi-coding-agent),并打印状态报告。重启工具即可使用记忆工具——AI 看到报告后会告诉你重启哪个,无需手动改任何 MCP 配置文件。
首次启动:需要下载 ~30MB 的 bge-small-zh 嵌入模型,最多阻塞 45 秒。后续启动有缓存,秒开。
本地模式 vs 服务器增强模式
AiFP 支持两种运行模式(环境变量 COGNITION_MODE,默认 remote):
本地模式完全私有(数据不出本机),但感知链工具需要连接服务器。服务器地址不随包分发,需通过官方接入渠道获取。
拿到 key 后,一条命令连上
接入地址和密钥通过官方渠道发放:联系作者(微信:zm8571806/QQ:8571806/邮箱:[email protected])订阅后发放,不随包公开。订阅到期可单独吊销,不影响其他用户。
--connect 会把连接信息保存在本机 ~/.ai-cognition/server.json,之后启动自动生效,无需每次配置环境变量。
更简单:直接让你的 AI 配置
不需要手动敲命令。在 Claude Code / Cursor / Codex / dsh 等任何 AI 工具的输入框里说:
这是我的 aifp 服务器地址和 key,帮我配置: 地址:https://<官方地址> key:<你的64位key>
AI 会自动执行 aifp-mcp --connect 并提示你重启工具。重启后感知链增强自动生效。
⚠️ key 会出现在对话记录中,介意的话配置完可在管理后台吊销重发(不影响使用)。
接入 Obsidian(笔记 ↔ 记忆双向)
Obsidian 笔记 → 记忆库(AI 可语义检索你的笔记):直接让你的 AI 导入,无需配置环境变量:
把 Obsidian 笔记导入记忆:directory = C:/Users/你/Obsidian/我的笔记库
AI 会调用 reimport_sources 同步导入(frontmatter 自动剥离、哈希去重)。以后新增笔记再说一次即可。
记忆库 → Obsidian 笔记(在 Obsidian 里看到全部记忆):让 AI 调用 export_memories_md:
把记忆导出到 Obsidian:directory = C:/Users/你/Obsidian/我的笔记库/AiFP记忆
导出的笔记带 frontmatter(type/tier/tags),Obsidian 可直接识别和检索;同名笔记自动覆盖更新,保持与记忆库同步。
MCP 工具(共 33 个)
核心工具(15 个):
另有 18 个管理/进阶工具:consolidate_memories / share_memory / merge_memories / batch_delete / batch_update / export_memories / export_memories_md(Obsidian)/ explain_query / get_confidence_stats / scan_memory_patterns / validate_memory / get_top_experiences / deduplicate_memories / scan_observation_patterns / rotate_observation_logs / session_mine / derive_memories / flush_recognizer。
跨平台自动记忆识别
Claude Code 使用原生 hooks(100% 自动,零遗漏)。其他工具通过 observe_turn 工具 + 指令文件实现(详见 rules/ 目录):
指令文件告诉 AI:"每次回答完用户后调用 observe_turn 记录本轮消息"。系统会自动判断是否有值得记住的内容,不需手动决定。
核心技术
- SQLite + FTS5 全文索引(CJK 感知,unicode61 tokenizer)
- bge-small-zh-v1.5 向量嵌入(本地 512 维语义搜索,自动重试 + 多镜像回退)
- Hebbian 共现矩阵("一起发射的神经元连在一起")
- 有向因果链(6 种关系类型)
- BFS 图扩散(沿关联多跳发现间接知识)
- 纠错 + 消歧 + 中文时间词解析
各 AI 工具怎么接入(自动或手动)
npm install -g aifp-mcp 时自动完成(postinstall 检测所有已装 AI 工具并写入 MCP 配置)。以后新装了某个 AI 工具,跑一次即可接入:
自动检测并配置已安装的 AI 工具(检测到才写入,不重复覆盖):
手动配置
Claude Code / Cursor
自定义数据目录
环境变量
识别器 LLM 配置(启用自动记忆识别)
观察队列需要 LLM 判断是否值得入记忆,二选一:
不配置则只记录观察日志,自动识别不落地(AI 主动 save_memory 不受影响)。
技术栈
- Node.js 22+ (node:sqlite) + TypeScript
- SQLite (内置) + FTS5
- @xenova/transformers (bge-small-zh-v1.5)
- @modelcontextprotocol/sdk (MCP 协议)
License
专有软件 — 见 LICENSE。个人/非商业用途免费;商业用途需授权。第三方依赖遵循各自开源许可。
Source: README.md at commit d2b685a
Tools
0Version history
1- v1.5.8LatestSep 16, 2026
Score
40% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts
Declare a license in the repository or the registry entry.