shared-memory-mcp
shared-memory-mcp
一个独立的、stdio 传输的 MCP 记忆服务。它把记忆写入调用者自己指定的目录,程序仓库与记忆数据分离,因此可以把这套能力分享给朋友,而不分享你的项目源码和现有记忆。
设计边界
仓库只放 MCP 程序、启动脚本、配置模板和通用策略。
每个使用者都有自己的
MDCG_ROOT,默认是~/.shared-memory-mcp/memory;辅助状态默认放在同目录旁的隐藏 runtime 目录。记忆目录不在 Git 仓库内,也不会自动扫描当前项目目录。
不要把
business/memory/、~/.dsh/、Harness 会话、日志、令牌或.env复制到本仓库。本仓库保留 MIT 授权文件;当前运行代码基于本机使用的
@furongjun1999/dsh-memory0.9.17 MCP 运行时,并保留上游归因信息。
Related MCP server: Qoopia
环境要求
Python 3.10 或更高版本
不需要安装第三方 Python 依赖即可运行 stdio MCP
DeepSeek Harness、Claude Code、Codex CLI 等支持 stdio MCP 的宿主
本地验证
python3 scripts/smoke_test.py该命令使用临时空记忆目录,只验证 MCP initialize 握手,不读取你的项目记忆。
启动 MCP
MDCG_ROOT="$HOME/.shared-memory-mcp/memory" \
python3 scripts/run_mcp.py不设置 MDCG_ROOT 时,启动脚本会使用 ~/.shared-memory-mcp/memory,并自动设置独立的 MDCG_AUX_ROOT、MDCG_STATE_ROOT、MDCG_DATA_ROOT。如果要让多人共享同一份记忆,必须改成远程、带认证和命名空间隔离的 MCP 服务;不要通过共享本地目录或把你的记忆文件提交到 Git 来实现。
DeepSeek Harness 配置
复制 dsh/cordis.patch.example.yml 中的配置到 Harness profile 的 cordis.patch.yml,并替换:
args中仓库的绝对路径;cwd中仓库的绝对路径;MDCG_ROOT为朋友自己的私有记忆目录;MDCG_ACTOR为朋友自己的标识。
建议先保持 MDCG_MCP_SURFACE: kernel,确认能启动后再按需切换到 full。不同 Harness 版本的 MCP 配置字段可能略有差异,但核心是以 stdio 方式运行 scripts/run_mcp.py。
直接运行协议探针
printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"manual","version":"0.1.0"}}}' \
| python3 scripts/run_mcp.py目录说明
md_cg/ MCP 记忆运行时源码
data/policy.json 通用策略,不包含个人记忆
scripts/run_mcp.py 使用独立记忆根目录启动服务
scripts/smoke_test.py 空目录握手自检
dsh/ DeepSeek Harness 配置模板Available Tools
2 toolscgB
灵枢认知图唯一入口(38 op:写/读/审/护/演化/元认知/预测/白箱/验证态 status/三元组反查 edges…)。完整 op/参数语义:cg(op="help", query="<op 名 | 参数名 | 工具名>")
| Name | Required | Description | Default |
|---|---|---|---|
| a | No | ||
| b | No | ||
| k | No | 返回条数(sustain pool_bench… | |
| op | Yes | route|read|write|verify|review|protect|identity|consistency|metacognition|self_state|evolution|sustain|scrub|predict|causal|forget|goal|task|recent|state_event|info|index_code|index_doc|ref|whitebox|theory|link|session|ingest|export|maintain|consolidate|insight|ccg|status|edges|audit|help | |
| ts | No | ||
| cap | No | ||
| ccg | No | CCG 六要素编译器入参:{action, no… | |
| hit | No | ||
| ids | No | ||
| new | No | ||
| old | No | ||
| out | No | ||
| pid | No | review decide 的提案 id | |
| ref | No | ||
| seq | No | ||
| set | No | ||
| tag | No | ||
| bm25 | No | ||
| fact | No | ||
| goal | No | ||
| keep | No | ||
| kind | No | condition_gap|layer_shift|general | |
| meta | No | ||
| mode | No | list|show | |
| name | No | ||
| note | No | task op:本轮备注(change 是计划变… | |
| pack | No | ||
| path | No | index_code/index_doc 的目录… | |
| peer | No | ||
| plan | No | ||
| role | No | user|assistant|tool-output|command | |
| root | No | ||
| rule | No | ||
| seed | No | ||
| slot | No | ||
| sort | No | 取值随 op 变化,完整枚举见 op=help | |
| tags | No | 标签(cap:xxx 会作为 route 的建议… | |
| text | No | recent op 的事件文本 | |
| view | No | ||
| apply | No | ||
| batch | No | ||
| child | No | ||
| clues | No | ||
| depth | No | ||
| edits | No | ||
| force | No | restore 强制(忽略前置条件:墓碑等) | |
| gated | No | ||
| kinds | No | ||
| layer | No | anchor|structural|knowledge|contextual|self | |
| limit | No | goal/recent 的返回条数;read 的… | |
| pools | No | ||
| prune | No | ||
| query | No | read 的查询 | |
| roots | No | ||
| since | No | ||
| state | No | pending|verified|falsified | |
| swarm | No | ||
| trait | No | ||
| until | No | ||
| write | No | ||
| action | No | 取值随 op 变化,完整枚举见 op=help | |
| change | No | ||
| dedupe | No | ||
| intent | No | route 的查询意图 | |
| issues | No | 问题清单(红队打回理由) | |
| marker | No | ||
| memory | No | succeeded|failed|blocked|partial | |
| offset | No | ||
| parent | No | ||
| prefix | No | ||
| reason | No | 原因;consolidate contextua… | |
| result | No | ||
| source | No | consolidate|verify|manual | |
| window | No | ||
| content | No | write 的内容(建议含 CCG 5 要素注释… | |
| context | No | 当前情境 | |
| doc_ref | No | ||
| dry_run | No | sustain heal / scrub:只列动… | |
| exclude | No | ||
| grantee | No | ||
| grantor | No | ||
| horizon | No | ||
| lexical | No | ||
| message | No | ||
| missing | No | ||
| node_id | No | 节点 id | |
| queries | No | ||
| redteam | No | pass|reject | |
| session | No | read(search/recall 分支):会… | |
| subject | No | link evidence:按主体过滤(如 ag… | |
| v_types | No | v1|v2|v3 | |
| verdict | No | 取值随 op 变化,完整枚举见 op=help | |
| boundary | No | ||
| category | No | ||
| deadline | No | ||
| decision | No | accept|reject|edit|merge | |
| end_time | No | 时间算子:查询窗终点(缺省该侧=无界) | |
| entry_id | No | ||
| evidence | No | verify 的证据;state_event:出… | |
| max_rows | No | ||
| min_conf | No | ||
| negative | No | ||
| ordering | No | ||
| override | No | 覆盖/删除受保护节点需显式 override=t… | |
| patterns | No | ||
| position | No | record|reflect|verify|output|sustain | |
| prefixes | No | ||
| priority | No | ||
| question | No | ||
| relation | No | split_from|extracted_from|merged_from|refined_from|source | |
| sample_n | No | ||
| semantic | No | ||
| start_id | No | ||
| strategy | No | stratified|risk|random | |
| subjects | No | ||
| validity | No | ||
| verdicts | No | ||
| aeis_root | No | ||
| auto_heal | No | ||
| condition | No | ||
| direction | No | out|in | |
| entry_ids | No | ||
| max_files | No | ||
| max_items | No | ||
| max_nodes | No | ||
| min_delta | No | ||
| min_merge | No | ||
| neighbors | No | ||
| questions | No | ||
| skip_dirs | No | ||
| statement | No | ||
| subsystem | No | ||
| time_axis | No | 时间算子轴:effective(效力轴,read… | |
| timestamp | No | ||
| acceptance | No | ||
| auto_scrub | No | ||
| basis_text | No | ||
| conditions | No | goal op:生效条件 | |
| depends_on | No | ||
| done_limit | No | ||
| importance | No | 重要性 0-1 | |
| max_events | No | ||
| merge_into | No | ||
| session_id | No | ||
| start_time | No | 时间算子:查询窗起点(ISO8601/时间戳)。… | |
| subject_id | No | 取值随 op 变化,完整枚举见 op=help | |
| valid_from | No | 双时间轴**起点**(ISO8601,如 202… | |
| action_hint | No | ||
| aggregation | No | by_relation|by_parent|by_child | |
| auto_evolve | No | ||
| bypass_gain | No | ||
| consistency | No | ||
| contract_id | No | ||
| exclude_doc | No | 检索面排除 doc_ 索引节点(会话日志切片;默… | |
| goal_status | No | active|done|dropped | |
| incremental | No | ||
| ledger_only | No | ||
| min_cluster | No | ||
| min_jaccard | No | ||
| on_conflict | No | reject|defer|record | |
| peer_theory | No | ||
| recent_days | No | ||
| sensitivity | No | ||
| snapshot_id | No | ||
| task_status | No | active|blocked|done|dropped | |
| valid_until | No | 双时间轴**终点**(ISO8601):此刻后不… | |
| window_days | No | ||
| active_limit | No | ||
| allow_evolve | No | ||
| blindspot_id | No | ||
| content_kind | No | code|image_desc|text|permission|work_done|work_wip|ccg_marks|hyperedge | |
| derived_from | No | ||
| end_operator | No | gt|gte|eq|lte|lt | |
| expand_nodes | No | ||
| max_branches | No | ||
| min_severity | No | info|low|medium|high | |
| peer_version | No | ||
| position_map | No | ||
| sample_limit | No | ||
| signers_file | No | ||
| source_layer | No | ||
| subject_kind | No | self|user|role|agent | |
| target_layer | No | ||
| task_running | No | ||
| auto_flywheel | No | ||
| beat_interval | No | ||
| budget_tokens | No | read 的 token 预算 | |
| heal_interval | No | ||
| prune_dry_run | No | ||
| actual_node_id | No | ||
| check_strength | No | hoop|smoking_gun|doubly_decisive | |
| include_recent | No | ||
| min_importance | No | ||
| overwrite_live | No | ||
| peer_signature | No | ||
| relation_types | No | ||
| scrub_interval | No | ||
| start_operator | No | gt|gte|eq|lte|lt | |
| status_summary | No | ||
| condition_space | No | 条件空间 | |
| evolve_interval | No | ||
| importance_hint | No | ||
| include_content | No | ||
| include_history | No | ||
| include_partial | No | ||
| requested_layer | No | ||
| declared_charter | No | ||
| excerpt_strategy | No | ||
| predicted_node_id | No | ||
| require_conditions | No | ||
| verification_basis | No | 验证基底 | |
| non_applicable_conditions | No | 不适用条件 |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full behavioral burden. It hints at mutation-related ops such as write, protect, forget, and evolution, but does not disclose permissions, destructive effects, reversibility, protected-node constraints, or return behavior.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The definition is two sentences, front-loaded with the sole-entry-point role and operation families, followed by the help discovery instruction. It is dense but appropriately sized with no wasted text.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a 212-parameter multi-op gateway with no output schema and no annotations, the description is very sparse. It points to op=help but does not provide return information, per-op behavior, or enough standalone detail to invoke most operations correctly without an extra help call.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is only 29% across 212 parameters, so the schema cannot fully document itself. The description partially compensates by naming op and query and showing the help lookup pattern, but it does not explain most parameter meanings directly.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description identifies the resource clearly as the sole entry point to the Lingzhu cognitive graph and enumerates 38 operation families including write/read/review/protect/evolution. It does not mention the sibling tool stg, so sibling differentiation is absent, but the core purpose is clear.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It gives explicit discovery guidance: call cg(op="help", query="<op name | parameter name | tool name>") for complete op and parameter semantics. This is clear context for how to proceed, though it does not state when-not to use the tool or explain alternatives beyond being the sole entry point.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
stgC
语义时空图 5 op:relation|timeline|anchors|consistency|state_chain。完整 op/参数语义:cg(op="help", query="<op 名 | 参数名 | 工具名>")
| Name | Required | Description | Default |
|---|---|---|---|
| a | No | ||
| b | No | ||
| op | Yes | relation|timeline|anchors|consistency|state_chain | |
| bbox | No | ||
| desc | No | ||
| slot | No | ||
| layer | No | 限定层 | |
| limit | No | 返回条数 | |
| history | No | ||
| session | No | timeline 的会话视图开关(归因维度,与授… | |
| subject | No | state_chain 的主体(省略=不过滤) | |
| time_axis | No | ||
| time_window | No | ||
| include_retired | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full disclosure burden, and it discloses nothing: no read-vs-write characterization, no side effects, no auth or rate-limit notes, and no indication whether state_chain or consistency mutate graph state. The op names hint at intent but behavior remains opaque.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two short sentences, no filler, with the op enumeration front-loaded. The structure is efficient, though the second sentence substitutes a lookup pointer for content rather than adding substance.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a 14-parameter, multi-op tool with no annotations and no output schema, the description is far too thin to call correctly without a preliminary help lookup. The cg help pointer prevents total failure but leaves the definition dependent on an external call.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With 14 parameters and only 36% schema description coverage, the description must compensate, yet it offers no parameter meaning at all — it only says to query cg(op="help") for param semantics. Parameters like a, b, bbox, slot, time_axis, and include_retired are entirely undocumented in both places.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
It names the resource (semantic spatiotemporal graph) and enumerates the five allowed ops, so an agent knows the tool's domain. But it never says what any op actually does, and the op list merely restates the enum already present in the schema, leaving purpose vague beyond the name.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no guidance on when to pick stg over the sibling cg, nor when to use relation vs timeline vs consistency. The only routing hint is a self-referential pointer to cg(op="help"), which pushes the decision to a second call rather than informing selection.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
2 tool updates
v0.1.0- First observed
cg - First observed
stg
TDQS
Scored across 2 tools
Both tools are op-dispatch mega-tools whose domains (cognitive graph vs. semantic spatiotemporal graph) overlap in graph/relation/edge concepts, making it hard to know which entry point to use. With 38 hidden ops in cg and 5 in stg, an agent must first call help to disambiguate, which is a poor tool-set boundary.
The two names cg and stg follow a consistent short-lowercase-abbreviation convention with no mixing of styles. They are not self-descriptive verb_noun names, but consistency is strong.
Two tools is thin for a server with this much implied functionality, and cg alone hides 38 operations behind a single tool. The op-dispatch design may be intentional, but at the tool level it feels compressed and forces discovery through a help op.
The descriptions suggest broad coverage: cg spans write/read/audit/protect/evolve/metacognition/predict/validation/edges, and stg covers relation/timeline/anchors/consistency/state_chain. Minor uncertainty remains because actual op semantics are hidden behind cg(op="help"), but the surface appears fairly complete for a shared-memory graph domain.
Maintenance
Related MCP Connectors
- KogniteOAuthdev.kognite
Hosted agent memory: store, search, and recall facts across sessions from any MCP client.
Private-by-default, local-first memory/context/task orchestrator for MCP apps and agents.
Private memory, scratchpads, context export/restore and task handoff for AI agents.
501Person-owned AI memory: portable context for any MCP client.
Related MCP Servers
- FlicenseNot gradedqualityCmaintenanceEnables each user to have a private, per-user memory store that persists across AI tools, allowing them to store, recall, search, list, and delete memories via MCP.-
- AlicenseNot gradedqualityAmaintenanceProvides persistent memory for AI agents via MCP, enabling agents to store and access notes, files, and session context across sessions and clients while under user control.4MIT
- AlicenseAqualityCmaintenanceEnables concurrent terminal sessions or other MCP clients on the same machine to register, exchange messages, check inboxes/replies, and coordinate tasks through file-based storage without a daemon or network port.6MIT
- AlicenseNot gradedqualityBmaintenanceEnables any MCP stdio client to share one local, evidence-backed project memory store, letting agents record verified facts and task outcomes, retrieve a token-budgeted context packet, and review, approve, or invalidate entries before they become active. Also supports handoff capsules and evidence-freshness recovery so stale or disputed memory is surfaced rather than silently reused.36 npm1MIT