memory-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| MEMORY_MCP_TOKEN | No | Token required for the loopback HTTP /api/* routes. If unset, a token is generated automatically and stored in state/http-token with permissions 0o600. | auto-generated and stored in state/http-token (mode 0o600) |
| MEMORY_MCP_DATA_DIR | No | Directory used for persistent state and storage. | <package>/state |
| MEMORY_MCP_HTTP_PORT | No | Port for the loopback HTTP server (listens on 127.0.0.1 only). | 7181 |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| memory_appendB | 写入一条记忆。tier=short 为会话内的短期记忆(默认带一天 TTL),tier=long 为跨会话的长期记忆。 |
| memory_queryC | 查询记忆。给 text 走全文检索;不按权重排序时默认按最近触及排序。 |
| memory_touchB | 标记一条记忆被命中:抬权重并刷新触及时间;够格时会自动巩固为长期记忆。 |
| memory_forgetA | 遗忘一条记忆。mode=soft 归档(不注入但可恢复),mode=hard 物理删除(被遗忘权)。 |
| memory_restoreC | 从归档恢复一条被软遗忘的记忆。 |
| memory_consolidateC | 把够格的短期记忆升级为长期记忆;给 sessionId 表示整会话批量执行。 |
| memory_ingestB | 入站消息落地:原文进原始层、正文进短期记忆,两写一个事务。幂等键是 msgId,重复投递不会产生第二条。 |
| memory_recordB | 把一条「值得长期记住」的事实写进长期层(不是每条消息都该记)。内容相同重复上报幂等,不会堆出两条。 |
| memory_context_headB | 产出稳定前缀(【长期记忆】【关系】【情绪】【黑话】)。同一断点内逐字节不变,可安全复用缓存。 |
| memory_context_tailC | 产出动态尾部(当前时间、最近几条短期记忆、上次情绪、召回片段、本轮正文)。每轮新拼。 |
| memory_context_composeA | 一次拿到完整注入块:head(可复用)+ tail(本轮新拼)+ 拼接结果 text。桥接通常只用这一个。 |
| memory_context_invalidateA | 手动失效稳定前缀:角色设定变更、记忆被批量改写后调用,下一次渲染必然重建。 |
| slang_discoverB | 从一批消息里用规则发现黑话候选(n-gram 频次 + 互信息 + 左右熵),不入库、不联网。 |
| slang_submitB | 提交一条黑话(默认状态为候选,需确认后才会注入提示词)。 |
| slang_queryC | 查询黑话词条。 |
| slang_confirmB | 确认一条黑话候选(确认后才会进入【黑话】段)。 |
| slang_rejectA | 拒绝一条黑话候选(不再注入,但保留记录以免反复发现)。 |
| memory_context_renderC | 产出可直接拼接的提示词段落(【记忆】【黑话】),平台桥接拿去即用。 |
| relation_setA | 写下「现在的事实」:称呼、喜好、约定,或当前情绪(kind=emotion)。同一 (说话人, 键) 只有一条,值变化才留历史。 |
| relation_getC | 读一条关系/情绪的当前值(含版本链里的最新一条)。 |
| relation_listC | 列出一个会话的关系或情绪。kind=emotion 只取情绪;不给 kind 取全部。 |
| relation_historyC | 查一条关系的版本链(谁在什么时候把它改成了什么)。 |
| relation_forgetB | 硬删一条关系,连版本链一起删(被遗忘权:只删当前值等于假装忘了)。 |
| raw_archiveA | 把超过保留期的原文导出成 gzip 分片并清空正文(保留 msgId/发送者/锚点)。先落盘再改库,可先用 dryRun 看积压。 |
| raw_purgeA | 【不可撤销】按消息 / 发言人 / 平台硬删原文,重写归档分片,并清除派生记忆里的 sourceMsgIds 引用。 |
| raw_backlogB | 报告待归档的原文条数(计划任务与告警用)。 |
| memory_recallB | 按当前对话内容主动检索记忆(短期记忆被淘汰后还能从原文里捞回)。默认只查本平台;返回可直接用的 text 与结构化 rows。 |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 27 tools
Grouped prefixes make the domains clear (memory, context, slang, relation, raw), but within groups several tools overlap: memory_append vs memory_record vs memory_ingest all write, and memory_query vs memory_recall both search. memory_forget, relation_forget, and raw_purge are three delete paths that differ in scope but require careful reading. The descriptions resolve most cases, but an agent can easily pick the wrong write or context tool.
All names are snake_case with a consistent group prefix followed by an action, giving a readable and predictable scheme. Minor deviations exist where the suffix is a noun or directional term (memory_context_head, memory_context_tail, raw_backlog) rather than a verb, but the pattern is still recognizable.
At 27 tools the surface is bloated for what is essentially one domain; it bundles memory storage, prompt-context rendering, slang mining, relations, and raw-archive maintenance into a single server. Several groups could be split into separate servers or trimmed.
Coverage is broad: full lifecycle for memories (write, touch, forget, restore, consolidate), relations (set/get/list/history/forget), slang (discover/submit/confirm/reject), and raw archives (archive/purge/backlog), plus context composition. Minor gaps remain, such as no list-all or update operation for memories independent of touch/consolidate.