@frontmcp/plugin-remember

中文文档
1.12.2发布于 2026/11/15Apache-2.0TypeScriptESM + CJS构建来源已验证近 30 天下载 7717

Remember plugin for FrontMCP: encrypted key-value memory for tools (this.remember) in session, user, tool and global scopes, stored in memory, Redis or Vercel KV

原始使用文档
文档目录12 节
  1. Install
  2. Usage
  3. Options
  4. Stores
  5. this.remember
  6. Scopes
  7. Encryption
  8. Memory tools
  9. Docs
  10. Related packages
  11. Contributing
  12. License

@frontmcp/plugin-remember

Gives the tools of a FrontMCP server a small encrypted key-value memory, this.remember, so a tool can store something on one call and read it on a later one: a user's language, a draft, the last record they opened. Values are encrypted before they're stored, in memory, Redis or Vercel KV. Each value lives in a scope (session, user, tool or global) that decides who can read it back. Turn on tools.enabled and the plugin also gives the model four tools to remember things itself.

npm License

Install

npm install @frontmcp/plugin-remember

The plugin runs inside a FrontMCP server, so your app needs @frontmcp/sdk, at the same version as this package, and Node.js 24 or later. Its peer dependency @frontmcp/lazy-zod comes with the SDK.

For the Vercel KV store (type: 'vercel-kv', or 'global-store' with a Vercel KV provider), also install the optional peer @vercel/kv. The Redis stores use ioredis, which is already a dependency.

Usage

Register the plugin with RememberPlugin.init() in the plugins of @FrontMcp (every app) or of one @App (that app only). Importing the package also tells TypeScript about this.remember.

import { RememberPlugin } from '@frontmcp/plugin-remember';
import { App, FrontMcp, Tool, ToolContext, z } from '@frontmcp/sdk';

@Tool({
  name: 'set_language',
  description: 'Set the language the user wants answers in',
  inputSchema: { language: z.string() },
})
class SetLanguageTool extends ToolContext {
  async execute({ language }: { language: string }) {
    await this.remember.set('language', language, { scope: 'user' });
    return { language };
  }
}

@Tool({ name: 'get_language', description: 'The language the user wants answers in', inputSchema: {} })
class GetLanguageTool extends ToolContext {
  async execute() {
    const language = await this.remember.get('language', { scope: 'user', defaultValue: 'en' });
    return { language };
  }
}

@App({ id: 'preferences', name: 'Preferences', tools: [SetLanguageTool, GetLanguageTool] })
class PreferencesApp {}

@FrontMcp({
  info: { name: 'assistant', version: '1.0.0' },
  apps: [PreferencesApp],
  plugins: [RememberPlugin.init({ type: 'memory' })],
})
export default class Server {}

user scope needs a signed-in caller. An anonymous caller is refused with RememberIdentityError; see Scopes.

Options

Every option is optional. RememberPlugin.init() and plugins: [RememberPlugin] both keep values in memory.

OptionTypeDefaultDescription
type'memory' | 'redis' | 'redis-client' | 'vercel-kv' | 'global-store''memory'Where values are kept. See Stores.
keyPrefixstring'remember:'Starts every key in the store. Give each server its own when several share a Redis.
defaultTTLnumber (seconds)How long a value set without ttl lives. A whole number; 0 means no default expiry.
encryption.enabledbooleantrueEncrypt values before they're stored. With false, values are stored as plain JSON.
encryption.customKeystringThe secret keys are derived from, in place of REMEMBER_SECRET. See Encryption.
config{ host, port, password?, db? }With type: 'redis': where to connect.
clientRedis (ioredis)With type: 'redis-client': a client you created.
url, tokenstringKV_REST_API_URL, KV_REST_API_TOKENWith type: 'vercel-kv': the store's REST URL and token.
tools.enabledbooleanfalseRegister the memory tools.
tools.prefixstringStarts the memory tools' names: 'memory_' gives memory_recall, and so on.
tools.allowedScopesRememberScope[]all fourWhich scopes the memory tools accept. Another scope fails with RememberScopeNotAllowedError.
skipLegacyPurgebooleanfalseDon't delete entries written by older versions of the plugin, whose keys can no longer be read.
legacyPurgeDelayMsnumber86400000 (24 hours)How long after the current key layout first reached the store to wait before that purge.

Stores

typeWhere values live
'memory'A Map in the server's process. Lost on restart, and not shared between instances.
'redis'A Redis server the plugin connects to with config.
'redis-client'Your own ioredis client, in client.
'vercel-kv'Vercel KV, through @vercel/kv.
'global-store'The store in @FrontMcp({ redis }): Redis, or Vercel KV. Without redis, the server doesn't start.

A browser build (create() in a web page, WebMCP) has no TCP socket for Redis: there 'redis' and 'redis-client' throw BrowserStoreUnavailableError from init(), and 'global-store' on a Redis redis throws it when the server starts, before anything connects. The message names type: 'memory'. Vercel KV, over HTTPS, is allowed.

this.remember

this.remember is available in tools, resources, prompts and agents. Every method takes a scope option, which defaults to 'session'.

MethodReturnsDescription
set(key, value, options?)Promise<RememberEntry>Stores a JSON-serializable value. Options: scope, ttl (seconds), brand, metadata.
get(key, options?)Promise<T | undefined>The value, or options.defaultValue when there is none or it expired.
getEntry(key, options?)Promise<RememberEntry | undefined>The value with its brand, metadata, createdAt, updatedAt and expiresAt.
update(key, value, options?)Promise<boolean>Replaces the value, keeping its metadata, and its expiry unless you pass ttl. false when there's nothing to update.
knows(key, options?)Promise<boolean>Whether get() would find a value.
forget(key, options?)Promise<void>Deletes the value.
list(options?)Promise<string[]>The keys in a scope. options.pattern filters them with * and ?.

this.get(RememberAccessorToken) returns the same accessor, and this.tryGet(RememberAccessorToken) returns it or undefined where the plugin isn't installed.

Scopes

ScopeWho can read a value back
session (default)The same session, as the server verified it. Without a verified session, the same signed-in caller.
userThe same signed-in caller, across sessions.
toolThe same caller as session, and only from the tool that stored it.
globalEvery caller.

A scope with no caller to keep values apart throws RememberIdentityError: user scope for an anonymous caller, and session or tool scope for an anonymous caller without a verified session. Under MCP 2026-07-28, which has no sessions, session values belong to the signed-in caller and last across all their requests, so give conversation-sized state a ttl.

Encryption

With encryption on (the default), each value is encrypted with AES-256-GCM, with a key derived (HKDF-SHA256) from a server secret and the scope's identity. The server secret is encryption.customKey when you set it, otherwise:

  1. REMEMBER_SECRET, MCP_MEMORY_SECRET or MCP_SESSION_SECRET from the environment.
  2. Outside production (NODE_ENV isn't production): a secret the plugin generates and saves to .frontmcp/remember-secret.json. Keep .frontmcp/ out of version control.
  3. In production: a random secret for this process, with a warning. Values can't be read after a restart, or by another instance.

Set REMEMBER_SECRET, or encryption.customKey, to the same value on every instance that shares a store.

Memory tools

With tools.enabled: true, the plugin registers four tools, named with tools.prefix if you set one:

ToolArguments
remember_thiskey, value, scope?, ttl?, brand?
recallkey, scope?
forgetkey, scope?
list_memoriesscope?, pattern?, limit? (default 50, at most 100)

Their scope is session (the default), user or global. They don't offer tool scope: it belongs to the tool that runs the call, so recall would never find what remember_this stored there. Up to 1.11.2 they accepted it.

The package also exports their classes, RememberThisTool, RecallTool, ForgetTool and ListMemoriesTool, to list in an app's tools yourself. Use one way or the other, not both.

Docs

Contributing

Source: plugins/plugin-remember. Issues and pull requests are welcome; see CONTRIBUTING.md.

License

Apache-2.0. See LICENSE.

版本与发布记录

@frontmcp/plugin-remember 共发布 112 个版本,首次发布于 2026/01/09;过去 12 个月发布了 112 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.12.2latest2026/11/151 天前
1.12.12026/11/132 天前
1.12.02026/11/114 天前
1.12.0-rc.1rc2026/11/114 天前
1.11.32026/11/106 天前
1.11.22026/11/096 天前

其他发布通道:beta → 1.1.2-beta.1,rc → 1.12.0-rc.1。

关于 @frontmcp/plugin-remember 的常见问题

@frontmcp/plugin-remember 是什么?

Remember plugin for FrontMCP: encrypted key-value memory for tools (this.remember) in session, user, tool and global scopes, stored in memory, Redis or Vercel KV

如何安装 @frontmcp/plugin-remember?

在项目目录运行 npm install @frontmcp/plugin-remember,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@frontmcp/sdk(1.12.2)、@frontmcp/lazy-zod(1.12.2)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@frontmcp/plugin-remember 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@frontmcp/plugin-remember 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@frontmcp/plugin-remember 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=24.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@frontmcp/plugin-remember 可以商用吗?

@frontmcp/plugin-remember 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@frontmcp/plugin-remember 的下载量有多少?

根据 npm 官方下载统计,@frontmcp/plugin-remember 在 2026/10/16 – 2026/11/14 这 30 天内被下载 7,717 次,日均约 257 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@frontmcp/plugin-remember 还在维护吗?

最新版本 1.12.2 发布于 2026/11/15(1 天前);至今共发布 112 个版本,其中过去 12 个月发布了 112 个;首次发布于 2026/01/09。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。