coremind-memory-mcp 0.1.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.
@@ -0,0 +1,3 @@
1
+ """CoreMind 独立 Hindsight 记忆网关。"""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,247 @@
1
+ """通过固定版 Hindsight SDK 管理自托管记忆库。"""
2
+
3
+ import asyncio
4
+ import json
5
+ from concurrent.futures import ThreadPoolExecutor
6
+ from datetime import date, datetime, timezone
7
+ from threading import RLock
8
+ from urllib.parse import urlsplit
9
+
10
+ from hindsight_client import Hindsight
11
+ from hindsight_client_api.exceptions import NotFoundException
12
+ from pydantic import BaseModel, ConfigDict, Field, ValidationError
13
+
14
+
15
+ def _document_tag(document_id: str) -> str:
16
+ if not document_id or "*" in document_id:
17
+ raise ValueError("记忆文档标识不能为空或包含通配符")
18
+ return f"coremind-doc:{document_id}"
19
+
20
+
21
+ class _Reflection(BaseModel):
22
+ model_config = ConfigDict(extra="forbid", strict=True, str_strip_whitespace=True)
23
+
24
+ hasDirectEvidence: bool = Field(description="来源是否直接支持提问所需的全部关键事实,相近主题或缺少记录时为 false")
25
+ rule: str = Field(description="可用于以后任务的经验规则,证据不足时留空")
26
+ conditions: list[str] = Field(description="该规则适用的条件")
27
+ counterexamples: list[str] = Field(description="依据支持的反例或失败情形")
28
+ attribution: list[str] = Field(description="规则和反例分别来自哪些依据")
29
+ needsConfirmation: list[str] = Field(description="需要宿主确认的问题")
30
+
31
+
32
+ def _fact(item: dict) -> dict | None:
33
+ metadata = item.get("metadata") or {}
34
+ try:
35
+ raw_version = metadata["version"]
36
+ version = int(raw_version)
37
+ source = json.loads(metadata["source"])
38
+ except (KeyError, TypeError, ValueError):
39
+ return None
40
+ if version < 1 or str(version) != raw_version or not isinstance(source, dict) or not source:
41
+ return None
42
+ return {
43
+ **item,
44
+ "documentId": item.get("document_id"),
45
+ "source": source,
46
+ "version": version,
47
+ "expiresAt": metadata.get("expiresAt") or None,
48
+ "kind": metadata.get("kind"),
49
+ }
50
+
51
+
52
+ def _active(item: dict) -> bool:
53
+ if item.get("state", "valid") != "valid":
54
+ return False
55
+ expiry = item["expiresAt"]
56
+ if not expiry:
57
+ return True
58
+ try:
59
+ deadline = date.fromisoformat(expiry)
60
+ except (TypeError, ValueError):
61
+ return False
62
+ return deadline.isoformat() == expiry and deadline > datetime.now(timezone.utc).date()
63
+
64
+
65
+ class HindsightBackend:
66
+ def __init__(self, base_url: str, api_key: str | None = None):
67
+ endpoint = urlsplit(base_url)
68
+ if (
69
+ endpoint.scheme not in {"http", "https"}
70
+ or not endpoint.hostname
71
+ or endpoint.username is not None
72
+ or endpoint.query
73
+ or endpoint.fragment
74
+ ):
75
+ raise ValueError("请提供明确的 Hindsight 自托管 HTTP(S) 地址")
76
+ self._client = Hindsight(base_url, api_key=api_key, max_attempts=1)
77
+ # 官方异步 HTTP 会话绑定事件循环,多个工具线程共用一个循环。
78
+ self._runner = asyncio.Runner()
79
+ self._worker = ThreadPoolExecutor(max_workers=1)
80
+ self._lock = RLock()
81
+ self._closed = False
82
+
83
+ def _run(self, coroutine):
84
+ with self._lock:
85
+ if self._closed:
86
+ coroutine.close()
87
+ raise RuntimeError("Hindsight 记忆连接已关闭")
88
+ return self._worker.submit(self._runner.run, coroutine).result()
89
+
90
+ def ensure_bank(self, bank_id: str) -> None:
91
+ self._run(self._ensure_bank(bank_id))
92
+
93
+ async def _ensure_bank(self, bank_id: str) -> None:
94
+ # 仅文档列表明确区分不存在的库与空库。
95
+ try:
96
+ await self._client.documents.list_documents(bank_id, limit=1)
97
+ except NotFoundException:
98
+ await self._client.acreate_bank(
99
+ bank_id, retain_extraction_mode="chunks", enable_observations=False
100
+ )
101
+ config = (await self._client.aget_bank_config(bank_id))["config"]
102
+ if config.get("retain_extraction_mode") != "chunks" or config.get("enable_observations") is not False:
103
+ raise RuntimeError("Hindsight 记忆库必须使用 chunks 并关闭观察自动提炼")
104
+
105
+ def retain(
106
+ self,
107
+ bank_id: str,
108
+ document_id: str,
109
+ text: str,
110
+ *,
111
+ source: dict,
112
+ version: int | str,
113
+ expires_at: str | None = None,
114
+ kind: str = "fact",
115
+ ) -> None:
116
+ response = self._run(
117
+ self._client.aretain(
118
+ bank_id,
119
+ text,
120
+ timestamp=f"{source['occurredAt']}T00:00:00Z",
121
+ document_id=document_id,
122
+ metadata={
123
+ "source": json.dumps(source, ensure_ascii=False, sort_keys=True),
124
+ "version": str(version),
125
+ "expiresAt": expires_at or "",
126
+ "kind": kind,
127
+ },
128
+ tags=[_document_tag(document_id)],
129
+ update_mode="replace",
130
+ resolve_entities=False,
131
+ )
132
+ )
133
+ if not response.success or response.var_async or response.items_count != 1:
134
+ raise RuntimeError("Hindsight 未确认完成记忆写入")
135
+
136
+ def get_document(self, bank_id: str, document_id: str) -> dict | None:
137
+ try:
138
+ response = self._run(self._client.documents.get_document(bank_id, document_id))
139
+ except NotFoundException:
140
+ return None
141
+ return response.model_dump(mode="json")
142
+
143
+ def recall(
144
+ self, bank_id: str, query: str, *, allowed_document_ids: list[str] | None = None
145
+ ) -> list[dict]:
146
+ if allowed_document_ids == []:
147
+ return []
148
+ tags = (
149
+ [_document_tag(value) for value in allowed_document_ids]
150
+ if allowed_document_ids is not None
151
+ else None
152
+ )
153
+ response = self._run(
154
+ self._client.arecall(
155
+ bank_id,
156
+ query,
157
+ types=["world", "experience"],
158
+ tags=tags,
159
+ tags_match="any_strict",
160
+ )
161
+ )
162
+ allowed = set(allowed_document_ids) if allowed_document_ids is not None else None
163
+ matches = []
164
+ for result in response.results:
165
+ item = _fact(result.model_dump(mode="json"))
166
+ if (
167
+ item
168
+ and item["documentId"]
169
+ and (allowed is None or item["documentId"] in allowed)
170
+ and _active(item)
171
+ ):
172
+ matches.append(item)
173
+ return matches
174
+
175
+ def reflect(
176
+ self, bank_id: str, query: str, *, allowed_document_ids: list[str]
177
+ ) -> dict:
178
+ if not allowed_document_ids:
179
+ return {}
180
+ return self._run(self._reflect(bank_id, query, allowed_document_ids))
181
+
182
+ async def _reflect(self, bank_id: str, query: str, allowed: list[str]) -> dict:
183
+ question = (
184
+ "只围绕以下待复盘问题生成候选。如果获准来源缺少问题要求的任何关键事实,"
185
+ "将 hasDirectEvidence 设为 false、rule 留空。不要根据相近主题生成替代经验,"
186
+ "也不要把未找到的内容写成不存在的事实。\n\n"
187
+ f"待复盘问题:{query}"
188
+ )
189
+ response = await self._client.areflect(
190
+ bank_id,
191
+ question,
192
+ tags=[_document_tag(value) for value in allowed],
193
+ tags_match="any_strict",
194
+ include_facts=True,
195
+ fact_types=["world", "experience"],
196
+ exclude_mental_models=True,
197
+ response_schema=_Reflection.model_json_schema(),
198
+ )
199
+ basis = response.based_on
200
+ if not basis or not basis.memories or basis.mental_models or basis.directives:
201
+ return {}
202
+ try:
203
+ structured = _Reflection.model_validate(response.structured_output).model_dump()
204
+ except ValidationError:
205
+ return {}
206
+ if response.structured_output_error or not structured.pop("hasDirectEvidence") or not structured["rule"]:
207
+ return {}
208
+ sources = []
209
+ for citation in basis.memories:
210
+ if not citation.id or (citation.document_id and citation.document_id not in allowed):
211
+ return {}
212
+ try:
213
+ native = await self._client.memory.get_memory(bank_id, citation.id)
214
+ except NotFoundException:
215
+ return {}
216
+ item = _fact(native)
217
+ if (
218
+ not item
219
+ or item["documentId"] not in allowed
220
+ or (citation.document_id and item["documentId"] != citation.document_id)
221
+ or not _active(item)
222
+ or item.get("text") != citation.text
223
+ ):
224
+ return {}
225
+ sources.append(item)
226
+ return {"structured_output": structured, "based_on": {"memories": sources}}
227
+
228
+ def forget(self, bank_id: str, document_id: str) -> None:
229
+ try:
230
+ response = self._run(self._client.documents.delete_document(bank_id, document_id))
231
+ except NotFoundException:
232
+ return
233
+ if not response.success:
234
+ raise RuntimeError("Hindsight 未确认完成记忆文档删除")
235
+
236
+ def close(self) -> None:
237
+ with self._lock:
238
+ if self._closed:
239
+ return
240
+ try:
241
+ self._run(self._client.aclose())
242
+ finally:
243
+ self._closed = True
244
+ try:
245
+ self._worker.submit(self._runner.close).result()
246
+ finally:
247
+ self._worker.shutdown(wait=True)
@@ -0,0 +1,285 @@
1
+ """以 CoreMind 的宿主授权连接本地 Hindsight。"""
2
+
3
+ import argparse
4
+ import hashlib
5
+ import hmac
6
+ import json
7
+ import os
8
+ from datetime import date, datetime, timezone
9
+ from pathlib import Path
10
+ from tempfile import NamedTemporaryFile
11
+ from threading import RLock
12
+ from typing import Annotated, Literal
13
+
14
+ import uvicorn
15
+ from . import __version__
16
+ from mcp.server.fastmcp import Context, FastMCP
17
+ from pydantic import BaseModel, ConfigDict, Field, ValidationError
18
+ from starlette.concurrency import run_in_threadpool
19
+ from starlette.requests import Request
20
+ from starlette.responses import JSONResponse
21
+
22
+ Identifier = Annotated[str, Field(pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{0,79}$")]
23
+ Query = Annotated[str, Field(min_length=1, max_length=2000)]
24
+
25
+
26
+ class RequestBody(BaseModel):
27
+ model_config = ConfigDict(extra="forbid", str_strip_whitespace=True)
28
+
29
+
30
+ class Bank(RequestBody):
31
+ kind: Literal["personal", "project", "team", "branch"]
32
+
33
+
34
+ class Grant(RequestBody):
35
+ tokenEnv: Identifier
36
+ banks: Annotated[list[Identifier], Field(min_length=1, max_length=8)]
37
+
38
+
39
+ class Bindings(RequestBody):
40
+ banks: dict[Identifier, Bank]
41
+ readers: list[Grant]
42
+ administrators: list[Grant]
43
+
44
+
45
+ class BankTarget(RequestBody):
46
+ bankId: Identifier
47
+
48
+
49
+ class Target(BankTarget):
50
+ documentId: Identifier
51
+
52
+
53
+ class Write(Target):
54
+ expectedVersion: Annotated[int, Field(ge=0, strict=True)] = 0
55
+ text: Annotated[str, Field(min_length=1, max_length=2000)]
56
+ source: Annotated[str, Field(min_length=1, max_length=250)]
57
+ occurredAt: date
58
+ expiresAt: date | None = None
59
+ kind: Literal["fact", "experience"] = "fact"
60
+
61
+
62
+ class Reflection(RequestBody):
63
+ bankId: Identifier
64
+ query: Query
65
+
66
+
67
+ class Conflict(ValueError):
68
+ pass
69
+
70
+
71
+ class MemoryService:
72
+ def __init__(self, backend, state_path):
73
+ self.backend = backend
74
+ self.state_path = state_path
75
+ self.lock = RLock()
76
+ self.records = json.loads(state_path.read_text(encoding="utf-8")) if state_path.exists() else {}
77
+
78
+ def _save(self, changes):
79
+ new_state = {**self.records, **changes}
80
+ with NamedTemporaryFile(
81
+ mode="w", encoding="utf-8", dir=self.state_path.parent, delete=False
82
+ ) as file:
83
+ temp = Path(file.name)
84
+ try:
85
+ json.dump(new_state, file, ensure_ascii=False, sort_keys=True)
86
+ file.flush()
87
+ os.fsync(file.fileno())
88
+ except BaseException:
89
+ file.close()
90
+ temp.unlink(missing_ok=True)
91
+ raise
92
+ try:
93
+ temp.replace(self.state_path)
94
+ finally:
95
+ temp.unlink(missing_ok=True)
96
+ self.records = new_state
97
+
98
+ @staticmethod
99
+ def _key(bank, document):
100
+ return f"{bank}/{document}"
101
+
102
+ def write(self, request):
103
+ bank, doc = request.bankId, request.documentId
104
+ key = self._key(bank, doc)
105
+ raw = request.model_dump(mode="json")
106
+ digest = hashlib.sha256(json.dumps(raw, sort_keys=True).encode("utf-8")).hexdigest()
107
+ source = {"ref": request.source, "occurredAt": raw["occurredAt"]}
108
+ if request.expiresAt and request.expiresAt <= request.occurredAt:
109
+ raise ValueError("到期日期必须晚于来源日期")
110
+ with self.lock:
111
+ previous = self.records.get(key)
112
+ version = request.expectedVersion + 1
113
+ if previous and previous["state"] in {"forgetting", "forgotten"}:
114
+ raise Conflict("已遗忘的记忆标识不可重放")
115
+ if previous and previous["version"] == version and previous["digest"] == digest:
116
+ if previous["state"] == "active":
117
+ return {"status": "active", "documentId": doc, "version": version}
118
+ elif previous and (previous["state"] != "active" or previous["version"] != request.expectedVersion):
119
+ raise Conflict("版本冲突或仍有未完成操作")
120
+ elif not previous and request.expectedVersion != 0:
121
+ raise Conflict("找不到待更正的记忆版本")
122
+ receipt = {"state": "pending", "version": version, "digest": digest, "expiresAt": raw["expiresAt"]}
123
+ self._save({key: receipt})
124
+ self.backend.ensure_bank(bank)
125
+ self.backend.retain(
126
+ bank, doc, request.text, source=source, version=version,
127
+ expires_at=raw["expiresAt"], kind=request.kind,
128
+ )
129
+ self._save({key: {**receipt, "state": "active"}})
130
+ return {"status": "active", "documentId": doc, "version": version}
131
+
132
+ def forget(self, target):
133
+ key = self._key(target.bankId, target.documentId)
134
+ with self.lock:
135
+ previous = self.records.get(key)
136
+ if not previous or previous["state"] != "forgotten":
137
+ self._save({key: {"state": "forgetting"}})
138
+ self.backend.forget(target.bankId, target.documentId)
139
+ self._save({key: {"state": "forgotten"}})
140
+ return {"status": "forgotten", "documentId": target.documentId}
141
+
142
+ def forget_bank(self, target):
143
+ with self.lock:
144
+ keys = [key for key in self.records if key.startswith(f"{target.bankId}/")]
145
+ pending = {key: {"state": "forgetting"} for key in keys if self.records[key]["state"] != "forgotten"}
146
+ if pending:
147
+ self._save(pending)
148
+ for key in keys:
149
+ self.forget(Target(bankId=target.bankId, documentId=key.split("/", 1)[1]))
150
+ return {"status": "forgotten", "bankId": target.bankId, "documents": len(keys)}
151
+
152
+ def _active(self, bank):
153
+ today = datetime.now(timezone.utc).date().isoformat()
154
+ return {
155
+ key.split("/", 1)[1]: receipt["version"]
156
+ for key, receipt in self.records.items()
157
+ if key.startswith(f"{bank}/") and receipt["state"] == "active"
158
+ and (receipt["expiresAt"] is None or receipt["expiresAt"] > today)
159
+ }
160
+
161
+ def recall(self, banks, query):
162
+ results = []
163
+ with self.lock:
164
+ seen = set()
165
+ for bank in banks:
166
+ active = self._active(bank)
167
+ if not active:
168
+ continue
169
+ for item in self.backend.recall(bank, query, allowed_document_ids=list(active)):
170
+ doc = item.get("documentId")
171
+ identity = (bank, doc, item.get("text"))
172
+ if doc in active and item.get("version") == active[doc] and identity not in seen:
173
+ results.append({**item, "bankId": bank})
174
+ seen.add(identity)
175
+ return {"memories": results[:5]}
176
+
177
+ def reflect(self, request):
178
+ with self.lock:
179
+ active = self._active(request.bankId)
180
+ if not active:
181
+ return {"status": "insufficient_evidence"}
182
+ candidate = self.backend.reflect(request.bankId, request.query, allowed_document_ids=list(active))
183
+ sources = candidate.get("based_on", {}).get("memories", [])
184
+ if not sources or any(
185
+ item.get("documentId") not in active or active[item["documentId"]] != item.get("version")
186
+ for item in sources
187
+ ):
188
+ return {"status": "insufficient_evidence"}
189
+ return {"status": "pending", "candidate": candidate}
190
+
191
+
192
+ def _grants(entries, known_banks):
193
+ grants = {}
194
+ for entry in entries:
195
+ token = os.environ.get(entry.tokenEnv, "").encode("utf-8")
196
+ if not token.startswith(b"Bearer ") or len(token) < 31 or token in grants:
197
+ raise ValueError(f"请设置独立的 Bearer 令牌:{entry.tokenEnv}")
198
+ if not set(entry.banks) <= known_banks or len(set(entry.banks)) != len(entry.banks):
199
+ raise ValueError(f"记忆库绑定缺失或重复:{entry.tokenEnv}")
200
+ grants[token] = tuple(entry.banks)
201
+ return grants
202
+
203
+
204
+ def make_app(service, bindings):
205
+ readers = _grants(bindings.readers, set(bindings.banks))
206
+ admins = _grants(bindings.administrators, set(bindings.banks))
207
+ if readers.keys() & admins.keys():
208
+ raise ValueError("管理凭据与只读凭据必须独立")
209
+
210
+ def allowed(request, grants):
211
+ token = request.headers.get("authorization", "").encode("utf-8")
212
+ return next((banks for key, banks in grants.items() if hmac.compare_digest(token, key)), ())
213
+
214
+ mcp = FastMCP("CoreMind Hindsight Memory", stateless_http=True, json_response=True)
215
+
216
+ @mcp.tool(structured_output=False)
217
+ def recall_memory(query: Query, ctx: Context) -> str:
218
+ """查找当前任务可用的长期偏好和经验,附来源与版本。"""
219
+ banks = allowed(ctx.request_context.request, readers)
220
+ if not banks or not query.strip():
221
+ raise ValueError("缺少授权或查询内容")
222
+ return json.dumps(service.recall(banks, query.strip()), ensure_ascii=False)
223
+
224
+ @mcp.custom_route("/health", methods=["GET"])
225
+ async def health(_request):
226
+ return JSONResponse({"status": "ready"})
227
+
228
+ @mcp.custom_route("/admin/{action}", methods=["POST"])
229
+ async def admin(request):
230
+ operation = request.path_params["action"]
231
+ banks = allowed(request, admins)
232
+ operations = {"retain": (Write, service.write), "correct": (Write, service.write),
233
+ "forget": (Target, service.forget), "forget-bank": (BankTarget, service.forget_bank),
234
+ "reflect": (Reflection, service.reflect)}
235
+ if operation not in operations:
236
+ return JSONResponse({"error": "unknown_operation"}, status_code=404)
237
+ model, handler = operations[operation]
238
+ try:
239
+ body = model.model_validate(await request.json())
240
+ if body.bankId not in banks:
241
+ return JSONResponse({"error": "scope_denied"}, status_code=403)
242
+ if isinstance(body, Write) and ((operation == "retain") != (body.expectedVersion == 0)):
243
+ return JSONResponse({"error": "invalid_version"}, status_code=400)
244
+ return JSONResponse(await run_in_threadpool(handler, body))
245
+ except Conflict as error:
246
+ return JSONResponse({"error": str(error)}, status_code=409)
247
+ except (ValidationError, ValueError):
248
+ return JSONResponse({"error": "invalid_request"}, status_code=400)
249
+ except Exception:
250
+ return JSONResponse({"error": "hindsight_unavailable"}, status_code=502)
251
+
252
+ app = mcp.streamable_http_app()
253
+
254
+ async def authorized(scope, receive, send):
255
+ if scope["type"] == "http":
256
+ request = Request(scope, receive)
257
+ grants = admins if request.url.path.startswith("/admin/") else readers
258
+ if not allowed(request, grants):
259
+ return await JSONResponse({"error": "unauthorized"}, status_code=401)(scope, receive, send)
260
+ await app(scope, receive, send)
261
+
262
+ return authorized
263
+
264
+
265
+ def main():
266
+ from .backend import HindsightBackend
267
+
268
+ parser = argparse.ArgumentParser(description="Serve host-authorized Hindsight memory over MCP.")
269
+ parser.add_argument("--version", action="version", version=f"%(prog)s {__version__}")
270
+ parser.add_argument("--hindsight-url", required=True)
271
+ parser.add_argument("--config", type=Path, required=True)
272
+ parser.add_argument("--state", type=Path, required=True)
273
+ parser.add_argument("--port", type=int, default=8769)
274
+ args = parser.parse_args()
275
+ bindings = Bindings.model_validate_json(args.config.read_text(encoding="utf-8"))
276
+ backend = HindsightBackend(args.hindsight_url, os.getenv("COREMIND_HINDSIGHT_API_KEY"))
277
+ try:
278
+ uvicorn.run(make_app(MemoryService(backend, args.state), bindings), host="127.0.0.1",
279
+ port=args.port, access_log=False)
280
+ finally:
281
+ backend.close()
282
+
283
+
284
+ if __name__ == "__main__":
285
+ main()
@@ -0,0 +1,41 @@
1
+ Metadata-Version: 2.4
2
+ Name: coremind-memory-mcp
3
+ Version: 0.1.0
4
+ Summary: Hindsight-backed, host-authorized memory for Streamable HTTP MCP clients
5
+ License-Expression: MIT
6
+ Requires-Python: >=3.12
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Requires-Dist: hindsight-client==1.2.3
10
+ Requires-Dist: mcp==1.30.0
11
+ Requires-Dist: pydantic<3,>=2
12
+ Requires-Dist: starlette<2
13
+ Requires-Dist: uvicorn==0.54.0
14
+ Dynamic: license-file
15
+
16
+ # CoreMind Memory MCP
17
+
18
+ `coremind-memory-mcp` 0.1.0 为标准 Streamable HTTP MCP 客户端提供经授权的 Hindsight 记忆查询。业务应用只持读令牌。宿主独立运行 Hindsight OSS 1.2.3、PostgreSQL、网关进程及记忆库绑定。
19
+
20
+ 在新的 Python 3.12 环境中从 PyPI 安装。
21
+
22
+ ```sh
23
+ python -m pip install coremind-memory-mcp==0.1.0
24
+ ```
25
+
26
+ 需要从源码安装时,可在源码根目录构建并安装本地 wheel。
27
+
28
+ ```sh
29
+ python -m pip wheel --no-deps ./components/memory --wheel-dir dist
30
+ python -m pip install ./dist/coremind_memory_mcp-0.1.0-py3-none-any.whl
31
+ ```
32
+
33
+ 准备宿主绑定文件和已存在的状态目录,在服务终端注入其引用的独立读、管理令牌。单个进程独占回执文件。
34
+
35
+ ```sh
36
+ coremind-memory-mcp --hindsight-url http://127.0.0.1:8780 --config memory-host.json --state memory-receipts.json --port 8769
37
+ ```
38
+
39
+ 标准客户端连接 `http://127.0.0.1:8769/mcp`,使用 `Authorization: Bearer …`,可见工具为 `recall_memory(query)`。宿主通过 `/admin/retain`、`/admin/correct`、`/admin/reflect`、`/admin/forget` 和 `/admin/forget-bank` 管理其获准的库。后端密钥可由 `COREMIND_HINDSIGHT_API_KEY` 注入。部署配置与生命周期测试见[中文示例](https://github.com/Eclipseic1848/CoreMind/tree/main/examples/modules/manage-memory)和[升级 SOP](https://github.com/Eclipseic1848/CoreMind/blob/main/docs/modules/manage-memory/SOP.zh-CN.md)。
40
+
41
+ The 0.1.0 wheel runs independently of the CoreMind CLI and SDKs. Install `coremind-memory-mcp==0.1.0` from PyPI in a dedicated Python 3.12 environment, or use the optional source wheel commands above. Set up the host bindings, state directory and separate reader and administrator tokens before starting the service. The application receives only its reader token. See the [standalone example](https://github.com/Eclipseic1848/CoreMind/blob/main/examples/modules/manage-memory/README.en.md) and [upgrade procedure](https://github.com/Eclipseic1848/CoreMind/blob/main/docs/modules/manage-memory/SOP.en.md).
@@ -0,0 +1,9 @@
1
+ coremind_memory_mcp/__init__.py,sha256=OBY8cpSVr3Y9aNxgvlw69wqMgqxgpjeARNloA_XEhbI,71
2
+ coremind_memory_mcp/backend.py,sha256=kwBB6Tb8VVSuipCH6bXz7OMYVwIcLIW3GAkuqQ-KpEA,9602
3
+ coremind_memory_mcp/server.py,sha256=J3qeAF9Ck3nvtwAaKw9W2WTnMXmfLx1fgC4lGJd17RY,11843
4
+ coremind_memory_mcp-0.1.0.dist-info/licenses/LICENSE,sha256=KXXZrpPu9JjGxQX1EbhIre6gO48Zu_QosI7izMUDKTM,1070
5
+ coremind_memory_mcp-0.1.0.dist-info/METADATA,sha256=6_KXduaAZWJfUlX_DnrCvN6QAit0WPj8u_6NEfGOhFs,2485
6
+ coremind_memory_mcp-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
+ coremind_memory_mcp-0.1.0.dist-info/entry_points.txt,sha256=GZ_jewfSvi-HENRrYOwQ5H3-XZk0B2FGQLoqRxNMWO4,72
8
+ coremind_memory_mcp-0.1.0.dist-info/top_level.txt,sha256=rApFF7Yxm1AoxC9lWqZoVUTgcqybqyLmLuyM53QhF_4,20
9
+ coremind_memory_mcp-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ coremind-memory-mcp = coremind_memory_mcp.server:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Eclipseic1848
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.
@@ -0,0 +1 @@
1
+ coremind_memory_mcp