memplain 0.6.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- memplain/__init__.py +11 -0
- memplain/__main__.py +6 -0
- memplain/server.py +390 -0
- memplain-0.6.0.dist-info/METADATA +329 -0
- memplain-0.6.0.dist-info/RECORD +8 -0
- memplain-0.6.0.dist-info/WHEEL +4 -0
- memplain-0.6.0.dist-info/entry_points.txt +2 -0
- memplain-0.6.0.dist-info/licenses/LICENSE +21 -0
memplain/__init__.py
ADDED
memplain/__main__.py
ADDED
memplain/server.py
ADDED
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""
|
|
4
|
+
memory-mcp —— 从零写的一个"长期记忆"MCP 服务器
|
|
5
|
+
|
|
6
|
+
作用:把一组纯文本记忆文件(FACT / JOURNAL / SOUL / USER)暴露成 MCP 工具,
|
|
7
|
+
任何支持 MCP 的客户端(Cherry Studio、DeepSeek Harness、Claude Desktop 等)接上就能读写。
|
|
8
|
+
|
|
9
|
+
记忆位置:默认 E:\\memory,可用环境变量 MEMORY_DIR 覆盖。
|
|
10
|
+
传输方式:stdio(客户端启动本进程,通过标准输入输出收发 JSON-RPC)。
|
|
11
|
+
依赖:mcp >= 2.3.0(用的是 McpServer 新接口,mcp 1.x 的 FastMCP 不兼容)。
|
|
12
|
+
|
|
13
|
+
⚠️ 数据永远不离开本机 —— 本文件可以公开,记忆文件绝不上传。
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
import difflib
|
|
17
|
+
import json
|
|
18
|
+
import os
|
|
19
|
+
import re
|
|
20
|
+
import shutil
|
|
21
|
+
import sys
|
|
22
|
+
from datetime import date, datetime, timezone
|
|
23
|
+
from pathlib import Path
|
|
24
|
+
|
|
25
|
+
from mcp.server.mcpserver import MCPServer
|
|
26
|
+
|
|
27
|
+
# ─────────────────────────── 配置 ───────────────────────────
|
|
28
|
+
MEMORY_DIR = Path(os.environ.get("MEMORY_DIR", r"E:\memory"))
|
|
29
|
+
|
|
30
|
+
FACT_FILE = MEMORY_DIR / "FACT.md" # 长期记忆(整篇覆盖)
|
|
31
|
+
JOURNAL_FILE = MEMORY_DIR / "JOURNAL.jsonl" # 事件日志(逐行追加)
|
|
32
|
+
|
|
33
|
+
# 允许通过 memory_read 读的文件白名单(防越权读别的文件);归档文件也可读
|
|
34
|
+
READABLE = {"FACT.md", "FACT.archive.md", "JOURNAL.jsonl", "SOUL.md", "USER.md"}
|
|
35
|
+
|
|
36
|
+
# 缩水闸门:新 FACT 小于 1KB 且旧的大于它 3 倍时,拒绝覆盖(防写坏/截断)
|
|
37
|
+
MIN_FACT_BYTES = 1024
|
|
38
|
+
SHRINK_RATIO = 3
|
|
39
|
+
|
|
40
|
+
# 巩固阈值:新事件与"今天的某条"内容相似度达到这个比例,就并进那条,不再新增
|
|
41
|
+
MERGE_SIMILARITY = 0.90
|
|
42
|
+
|
|
43
|
+
mcp = MCPServer("memory")
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _now() -> str:
|
|
47
|
+
"""当前时间,本地时区 ISO 格式(带 +08:00 偏移,例如 2026-10-25T00:39:01.601+08:00)。
|
|
48
|
+
|
|
49
|
+
为什么不再写 UTC 的 "Z":外部消费方(Cherry 侧界面、别的 agent)常直接取 ts 的前 10 个
|
|
50
|
+
字符当日期显示。凌晨 0–8 点写出的条目,UTC 日期会落到前一天(本地 2026-10-25 00:39
|
|
51
|
+
→ "2026-10-24T16:39Z"),于是被误读成"昨天说的"。带偏移写出来仍是合法 ISO 8601,
|
|
52
|
+
绝对时间完全不变(本文件 _day_of() 会 astimezone 再取本地日期,结果一致),
|
|
53
|
+
但"截前 10 字符"的消费方也能拿到正确的本地日期。
|
|
54
|
+
"""
|
|
55
|
+
return datetime.now().astimezone().isoformat(timespec="milliseconds")
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def _backup(path: Path) -> str | None:
|
|
59
|
+
"""写入前先备份(文件名带日期)。返回备份路径,没写成功返回 None。"""
|
|
60
|
+
if not path.exists():
|
|
61
|
+
return None
|
|
62
|
+
bak = path.with_suffix(path.suffix + f".bak-{datetime.now():%Y%m%d-%H%M%S}")
|
|
63
|
+
shutil.copy2(path, bak)
|
|
64
|
+
return str(bak)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def _fmt_size(n: int) -> str:
|
|
68
|
+
"""字节数转人读格式。"""
|
|
69
|
+
if n < 1024:
|
|
70
|
+
return f"{n} B"
|
|
71
|
+
if n < 1024 * 1024:
|
|
72
|
+
return f"{n / 1024:.1f} KB"
|
|
73
|
+
return f"{n / 1024 / 1024:.2f} MB"
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def _norm(s: str) -> str:
|
|
77
|
+
"""归一化:小写 + 去掉空白与标点,只留比对用的“字”。"""
|
|
78
|
+
return re.sub(r"[\s\W_]+", "", s.lower())
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def _day_of(ts: str) -> date | None:
|
|
82
|
+
"""JOURNAL 里的 UTC 时间戳 → 本地日期。解析失败返回 None。"""
|
|
83
|
+
try:
|
|
84
|
+
return datetime.fromisoformat(str(ts).replace("Z", "+00:00")).astimezone().date()
|
|
85
|
+
except (ValueError, TypeError):
|
|
86
|
+
return None
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def _parse_day(s: str) -> date | None:
|
|
90
|
+
"""把 YYYY-MM-DD / YYYY/MM/DD 解析成本地日期;空串或非法返回 None。"""
|
|
91
|
+
s = (s or "").strip()
|
|
92
|
+
if not s:
|
|
93
|
+
return None
|
|
94
|
+
try:
|
|
95
|
+
return datetime.strptime(s.replace("/", "-"), "%Y-%m-%d").date()
|
|
96
|
+
except ValueError:
|
|
97
|
+
return None
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def _merge_into_today(text: str, tags: list[str]) -> str | None:
|
|
101
|
+
"""「巩固」:今天已有高度相似的条目就并进去,返回提示文案;没有就返回 None。
|
|
102
|
+
|
|
103
|
+
只回看最近 500 行、碰到更早的日期就停 —— 巩固的是“同一天里反复出现的事”。
|
|
104
|
+
"""
|
|
105
|
+
today = datetime.now().date()
|
|
106
|
+
lines = JOURNAL_FILE.read_text(encoding="utf-8", errors="replace").splitlines()
|
|
107
|
+
new_norm = _norm(text)
|
|
108
|
+
if not new_norm:
|
|
109
|
+
return None
|
|
110
|
+
|
|
111
|
+
best_i, best_ratio, best_entry = -1, 0.0, None
|
|
112
|
+
for i in range(len(lines) - 1, max(-1, len(lines) - 500), -1):
|
|
113
|
+
try:
|
|
114
|
+
e = json.loads(lines[i])
|
|
115
|
+
except json.JSONDecodeError:
|
|
116
|
+
continue
|
|
117
|
+
if _day_of(e.get("ts", "")) != today:
|
|
118
|
+
break
|
|
119
|
+
old_norm = _norm(str(e.get("text", "")))
|
|
120
|
+
if not old_norm:
|
|
121
|
+
continue
|
|
122
|
+
if new_norm in old_norm:
|
|
123
|
+
ratio = 1.0
|
|
124
|
+
else:
|
|
125
|
+
ratio = difflib.SequenceMatcher(None, old_norm, new_norm).ratio()
|
|
126
|
+
if ratio > best_ratio:
|
|
127
|
+
best_i, best_ratio, best_entry = i, ratio, e
|
|
128
|
+
|
|
129
|
+
if best_entry is None or best_ratio < MERGE_SIMILARITY:
|
|
130
|
+
return None
|
|
131
|
+
|
|
132
|
+
old_text = str(best_entry.get("text", ""))
|
|
133
|
+
if new_norm not in _norm(old_text):
|
|
134
|
+
best_entry["text"] = f"{old_text};{text}"
|
|
135
|
+
best_entry["tags"] = sorted({*(str(t) for t in (best_entry.get("tags") or [])), *tags})
|
|
136
|
+
lines[best_i] = json.dumps(best_entry, ensure_ascii=False)
|
|
137
|
+
|
|
138
|
+
bak = _backup(JOURNAL_FILE)
|
|
139
|
+
tmp = JOURNAL_FILE.with_name(JOURNAL_FILE.name + ".tmp")
|
|
140
|
+
tmp.write_text("\n".join(lines) + "\n", encoding="utf-8")
|
|
141
|
+
os.replace(tmp, JOURNAL_FILE)
|
|
142
|
+
return (
|
|
143
|
+
f"已合并进今天的第 {best_i + 1} 行(相似度 {best_ratio:.0%},未新增条目),"
|
|
144
|
+
f"当前共 {len(lines)} 条" + (f",备份:{bak}" if bak else "")
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def _archive_files() -> list[Path]:
|
|
149
|
+
"""记忆目录里的归档文件(`*.archive.md`,按名字排序)。
|
|
150
|
+
|
|
151
|
+
归档 = 从 FACT.md 搬出去的旧段落:不进每次会话的固定注入,但仍旧可读、可搜。
|
|
152
|
+
"""
|
|
153
|
+
if not MEMORY_DIR.exists():
|
|
154
|
+
return []
|
|
155
|
+
return sorted(MEMORY_DIR.glob("*.archive.md"))
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
# ─────────────────────────── 工具 ───────────────────────────
|
|
159
|
+
|
|
160
|
+
@mcp.tool(description=(
|
|
161
|
+
"读取记忆文件。filename 默认 FACT.md;可传 SOUL.md / USER.md / JOURNAL.jsonl / FACT.archive.md(归档)。"
|
|
162
|
+
"三种取法(按优先级):tail>0 只返回最后 tail 行;offset>0 或 limit>0 按行号读一段"
|
|
163
|
+
"(offset 从 1 起,limit 最多几行;配合 memory_search 给的行号读归档最省 token);"
|
|
164
|
+
"都不给就整份返回。"
|
|
165
|
+
))
|
|
166
|
+
def memory_read(filename: str = "FACT.md", tail: int = 0, offset: int = 0, limit: int = 0) -> str:
|
|
167
|
+
name = Path(filename).name
|
|
168
|
+
if name not in READABLE:
|
|
169
|
+
return f"拒绝:只能读 {sorted(READABLE)},收到的是 {filename!r}"
|
|
170
|
+
path = MEMORY_DIR / name
|
|
171
|
+
if not path.exists():
|
|
172
|
+
return f"文件不存在:{path}"
|
|
173
|
+
text = path.read_text(encoding="utf-8", errors="replace")
|
|
174
|
+
lines = text.splitlines()
|
|
175
|
+
total = len(lines)
|
|
176
|
+
if tail > 0:
|
|
177
|
+
start = max(1, total - tail + 1)
|
|
178
|
+
return f"[{name} 第 {start}–{total} 行 / 共 {total} 行]\n" + "\n".join(lines[-tail:])
|
|
179
|
+
if offset > 0 or limit > 0:
|
|
180
|
+
start = max(1, offset or 1)
|
|
181
|
+
if start > total:
|
|
182
|
+
return f"{name} 只有 {total} 行,offset={start} 超出范围"
|
|
183
|
+
end = total if limit <= 0 else min(total, start + limit - 1)
|
|
184
|
+
return f"[{name} 第 {start}–{end} 行 / 共 {total} 行]\n" + "\n".join(lines[start - 1:end])
|
|
185
|
+
return text
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
@mcp.tool(description=(
|
|
189
|
+
"覆盖写入 FACT.md(长期记忆)。写入前会自动备份,并有缩水保护:"
|
|
190
|
+
"若新内容不足 1KB 且旧内容的三倍以上,则拒绝(防写坏)。"
|
|
191
|
+
))
|
|
192
|
+
def memory_update(content: str) -> str:
|
|
193
|
+
old = FACT_FILE.read_text(encoding="utf-8") if FACT_FILE.exists() else ""
|
|
194
|
+
if len(content.encode("utf-8")) < MIN_FACT_BYTES and len(old.encode("utf-8")) > MIN_FACT_BYTES * SHRINK_RATIO:
|
|
195
|
+
return (f"拒绝写入:新内容太小({len(content.encode('utf-8'))} 字节),"
|
|
196
|
+
f"旧内容有 {len(old.encode('utf-8'))} 字节,疑似写坏/截断。"
|
|
197
|
+
f"确实要整篇覆盖,请直接编辑文件(写入前记得先备份)。")
|
|
198
|
+
bak = _backup(FACT_FILE)
|
|
199
|
+
FACT_FILE.write_text(content, encoding="utf-8")
|
|
200
|
+
return f"已写入 FACT.md({len(content.encode('utf-8'))} 字节)" + (f",备份:{bak}" if bak else "")
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
@mcp.tool(description=(
|
|
204
|
+
"往 JOURNAL.jsonl 追加一条事件记录。tags 可选,是标签列表。"
|
|
205
|
+
"默认先做「巩固」:如果今天已有条目与新内容相似度 ≥90%(或新内容被旧条目包含),"
|
|
206
|
+
"就不再新增,而是把新信息并进那条(保留原时间戳、tags 取并集)。merge=False 可强制新增。"
|
|
207
|
+
))
|
|
208
|
+
def memory_append(text: str, tags: list[str] | None = None, merge: bool = True) -> str:
|
|
209
|
+
text = (text or "").strip()
|
|
210
|
+
if not text:
|
|
211
|
+
return "拒绝:text 不能为空"
|
|
212
|
+
tags = [str(t) for t in (tags or [])]
|
|
213
|
+
if merge and JOURNAL_FILE.exists():
|
|
214
|
+
merged = _merge_into_today(text, tags)
|
|
215
|
+
if merged:
|
|
216
|
+
return merged
|
|
217
|
+
entry = {"ts": _now(), "tags": tags, "text": text}
|
|
218
|
+
with JOURNAL_FILE.open("a", encoding="utf-8") as f:
|
|
219
|
+
f.write(json.dumps(entry, ensure_ascii=False) + "\n")
|
|
220
|
+
with JOURNAL_FILE.open(encoding="utf-8", errors="replace") as f:
|
|
221
|
+
n = sum(1 for _ in f)
|
|
222
|
+
return f"已追加到 JOURNAL(当前共 {n} 条)"
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
@mcp.tool(description=(
|
|
226
|
+
"在记忆里检索。默认同时搜 JOURNAL 事件和归档文件(FACT.archive.md)——"
|
|
227
|
+
"归档是从 FACT 搬走的旧段落,不占固定注入,靠这里找回。"
|
|
228
|
+
"query 为空时只按 tag / 日期过滤 JOURNAL(= 列出某段时间的事)。"
|
|
229
|
+
"tag 可写多个(逗号分隔),命中任一即可;after / before 用 YYYY-MM-DD(本地日期,含当天)。"
|
|
230
|
+
"返回最近 limit 条事件(带时间戳与 tags)和命中的归档行。大小写不敏感的普通子串匹配,不是语义检索。"
|
|
231
|
+
))
|
|
232
|
+
def memory_search(
|
|
233
|
+
query: str = "",
|
|
234
|
+
limit: int = 20,
|
|
235
|
+
tag: str = "",
|
|
236
|
+
after: str = "",
|
|
237
|
+
before: str = "",
|
|
238
|
+
include_archive: bool = True,
|
|
239
|
+
) -> str:
|
|
240
|
+
q = (query or "").strip().lower()
|
|
241
|
+
want_tags = [t.strip().lower() for t in (tag or "").split(",") if t.strip()]
|
|
242
|
+
d_after, d_before = _parse_day(after), _parse_day(before)
|
|
243
|
+
|
|
244
|
+
hits: list[tuple[str, str, list[str]]] = []
|
|
245
|
+
if JOURNAL_FILE.exists():
|
|
246
|
+
for line in JOURNAL_FILE.read_text(encoding="utf-8", errors="replace").splitlines():
|
|
247
|
+
try:
|
|
248
|
+
e = json.loads(line)
|
|
249
|
+
except json.JSONDecodeError:
|
|
250
|
+
if q and q in line.lower():
|
|
251
|
+
hits.append(("", line, []))
|
|
252
|
+
continue
|
|
253
|
+
body = str(e.get("text", ""))
|
|
254
|
+
etags = [str(t) for t in (e.get("tags") or [])]
|
|
255
|
+
if q and q not in body.lower() and q not in line.lower():
|
|
256
|
+
continue
|
|
257
|
+
if want_tags and not any(t in {x.lower() for x in etags} for t in want_tags):
|
|
258
|
+
continue
|
|
259
|
+
if d_after or d_before:
|
|
260
|
+
d = _day_of(e.get("ts", ""))
|
|
261
|
+
if d is None or (d_after and d < d_after) or (d_before and d > d_before):
|
|
262
|
+
continue
|
|
263
|
+
hits.append((str(e.get("ts", "")), body, etags))
|
|
264
|
+
|
|
265
|
+
hits = hits[-limit:] # 取最近的
|
|
266
|
+
|
|
267
|
+
# 归档文件:按行子串匹配(默认开,避免"图省事只搜 JOURNAL"导致归档变成黑洞)
|
|
268
|
+
arch_hits: list[tuple[str, int, str]] = []
|
|
269
|
+
if q and include_archive:
|
|
270
|
+
for f in _archive_files():
|
|
271
|
+
try:
|
|
272
|
+
text = f.read_text(encoding="utf-8", errors="replace")
|
|
273
|
+
except OSError:
|
|
274
|
+
continue
|
|
275
|
+
for i, line in enumerate(text.splitlines(), 1):
|
|
276
|
+
if q in line.lower():
|
|
277
|
+
s = line.strip()
|
|
278
|
+
if len(s) > 300:
|
|
279
|
+
s = s[:300] + "…"
|
|
280
|
+
arch_hits.append((f.name, i, s))
|
|
281
|
+
|
|
282
|
+
if not hits and not arch_hits:
|
|
283
|
+
bits = []
|
|
284
|
+
if q:
|
|
285
|
+
bits.append(f"含 {query!r}")
|
|
286
|
+
if want_tags:
|
|
287
|
+
bits.append("tags=" + ",".join(want_tags))
|
|
288
|
+
if d_after:
|
|
289
|
+
bits.append(f">={d_after}")
|
|
290
|
+
if d_before:
|
|
291
|
+
bits.append(f"<={d_before}")
|
|
292
|
+
return "没找到" + ("(" + " ".join(bits) + ")" if bits else "任何记录")
|
|
293
|
+
|
|
294
|
+
out: list[str] = []
|
|
295
|
+
if hits:
|
|
296
|
+
out.append(f"找到 {len(hits)} 条 JOURNAL 事件(最近 {len(hits)} 条):")
|
|
297
|
+
for ts, body, etags in hits:
|
|
298
|
+
tail = f" (tags: {', '.join(etags)})" if etags else ""
|
|
299
|
+
out.append(f"[{ts}] {body}{tail}")
|
|
300
|
+
else:
|
|
301
|
+
out.append(f"JOURNAL 里没找到{'含 ' + repr(query) if q else '匹配记录'}(可能只在归档里,见下)")
|
|
302
|
+
if arch_hits:
|
|
303
|
+
out.append(f"归档文件命中 {len(arch_hits)} 行(不进每次注入,按需 memory_read 读原文):")
|
|
304
|
+
for name, i, s in arch_hits[:limit]:
|
|
305
|
+
out.append(f"[{name}:{i}] {s}")
|
|
306
|
+
return "\n".join(out)
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
@mcp.tool(description=(
|
|
310
|
+
"记忆体检(只读):返回各记忆文件的体积、行数/条数、最后修改时间与距今天数,"
|
|
311
|
+
"JOURNAL 的首末时间与今日新增条数,以及备份文件占用。"
|
|
312
|
+
"适合在整理记忆前、或回答「你记不记得某件事」之前先看整体状态——"
|
|
313
|
+
"它只量尺寸,不判断内容重要性、不动任何文件。"
|
|
314
|
+
))
|
|
315
|
+
def memory_stats() -> str:
|
|
316
|
+
if not MEMORY_DIR.exists():
|
|
317
|
+
return f"记忆目录不存在:{MEMORY_DIR}"
|
|
318
|
+
|
|
319
|
+
now = datetime.now()
|
|
320
|
+
today = now.date()
|
|
321
|
+
out = [f"记忆目录:{MEMORY_DIR}"]
|
|
322
|
+
hints: list[str] = []
|
|
323
|
+
|
|
324
|
+
names = ["FACT.md", "USER.md", "SOUL.md", "JOURNAL.jsonl"] + [p.name for p in _archive_files()]
|
|
325
|
+
for name in names:
|
|
326
|
+
path = MEMORY_DIR / name
|
|
327
|
+
if not path.exists():
|
|
328
|
+
out.append(f"{name}:不存在")
|
|
329
|
+
continue
|
|
330
|
+
size = path.stat().st_size
|
|
331
|
+
text = path.read_text(encoding="utf-8", errors="replace")
|
|
332
|
+
|
|
333
|
+
if name == "JOURNAL.jsonl":
|
|
334
|
+
lines = text.splitlines()
|
|
335
|
+
first_ts = last_ts = "?"
|
|
336
|
+
today_n = 0
|
|
337
|
+
for ln in lines:
|
|
338
|
+
try:
|
|
339
|
+
entry = json.loads(ln)
|
|
340
|
+
except json.JSONDecodeError:
|
|
341
|
+
continue
|
|
342
|
+
ts = str(entry.get("ts", ""))
|
|
343
|
+
if not ts:
|
|
344
|
+
continue
|
|
345
|
+
if first_ts == "?":
|
|
346
|
+
first_ts = ts
|
|
347
|
+
last_ts = ts
|
|
348
|
+
try:
|
|
349
|
+
local_day = datetime.fromisoformat(ts.replace("Z", "+00:00")).astimezone().date()
|
|
350
|
+
except ValueError:
|
|
351
|
+
continue
|
|
352
|
+
if local_day == today:
|
|
353
|
+
today_n += 1
|
|
354
|
+
out.append(
|
|
355
|
+
f"{name}:{_fmt_size(size)},{len(lines)} 条,"
|
|
356
|
+
f"今日新增 {today_n} 条,{first_ts[:10]} → {last_ts[:10]}"
|
|
357
|
+
)
|
|
358
|
+
if size > 400 * 1024:
|
|
359
|
+
hints.append(f"JOURNAL 已到 {_fmt_size(size)},旧事件可考虑归档")
|
|
360
|
+
else:
|
|
361
|
+
lines = text.count("\n") + (1 if text and not text.endswith("\n") else 0)
|
|
362
|
+
mtime = datetime.fromtimestamp(path.stat().st_mtime)
|
|
363
|
+
out.append(
|
|
364
|
+
f"{name}:{_fmt_size(size)},{lines} 行,"
|
|
365
|
+
f"改于 {mtime:%Y-%m-%d %H:%M}({(now - mtime).days} 天前)"
|
|
366
|
+
)
|
|
367
|
+
if name == "FACT.md" and size > 60 * 1024:
|
|
368
|
+
hints.append(f"FACT 已到 {_fmt_size(size)}(新会话要整份注入),可考虑归档旧段落")
|
|
369
|
+
|
|
370
|
+
baks = [p for p in MEMORY_DIR.iterdir() if p.is_file() and ".bak" in p.name]
|
|
371
|
+
if baks:
|
|
372
|
+
total = sum(p.stat().st_size for p in baks)
|
|
373
|
+
out.append(f"备份文件:{len(baks)} 个,共 {_fmt_size(total)}")
|
|
374
|
+
|
|
375
|
+
if hints:
|
|
376
|
+
out.append("提示:" + ";".join(hints))
|
|
377
|
+
else:
|
|
378
|
+
out.append("提示:各文件体积正常")
|
|
379
|
+
return "\n".join(out)
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
def main() -> None:
|
|
383
|
+
if not MEMORY_DIR.exists():
|
|
384
|
+
print(f"警告:记忆目录不存在 {MEMORY_DIR},已自动创建(空的记忆)。", file=sys.stderr)
|
|
385
|
+
MEMORY_DIR.mkdir(parents=True, exist_ok=True)
|
|
386
|
+
mcp.run(transport="stdio")
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
if __name__ == "__main__":
|
|
390
|
+
main()
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: memplain
|
|
3
|
+
Version: 0.6.0
|
|
4
|
+
Summary: 本地纯文本长期记忆 MCP 服务器:一份记忆目录,多个 AI 客户端共用(Cherry Studio / Claude Desktop / DeepSeek Harness)
|
|
5
|
+
Project-URL: Homepage, https://github.com/WANGJINSHAN-11/memory_mcp
|
|
6
|
+
Project-URL: Repository, https://github.com/WANGJINSHAN-11/memory_mcp
|
|
7
|
+
Project-URL: Issues, https://github.com/WANGJINSHAN-11/memory_mcp/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/WANGJINSHAN-11/memory_mcp/blob/main/CHANGELOG.md
|
|
9
|
+
Author: WANGJINSHAN-11
|
|
10
|
+
License: MIT License
|
|
11
|
+
|
|
12
|
+
Copyright (c) 2026 WANGJINSHAN-11
|
|
13
|
+
|
|
14
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
15
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
16
|
+
in the Software without restriction, including without limitation the rights
|
|
17
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
18
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
19
|
+
furnished to do so, subject to the following conditions:
|
|
20
|
+
|
|
21
|
+
The above copyright notice and this permission notice shall be included in all
|
|
22
|
+
copies or substantial portions of the Software.
|
|
23
|
+
|
|
24
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
25
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
26
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
27
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
28
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
29
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
30
|
+
SOFTWARE.
|
|
31
|
+
License-File: LICENSE
|
|
32
|
+
Keywords: ai-agent,cherry-studio,claude,local-first,markdown,mcp,memory
|
|
33
|
+
Classifier: Development Status :: 4 - Beta
|
|
34
|
+
Classifier: Intended Audience :: Developers
|
|
35
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
36
|
+
Classifier: Operating System :: OS Independent
|
|
37
|
+
Classifier: Programming Language :: Python :: 3
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
41
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
42
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
43
|
+
Requires-Python: >=3.10
|
|
44
|
+
Requires-Dist: mcp>=2.3.0
|
|
45
|
+
Description-Content-Type: text/markdown
|
|
46
|
+
|
|
47
|
+
# memplain
|
|
48
|
+
|
|
49
|
+
> 让 AI 记住你,但记忆存在**你自己磁盘上的文本文件**里。
|
|
50
|
+
> Local-first, plain-text long-term memory for any MCP client.
|
|
51
|
+
|
|
52
|
+
<p>
|
|
53
|
+
<img alt="Python" src="https://img.shields.io/badge/python-%E2%89%A53.10-blue">
|
|
54
|
+
<img alt="License" src="https://img.shields.io/badge/license-MIT-green">
|
|
55
|
+
<img alt="MCP" src="https://img.shields.io/badge/MCP-2.x-purple">
|
|
56
|
+
</p>
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## 安装
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pip install memplain
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
或者从源码装(开发用):
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
git clone https://github.com/WANGJINSHAN-11/memory_mcp.git
|
|
70
|
+
cd memory_mcp
|
|
71
|
+
pip install -e .
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
装完有两个入口,效果一样:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
memplain # 命令行脚本
|
|
78
|
+
python -m memplain # 模块方式
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## English quick start
|
|
82
|
+
|
|
83
|
+
A **local-first, plain-text long-term memory server** for any MCP client (Cherry Studio, Claude Desktop, DeepSeek Harness, …). Memory lives in four human-readable files under `MEMORY_DIR` — `FACT.md`, `JOURNAL.jsonl`, `SOUL.md`, `USER.md` — so you can open, edit, back up and `git diff` it.
|
|
84
|
+
|
|
85
|
+
- No database, no vector store, no network calls.
|
|
86
|
+
- Five tools: `memory_read`, `memory_update`, `memory_append`, `memory_search`, `memory_stats`.
|
|
87
|
+
- Safety: shrink protection on `FACT.md` (refuses writes that shrink it below 1 KB or to less than 1/3 of its size), automatic `*.bak-<timestamp>` backup before every overwrite, read whitelist.
|
|
88
|
+
- Requires Python ≥ 3.10 and `mcp >= 2.3.0`.
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
git clone https://github.com/WANGJINSHAN-11/memory_mcp.git
|
|
92
|
+
cd memory_mcp
|
|
93
|
+
python -m venv .venv
|
|
94
|
+
.venv\Scripts\python -m pip install -r requirements.txt # macOS/Linux: .venv/bin/python
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Client config for any MCP client — command = venv python, args = [`server.py`], env = `MEMORY_DIR`:
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"mcpServers": {
|
|
102
|
+
"memory": {
|
|
103
|
+
"command": "C:\\path\\to\\memory_mcp\\.venv\\Scripts\\python.exe",
|
|
104
|
+
"args": ["C:\\path\\to\\memory_mcp\\server.py"],
|
|
105
|
+
"env": { "MEMORY_DIR": "E:\\memory" }
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Ready-made configs for Cherry Studio / Claude Desktop / DeepSeek Harness are in [`examples/`](examples/).
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## 30 秒看懂
|
|
116
|
+
|
|
117
|
+
- **记忆 = 4 个纯文本文件**(+ 可选的 `FACT.archive.md` 归档):`FACT.md`(长期事实)、`JOURNAL.jsonl`(事件流水)、`SOUL.md`(人格)、`USER.md`(用户档案)
|
|
118
|
+
- **工具 = 一个 MCP 服务器**:只负责读写上面这几个文件,不联网、不建库、不上云
|
|
119
|
+
- **结果**:Cherry Studio、Claude Desktop、DeepSeek Harness……接上**同一个目录**,就共享同一份记忆
|
|
120
|
+
|
|
121
|
+
记忆长这样(`JOURNAL.jsonl` 的一行,人眼可读,`git diff` 可看):
|
|
122
|
+
|
|
123
|
+
```json
|
|
124
|
+
{"ts":"2026-10-19T06:59:54.413Z","tags":["项目","进度"],"text":"一句话结论,不抄原文。"}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**代码公开,数据私有。** 仓库里只有代码;记忆文件永远留在你本机,`.gitignore` 已经把它们挡死了。
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## 它解决什么问题
|
|
132
|
+
|
|
133
|
+
每个 AI 客户端(Cherry Studio、Claude Desktop、Cursor、各种 Agent 框架)都有自己的"记忆",但数据往往锁在平台里:
|
|
134
|
+
换个客户端,记忆就断了;导出是一堆看不懂的 JSON;同步全靠平台。
|
|
135
|
+
|
|
136
|
+
这个项目只做一件事:**把记忆从平台里拿出来,变成你能打开、能改、能备份、能进 git 的文本文件**,
|
|
137
|
+
再用 MCP 把这几个文件开放给任何客户端。
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## 安装
|
|
142
|
+
|
|
143
|
+
### 克隆源码
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
git clone https://github.com/WANGJINSHAN-11/memory_mcp.git
|
|
147
|
+
cd memory_mcp
|
|
148
|
+
|
|
149
|
+
python -m venv .venv
|
|
150
|
+
|
|
151
|
+
# Windows
|
|
152
|
+
.venv\Scripts\pip install -r requirements.txt
|
|
153
|
+
# macOS / Linux
|
|
154
|
+
# .venv/bin/pip install -r requirements.txt
|
|
155
|
+
|
|
156
|
+
# 自检:在临时目录里跑,不碰你的真实记忆
|
|
157
|
+
.venv\Scripts\python.exe _test.py
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
要求:**Python ≥ 3.10**(实测 3.13.3)、**mcp ≥ 2.3.0**。
|
|
161
|
+
⚠️ 本版用 mcp 2.x 的 `MCPServer` 接口,**1.x 的 `FastMCP` 写法不兼容**。
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## 接到客户端
|
|
166
|
+
|
|
167
|
+
三要素就三个字段:
|
|
168
|
+
|
|
169
|
+
| 字段 | 值 |
|
|
170
|
+
|---|---|
|
|
171
|
+
| 命令 | 仓库 venv 里的 Python:`<仓库路径>\.venv\Scripts\python.exe`(macOS/Linux 用 `.venv/bin/python`) |
|
|
172
|
+
| 参数 | `<仓库路径>/server.py` 的绝对路径 |
|
|
173
|
+
| 环境变量 | `MEMORY_DIR=<你的记忆目录>`(建议显式填,默认是 `E:\memory`) |
|
|
174
|
+
|
|
175
|
+
### Cherry Studio / Claude Desktop / 任何 `mcpServers` 格式的客户端
|
|
176
|
+
|
|
177
|
+
```json
|
|
178
|
+
{
|
|
179
|
+
"mcpServers": {
|
|
180
|
+
"memory": {
|
|
181
|
+
"command": "E:\\memory-mcp\\.venv\\Scripts\\python.exe",
|
|
182
|
+
"args": ["E:\\memory-mcp\\server.py"],
|
|
183
|
+
"env": { "MEMORY_DIR": "E:\\memory" }
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### DeepSeek Harness(`cordis.patch.yml`)
|
|
190
|
+
|
|
191
|
+
```yaml
|
|
192
|
+
- insert:
|
|
193
|
+
- id: mcp-memory
|
|
194
|
+
name: '@deepseek-ai/dsh-mcp-client'
|
|
195
|
+
config:
|
|
196
|
+
transport: stdio
|
|
197
|
+
serverName: memory
|
|
198
|
+
command: 'E:\memory-mcp\.venv\Scripts\python.exe'
|
|
199
|
+
args: ['E:\memory-mcp\server.py']
|
|
200
|
+
env:
|
|
201
|
+
MEMORY_DIR: 'E:\memory'
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### macOS / Linux 路径对照
|
|
205
|
+
|
|
206
|
+
把上面的 Python 换成 `<仓库路径>/.venv/bin/python`、`server.py` 换成 `<仓库路径>/server.py` 即可。
|
|
207
|
+
`examples/` 里有三个现成文件:`cherry-studio.json`、`claude-desktop.json`、`deepseek-harness.patch.yml`。
|
|
208
|
+
|
|
209
|
+
> ⚠️ **多个客户端同时开着时**:`memory_update` 是整篇覆盖 `FACT.md`,两个客户端同时写会互相覆盖。
|
|
210
|
+
> 约定同一时间只让一个客户端写长期记忆;`memory_append`(追加)可以随便并发。
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## 五个工具
|
|
215
|
+
|
|
216
|
+
| 工具 | 作用 |
|
|
217
|
+
|---|---|
|
|
218
|
+
| `memory_read(filename="FACT.md", tail=0, offset=0, limit=0)` | 读记忆文件;`tail=N` 读末尾 N 行;`offset`/`limit` 按行号读一段(读归档时最省 token) |
|
|
219
|
+
| `memory_update(content)` | 整篇覆盖 `FACT.md`;**写入前自动备份** + **缩水保护** |
|
|
220
|
+
| `memory_append(text, tags=[], merge=True)` | 往 `JOURNAL.jsonl` 追加一条事件;**默认「巩固」**:与今天某条相似度 ≥90% 就并进那条,不新增 |
|
|
221
|
+
| `memory_search(query="", limit=20, tag="", after="", before="", include_archive=True)` | 检索:JOURNAL 关键词 + tag/日期过滤(`YYYY-MM-DD`,本地日期);**默认连归档文件一起搜**(`include_archive=False` 关掉) |
|
|
222
|
+
| `memory_stats()` | **记忆体检(只读)**:各文件体积/行数/条数、最后修改时间与距今天数、JOURNAL 首末时间与今日新增、备份占用;超阈值给整理提示 |
|
|
223
|
+
|
|
224
|
+
给模型用的习惯:
|
|
225
|
+
|
|
226
|
+
| 想做的事 | 调用 |
|
|
227
|
+
|---|---|
|
|
228
|
+
| 读长期记忆 | `memory_read()` |
|
|
229
|
+
| 只读 FACT 末尾几节(省 token) | `memory_read(tail=50)` |
|
|
230
|
+
| 按行号读归档的一段(配合 search 给的行号) | `memory_read(filename="FACT.archive.md", offset=88, limit=12)` |
|
|
231
|
+
| 记一条事件(只写结论,不抄原文) | `memory_append(text="...", tags=["项目"])` |
|
|
232
|
+
| 手动补一条重复内容(不想合并) | `memory_append(text="...", merge=False)` |
|
|
233
|
+
| 找以前记过的事 | `memory_search(query="关键词")`(默认连归档一起搜) |
|
|
234
|
+
| 找已经搬进归档的旧事 | 同上,不用额外参数;需要看原文就 `memory_read(filename="FACT.archive.md")` |
|
|
235
|
+
| 看某个方向最近都发生了什么 | `memory_search(tag="项目")` 或 `memory_search(after="2026-10-01", before="2026-10-31")` |
|
|
236
|
+
| 先看记忆整体状态、该不该整理 | `memory_stats()` |
|
|
237
|
+
| 重写整篇 FACT(谨慎) | `memory_update(content="...")` |
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## 记忆文件格式
|
|
242
|
+
|
|
243
|
+
目录结构(默认 `E:\memory`,用环境变量 `MEMORY_DIR` 可改到任意位置):
|
|
244
|
+
|
|
245
|
+
```
|
|
246
|
+
<MEMORY_DIR>\
|
|
247
|
+
├── FACT.md 长期记忆:身份、项目、环境、约定……(整篇覆盖)
|
|
248
|
+
├── FACT.archive.md 归档(可选):从 FACT 搬出的旧段落,不进固定注入,靠 memory_search 找回
|
|
249
|
+
├── JOURNAL.jsonl 事件日志:每行一条 JSON(只追加)
|
|
250
|
+
├── SOUL.md 人格定义(只读)
|
|
251
|
+
└── USER.md 用户档案(只读)
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
`JOURNAL.jsonl` 每行格式(时间戳统一 **UTC、`Z` 结尾、毫秒**,方便跨机器合并排序):
|
|
255
|
+
|
|
256
|
+
```json
|
|
257
|
+
{"ts":"2026-10-19T06:59:54.413Z","tags":["项目","进度"],"text":"一句话结论,不抄原文。"}
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
`templates/` 里有一份空的 FACT 骨架和 JOURNAL 示例,可以先照着抄。
|
|
261
|
+
|
|
262
|
+
**FACT 太大怎么办(归档)**:新会话往往得把 `FACT.md` 整篇读进来,所以它越短越好。用 `memory_stats()` 看体积,超过约 60 KB 就把「日期流水」这类旧段落**整节**剪到 `FACT.archive.md`(原文不动,FACT 原位留一行指针),并且**先备份**。归档文件不参与固定注入,但 `memory_read` 能读、`memory_search` 默认会搜——**归档 = 搬家,不是丢弃**。
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
## 安全设计
|
|
267
|
+
|
|
268
|
+
1. 🔒 **缩水保护**:`memory_update` 若发现新内容不足 1KB、且旧内容是它的 **3 倍以上**,直接拒绝——防一次误写/截断毁掉全部记忆。真要整篇覆盖,请直接编辑文件(记得先备份)。
|
|
269
|
+
2. 💾 **自动备份**:每次覆盖写入前,旧文件先备份成 `FACT.md.bak-<时间戳>`。
|
|
270
|
+
3. 📖 **读取白名单**:`memory_read` 只能读 FACT / FACT.archive / JOURNAL / SOUL / USER,`../../secret.txt` 这类越权路径会被拒。
|
|
271
|
+
4. 🏠 **数据不出本机**:服务器只读写本地文件,没有任何网络请求。
|
|
272
|
+
5. 🔧 **路径不写死**:`MEMORY_DIR` 环境变量,换机器只改一处。
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
## 项目结构
|
|
277
|
+
|
|
278
|
+
```
|
|
279
|
+
memory-mcp/
|
|
280
|
+
├── memplain/
|
|
281
|
+
│ ├── __init__.py 包入口(导出 main、__version__)
|
|
282
|
+
│ ├── __main__.py 支持 python -m memplain
|
|
283
|
+
│ └── server.py MCP 服务器主体(约 370 行,中文注释,可当源码读)
|
|
284
|
+
├── server.py 兼容层:老配置里写 server.py 路径照样能跑
|
|
285
|
+
├── pyproject.toml 打包配置(预留,暂未发布到 PyPI)
|
|
286
|
+
├── requirements.txt 源码方式的依赖(只有 mcp)
|
|
287
|
+
├── _test.py 本地自检:临时目录 + 完整握手 + 五个工具 + 越权断言
|
|
288
|
+
├── README.md / CHANGELOG.md / LICENSE
|
|
289
|
+
├── examples/ 三个客户端的接入配置示例
|
|
290
|
+
└── templates/ 记忆文件骨架
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## 设计取舍:为什么不用数据库 / 向量库
|
|
296
|
+
|
|
297
|
+
- **可读**:出问题打开文件就能看,不用工具、不用查询语句
|
|
298
|
+
- **可迁移**:换机器拷一个目录就完事,没有导出/导入格式
|
|
299
|
+
- **可版本化**:`git diff` 能看见记忆是怎么长出来的
|
|
300
|
+
- **便宜**:一个进程、零 embedding、零索引,不额外烧 token
|
|
301
|
+
- **缺点**:`memory_search` 只是关键词子串匹配,没有语义检索;`FACT.md` 变大后要配合 `tail` 分页读,或先用 `memory_stats()` 看体积再决定是否整理
|
|
302
|
+
|
|
303
|
+
这些缺点是有意接受的——记忆量在"几千条事件、几十 KB 正文"这个量级时,纯文本完全够用,
|
|
304
|
+
而可读、可改、可迁移的价值远大于语义检索。
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
## 常见问题
|
|
309
|
+
|
|
310
|
+
- **装了没反应?** 先确认 `MEMORY_DIR` 存在且可写;客户端里手动调用 `memory_read` 看返回。
|
|
311
|
+
- **Windows 路径怎么写?** JSON 里反斜杠要转义:`"E:\\memory"`;YAML 里用单引号:`'E:\memory'`。
|
|
312
|
+
- **换机器怎么办?** 拷整个记忆目录过去,只改 `MEMORY_DIR`,其他不动。
|
|
313
|
+
- **能和官方 memory MCP 一起用吗?** 能,它们各管各的目录;本项目的记忆是纯文本,随时能肉眼检查。
|
|
314
|
+
- **mcp 1.x 报错?** 升级:`pip install -U "mcp>=2.3.0"`。
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
## 版本
|
|
319
|
+
|
|
320
|
+
见 [CHANGELOG.md](CHANGELOG.md)。当前 **v0.6.0**(2026-10-24)。
|
|
321
|
+
|
|
322
|
+
## 许可
|
|
323
|
+
|
|
324
|
+
MIT,见 [LICENSE](LICENSE)。
|
|
325
|
+
|
|
326
|
+
## 致谢
|
|
327
|
+
|
|
328
|
+
基于 MCP 官方 Python SDK([modelcontextprotocol/python-sdk](https://github.com/modelcontextprotocol/python-sdk))实现;
|
|
329
|
+
接口设计参考了社区里常见的 `memory_read / memory_update / memory_append / memory_search` 四工具约定;`memory_stats` 是本项目额外加的只读"体检"口,不参与读写。
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
memplain/__init__.py,sha256=ZcV9h2C2kBCLqurBqRGpPzvM9LiY0nNanT4i0L0ENvQ,326
|
|
2
|
+
memplain/__main__.py,sha256=EWBv5JZGaY84YQArpKktPQIO_JLCdhNVmdmE-rXESK8,102
|
|
3
|
+
memplain/server.py,sha256=vyfVIn_FFPApcFmxqQSpYBeVr9JGpc0XBpqgVK6ODk0,16472
|
|
4
|
+
memplain-0.6.0.dist-info/METADATA,sha256=1PNsYf9zOR9PAjRnZncbax--kWqvCvdZlYEOQHWKYTI,14410
|
|
5
|
+
memplain-0.6.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
6
|
+
memplain-0.6.0.dist-info/entry_points.txt,sha256=erdkoSeTfFiyVj9ddL0pHsdoZj7PrNY7PP-SRiJ00Jk,50
|
|
7
|
+
memplain-0.6.0.dist-info/licenses/LICENSE,sha256=TD8y1g1XDsk9KWTIg2vFRMcBFUJso2DJSbImNeEayjE,1071
|
|
8
|
+
memplain-0.6.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 WANGJINSHAN-11
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|