Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

MCP 集成

本章节是 GitHub Wiki: MCP Integration 的镜像。

MCP 是什么

MCP(Model Context Protocol)是 Anthropic 推出的 Agent 工具调用协议,主流 AI 编程客户端全支持。MemoryCenter MCP server 让 Agent 通过标准协议调用记忆库能力,无需自己实现归档/检索逻辑。

两种传输模式

模式版本适用场景Binary
stdiov2.3本地 IDE(Claude Code / Cursor / Trae)memory-center-mcp
Streamable HTTPv2.36远程客户端(DeepSeek 网页端等)memory-center-server

21 个 Tools 一览

类别Tools
归档/检索archive / pre_compress_hook / retrieve / batch_retrieve / batch_delete / batch_update / find_hook_by_prefix
摘要/渲染summaries / prompt / get_config
检索增强semantic_search / detect_conflicts / get_conflicts
周期任务compaction
预设管理preset_build / preset_list_agents / preset_list_scenarios / preset_list_models
项目记忆update_project_memory / get_project_memory
规则安装install_rules(支持本地直接写入 + 远程模板模式)

最简配置(stdio 模式)

{
  "mcpServers": {
    "memory-center": {
      "command": "/path/to/memory-center-mcp",
      "env": {
        "MEMORY_CENTER_ROOT": "/path/to/memory/data"
      }
    }
  }
}

Streamable HTTP 模式

{
  "mcpServers": {
    "memory-center": {
      "url": "https://your-server/mcp",
      "transport": "streamable-http"
    }
  }
}

详细配置

各环境详细配置、踩坑排查见 MCP 配置指南

完整 MCP tools 实现见 crates/memory-center-mcp/src/lib.rs。 MCP 集成测试见 crates/memory-center-mcp/tests/(56 个测试用例)。