feat(examples): add generic memory MCP overlays
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write .agents/notes/implemented/feature/2026-07-31-third-party-memory-mcp-examples.md
|
||||
2026-07-31-third-party-memory-mcp-examples.md: 512a222d1f8406d11ef5c58c5f2749c9b571d846
|
||||
2026-07-31-third-party-memory-mcp-examples.zh.md: 8bdc4ae371b7b3c4a8e78eeceed1f965e515a475
|
||||
@@ -0,0 +1,78 @@
|
||||
# Agent Note: Third-party memory MCP examples
|
||||
|
||||
Status: implemented
|
||||
|
||||
English | [中文](2026-07-31-third-party-memory-mcp-examples.zh.md)
|
||||
|
||||
## Problem
|
||||
|
||||
A direct vendor integration made one provider's API, configuration, health behavior, and tool semantics part of DSH. That was too much product surface for a capability already expressible through MCP, and it would require repeating the same adaptation for every memory system. Users instead need a small, inspectable way to opt into one external memory server while preserving the generic MCP boundary.
|
||||
|
||||
The acceptance bar is stronger than "the socket connects": each reference must support a real DSH write in session A, recall from the provider in a fresh DSH session B, and use of the recalled value. At the same time, provider downloads, accounts, models, embeddings, storage initialization, and separate HTTP processes must remain upstream responsibilities.
|
||||
|
||||
## Decision
|
||||
|
||||
Ship three default-off Cordis overlay examples under `examples/mcp-memory`: Memorix, MCP Reference Memory, and Engram. Every file inserts exactly one `@deepseek-ai/dsh-mcp-client` row. None is referenced by the shipped composition, and the CLI declares the generic bridge only so an explicitly selected overlay can resolve it.
|
||||
|
||||
These third-party configurations are provided as interoperability examples only. Their inclusion does not imply endorsement, recommendation, partnership, or ongoing support by DeepSeek. There is no memory preset registry, vendor-specific DSH plugin, universal memory service, installation UI, migration layer, health checker, or reconnect controller. Another memory MCP server uses the same documented stdio or Streamable HTTP row.
|
||||
|
||||
## Responsibility boundary
|
||||
|
||||
| Concern | DSH | Upstream provider or user |
|
||||
|---|---|---|
|
||||
| Parse selected overlay | Yes | Select one file |
|
||||
| Start stdio command and stop it on plugin disposal | Yes | Install the pinned executable |
|
||||
| Connect to Streamable HTTP and discover tools | Yes | Run and supervise the HTTP service |
|
||||
| Register tools as `mcp__<serverName>__<rawName>` | Yes | Define tool schemas and behavior |
|
||||
| Account, auth, model, embedding, storage initialization | No | Yes |
|
||||
| Vendor data migration, retry, crash recovery | No | Yes |
|
||||
|
||||
The generic stdio transport scrubs ambient credential-shaped and `DSH_*` variables. Baseline examples explicitly map only the variables they require; optional provider secrets must be added to `config.env` or configured in the provider's own files.
|
||||
|
||||
## Pins and identity
|
||||
|
||||
| Provider | Tested contract |
|
||||
|---|---|
|
||||
| Memorix | npm `1.3.0`, tag commit `500792cad3144142293bfbb20acb4841c9f7fcfa` |
|
||||
| MCP Reference Memory | npm `2026.7.4`, package commit `6dd0a683e198783e30feabf7abaf42f925bd18b1` |
|
||||
| Engram | tag `v1.20.0`, commit `ba9e46ced152c37a7cb9e576153c41995873e2fc` |
|
||||
|
||||
`DSH_MEMORY_USER_ID` is a stable user partition, not a DSH session id. Each example maps it to a separate provider data path under `$DSH_HOME`.
|
||||
|
||||
Project identity remains provider-owned: Memorix and Engram use the DSH working directory's Git project, with Engram optionally accepting `ENGRAM_PROJECT`.
|
||||
|
||||
## Model guidance
|
||||
|
||||
The examples do not patch `@deepseek-ai/dsh-system-prompt`: a config patch replaces a row's complete config and could erase an existing persona. The README instead offers one optional additive instruction:
|
||||
|
||||
> When the user asks you to remember something, call a memory write tool. When historical information may be relevant, search memory and use relevant results.
|
||||
|
||||
Provider tool descriptions remain authoritative.
|
||||
|
||||
## Validation contract
|
||||
|
||||
Remote CI never contacts third-party services or consumes secrets. The keyless suite parses all three overlay files, checks their generic bridge and secret boundary, replaces the upstream endpoint with the package-owned MCP fixture server, boots the real Cordis Loader, and proves tool discovery.
|
||||
|
||||
Before merge, manual evidence for every pinned provider must separately show:
|
||||
|
||||
1. DSH session A calls a write tool and receives success for a unique value.
|
||||
2. Fresh DSH session B, under the same provider/user scope, calls search or recall and returns that value without session A's transcript.
|
||||
3. Session B uses the recalled value in a subsequent answer.
|
||||
|
||||
"Fresh session" means a new DSH session in the same Host. No Host restart is required. The generic MCP client discovers asynchronously and has no automatic reconnect after a child or HTTP transport closes; validation waits for tools before the first turn and uses HMR or a Host restart only after a crash.
|
||||
|
||||
## Alternatives considered
|
||||
|
||||
**One DSH plugin per provider.** Rejected because it repeats auth, configuration, lifecycle, and tool wrappers that MCP already standardizes and expands ownership for every added provider.
|
||||
|
||||
**A memory-provider preset registry.** Rejected because a registry would make third-party versions and recommendations look like a supported DSH product surface. Copyable overlays keep ownership and drift visible.
|
||||
|
||||
**Run `npx` or `go run` inside the MCP row.** Rejected after probes showed first-run npm downloads can exceed the MCP initialization timeout and an interrupted `npx` cache can become unusable. DSH starts a server process; it is not the provider package manager. Pinned installation commands are explicit prerequisites.
|
||||
|
||||
**Inject the common instruction from the generic MCP client.** Rejected because the bridge serves non-memory MCP servers too, and generic prompt mutation would reintroduce provider semantics into shared runtime code.
|
||||
|
||||
## Consequences
|
||||
|
||||
Selecting a file gives the model the provider's complete discovered MCP tool surface, with schema/token cost determined by that provider. Removing `--config` removes the memory server. Users accept each upstream license, data policy, cloud cost, and operational model directly.
|
||||
|
||||
The earlier vendor-specific change is superseded by this generic path. Future provider drift is handled by updating and revalidating a small example pin rather than adding runtime branches to DSH.
|
||||
@@ -0,0 +1,78 @@
|
||||
# Agent Note: 第三方记忆 MCP 示例
|
||||
|
||||
Status: implemented
|
||||
|
||||
[English](2026-07-31-third-party-memory-mcp-examples.md) | 中文
|
||||
|
||||
## 问题
|
||||
|
||||
直接集成某个提供方会使该提供方的 API、配置、健康状态行为和工具语义成为 DSH 的一部分。对于已经可以通过 MCP 表达的功能,这会让产品接口过于庞大,而且每接入一个记忆系统都需要重复同样的适配工作。用户需要的是一种精简、可检查的方式,在保留通用 MCP 边界的同时,选择启用一个外部记忆服务器。
|
||||
|
||||
验收标准不止于「套接字可以连接」:每份参考配置都必须支持 DSH 在会话 A 中实际写入,在新的 DSH 会话 B 中从提供方召回,并使用召回的值。与此同时,提供方下载、账户、模型、embedding、存储初始化和独立 HTTP 进程仍由上游负责。
|
||||
|
||||
## 决策
|
||||
|
||||
在 `examples/mcp-memory` 下交付三份默认关闭的 Cordis overlay 示例:Memorix、MCP Reference Memory 和 Engram。每个文件只插入一个 `@deepseek-ai/dsh-mcp-client` 配置项。交付组合不会引用这些文件;CLI(命令行界面)仅声明通用桥接器,使用户显式选择 overlay 时可以解析它。
|
||||
|
||||
这些第三方配置仅作为互操作参考;收录不代表 DeepSeek 的认可、推荐、合作关系或持续支持承诺。系统没有记忆预设注册表、提供方专属 DSH 插件、通用记忆服务、安装 UI、迁移层、健康检查器或重连控制器。其他记忆 MCP 服务器可以使用同一份文档中的 stdio 或 Streamable HTTP 配置项。
|
||||
|
||||
## 职责边界
|
||||
|
||||
| 事项 | DSH | 上游提供方或用户 |
|
||||
|---|---|---|
|
||||
| 解析选中的 overlay | 是 | 选择一个文件 |
|
||||
| 启动 stdio 命令,并在插件 dispose(资源释放)时将其停止 | 是 | 安装固定版本的可执行文件 |
|
||||
| 连接 Streamable HTTP 并发现工具 | 是 | 运行并监管 HTTP 服务 |
|
||||
| 以 `mcp__<serverName>__<rawName>` 注册工具 | 是 | 定义工具 schema 和行为 |
|
||||
| 账户、认证、模型、embedding、存储初始化 | 否 | 是 |
|
||||
| 提供方数据迁移、重试、崩溃恢复 | 否 | 是 |
|
||||
|
||||
通用 stdio 传输会清除环境中名称类似凭据的变量和 `DSH_*` 变量。基线示例仅显式映射自己需要的变量;可选的提供方密钥必须添加到 `config.env`,或配置在提供方自己的文件中。
|
||||
|
||||
## 版本固定与身份
|
||||
|
||||
| 提供方 | 已测试契约 |
|
||||
|---|---|
|
||||
| Memorix | npm `1.3.0`,tag commit `500792cad3144142293bfbb20acb4841c9f7fcfa` |
|
||||
| MCP Reference Memory | npm `2026.7.4`,package commit `6dd0a683e198783e30feabf7abaf42f925bd18b1` |
|
||||
| Engram | tag `v1.20.0`,commit `ba9e46ced152c37a7cb9e576153c41995873e2fc` |
|
||||
|
||||
`DSH_MEMORY_USER_ID` 是稳定的用户分区,不是 DSH 会话 id。每份示例都将其映射到 `$DSH_HOME` 下相互独立的提供方数据路径。
|
||||
|
||||
项目身份仍由提供方负责:Memorix 和 Engram 使用 DSH 工作目录中的 Git 项目,其中 Engram 还可以选择接受 `ENGRAM_PROJECT`。
|
||||
|
||||
## 模型指导
|
||||
|
||||
示例不会修改 `@deepseek-ai/dsh-system-prompt`:配置 patch 会替换某个配置项的完整配置,可能抹除已有 persona。README 改为提供一条可选的附加指令:
|
||||
|
||||
> 用户要求记住时调用写入工具;涉及历史信息时,主动检索并使用相关记忆。
|
||||
|
||||
提供方的工具描述仍然是权威定义。
|
||||
|
||||
## 验证契约
|
||||
|
||||
远程 CI 不会访问第三方服务或消耗密钥。无密钥套件解析全部三份 overlay 文件,检查其通用桥接器和密钥边界,将上游端点替换为包自带的 MCP fixture(测试前置数据)服务器,通过真实 Cordis Loader 启动,并验证工具发现。
|
||||
|
||||
合并前,每个固定版本的提供方都必须分别提供以下人工证据:
|
||||
|
||||
1. DSH 会话 A 调用写入工具,为一个唯一值写入记忆,并收到成功结果。
|
||||
2. 新的 DSH 会话 B 在相同提供方/用户范围下调用搜索或召回,不借助会话 A 的 transcript(文本记录)便可返回该值。
|
||||
3. 会话 B 在后续回答中使用该召回值。
|
||||
|
||||
「新会话」是指同一个 Host 中新建的 DSH 会话,不需要重启 Host。通用 MCP 客户端以异步方式发现工具,子进程或 HTTP 传输关闭后不会自动重连;验证会在第一轮之前等待工具出现,并且只在崩溃后使用 HMR 或重启 Host。
|
||||
|
||||
## 考虑过的替代方案
|
||||
|
||||
**每个提供方使用一个 DSH 插件。** 不予采纳,因为这会重复 MCP 已经标准化的认证、配置、生命周期和工具包装层,并随着每增加一个提供方而扩大维护范围。
|
||||
|
||||
**记忆提供方预设注册表。** 不予采纳,因为注册表会让第三方版本和推荐看起来像受支持的 DSH 产品接口。可复制的 overlay 让所有权和版本偏移保持可见。
|
||||
|
||||
**在 MCP 配置项内运行 `npx` 或 `go run`。** 不予采纳,因为探测表明首次 npm 下载可能超过 MCP 初始化超时,而中断的 `npx` 缓存可能变得不可用。DSH 负责启动服务器进程,不是提供方的包管理器。固定版本的安装命令属于显式前置条件。
|
||||
|
||||
**由通用 MCP 客户端注入共用指令。** 不予采纳,因为该桥接器也服务于非记忆类 MCP 服务器,而且通用提示词变更会把提供方语义重新带入共享运行时代码。
|
||||
|
||||
## 后果
|
||||
|
||||
选择一个文件后,模型可以使用提供方发现到的完整 MCP 工具接口;工具 schema 和 token 成本由提供方决定。移除 `--config` 就会移除记忆服务器。用户直接接受各上游的许可证、数据政策、云服务费用和运维模式。
|
||||
|
||||
通用方案取代了早期针对特定提供方的改动。未来出现提供方版本偏移时,只需更新并重新验证一份小型示例的固定版本,不必向 DSH 添加运行时分支。
|
||||
Reference in New Issue
Block a user