Skip to content

feat(mcp): add memory search MCP server#451

Open
soongao wants to merge 1 commit into
TencentCloud:mainfrom
soongao:feat/mcp-memory-search-adapter
Open

feat(mcp): add memory search MCP server#451
soongao wants to merge 1 commit into
TencentCloud:mainfrom
soongao:feat/mcp-memory-search-adapter

Conversation

@soongao

@soongao soongao commented Jul 9, 2026

Copy link
Copy Markdown

概述

本 PR 新增一个独立的 Python MCP server 包:packages/tdai-memory-mcp

它用于把 TencentDB Agent Memory 的记忆检索能力暴露给 MCP 客户端。MCP server 本身不启动、不管理 Gateway,只连接一个已经运行中的 TDAI Gateway,并通过 Gateway HTTP API 提供查询能力。

关联 Issue

Part of #235

提供的 MCP 能力

本 PR 暴露两个 LLM-callable MCP tools:

Tool 能力 典型用途
tdai_memory_search 检索结构化长期记忆 在回答用户问题前查询已沉淀的偏好、事实、项目上下文等记忆
tdai_conversation_search 检索原始会话历史 回溯之前的对话、任务过程、上下文片段

另外提供一个 side-channel 诊断命令:

命令 能力 说明
tdai-memory-mcp health 检查 MCP 包配置和 Gateway 连通性 仅用于本地诊断,不作为 LLM-callable MCP tool 暴露

实现范围

本 PR 包含:

  • Python MCP stdio server
  • MCP protocol 请求/响应处理
  • Gateway HTTP transport
  • memory search / conversation search tool handlers
  • session/config 辅助逻辑
  • side-channel health diagnostics
  • Claude Desktop / Codex 配置示例
  • 单元测试和可选 e2e 测试入口

设计说明

MCP server 默认假设 Gateway 已经由用户或部署环境启动。

整体调用链路是:

MCP client
  -> tdai-memory-mcp
  -> TDAI Gateway HTTP API
  -> TencentDB Agent Memory

这样可以让 Codex、Claude Desktop、Claude Code 或其他 MCP client 通过标准 MCP tool 使用 TencentDB Agent Memory 的查询能力,同时保持 Gateway 生命周期管理和 MCP server 解耦。

自测结果

检查项 命令 结果
MCP unit tests cd packages/tdai-memory-mcp && python3 -m pytest tests/unit -q 16 passed

可选 e2e 测试需要本地已经运行 TDAI Gateway,因此不作为默认自测要求。

@YOMXXX

YOMXXX commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Duplicate/scope cleanup triage:

This overlaps the #235 MCP/adapter lane that already has narrower canonical PRs:

This PR introduces a second MCP server implementation as a new Python package, which duplicates the integration surface while adding another packaging/runtime/protocol matrix to maintain. I would not keep this open as another #235 implementation candidate while #372 is already the approved MCP bridge path.

Suggested cleanup path: close this as superseded by #372 for the current #235 work. If maintainers still want a Python MCP package after #372 lands, reopen it as a follow-up with a narrower delta: why a separate Python package is needed, how it stays protocol/tool-compatible with the approved MCP bridge, ownership of packaging/release, and a security/transport validation matrix.

@Maxwell-Code07

Copy link
Copy Markdown
Collaborator

Thank you for submitting this PR and participating in Tencent Rhino-bird Open-source Training Program!
We have successfully received your submission. The program is currently in full swing, and we will complete the Code Review for you as soon as possible. Please keep an eye on the status notifications for this PR so you can follow up promptly once the review feedback is provided.
Thanks again for your contribution and open-source spirit! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants