Token导航 LogoToken导航TokenDH.com
Opc Memory MCP logo
AI代理stdio官方级别未说明来源级核验

Opc Memory MCP

MCP Server

提供OPC记忆系统的MCP接口,支持语义记忆存储、检索和模式检测,用于跨会话上下文维护。

工具数

9

提示词数

0

GitHub Stars

1

资源数

0
PythonClaudeAI代理Claude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

stephenfeather

提供方

stephenfeather

最后核验

2026/5/17 20:23

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

uv run opc-memory-server

详细介绍

OPC内存MCP服务器

MCP服务器,将OPC内存脚本作为Claude Code和Claude Desktop的工具公开。

该项目提供了一个MCP接口 OPC(Opinionated持久上下文) 存储系统从 OPC项目OPC支持语义记忆存储和检索,使Claude能够从过去的会话中学习,并在对话中保持上下文。

注: 此服务器最初是针对Continuous-Claude-v3构建的。从v0.7.2开始,它针对的是单机版 OPC存储库 它包含内存脚本、数据库模式和模式检测基础架构。

工具

工具说明
store_learning将会话学习与语义回忆的嵌入一起存储
recall_learnings基于存储学习的语义搜索
query_artifacts在上下文图中搜索过去会话的先例
index_artifacts索引交接、计划和连续性分类账
mark_handoff标记切换结果以进行跟踪
start_daemon启动内存提取守护进程
stop_daemon停止内存提取守护进程
daemon_status检查守护进程状态并查看最近的日志
detect_patterns跨存储的学习运行按需模式检测

先决条件

此MCP服务器需要:

  1. OPC项目 -内存脚本和PostgreSQL数据库模式 OPC存储库
  2. PostgreSQL数据库 -使用OPC模式运行(会话、file_claims、archival_memory表)
  3. 环境变量 - DATABASE_URL 指向您的PostgreSQL实例

请参阅 OPC存储库 有关设置说明。

OPC目录配置

OPC目录路径可以通过两种方式配置(按优先级顺序):

1.环境变量(覆盖)

export CLAUDE_OPC_DIR="/path/to/your/opc"

将其用于临时覆盖或CI/CD环境。

2.配置文件(持久)

创建 ~/.claude/opc.json:

{
  "opc_dir": "/path/to/your/opc"
}

这是持久用户配置的推荐方法。

解析顺序

钩子和脚本按以下顺序解析OPC_DIR:

优先级来源用例
1CLAUDE_OPC_DIR env var显式重写,CI/CD
2~/.claude/opc.json持久用户偏好
3${CLAUDE_PROJECT_DIR}/opc项目本地设置
4~/.claude全球安装

挂钩集成

如果您正在构建需要引用OPC基础架构的钩子,请使用共享 opc-path.ts 模块。请参阅 examples/hooks/ 您可以将完整示例的目录复制到 ~/.claude/hooks/src/shared/ 目录。

MCP服务器分辨率

main.py MCP服务器使用相同的解析逻辑:

def get_opc_dir() -> str:
    # 1. CLAUDE_OPC_DIR env var
    # 2. ~/.claude/opc.json config file
    # 3. Fallback default

这意味着MCP服务器将自动使用您配置的OPC路径。

技能说明

如果你有引用OPC内存工具的Claude Code技能(例如。, /recall, /remember),您可能需要更新它们以使用MCP工具名称:

技能参考MCP工具名称
store_learningmcp__opc-memory__store_learning
recall_learningsmcp__opc-memory__recall_learnings
query_artifactsmcp__opc-memory__query_artifacts
index_artifactsmcp__opc-memory__index_artifacts
mark_handoffmcp__opc-memory__mark_handoff
start_daemonmcp__opc-memory__start_daemon
stop_daemonmcp__opc-memory__stop_daemon
daemon_statusmcp__opc-memory__daemon_status
detect_patternsmcp__opc-memory__detect_patterns

安装

cd /Users/stephenfeather/Tools/opc-memory-mcp
uv sync

用法

直接运行

uv run opc-memory-server

Claude桌面配置

添加 ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "opc-memory": {
      "command": "uv",
      "args": ["--directory", "/Users/stephenfeather/Tools/opc-memory-mcp", "run", "opc-memory-server"]
    }
  }
}

Claude代码配置

添加 .claude/settings.json 或全局设置:

{
  "mcpServers": {
    "opc-memory": {
      "command": "uv",
      "args": ["--directory", "/Users/stephenfeather/Tools/opc-memory-mcp", "run", "opc-memory-server"]
    }
  }
}

工具示例

店铺学习

Store a learning about hook development patterns.

Parameters:
- content: "TypeScript hooks require npm install before they work"
- learning_type: "WORKING_SOLUTION"
- context: "hook development"
- tags: "hooks,typescript"
- confidence: "high"

回顾_收益

Search for past learnings about authentication.

Parameters:
- query: "authentication patterns"
- k: 5
- text_only: false (use embeddings)

索引_事实

Index all artifacts:
- mode: "all"

Index specific file:
- mode: "file"
- file_path: "/path/to/handoff.md"

mark_handoff

Mark the latest handoff as successful:
- outcome: "SUCCEEDED"
- notes: "All tasks completed"

检测模式

Dry run to preview patterns:
- dry_run: true

Run detection and write to database:
- min_confidence: 0.3
- use_llm: false

View last run's report:
- report: true

守护进程管理

Check daemon status:
daemon_status()
# Returns: running status, PID, recent log entries

Start the daemon:
start_daemon()
# Starts memory extraction daemon if not running

Stop the daemon:
stop_daemon()
# Stops the running daemon

发展

测试服务器:

# Check it starts without errors
uv run opc-memory-server &
PID=$!
sleep 2
kill $PID

# Test individual tools via subprocess
uv run python -c "
from main import store_learning, recall_learnings
result = recall_learnings(query='test', k=1)
print(result)
"

目录标签

目录标签

PythonClaudeAI代理语义记忆本地部署上下文管理会话学习模式检测MCP接口

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Python

工具数量(toolCount,工具数)

9

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP