Polypack Memory

io.github.imattau由 GitHub 账号 imattau 发布v0.1.31更新于 Oct 24, 2026

MCP server exposing Polypack as persistent adaptive memory

发布方自己的服务:Memory.fit

已验证STDIO仅桌面数据库知识与记忆

概览

AI 生成的概览

一个本地 MCP 服务器,通过 Polypack 为助手提供持久、自适应的记忆,可存储、召回、关联和整合记忆。

可以做什么
存储、按 ID 获取、更新、批量存储和永久删除记忆,删除需确认,内容变更用取代方式保留历史。按 token 预算召回记忆并组装上下文,可选严格上下文隔离和按需、有上限的图邻居补全。关联与取消关联记忆,取代和整合记忆,并查询关系图。提交激活反馈、抑制记忆并列出上下文。读取 polypack 协议下的上下文、活跃记忆、模式、统计和工作流指引资源。
适用场景
适合需要助手跨会话记住项目或用户偏好、过往事件和操作流程的场景,也适合让 Claude 与 Codex 等多个客户端共享同一份持久记忆。
运行要求
以本地 Python 包形式运行,从 PyPI 安装,polypack 附加依赖会引入 polypack-db。需用 --store 指定持久存储目录,否则使用内存后端。多客户端共享需运行常驻的本地 Streamable HTTP 服务,可通过 systemd 用户服务、Debian 或 RPM 包或手动命令启动。可选的语义检索会下载一次 Qwen 嵌入模型。
安装前请注意
记忆工具会写入、修改和删除本地存储中的数据;memory_delete 为永久删除且需 confirm=true。变更操作会立即写入持久存储。可选的嵌入设置会下载模型并运行本地 helper。不要让多个客户端用命令方式共用同一存储,进程竞争可能破坏共享记忆。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Polypack Memory,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

[polypack-mcp]

Persistent, adaptive memory for MCP clients.

An MCP server that exposes Polypack as persistent adaptive memory. MCP-specific tools live here; the database remains an independent dependency.

Install and run

The simplest installation is from PyPI:

sh
python3 -m pip install 'polypack-mcp[polypack]'

For one MCP client, use the default stdio server configuration. For Claude and Codex sharing the same durable memory, install once and create a long-running user service:

sh
polypack-mcp setup --store ~/.local/share/polypack-mcp

This starts a stateless Streamable HTTP server at http://127.0.0.1:8765/mcp/, restarts it after a failure, and prints client configuration snippets. The setup command uses systemd --user; on systems without systemd, start the server directly:

sh
polypack-mcp --transport streamable-http --port 8765 --store ~/.local/share/polypack-mcp

In shared Streamable HTTP mode, configure both clients with the URL. Do not configure them with a command and --store, since that starts two processes competing for the same durable store.

Codex (~/.codex/config.toml):

toml
[mcp_servers.polypack]  url = "http://127.0.0.1:8765/mcp/"

Claude Desktop:

json
{  "mcpServers": {    "polypack": { "url": "http://127.0.0.1:8765/mcp/" }  }}

Debian package

The Debian package installs and starts a system-level polypack-mcp service automatically. It runs as the dedicated polypack user, stores data in /var/lib/polypack-mcp, and exposes the same local Streamable HTTP endpoint:

sh
sudo apt install ./polypack-mcp_<version>_amd64.deb

After installation, point Claude and Codex at http://127.0.0.1:8765/mcp/. The default port can be changed in /etc/default/polypack-mcp, followed by a service restart. The service can be managed with:

sh
sudo systemctl status polypack-mcpsudo systemctl restart polypack-mcp

The PyPI installation remains user-managed and uses polypack-mcp setup to create a per-user service instead.

Optional semantic retrieval

The default installation uses Polypack's local graph, activation, and lexical retrieval without downloading an AI model. To enable local Qwen semantic retrieval, run:

sh
sudo polypack-mcp embeddings setup qwen3 --system --store /var/lib/polypack-mcp

This creates a managed localhost helper, downloads Qwen once into the store's embedding cache, and reindexes existing memories. The model is not bundled in the Debian/RPM package.

The helper loads Qwen3-Embedding-0.6B in bfloat16 (~1GB resident once loaded, versus ~2.4GB in fp32) and unloads it after 15 minutes of inactivity, reloading automatically on the next request. memory_recall results include a semantic entry in scoreComponents whenever the helper is reachable, alongside lexical and activation — the three sum to the reported score. If the helper is stopped or errors, recall falls back to lexical + activation scoring automatically. Check or disable it with:

sh
polypack-mcp embeddings statussudo polypack-mcp embeddings disable --system --store /var/lib/polypack-mcp

For a PyPI user service, omit sudo --system and use the user store:

sh
polypack-mcp embeddings setup qwen3

APT repository

The latest Debian package is also published to the public APT repository at https://imattau.github.io/polypack-mcp. Configure it with the repository's signing key, then install and update normally:

sh
curl -fsSL https://imattau.github.io/polypack-mcp/gpg.key \  | sudo gpg --dearmor -o /usr/share/keyrings/polypack-mcp.gpgecho "deb [signed-by=/usr/share/keyrings/polypack-mcp.gpg] https://imattau.github.io/polypack-mcp stable main" \  | sudo tee /etc/apt/sources.list.d/polypack-mcp.listsudo apt updatesudo apt install polypack-mcp

The repository is updated automatically for each v*.*.* release tag. See docs/apt-repository.md for maintainer setup instructions.

RPM package

RPM-based distributions can install from the public RPM repository:

sh
sudo rpm --import https://imattau.github.io/polypack-mcp/rpm/RPM-GPG-KEY-polypack-mcpsudo tee /etc/yum.repos.d/polypack-mcp.repo >/dev/null <<'EOF'[polypack-mcp]name=Polypack MCPbaseurl=https://imattau.github.io/polypack-mcp/rpm/enabled=1gpgcheck=1gpgkey=https://imattau.github.io/polypack-mcp/rpm/RPM-GPG-KEY-polypack-mcpEOFsudo dnf install polypack-mcp

The matching .rpm asset is also attached to the GitHub release:

sh
sudo dnf install ./polypack-mcp-<version>-1.x86_64.rpm

The RPM package provides the same systemd service, store location, localhost Streamable HTTP endpoint, and Python 3.12 requirement as the Debian package.

Run manually

sh
pip install -e '.[polypack]'polypack-mcp --store ./polypack-data

The server exposes seventeen focused tools: memory_store, memory_get, memory_update, memory_list_contexts, memory_delete, memory_recall, memory_context, memory_feedback, memory_suppress, memory_supersede, memory_consolidate, memory_link, memory_unlink, memory_thread, memory_store_batch, memory_link_batch, and graph_query. It also publishes context, active-memory, schema, stats, and agent workflow guidance resources under polypack://.

Memory classes are entity, episodic, procedural, and semantic. Store project or user preferences as procedural memories; preference is not a separate memory class.

When using a durable Polypack store, mutating operations checkpoint immediately and the server flushes the store during shutdown.

Retrieval tools return {items, metadata}. Metadata includes candidate and excluded counts, context matches, score components, fallback behavior, the retrieval version, and selection statistics. memory_context uses estimated tokens (ceil(content characters / 4), minimum one) as its token_budget. An item is never returned if it would exceed the remaining budget; budgets less than or equal to zero are rejected. Context is a soft preference: matching memories are preferred and unscoped global memories may be used as fallback. Pass strict_context: true for isolation. An empty isolated result reports reason: "no_context_match" and the searched context.

memory_recall can optionally hydrate related graph memories in the same call:

json
{  "query": "identity cache fix",  "context": "cross-agent",  "include_neighbors": true,  "edge_types": ["RESPONDS_TO"],  "depth": 2,  "neighbor_limit": 3,  "limit": 20,  "token_budget": 4000}

Neighbor traversal is opt-in and bounded. limit caps the total response and neighbor_limit caps hydrated neighbors; metadata reports moreNeighborsAvailable when additional eligible neighbors were found. Neighbor items include their distance and connecting relationship metadata. Use memory_link with the default RESPONDS_TO relationship for handoffs, reviews, and fixes that address an earlier memory. Graph edges are authoritative for relationships; use graph_query(operation="relationship_diagnostics") to find legacy provenance.responds_to values that are not backed by edges. See polypack://help/workflow for the agent-facing workflow.

Feedback is activation feedback: useful=true reinforces a memory and useful=false provides negative retrieval feedback. Responses expose activation before and after plus whether learned weights changed. Supersession and consolidation materialize SUPERSEDES, SUPERSEDED_BY, and CONSOLIDATED_FROM graph edges.

Use memory_get for exact ID lookup and memory_update for mutable fields (context, confidence, provenance, and metadata). Content changes should use memory_supersede so history remains intact. Use memory_unlink to correct a relationship and memory_list_contexts to discover namespaces. memory_delete is permanent, requires confirm=true, and supports an optional revision check; prefer memory_suppress when retaining history is useful.

Pass --store to open a durable Polypack directory. Without it, the server uses the in-memory reference backend, which is convenient for smoke tests. The polypack extra requires polypack-db>=3.3.1 and uses its native ActivationEngine.working_memory selector for context assembly.

Development

sh
pip install -e '.[dev]'pytest

The test suite includes an MCP client/server protocol smoke test covering tool discovery, memory storage, recall, and resource reads.

Documentation

来源:README.md,提交 201feb8

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.31最新Sep 16, 2026

评分

已满足适用检查项的 40%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

    请在仓库或注册中心条目中声明许可证。

其他 Memory 集成