Memory7

MCP文档知识

提供方 未标注

文档知识 stdio · 本地进程 会话登录 社区 / 第三方 ClaudeCursorVS CodeCline
查看接入方式

通过 MCP 为 AI 编码工具提供快速、本地、低 token 的长期记忆。

一句话选型结论

按资料字段整理

Memory7 属于文档知识类 MCP 服务器,stdio · 本地进程,会话登录,可直接接入 Claude、Cursor、VS Code 等,有可直接执行的安装命令。接入前先确认权限范围;涉及写入、删除或付款的操作,建议先在测试环境验证。

分类文档知识 传输方式stdio · 本地进程 鉴权会话登录 部署方式本地部署
GitHub 星标 未标注 仓库热度,无公开仓库时显示未标注
工具数 未标注 暴露给模型的工具数量
资源 / 提示词 0 / 0 资源与提示词模板数量
维护方 社区 / 第三方 核验等级 仅资料核对

工具与能力

文档知识
数量来自来源目录的标注,具体工具清单以官方文档为准
工具数量未标注暴露给模型可调用的工具个数
资源数量0可读取的资源条目
提示词数量0内置提示词模板数量

能力标签

支持客户端

适用场景

记忆

安装与配置

stdio · 本地进程 会话登录
客户端在本机拉起子进程,数据不出本机
npm install -g memory7 # or use npx memory7 init # wires memory7 into the IDEs it finds memory7 init --project # inside a repo: share its memory through git (.memory/ + MEMORY.md)

这条命令只是入口,具体启动参数请按官方文档补齐,不要直接照搬到别的服务器。

  1. 1
    准备运行环境

    stdio 服务在本地起进程,需要先装好 Node.js 等运行时,再按安装命令拉取依赖。

  2. 2
    安装服务

    复制上面的安装命令执行;命令里带占位符的位置,换成自己的密钥或路径。

  3. 3
    写入客户端配置

    在客户端的 MCP 配置里填好启动命令和参数,保存后完全退出客户端再打开,让新配置生效。

  4. 4
    验证是否可用

    连接成功后随便调一个只读工具,确认能返回结果,再接入正式流程。

典型使用场景

3 类
按分类与标签整理的常见用法,具体以官方文档为准
文档检索问答

在你的文档库里按问题找答案。

知识库读写

把新资料写进知识库,随用随取。

内容整理

把零散资料归纳成结构化笔记。

选择建议

选之前先看这几条
按条目字段给出的判断,不替你决定用不用

值得选的地方

  • 有现成的安装命令,不用自己找入口,照着跑就能起服务。
  • 已适配 Claude、Cursor、VS Code,换客户端不用重新研究配置。

先想清楚的地方

  • stdio 方式要求本地装好运行时(如 Node.js),换机器要重新装一遍。
  • 使用前要准备好会话登录对应的凭据,并按最小权限配置。
  • 资料没标注工具数量,实际能力要装好后确认。
  • 版本更新与行为细节以官方仓库为准。

更适合

  • 需要在文档知识场景里让模型直接调用外部能力的人。
  • 已经在用 Claude、Cursor 的用户,接入路径最短。
  • 想先快速试一下、能接受在本地或自有环境跑服务的人。

不太适合

  • 完全不想在本地装环境的人。
  • 不方便管理密钥或第三方授权的人。
  • 需要厂商级 SLA 和技术支持的生产环境。

同类对比

6 个同类
同分类里挑最接近的几条,字段以各自详情页为准
MCP 服务器工具数传输方式部署方式安装命令最后核验
Memory7当前 未标注 stdio · 本地进程 本地部署 有 2026-11-20
dify 未标注 stdio · 本地进程 本地部署 有 2026-04-11
open-webui 未标注 stdio · 本地进程 本地部署 有 2026-04-11
JeecgBoot 未标注 stdio · 本地进程 本地部署 有 2026-04-11
Cherry Studio 未标注 未标注 未标注 无 2026-05-17
mempalace 未标注 stdio · 本地进程 本地部署 有 2026-04-11

服务器档案

文档知识
字段来自项目仓库与公开索引,中文说明由本站标注
提供方未标注上游标注的维护方 未标注
分类文档知识本站按上游分类展示
连接方式stdio · 本地进程客户端在本机拉起子进程,数据不出本机
鉴权方式会话登录远程服务建议用最小权限凭据
维护方社区 / 第三方核验等级 仅资料核对
包名 / 运行时未标注 · 未标注本地安装时用到的包标识与运行时
部署类型本地部署上游给出的部署形态
最近核验2026-11-20上游最后核验时间

详细介绍

13.1 KB
来自项目仓库与上游目录的原文,未做删改

memory7

Fast, local, low-token long-term memory for AI coding tools, over MCP.

One memory shared by Claude Code, Kiro, VS Code (Copilot), Cursor and OpenCode, on macOS, Linux and Windows. It remembers things about you (global: "uses Ubuntu", "prefers pnpm") and about each project (stack, commands, decisions, gotchas). Project memory can live in the repo, so a teammate who clones it starts with the same memory.```bash
npm install -g memory7 # or use npx
memory7 init # wires memory7 into the IDEs it finds
memory7 init --project # inside a repo: share its memory through git (.memory/ + MEMORY.md)


Restart your IDE. From then on, the AI loads a short digest at session start, saves what matters as you work, and searches before asking you something you already told it.

## Why this one

**Fast** · In-process SQLite + FTS5. On 10k memories: search p95 ≈ 3 ms, digest ≈ 5 ms, MCP server ready in ≈ 90 ms. Hooks run in ≈ 45 ms.
**Few tokens** · 4 tools, ≈ 800 tokens of schema + instructions in total. Results are one line each. The session digest is capped (default 400 tokens) and ranked, not dumped.
**Automatic** · The AI is told to save unprompted. On top of that, memory7 reads your manifests (`package.json`, `pyproject.toml`, `Cargo.toml`, Dockerfile, CI files, ...) and records stack and commands itself.
**Notices when code moves on** · A memory that names a file is tracked against it automatically and flagged `?stale` when the file changes.
**Shared through git** · `.memory/memory.jsonl` in the repo, merged without conflicts, newest edit wins, deletes propagate.
**Not a pile** · Keyed facts replace their old value ("switched to Fedora" overwrites "uses Ubuntu"). Duplicates are skipped. Everything is soft-deleted with undo.
**Local** · SQLite file in `~/.memory7`. No network, no telemetry, no model download.
**Zero dependencies** · The published package bundles everything. Needs Node ≥ 22.13 (built-in `node:sqlite`).

## How it works

### Tools the AI sees

Tool · What it does
`memory_context` · Short digest: global memory + current project (stack, commands, conventions, decisions, gotchas, todos, recent commits) and a `stale:` line for memories whose code changed. Called once per session.
`memory_search(query, scope?, type?, limit?)` · One line per hit, e.g. `#12 [pref\ · g] {pkg-manager} Prefers pnpm over npm`. `scope`: `all` (default), `project`, `global`, `any-project`.
`memory_save(content, key?, type?, scope?, files?, id?, replace?, items?)` · Upsert. Scope and type are inferred if omitted. `items` saves several at once. `id` with no `content` re-confirms a memory against the current code.
`memory_delete(ids? \ · key? \ · query?)` · Soft delete. A query deletes only when it matches exactly one memory, otherwise it lists candidates.

Also exposed: resource `memory7://context` and prompt `/remember `.

### Keeping memory current when code changes

Memory that is not updated when the code changes is worse than none, so memory7 attacks this from several sides:

1. **Auto-anchoring.** When a saved memory mentions an existing file (`src/lib/auth.ts`), memory7 records the file's content hash. When the file changes the memory shows `?stale` (or `?missing` if deleted) in search results and in the digest, and the digest ends with `stale: #12 #19 ...` plus what to do. Line endings are normalized, so a Windows checkout with CRLF does not look changed.
2. **An edit trigger (Claude Code).** After the AI edits a file, a `PostToolUse` hook tells it which memories depend on that file: "update with `memory_save(id=N, ...)`, delete, or re-confirm". It is installed only when memory7 is installed globally, because it runs on every edit and `npx` startup would be too slow. Kiro's file-save hook cannot return text to the AI, so Kiro relies on the digest and its steering rules.
3. **Rules that name the moments.** The server instructions and `MEMORY.md` say when to save (immediately, not at the end), when to update (after changing code a memory describes), and what a `?stale` flag means.
4. **Passive capture.** On each tool call (throttled to once per 20 s) memory7 re-reads changed manifests and refreshes stack, package manager, Node/Python version, test/dev/build/lint commands, containers, CI, env-var names (never values) and Make/just targets. Facts that disappear from the manifests disappear from memory. A memory you or the AI set with the same key wins over an auto one.
5. **`memory7 check`** lists every out-of-date memory; `--strict` exits non-zero so you can run it in CI.

What it cannot do: notice that a memory is wrong when it names no file and no manifest changed. Those depend on the AI following the rules.

### Staying current without being asked

An MCP server cannot force a model to call it, so there are three layers: the server instructions and rules files; passive capture (no AI involved); and hooks where the IDE supports them (digest injected at session start, prompts starting with "remember ..." saved directly).

### Search

SQLite FTS5 (porter stemming, prefix matching), a built-in synonym map (searching `os` finds "Ubuntu", `db` finds "Postgres"), AND-then-OR fallback, and a trigram fallback for typos. Ranking blends match quality with memory type, recency (60-day half-life, floored), how often a memory was actually returned, pinning, and whether it belongs to the current project.

### Project identity

A project is identified by the hash of its normalized `origin` URL, so every clone and git worktree shares memory. With no remote it falls back to the real path. The workspace comes from the MCP client's `roots`, then `MEMORY7_PROJECT`, then the working directory. Home and `/` are never treated as projects.

## Sharing project memory with your team```bash
cd my-repo
memory7 init --project      # creates .memory/ and MEMORY.md, adds rule files for your IDEs
git add .memory MEMORY.md AGENTS.md CLAUDE.md .kiro .cursor   # whichever were created
git commit -m "Add shared AI memory"

What you get in the repo:

File Purpose
.memory/memory.jsonl The shared memories: one JSON object per line, sorted, plain text.
.memory/.gitattributes merge=union and LF endings, so two branches that each add memories merge without conflicts.
MEMORY.md Setup instructions per OS, the rules for AI agents, and when to update memory. Written between markers; text you add around the block is kept.
AGENTS.md / CLAUDE.md / .kiro/steering / .cursor/rules A short pointer block with the rules, because no AI tool reads a file just because it is called MEMORY.md.

A teammate then runs npm install -g memory7 && memory7 init once (the steps are in MEMORY.md), opens the project, and has the same memory. After git pull the new lines are picked up on the next tool call or session start. Nothing to run.

How sync behaves:

  • Sync is on for a project when its .memory/ folder exists. Turn it off everywhere with "sync": false in ~/.memory7/config.json, or per shell with MEMORY7_NO_SYNC=1.
  • Every project memory you or your AI save is written through to the file right after the call, except memories you mark local (memory7 private), auto-detected facts (recomputed anywhere) and global memory (always personal).
  • Conflicts: the newest edit of a memory wins. Deletes are written as tombstones (kept 180 days) so they reach teammates, and a stale copy cannot resurrect a deleted memory. Two people saving the same note independently end up with one.
  • memory7 sync runs it by hand. memory7 doctor shows the state.
  • Treat the file like code. It is plain text in your git history, so review it in pull requests. Secrets are refused when saving, but nothing can promise a human never types one.

Safety of a file that comes from a repository (it is untrusted input, like AGENTS.md):

  • Every line is validated: known type, length limit, secret filter, safe file paths, at most 5,000 lines / 2 MB. Bad lines are dropped and counted.
  • Lines can only create project memories. A repo can never write your global memory.
  • Memory that came from a repo is hidden from any-project searches in other projects.
  • The AI is told that memory entries are notes, not instructions.
  • A file that is mostly unreadable (for example with merge-conflict markers) is left untouched.

Setup per IDE

memory7 init detects installed IDEs. Choose explicitly with --ide claude,kiro,vscode,cursor,opencode (or all). Preview with --dry-run. Every edited file gets a one-time *.memory7.bak copy, edits are merged (never overwritten), and memory7 uninstall reverses everything except your shared memories.

IDE MCP server Rules Hooks
Claude Code claude mcp add --scope user (or ~/.claude.json) ~/.claude/CLAUDE.md block; with --project: CLAUDE.md block SessionStart digest, UserPromptSubmit "remember", PostToolUse edit trigger (global install only), plus permissions so the three safe tools don't prompt on every call (delete still asks)
Kiro ~/.kiro/settings/mcp.json with autoApprove ~/.kiro/steering/memory7.md; with --project: .kiro/steering/memory7.md with --project: .kiro/hooks/memory7.json (committed, so teammates need memory7 installed)
VS Code user mcp.json (servers) with --project: AGENTS.md block none
Cursor ~/.cursor/mcp.json with --project: .cursor/rules/memory7.mdc none
OpenCode opencode mcp add --global ~/.config/opencode/AGENTS.md block; with --project: AGENTS.md block none

If a config file contains comments (JSONC), memory7 will not rewrite it. It prints the snippet to add by hand. Manual MCP entry for any client that launches stdio servers:```json
{ "command": "npx", "args": ["-y", "memory7"] }


On Windows clients that cannot run `npx` directly, use `{ "command": "cmd", "args": ["/c", "npx", "-y", "memory7"] }` (`init` does this for you). With a global install (`npm i -g memory7`) `init` points at the `memory7` binary instead of `npx`, which starts faster.

## CLI```
memory7 init | uninstall [--ide ...] [--project] [--no-hooks] [--dry-run]
memory7 doctor                      check Node, SQLite, database, sharing and IDE setup
memory7 rules                       print the rule text for any IDE's instructions
memory7 context [--budget N]        the session digest
memory7 search <query> [--scope S] [--type T] [--limit N]
memory7 add <text> [--global] [--key K] [--type T]
memory7 ls | rm <id|key> | undo <id> | pin <id> | unpin <id>
memory7 sync                        pull/push .memory/memory.jsonl now (normally automatic)
memory7 private <id> | unprivate <id>   keep a memory out of the repo / share it again
memory7 verify <id>                 re-confirm a memory against the current code
memory7 check [--strict]            list memories whose files changed or vanished
memory7 capture [--force]           re-detect stack and commands
memory7 export | import <file>      personal backup as JSONL
memory7 gc | projects

Data, privacy, configuration

  • Everything private lives in ~/.memory7/memory7.db (override with MEMORY7_HOME). One file, WAL mode, safe with several IDEs open at once.
  • Nothing leaves your machine except what you commit in .memory/. There is no telemetry.
  • Saves are rejected if they look like credentials (cloud/API keys, tokens, JWTs, private keys, passwords, credentials in URLs, high-entropy strings). The model is told why and can save a redacted version.
  • ~/.memory7/config.json (optional): { "budget": 400, "sync": true }.
  • Env: MEMORY7_HOME, MEMORY7_PROJECT (force the workspace path), MEMORY7_NO_SYNC=1.

Platforms

Written for macOS, Linux and Windows: paths go through Node's path module, anchors use / in the shared file, line endings are normalized for hashing and the shared file is forced to LF, Windows launch commands use cmd /c, and file replacement retries when Windows holds a file open. The test suite and the packed-tarball smoke test run on all three in GitHub Actions (.github/workflows/ci.yml). Linux was exercised directly during development; treat macOS and Windows as verified only once that workflow is green.

Known limits

  • Local IDEs only. ChatGPT needs a remote HTTP server and is not supported.
  • Whether the AI saves and updates on its own depends on the model following the instructions. Hooks, auto-anchoring and passive capture reduce that dependence but do not remove it.
  • A memory that names no file cannot go stale automatically.
  • The fast path trusts an unchanged file modification time; a content change that preserves the mtime is not noticed until the mtime moves.
  • VS Code gets no user-level rules file from init; use --project (AGENTS.md) or paste the output of memory7 rules.
  • OpenCode's config format changed across versions, so init uses the opencode CLI when available and otherwise prints a snippet.
  • No semantic embeddings in v0.1. Synonyms and fuzzy matching cover common cases, not arbitrary paraphrase.

Development```bash

npm install
npm run typecheck && npm test # 119 tests, including a real MCP client over stdio and a two-person git workflow
npm run build # bundles to dist/
npm run bench # 10k-memory latency benchmark
```

常见问题

8 问
答案由本站依据条目字段整理,不引用上游原文
Memory7 怎么安装?

在客户端按下面的安装命令接入:npm install -g memory7 # or use npx memory7 init # wires memory7 into the IDEs it finds memory7 init --project # inside a repo: share its memory through git (.memory/ + MEMORY.md)。装完在客户端配置里引用同一个包或端点。

Memory7 怎么在 Claude、Cursor、VS Code 里配置?

它的传输方式是stdio · 本地进程,在客户端的 MCP 配置里填好启动命令和参数,保存后完全退出客户端再打开,配置才会生效。

Memory7 收费吗?

本站不代收费用,也没有标注具体价格。是否收费取决于服务本身和背后的接口额度,正式使用前按官方说明确认。

Memory7 需要 API Key 吗?

资料标注需要会话登录认证,使用前准备好对应凭据,并按最小权限配置。

Memory7 支持哪些客户端?

资料标注支持 Claude、Cursor、VS Code、Cline、Codex、Zed;其他客户端只要能配置 MCP Server,也能用同样的命令或地址接入。

Memory7 能提供哪些能力?

资料显示能力标签包括 记忆。具体工具清单以官方文档为准。

Memory7 需要什么运行环境?

属于本地进程,需要在本机装好运行环境。

Memory7 是本地还是远程?

它是本地进程(stdio),由客户端在本机拉起。传输方式为stdio · 本地进程。

热门专题

按标签挑服务器
全部专题 →

服务器信息以作者仓库与官方文档为准;分类、传输方式与鉴权方式的中文说明为中文整理,最近核验 2026-11-20。