Skip to main content

PASM MCP Server · 给任意 AI 客户端装上长期记忆

把 PASM 的认知内核暴露成标准 MCP 工具。 你的大模型(IDE 插件 / 桌面 AI 客户端 / 自研 Agent)本身没有跨会话记忆、没有情绪连续性、 没有"被夸过就更爱做某件事"的行为倾向 —— 这个包就是给它补上这些。

一句话定位:PASM 不是"又一个聊天模型",是一个认知器官 —— 记忆、情绪、行为倾向。语言生成仍然由你自己的模型负责。

┌──────────────────────────┐   MCP (stdio)   ┌──────────────────────┐
│  你的 AI 客户端 / Agent   │ ◄─────────────► │  pasm-mcp-server     │
│  (负责说话与推理)        │   工具调用       │  (负责记住与感受)   │
└──────────────────────────┘                 └──────────────────────┘

〇、PASM 生态索引(六仓同频)

角色 可见性 版本
pasm-skills 基座:BaseAgent + 认知能力层 公开 0.5.0
pasm-agents 成品智能体集(NPC / 陪伴 / 教学 / 验证) 公开 0.4.5
pasm-mcp-server(本仓) MCP 接入层:给任意 AI 客户端装长期记忆 公开 0.2.0
PASM-Lite 教学版 + 认知引擎接口 公开
PASM 核心引擎(七层仿生 / 世界模型) 私有 0.7.2
pasm-qclaw 桌面应用发行通道 公开 0.29.1

流向:PASM(核心)→ pasm-skills(基座)→ pasm-agents(智能体)→ pasm-mcp-server(分发)→ pasm-qclaw(桌面产品);PASM-Lite 是面向外界的教学窗口。

地址: Gitee · GitHub


一、快速开始

pip install pasm-mcp-server
pasm-mcp-server --selftest        # 自检(16 项)

接入客户端(以 Cursor 为例)

写到 .cursor/mcp.json(项目级)或 ~/.cursor/mcp.json(全局):

{
  "mcpServers": {
    "pasm": {
      "command": "python",
      "args": ["-m", "pasm_mcp_server"]
    }
  }
}

Windows 上如果 python 不在 PATH,把它换成绝对路径,例如 "C:\\Python313\\python.exe"

各客户端配置位置

客户端 配置文件 字段形状
Cursor .cursor/mcp.json~/.cursor/mcp.json mcpServers
Claude Desktop %APPDATA%\Claude\claude_desktop_config.json(macOS:~/Library/Application Support/Claude/ mcpServers
VS Code(Copilot Agent) .vscode/mcp.json servers + "type": "stdio"
自建 / 其他客户端 examples/mcp_generic.json mcpServers

现成文件:examples/mcp_cursor.json · examples/mcp_claude_desktop.json · examples/mcp_vscode.json · examples/mcp_generic.json

校验是否接上python examples/stdio_client_demo.py —— 它会真的起一个子进程、 做完整握手、逐个调用工具(和真实客户端做的事一模一样)。


二、工具有哪些(13 个)

认知核心

工具 干什么
pasm_context 首选。取"现在该记得什么 + 情绪如何 + 倾向做什么",拿去拼进提示词。只读,不写记忆
pasm_recall 记忆检索(装了认知层自动走语义)
pasm_semantic 语义检索 + 可解释:换说法也能命中,并给出每条的融合分 / 语义分 / 记忆保留度
pasm_observe 把一件事写进长期记忆(重要度 1-5)
pasm_feel 报告带情绪效价的事件,驱动情绪演化
pasm_act 按「人格 + 学到的偏好」选一个动作
pasm_feedback 反馈塑形(务必带 action

记忆维护

工具 干什么
pasm_focus 焦点栈:压入/查看"现在在聊什么",给检索加权
pasm_consolidate 记忆巩固(睡眠回放):把重复经历蒸馏成要点。默认只出建议

管理

工具 干什么
pasm_chat 完整认知回路对话一次(模板渲染,非 LLM)
pasm_persona 查看/合并更新人格
pasm_status 状态快照(档位、记忆量、认知层后端、焦点、归档)
pasm_save 立即落盘

三、认知能力(0.2.0 起)

依赖 pasm-skills>=0.5.0 的认知层时自动启用,没有也能跑(退回字面匹配,功能降级不报错)。

能力 效果
语义检索 「我叫什么名字」能命中存成「姓名」的记忆(字面匹配做不到)
遗忘曲线 久未唤起的记忆自然降权,学情更真实
记忆巩固 重复经历蒸馏成要点,记忆池不被撑爆
焦点栈 长对话不跑题

检索打分是可解释的:

score = 语义相似 × 0.62 + 记忆保留度 × 0.24 + 重要度 × 0.14 + 焦点加成

换更好的向量后端(可选)

内置后端是零依赖离线的字符 n-gram hashing + 中文同义扩展,开箱即用。 想要真正的语义向量,配一个 OpenAI 兼容的 embedding 接口即可自动接管:

export PASM_EMBED_URL="https://<your-endpoint>/v1/embeddings"
export PASM_EMBED_MODEL="bge-m3"
export PASM_EMBED_KEY="<key>"

也可以装 sentence-transformersfastembed,会自动被识别。 pasm_status 会告诉你当前实际用的是哪个后端 —— 降级不隐藏


四、环境变量

变量 作用
PASM_MCP_PERSIST_DIR 状态落盘根目录,默认 ~/.pasm-mcp/
PASM_MCP_PERSONA 默认人格(JSON 字符串)
PASM_SKILLS_PATH 本地开发逃生口:指向 pasm-skills 仓库根目录
PASM_EMBED_URL / _MODEL / _KEY 可选:外部 embedding 接口

五、PASM 在整条链路里的位置

不生成语言。正确用法是:先把 pasm_context 的返回拼进提示词,再让你自己的模型说话。

用户说话 → pasm_context(query=用户的话) → 拿到 recalled / mood / action_pool
        → 拼进你的系统提示词 → 你的模型生成回复
        → pasm_observe(值得记的事) → pasm_feedback(用户反应)

六、生态中的位置

角色 可见性
pasm-skills 基座BaseAgent + 认知能力层 公开
pasm-agents 成品智能体集(NPC / 陪伴 / 教学 / 验证) 公开
pasm-mcp-server 本仓:MCP 接入层 公开
PASM-Lite 教学版 + 认知引擎接口 公开
PASM 核心引擎(七层仿生 / 世界模型) 私有
pasm-qclaw 桌面应用发行通道 公开

本包只依赖公开pasm-skills,不依赖私有核心。 装了核心的机器会自动从 light 档升到 bionic 档,没有也能正常跑。


七、打包发布(维护者)

python -m pip install --upgrade build twine
python -m build                      # 产出 dist/*.whl 与 dist/*.tar.gz
twine check dist/*
twine upload dist/*                  # 需要 PyPI token

GitHub Actions 流水线见 docs/publish-workflow.example.yml (放到 .github/workflows/publish.yml 即生效;默认不放在那里是因为推送 workflow 需要 PAT 带 workflow 权限)。


许可

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pasm_mcp_server-0.2.0.tar.gz (28.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pasm_mcp_server-0.2.0-py3-none-any.whl (24.9 kB view details)

Uploaded Python 3

File details

Details for the file pasm_mcp_server-0.2.0.tar.gz.

File metadata

  • Download URL: pasm_mcp_server-0.2.0.tar.gz
  • Upload date:
  • Size: 28.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pasm_mcp_server-0.2.0.tar.gz
Algorithm Hash digest
SHA256 607102f9ca916b0f0939cccc5567f00355b1d89bded933a0a1c6a9df651dcedc
MD5 9e0a9b36c7b15e0cd32e1a1f1a8fcea0
BLAKE2b-256 5e3c8ed31a48baa833e45ea8230e0d8270947ef258f89e18adf1c6ceef72350a

See more details on using hashes here.

File details

Details for the file pasm_mcp_server-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pasm_mcp_server-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 560ec56aca1044195984fb0a66dd0cdb36a6f6c3558ecca9fadaa2b908746f0a
MD5 244aa4861d6aef8db7de44e2b79a55c1
BLAKE2b-256 8edc3b6982a4e5f55f33e9d28d34b511e738f20e9b68a30ae2772a18001aa612

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page